Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $server = 'target' #(using the FQHN)
- $username = 'u_target'
- $password = 'u_targetpwd' #(the correct one, of course)
- $pass = ConvertTo-SecureString -AsPlainText $password -Force
- $Cred = New-Object System.Management.Automation.PSCredential -Argumentlist $username,$pass
- $scbScriptBlock = {
- # a valid script. For simplicity assume it's
- Get-ChildItem C:
- }
- Invoke-Command -ComputerName $server -Credential $Cred -ScriptBlock $scbScriptBlock
- [target] Connecting to remote server failed with following error messages :
- The connection to the specified remote host was refused. Verify that the
- WS-Management service is running on the remote host and configured to
- listen for requests on the correct port and HTTP URL. For more information,
- see the about_Remote_Troubleshooting Help topic.
- + CategoryInfo : OpenError: (:) [], PSRemotingTransportException
- + FullyQualifiedErrorID : PSSessionStateBroken
- Import-Module PSDiagnostics
- Enable-PsWsmanCombinedTrace
- <run your script>
- Disable-PsWsmanCombinedTrace
- netstat -ano | findstr /i ":598"
- TCP 0.0.0.0:5985 0.0.0.0:0 LISTENING 4
- TCP 192.168.1.132:49223 192.168.1.131:5985 ESTABLISHED 972
- TCP [::]:5985 [::]:0 LISTENING 4
- netsh winhttp show proxy
- netsh winhttp reset proxy
Add Comment
Please, Sign In to add comment