Using DelProf2.exe via PowerShell to Remote Computer

We needed to simplify the use of DelProf2, a tool for deleting user profiles on computers (domain computers and even work-group computers).

The organization runs a Windows XP/7 environment (in the process of upgrading to Windows 7 only) with approximately 13K computers, not including terminal servers and servers.

The solution had to be simple, so everyone is able to use it.

We searched everywhere and could not find a script for what was needed, since we do not want to delete profiles using a GPO. We decided to write something ourselves. We have only been using PowerShell for three days and had no training whatsoever.

Here is what we came up with:

[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') 
# Prompts the user for the name of the remote computer
$RemoteComputer = [Microsoft.VisualBasic.Interaction]::InputBox("Insert name of remote computer", "Delprof2.exe")
#If the user presses cancel, the script will stop
If ($RemoteComputer -eq ""){exit}
# Prompts the user for the username of the profile to be deleted
$UserID = [Microsoft.VisualBasic.Interaction]::InputBox("Intsert username of profile to be deleted", "Delprof2.exe")
# Executes the delprof2.exe file with given parameters. /id $UserID for specific profile
# /p asks for confirmation (just in case) /q So delprof2.exe does not list all profiles
#/C:\$RemoteComputer defines the remote computer
.\DelProf2\DelProf2.exe /id $UserID /p /q /C:\$RemoteComputer

Feel free to use the script. We would also appreciate feedback since this is the first time writing a script.