| Set-GPEnvironment.ps1 |
|
# Set-GPEnvironment # Writen By Brandon Shell(www.BSonPosh.com) # Sets GPO Environment function Convert-DNToDNS{$args[0] -replace "DC=","" -replace ",","."} function Convert-GPSOMType { Param($SOMType) switch ($SOMType) { $gpmConstants.SOMDomain {"Domain"} $gpmConstants.SOMOU {"OU"} $gpmConstants.SOMSite {"Site"} Default {"Domain"} } } function Convert-GPTrusteeValue { Param($trusteeValue) switch ($trusteeValue) { 1 {"User"} 2 {"Group"} 3 {"Domain"} 4 {"Domain Local Group"} 5 {"Well Known Group"} 6 {"Deleted Account"} 7 {"Invalid"} 8 {"Unknown"} 9 {"Computer"} } } function Convert-GPPermValue { Param($PermValue) switch ($PermValue) { $gpmConstants.PermGPOApply {"Apply"} $gpmConstants.PermGPOCustom {"Custom"} $gpmConstants.PermGPOEdit {"Edit"} $gpmConstants.PermGPOEditSecurityandDelete {"Edit and Delete"} $gpmConstants.PermGPORead {"Read"} } } function Get-GPOBackups{ Param($BackupFolder) $gpmSearchCriteria = $gpm.CreateSearchCriteria() $gpmSearchCriteria.Add($gpmConstants.SearchPropertyBackupMostRecent,$gpmConstants.SearchOPEquals,$True) $gpmBackupDir = $gpm.GetBackupDir($BackupFolder) $gpmBackupDir.SearchBackups($gpmSearchCriteria) } # Global $gpm = new-object -ComObject "gpmgmt.gpm" $gpmConstants = $gpm.GetConstants() $rootDSE = [ADSI]"LDAP://rootDSE" $ADSIDomain = $rootDSE.defaultNamingContext $dnsDomain = Convert-DNToDNS $ADSIDomain $ADSIForestRoot = $rootDSE.rootDomainNamingContext $dnsForestRoot = Convert-DNToDNS $ADSIForestRoot $gpmDomain = $gpm.GetDomain($dnsDomain,$null,$gpmConstants.UsePDC) |
Be a hero! Report a problem with this web page here
Event Calendar
Find out where and when Jeremy will be speaking next.
| November 2008 | ||||||
| S | M | T | W | T | F | S |
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | ||||||
|
Mon, Nov 10 - Thu, Nov 13 |
|
Windows Connections -- Vegas It's WinConnections time! All sorts of great speeches this time. GP Troubleshooting, My Pre-Con, App-V 101. Will you be there? www.winconnections.com |
|
Mon, Nov 17 - Tue, Nov 18 |
|
Two-Day Intensive Group Policy Essentials Workshop
(taught by
Jeremy Moskowitz (Lead Instructor) - GPanswers.com / Moskowitz, Inc.
)
Final class of 2008. This is a Two-Day Intensive Group Policy Essentials Workshop in Atlanta, GA ! |
|
Wed, Nov 19 - Thu, Nov 20 |
|
Two-Day "Group Policy 2.0" Catch-Up Workshop
(taught by
Jeremy Moskowitz (Lead Instructor) - GPanswers.com / Moskowitz, Inc.
)
Final class of 2008. This is a Two-Day "Group Policy 2.0" Catch-Up Workshop in Atlanta, GA ! |
|
Fri, Nov 21 - Fri, Nov 21 |
|
One-Day Advanced Group Policy Workshop (XP/Vista Focused)
(taught by
Jeremy Moskowitz (Lead Instructor) - GPanswers.com / Moskowitz, Inc.
)
Final class of 2008. This is a One-Day Advanced Group Policy Workshop (XP/Vista Focused) in Atlanta, GA ! |