Created
August 9, 2018 14:39
-
-
Save brettmillerb/d468c84e24c19cf06178fdcce03a5228 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ADSystemInfo{ | |
<# | |
.LINK | |
https://technet.microsoft.com/en-us/library/ee198776.aspx | |
#> | |
$properties = @( | |
'UserName', | |
'ComputerName', | |
'SiteName', | |
'DomainShortName', | |
'DomainDNSName', | |
'ForestDNSName', | |
'PDCRoleOwner', | |
'SchemaRoleOwner', | |
'IsNativeMode' | |
) | |
$ads = New-Object -ComObject ADSystemInfo | |
$type = $ads.GetType() | |
$hash = @{} | |
foreach($p in $properties){ | |
$hash.Add($p,$type.InvokeMember($p,'GetProperty', $Null, $ads, $Null)) | |
} | |
[pscustomobject]$hash | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment