Clean up environment after personal user creation

This commit is contained in:
Manuel Thalmann 2023-06-28 22:50:59 +02:00
parent 39c2db4414
commit cbb3d329f9

View file

@ -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();
}
}