From 2107d52eed041ef7d10903f8af9e4c465e8abd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20K=C5=82ys?= Date: Tue, 21 Apr 2020 09:10:48 +0200 Subject: [PATCH] Updates to examples --- .../Example-02-RemoveEmptyAndUnlinkedGPOs.ps1 | 2 +- Examples/Example-03-RestoreGPO.ps1 | 2 +- Examples/Example-04-GPOinformation.ps1 | 2 +- Examples/Example-16-AddGPOPermission.ps1 | 13 ------------- .../Example-16-AddRemoveGPOPermission01.ps1 | 17 +++++++++++++++++ .../Example-16-AddRemoveGPOPermission02.ps1 | 19 +++++++++++++++++++ 6 files changed, 39 insertions(+), 16 deletions(-) delete mode 100644 Examples/Example-16-AddGPOPermission.ps1 create mode 100644 Examples/Example-16-AddRemoveGPOPermission01.ps1 create mode 100644 Examples/Example-16-AddRemoveGPOPermission02.ps1 diff --git a/Examples/Example-02-RemoveEmptyAndUnlinkedGPOs.ps1 b/Examples/Example-02-RemoveEmptyAndUnlinkedGPOs.ps1 index 39dc451..2c7443a 100644 --- a/Examples/Example-02-RemoveEmptyAndUnlinkedGPOs.ps1 +++ b/Examples/Example-02-RemoveEmptyAndUnlinkedGPOs.ps1 @@ -2,4 +2,4 @@ # Remove GPOS $BackupPath = "$Env:UserProfile\Desktop\GPO" -Remove-GPOZaurr -Type Empty -BackupPath $BackupPath -BackupDated -LimitProcessing 2 -Verbose \ No newline at end of file +Remove-GPOZaurr -Type Empty, Unlinked -BackupPath $BackupPath -BackupDated -LimitProcessing 2 -Verbose \ No newline at end of file diff --git a/Examples/Example-03-RestoreGPO.ps1 b/Examples/Example-03-RestoreGPO.ps1 index 0479f27..43d35a9 100644 --- a/Examples/Example-03-RestoreGPO.ps1 +++ b/Examples/Example-03-RestoreGPO.ps1 @@ -1,6 +1,6 @@ Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force -$RestoreFrom = 'C:\Users\przemyslaw.klys\Desktop\GPO\2020-04-12_10_11_24' +$RestoreFrom = 'C:\Users\przemyslaw.klys\Desktop\GPO\2020-04-20_15_51_00' $BackupInformation = Get-GPOZaurrBackupInformation -BackupFolder $RestoreFrom $BackupInformation | Format-Table -a diff --git a/Examples/Example-04-GPOinformation.ps1 b/Examples/Example-04-GPOinformation.ps1 index b197f3d..db25f6c 100644 --- a/Examples/Example-04-GPOinformation.ps1 +++ b/Examples/Example-04-GPOinformation.ps1 @@ -9,4 +9,4 @@ $GPOs[0].ACL | Format-Table -AutoSize $GPOs.Links | Format-Table -AutoSize -$GPOS | Format-Table -AutoSize Name, WmiFilter, WMIDescription \ No newline at end of file +$GPOS | Format-Table -AutoSize DisplayName, WmiFilter, WMIDescription \ No newline at end of file diff --git a/Examples/Example-16-AddGPOPermission.ps1 b/Examples/Example-16-AddGPOPermission.ps1 deleted file mode 100644 index 0447f06..0000000 --- a/Examples/Example-16-AddGPOPermission.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force - -$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -IncludeGPOObject #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject -$T | Format-Table -AutoSize * - -Remove-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoEditDeleteModifySecurity -Principal 'CN=Przemysław Kłys,OU=Users,OU=Production,DC=ad,DC=evotec,DC=xyz' -PrincipalType 'DistinguishedName' - -#$T = Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoEditDeleteModifySecurity -Principal 'Domain Admins' -verbose #| Format-Table -#$T = Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoApply -Principal 'przemyslaw.klys' -verbose #| Format-Table -#$T | Format-Table -AutoSize * - -$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject -$T | Format-Table -AutoSize * \ No newline at end of file diff --git a/Examples/Example-16-AddRemoveGPOPermission01.ps1 b/Examples/Example-16-AddRemoveGPOPermission01.ps1 new file mode 100644 index 0000000..32d750e --- /dev/null +++ b/Examples/Example-16-AddRemoveGPOPermission01.ps1 @@ -0,0 +1,17 @@ +Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force + +Clear-Host + +$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' #-IncludeGPOObject #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject +$T | Format-Table -AutoSize * + +Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoApply -Principal 'przemyslaw.klys' -Verbose + +$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject +$T | Format-Table -AutoSize * + +Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoEditDeleteModifySecurity -Principal 'Domain Admins' -Verbose +Remove-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoApply -Principal 'przemyslaw.klys' -PrincipalType Name -Verbose + +$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject +$T | Format-Table -AutoSize * \ No newline at end of file diff --git a/Examples/Example-16-AddRemoveGPOPermission02.ps1 b/Examples/Example-16-AddRemoveGPOPermission02.ps1 new file mode 100644 index 0000000..8fcf959 --- /dev/null +++ b/Examples/Example-16-AddRemoveGPOPermission02.ps1 @@ -0,0 +1,19 @@ +Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force + +Clear-Host + +$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' #-IncludeGPOObject #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject +$T | Format-Table -AutoSize * + +Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoEditDeleteModifySecurity -Principal 'Domain Admins' -Verbose +Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoApply -Principal 'przemyslaw.klys' -Verbose +Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoEditDeleteModifySecurity -Principal 'przemyslaw.klys' -Verbose +Add-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoEdit -Principal 'przemyslaw.klys' -Verbose + +$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject +$T | Format-Table -AutoSize * + +#Remove-GPOZaurrPermission -GPOName 'ALL | Enable RDP' -PermissionType GpoApply -Principal 'przemyslaw.klys' -PrincipalType Name -Verbose + +#$T = Get-GPOZaurrPermission -GPOName 'ALL | Enable RDP' #-ExcludePermissionType GpoApply,GpoRead -IncludeGPOObject +#$T | Format-Table -AutoSize * \ No newline at end of file