Guest User

Untitled

a guest
Mar 21st, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. $server = 'target' #(using the FQHN)
  2. $username = 'u_target'
  3. $password = 'u_targetpwd' #(the correct one, of course)
  4.  
  5. $pass = ConvertTo-SecureString -AsPlainText $password -Force
  6. $Cred = New-Object System.Management.Automation.PSCredential -Argumentlist $username,$pass
  7.  
  8. $scbScriptBlock = {
  9. # a valid script. For simplicity assume it's
  10. Get-ChildItem C:
  11. }
  12.  
  13. Invoke-Command -ComputerName $server -Credential $Cred -ScriptBlock $scbScriptBlock
  14.  
  15. [target] Connecting to remote server failed with following error messages :
  16. The connection to the specified remote host was refused. Verify that the
  17. WS-Management service is running on the remote host and configured to
  18. listen for requests on the correct port and HTTP URL. For more information,
  19. see the about_Remote_Troubleshooting Help topic.
  20. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException
  21. + FullyQualifiedErrorID : PSSessionStateBroken
  22.  
  23. Import-Module PSDiagnostics
  24. Enable-PsWsmanCombinedTrace
  25. <run your script>
  26. Disable-PsWsmanCombinedTrace
  27.  
  28. netstat -ano | findstr /i ":598"
  29. TCP 0.0.0.0:5985 0.0.0.0:0 LISTENING 4
  30. TCP 192.168.1.132:49223 192.168.1.131:5985 ESTABLISHED 972
  31. TCP [::]:5985 [::]:0 LISTENING 4
  32.  
  33. netsh winhttp show proxy
  34.  
  35. netsh winhttp reset proxy
Add Comment
Please, Sign In to add comment