Local_Admin_Script/ValidateUsers.ps1
2025-01-02 11:41:17 -07:00

23 lines
518 B
PowerShell

$UserMachineMapping = @{
"tmctesterson" = "LB-SPAREASUS1"
}
$CurrentUser = $env:USERNAME
$CurrentMachine = $env:COMPUTERNAME
if ($UserMachineMapping.ContainsKey($CurrentUser)){
$ExpectedMachine = $UserMachineMapping[$CurrentUser]
if ($CurrentMachine -ne $ExpectedMachine) {
Write-Output "Access Denied Biatch! $CurrentUser is not allowed in $CurrentMachine"
shutdown.exe /l
}
}else {
Write-Output "Access Denied! $CurrentUser does not exist in the List"
shutdown.exe /l
}