Remove user profile of OneShot user
This commit is contained in:
parent
56463a4e30
commit
ac4b6e0700
1 changed files with 4 additions and 1 deletions
|
@ -91,7 +91,10 @@ $null = New-Module {
|
|||
#>
|
||||
function Disable-OneShotListener {
|
||||
Unregister-ScheduledTask -Confirm:$false $oneShotTaskName;
|
||||
Remove-LocalUser (& $getUserName);
|
||||
$user = Get-LocalUser (& $getUserName);
|
||||
[string] $sid = $user.SID;
|
||||
Remove-LocalUser $user;
|
||||
Get-CimInstance Win32_UserProfile | Where-Object { $_.SID -eq $sid } | Remove-CimInstance;
|
||||
}
|
||||
|
||||
<#
|
||||
|
|
Loading…
Reference in a new issue