Advertisement
PC_Aide

Enable Powershell remoting.ps1

Feb 22nd, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <############################################################
  2.  
  3. Author : PC-Aide
  4. Title : Enable PowerShell remoting
  5. Youtube channel : https://www.youtube.com/user/Boliccov
  6. SRC : http://www.tomsitpro.com/articles/powershell-remote-management,2-781.html
  7.       https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/running-remote-commands
  8.       https://msdn.microsoft.com/en-us/powershell/reference/3.0/microsoft.powershell.core/new-pssession
  9.       https://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/
  10.       http://pastebin.com/u/PC_Aide
  11.  
  12. ############################################################>
  13.  
  14. # First time
  15. # Enabling PowerShell remoting
  16. # if succesful, you see 2 services, WinRM - imgur ► https://imgur.com/A8XOejU)
  17. Enable-PSRemoting -Force
  18.  
  19. # Testing the connection:
  20. # Describe - imgur ► https://imgur.com/1QVZZG8
  21. Test-WSMan serv
  22.  
  23. # Executing a remote command
  24. # imgur ► https://imgur.com/UeOASWk
  25. # imgur 2 (all commands possible : Cmdlet) ► https://imgur.com/J3jMyvJ
  26. # Invoke-Command -ComputerName COMPUTER -ScriptBlock { COMMAND } -credential USERNAME
  27. Invoke-Command -ComputerName serv -ScriptBlock { COMMAND } -credential administrator
  28.  
  29. # Staring a remote session
  30. # imgur ► https://imgur.com/zdgkvRK
  31. # imgur 2 ► https://imgur.com/W7qD6TD
  32. # Enter-PSSession -ComputerName COMPUTER -Credential USER
  33. Enter-PSSession -ComputerName serv -Credential administrator
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement