Get-PC/Private/EnableComputer.ps1

16 lines
735 B
PowerShell
Raw Normal View History

2024-10-25 22:05:21 +00:00
function Invoke-EnableComputer ($comp) {
$site = switch -Regex ($comp) {
'^A' {'SAGH'}
'^L' {'SLCH'}
'^S' {'SNLH'}
'^P' {'SPCH'}
'^G(AV|CN|WN)' {'Avery'}
default {'GSRMC'}
}
$comp | Get-ADComputer | Enable-ADAccount -PassThru | Move-ADObject -TargetPath "OU=$site,OU=Samaritan Workstations,DC=int,DC=samhealth,DC=net"
if (Get-ADUser -Filter "Name -like 'K_$comp'") {
Write-Host -ForegroundColor Yellow "Kiosk account found. Please re-submit a kiosk request and re-kiosk $comp."
} else {
Add-ADGroupMember -Identity 'SSO Workstations' -Members (Get-ADComputer $comp)
}
}