To Check if WinRM has been enabled on a Remote machine:
$RemoteMachine = “Remote Machine Name” [system.convert]::ToBoolean(((winrm get winrm/config/winrs -r:$remotemachine | ?{$_ -imatch "AllowRemoteShellAccess"}).split("="))[1].trim())
To Check the Default HTTP listener port on a remote machine:
$RemoteMachine = “Remote Machine Name” [System.Convert]:: ToInt32(((winrm get winrm/config/Service/DefaultPorts -r:$RemoteMachine | ?{$_ -imatch "HTTP = " }).split("="))[1].trim())
To Check the Default HTTPS listener port on a remote machine:
$RemoteMachine = “Remote Machine Name” [System.Convert]:: ToInt32(((winrm get winrm/config/Service/DefaultPorts -r:$RemoteMachine | ?{$_ -imatch "HTTPS = " }).split("="))[1].trim())
Good one – will come handy for tshoot.
Not sure it is appropriate to ask but I will ask anyway, since you are so good at Powershell.. Is it possible to create a Powershell script to list all existing permissions on share folders or even subfolders, then use a variable to find groups or users who don’t exist in the permission sets, and then add new groups or users in permission set …It maybe a very complicated script……
HI,
since i got this answer on the first command:
AllowRemoteShellAccess = true [Source=”GPO”]
my extention is:
[system.convert]::ToBoolean((((winrm get winrm/config/winrs -r:$remotemachine | ?{$_ -imatch “AllowRemoteShellAccess”}).split(“[“)).split(“=”))[1].trim())
Best regards
Leonard