Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors to Enable PSRemoting on win2008R2 and Win7

Tags:

powershell

Today I need enable PSRemoting on W2008R2 and Win7:

All VMs are in workgroup.
I have setup same administrator account with same pwd on each VMs.
Run Enable-PSRemoting in powershell with administrator role.
However I still faced following errors:

Error 1:

Set-WSManQuickConfig : Access is denied.

Error 2:

[192.168.23.2] Connecting to remote server failed with the following error message : The WinRM client cannot process th e request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain , then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken

Error 3:

Set-WSManQuickConfig : WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private and try again.

like image 410
Amitabha Avatar asked Mar 17 '23 19:03

Amitabha


2 Answers

For error 3, run this command:

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.

like image 76
kevmar Avatar answered Mar 23 '23 16:03

kevmar


After google, error are fixed with following solution:

Error 1:
Set-WSManQuickConfig : Access is denied.

Solution:
Run following cmd with administrator role.

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

Error 2:

If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain , then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting.

Solution:
Run following cmd on your client machine

Set-Item WSMan:\localhost\Client\TrustedHosts *

Error 3:

Set-WSManQuickConfig : WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private and try again.

Solution:
ref: http://blogs.msdn.com/b/powershell/archive/2009/04/03/setting-network-location-to-private.aspx
Run following ps script with adminsitrator role:

#Skip network location setting for pre-Vista operating systems 
if([environment]::OSVersion.version.Major -lt 6) { return } 

#Skip network location setting if local machine is joined to a domain. 
if(1,3,4,5 -contains (Get-WmiObject win32_computersystem).DomainRole) { return } 

#Get network connections 
$networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")) 
$connections = $networkListManager.GetNetworkConnections() 

#Set network location to Private for all networks 
$connections | % {$_.GetNetwork().SetCategory(1)}
like image 37
Amitabha Avatar answered Mar 23 '23 15:03

Amitabha