sync
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# Ashley's script to pull all OUs and their linked GPOs, dump to csv
|
||||
$Timestamp = (Get-Date).ToString("yyyyMMdd_HHmmss")
|
||||
Get-GPLinkReport | export-csv "D:\GPOs\^LinkReport\GPOLinks-$Timestamp.csv" -Force
|
||||
|
||||
# import-csv Ashley's report, filter only ITD
|
||||
$LinkReports = Get-ChildItem "D:\GPOs\^LinkReport\" | Sort-Object LastWriteTime -Descending
|
||||
$FirstNewest = $LinkReports | select -first 1
|
||||
$SecondNewest = $LinkReports | select -first 2 | select -last 1
|
||||
|
||||
# check dates and backup any new changes
|
||||
$compare = Compare-Object $FirstNewest $SecondNewest
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$GPOs=Get-GPO -All
|
||||
ForEach($GPO in $GPOs)
|
||||
{
|
||||
$GPOName = $GPO.DisplayName
|
||||
$Timestamp = $GPO.ModificationTime.ToString("yyyyMMdd_HHmmss")
|
||||
$FolderPath = "D:\GPOs\$GPOName\$Timestamp\"
|
||||
If(!(Test-Path $FolderPath))
|
||||
{
|
||||
New-Item -Path $FolderPath -Force -ItemType Directory
|
||||
}
|
||||
$GPO | Backup-GPO -Path $FolderPath
|
||||
Reference in New Issue
Block a user