Script repository
The script deletes the Remote Desktop Services profile of a user. To execute the script, create a business rule, scheduled task or custom command configured for the User object type.
# Get the Remote Desktop Services profile path.
$rdsProfilePath = $Context.TargetObject.TerminalServicesProfilePath
if($rdsProfilePath -eq $NULL)
{
return
}
# Check whether the Remote Desktop Services profile folder exists.
if(!(Test-Path -Path $rdsProfilePath))
{
$Context.LogMessage("Remote Desktop Services profile folder with path $rdsProfilePath does not exist.", "Error")
return
}
# Delete Remote Desktop Services profile folder.
Remove-Item -Path $rdsProfilePath -Force -Recurse
Comments 0
You must be signed in to comment.