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

Extract group Policies of multiple Servers through PowerShell

$
0
0

Hello

I wrote a script which is supposed to gather group policies on more than 300 servers. The CSV file has just one Column and it is called IP.

# DO NOT FORGET To start Windows PowerShell with elevated rights


$IPList = Import-Csv -path "C:\Users\Administrator\Desktop\Test\ServerNames.csv" -Delimiter  ";" 
$Path = "C:\Users\Administrator\Desktop\Test\$IP.GPResult.HTML"

ForEach ($IP in $IPList)
{

Get-GPResultantSetOfPolicy -Computer $IP_ -reporttype html -path $Path
write-host $IP
} 

I know sth is wrong with the script which doesn’t connect to servers and then run the Get-GPResultantSetOfPolicy command on each server. It just gives me the result of the server which the script is running on.

It is planned to adjust the script to run once with admin right and remotely should work for other servers which the IPs are in CSV file.

That would be very helpful if someone can help me with that.

Thanks




Viewing all articles
Browse latest Browse all 21975

Trending Articles



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