[置顶] [20]Window PowerShell DSC学习系列---- start-dscconfiguration 中遇到 Access Denied的解决方案

标签: start-dscconfiguratiAccess DeniedPowerShell DSCPowerShell
1934人阅读 评论(0) 收藏 举报
分类:

当我们执行start-DscConfiguration -computername psdsc-window201 -Path c:\DSC\TestFile -Wait -Verbose -force

这条命令的时候,会遇到下面的问题


问题的根源有很多,解决的也不相同办法,主要有以下解决方法:

@执行下面的命令从而确保该开启的服务都已经开启Enable-PSRemoting

其输出的界面信息如下:
PS C:\windows\system32> Enable-PSRemoting
WinRM Quick Configuration
Running command "Set-WSManQuickConfig" to enable remote management of this computer by using the Windows Remote
Management (WinRM) service.
This includes:
1. Starting or restarting (if already started) the WinRM service
2. Setting the WinRM service startup type to Automatic
3. Creating a listener to accept requests on any IP address
4. Enabling Windows Firewall inbound rule exceptions for WS-Management traffic (for http only).
Do you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
WinRM is already set up to receive requests on this computer.
WinRM is already set up for remote management on this computer.
Confirm
Are you sure you want to perform this action?
Performing the operation "Set-PSSessionConfiguration" on target "Name: microsoft.powershell SDDL:
O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;RM)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD). This lets selected users remotely run Windows
PowerShell commands on this computer.".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
Confirm
Are you sure you want to perform this action?
Performing the operation "Set-PSSessionConfiguration" on target "Name: microsoft.powershell.workflow SDDL:
O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;RM)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD). This lets selected users remotely run Windows
PowerShell commands on this computer.".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
Confirm
Are you sure you want to perform this action?
Performing the operation "Set-PSSessionConfiguration" on target "Name: microsoft.powershell32 SDDL:
O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;RM)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD). This lets selected users remotely run Windows
PowerShell commands on this computer.".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
Confirm
Are you sure you want to perform this action?
Performing the operation "Set-PSSessionConfiguration" on target "Name: microsoft.windows.servermanagerworkflows SDDL:
O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD). This lets selected users remotely run Windows
PowerShell commands on this computer.".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y

@ help about_Remote_Troubleshooting 查看更多的帮助信息

通过help about_Remote_Troubleshooting 查看更多的帮助信息

@运行Set-WSManQuickConfig -SkipNetworkProfileCheck

When you connect your network, it gets set to Public, Private, or Domain. If the current profile is set to Public, Set-WSManQuickConfig will fail with that message. You can either change it (if the system will let you) or skip the profile check.
就执行下面的命令:

Set-WSManQuickConfig -SkipNetworkProfileCheck


@其他原因

另外,也可能是Winrm的设置没有设置好,比如,监听的5985端口的服务没有开启,认证的方式没有设置正确;可以通过下面的方式进行查看。
winrm get winrm/config
那么如何设置其值呢?有很多的方法,下面介绍两种方法:在CMD窗口中和在PowerShell窗口中
#1 需要在cmd窗口,而不是PowerShell窗口
winrm set winrm/config/client @{TrustedHosts="*"}

#2 在PowerShell窗口中,需要加上单引号
winrm set winrm/config/client ‘@{TrustedHosts=”*”}’
winrm set winrm/config/service ‘@{EnableCompatibilityHttpListener="true"}'




1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:385880次
    • 积分:6347
    • 等级:
    • 排名:第4081名
    • 原创:228篇
    • 转载:0篇
    • 译文:5篇
    • 评论:157条
    博客专栏