23 lines
518 B
PowerShell
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
|
|
} |