Clean up environment after personal user creation
This commit is contained in:
parent
39c2db4414
commit
cbb3d329f9
1 changed files with 6 additions and 0 deletions
|
@ -61,6 +61,12 @@ function New-PersonalUser([Context] $context)
|
|||
|
||||
Start-ScheduledTask $cleanupName;
|
||||
Enable-CurrentUserAutologon $context;
|
||||
|
||||
Write-Information "Removing Admin Account";
|
||||
Get-CimInstance -ClassName "Win32_UserProfile" -Filter "SID = $((Get-LocalUser $context.AdminName).SID)" | Remove-CimInstance;
|
||||
|
||||
Write-Host "Rebooting";
|
||||
$context.Reboot();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue