Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Running a PS script against each servers logical drive(s)

$
0
0

Hi All,

I'm trying to create a script to enumerate the logical disks of a list of servers and run a script against each drive, how is this done in powershell?

E.G.

$cim = new-cimsession -comp server1, server2, server3,server4
Get-CimInstance -ClassName Win32_LogicalDisk -filter 'DriveType=3' -CimSession $cim  |
Select PSComputerName, DeviceID | Invoke-Command -ComputerName PSComputerName -FilePath "C:\admin\RunScript.ps1" -ArgumentList DeviceID

Thanks in advance.



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>