Solved

# Install powershell remotely on multiple servers

Posted on 2013-12-09
1,077 Views
1 Endorsement
Hi all, i have the following script to copy PS3 on to the server but is there a way to install powereshell on all using the command similar to the one below?

thanks

$servers =Get-Content "C:\Users\Downloads\machines.txt" foreach ($servers1 in $servers ) { @" Displaying for$servers1

"@

$copy2 = Copy-Item -Path C:\IT\Windows6.1-KB2506143-x64.msu "\\$servers1\c$\it" -Recurse 1 Question by:cwstad2 • 2 • 2 5 Comments LVL 68 Expert Comment ID: 39706396 Using PowerShell to install PowerShell could be difficult ;-). But of course you can use Invoke-Command to remote start the MSU file in silent install mode if you've set up WinRM properly. BTW, copy-item -recurse for a single file seems to be overkill ... 0 LVL 15 Author Comment ID: 39706408 I know im a bit lazy but its over a very low bandwidth connection so it takes a while to log on or to enter-pssession. Can i use the invoke command against a list from the txt file? 0 LVL 13 Expert Comment ID: 39706419 wusa.exe C:\IT\Windows6.1-KB2506143-x64.msu /quiet /norestart  will install the update 0 LVL 68 Accepted Solution Qlemo earned 500 total points ID: 39706519 Invoke-Command takes a list of computer names, so yes, you can do that with a single command after having copied the file to all servers, Invoke-Command -ComputerName$servers { wusa.exe C:\IT\Windows6.1-KB2506143-x64.msu /quiet /norestart }

or in background (as job) after having copied the MSU to one server.
$servers =Get-Content "C:\Users\Downloads\machines.txt" foreach ($server in $servers ) { @" Displaying for$server

"@

$copy2 = Copy-Item -Path C:\IT\Windows6.1-KB2506143-x64.msu "\\$server\c$\it" Invoke-Command -Computer$server -AsJob { wusa.exe C:\IT\Windows6.1-KB2506143-x64.msu /quiet /norestart }
}

But that only works that way if you are in the same domain, and not using IP addresses.
0

LVL 15

Author Closing Comment

ID: 39710831
perfect thanks
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
A brief introduction to what I consider to be the best editor for PowerShell.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…