# list OS information. echo 'OS Details:' New-Object -TypeName PSObject -Property @{ Is64BitOperatingSystem = [Environment]::Is64BitOperatingSystem } | Format-Table -AutoSize [Environment]::OSVersion | Format-Table -AutoSize # list all the installed Windows features. echo 'Installed Windows Features:' Get-WindowsFeature | Where Installed | Format-Table -AutoSize | Out-String -Width 2000 # see https://gist.github.com/IISResetMe/36ef331484a770e23a81 function Get-MachineSID { param( [switch]$DomainSID ) # Retrieve the Win32_ComputerSystem class and determine if machine is a Domain Controller $WmiComputerSystem = Get-WmiObject -Class Win32_ComputerSystem $IsDomainController = $WmiComputerSystem.DomainRole -ge 4 if ($IsDomainController -or $DomainSID) { # We grab the Domain SID from the DomainDNS object (root object in the default NC) $Domain = $WmiComputerSystem.Domain $SIDBytes = ([ADSI]"LDAP://$Domain").objectSid | %{$_} New-Object System.Security.Principal.SecurityIdentifier -ArgumentList ([Byte[]]$SIDBytes),0 } else { # Going for the local SID by finding a local account and removing its Relative ID (RID) $LocalAccountSID = Get-WmiObject -Query "SELECT SID FROM Win32_UserAccount WHERE LocalAccount = 'True'" | Select-Object -First 1 -ExpandProperty SID $MachineSID = ($p = $LocalAccountSID -split "-")[0..($p.Length-2)]-join"-" New-Object System.Security.Principal.SecurityIdentifier -ArgumentList $MachineSID } } echo "This Computer SID is $(Get-MachineSID)"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 25623 | Jen Bottom | Have moved the AD stuff in to the 'ldap' directory | ||
#2 | 25621 | Jen Bottom | Integrating sone fixes from dev to main | ||
#1 | 23849 | Jen Bottom |
Integrating an AD setup from dev to main. This is based on a Vagrant setup that is available on GitHub |