16 lines
735 B
PowerShell
16 lines
735 B
PowerShell
|
|
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)
|
||
|
|
}
|
||
|
|
}
|