moving shit around
This commit is contained in:
3
testing/Args-Test.ps1
Normal file
3
testing/Args-Test.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
$Arg1 = $args[0]
|
||||
$Arg2 = $args[1]
|
||||
Write-Host "$Arg1 and $Arg2"
|
25
testing/GetADOU.ps1
Normal file
25
testing/GetADOU.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
# Script to get current OU.
|
||||
# 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)"
|
||||
} elseif ($computerou.Contains("OU=Workstations")) {
|
||||
echo "This is WKS ($computerou)"
|
||||
} elseif ($computerou.Contains("OU=Domain Servers")) {
|
||||
echo "This is a server ($computerou)"
|
||||
}
|
20
testing/Param-Test.ps1
Normal file
20
testing/Param-Test.ps1
Normal file
@@ -0,0 +1,20 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Joins this computer to the Technolog domain.
|
||||
.PARAMETER CompType
|
||||
The computer type. This can either be (w/o quotes) "WKS", or "Server".
|
||||
.PARAMETER ServerTier
|
||||
Can only be used with if CompType is "Server"- determines the tier of the server.
|
||||
#>
|
||||
|
||||
# Parameters
|
||||
param(
|
||||
[Parameter(Position=0,Mandatory=$true)]
|
||||
[string]$CompType = "None",
|
||||
[Parameter(Position=1,Mandatory=$false)]
|
||||
[string]$ServerTier = "None"
|
||||
)
|
||||
|
||||
|
||||
$CompType
|
||||
$ServerTier
|
Reference in New Issue
Block a user