$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
Just some quick code to get the OU Name of the computer we run the script on.
VBS:
1 2 3 4 5 6 7 8 | Function GetComputerOU Dim objSysInfo: Set objSysInfo = CreateObject("ADSystemInfo") Dim objComputer: Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName) Dim objOU : Set objOU = GetObject(objComputer.Parent) GetComputerOU = objOU.OU End Function Wscript.Echo GetComputerOU |
PowerShell:
1 2 3 4 5 6 7 8 | function GetComputerOU { $SysInfo = New-Object -ComObject "ADSystemInfo" $Computer = [ADSI]("LDAP://{0}" -f $SysInfo.GetType().InvokeMember("ComputerName", [System.Reflection.BindingFlags]::GetProperty, $null, $SysInfo, $null)) return ([ADSI]$Computer.Parent).OU } GetComputerOU |
Leave a reply