moving shit around
This commit is contained in:
28
old/TNGMeshInstallerOU.ps1
Normal file
28
old/TNGMeshInstallerOU.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
# Script to get current OU to install MeshCentral Agent.
|
||||
# Technolog Networks, 04/30/2024
|
||||
|
||||
# Define our AD searcher
|
||||
$adsearcher = New-Object System.DirectoryServices.DirectorySearcher
|
||||
|
||||
# Filter to return only computer objs
|
||||
$adsearcher.Filter = "(&(objectClass=computer)(samAccountName=$env:computername$))"
|
||||
|
||||
# Find the object in the directory
|
||||
$adobjpath = $adsearcher.FindOne()
|
||||
|
||||
# Return the LDAP path for the object
|
||||
$adobject = $adobjpath.GetDirectoryEntry()
|
||||
|
||||
# Stupid: get the OU of the computer by returning the parent object
|
||||
$computerou = $adobject.Parent
|
||||
|
||||
if ($computerou.Contains("OU=PersonalComputers")){
|
||||
echo "This is an XH system ($computerou)"
|
||||
./TNGMeshInstaller.bat install wks
|
||||
} elseif ($computerou.Contains("OU=Workstations")) {
|
||||
echo "This is WKS ($computerou)"
|
||||
./TNGMeshInstaller.bat install wks
|
||||
} elseif ($computerou.Contains("OU=Domain Servers")) {
|
||||
echo "This is a server ($computerou)"
|
||||
./TNGMeshInstaller.bat install srv
|
||||
}
|
Reference in New Issue
Block a user