0% found this document useful (0 votes)
4 views9 pages

PowerShell Scripts Notes

This document outlines the steps to run PowerShell scripts on remote computers within a LAN network using PowerShell remoting. It details prerequisites such as enabling WinRM and having the necessary permissions, as well as commands to execute scripts on remote machines. Additionally, it includes instructions for configuring both client and server roles for WSManCredSSP authentication.

Uploaded by

kerexcw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

PowerShell Scripts Notes

This document outlines the steps to run PowerShell scripts on remote computers within a LAN network using PowerShell remoting. It details prerequisites such as enabling WinRM and having the necessary permissions, as well as commands to execute scripts on remote machines. Additionally, it includes instructions for configuring both client and server roles for WSManCredSSP authentication.

Uploaded by

kerexcw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

PowerShell Remote

Run PowerShell Scripts on Remote Computers in Lan Network.


Prerequisite

The remote computers must have PowerShell remoting enabled


(WinRM) and a user account with sufficient permissions on the remote
machines is required
Enable WinRM in Remote PC

Run CMD or PowerShell with Admin rights

Run this command with admin privileges ‘winrm quickconfig –y’


Prepare list of Computer to Execute
Script.

Prepare a list of computer names or IPs from the LanSweeper

Add the list in PowerShell Script variable


Command to Execute Script.

Invoke-Command -ComputerName $computerNames -ScriptBlock { script code }

Also ensure that port number 5985 should be open on remote computer.
Command to Execute Script.

# Run the script on each computer asynchronously Invoke-Command -


ComputerName $computerNames -AsJob -ScriptBlock { # your script code }

# Process computers in batches of 20 $computerNames | ForEach-Object


{ Invoke-Command -ComputerName $_ -ScriptBlock { # your script code } }
Local Machine PS

PSSession Invoke-Command
‘Use WinRM’

Authenticated via Kerberos Logged-In successfully on remote pc


“CredSSP” to access network resources

Run “\\rbi-d-349\ScanEDD\Windows 10 Upgrade New-2-Final.ps1"


Client Side Commands:

1. Enable-WinRM Quickconfig
Yes

2. Enable-PSRemoting –Force

3. Enable-WSManCredSSP –Role Server


Local Machine Side Commands:

Same as Remote Machine Command but

Use

Enable-WSManCredSSP -Role Client -DelegateComputer "MEN-D-331"

You might also like