You can use Windows environmental variables in most agent procedure steps. To find the Domain of the Current User it would be %userdomain%. You could also query the Registry, possibly. I'd have to dig around for the specific Key to read.
I deal mainly with a non-domain kiosk environment, so the script I have (attached) doesn't take the Domain into account. In a Workgroup or stand alone Windows system the temp profile names would be %username%.%computername% instead of %username%.%userdomain%. Oddly, the %userdomain% for a Workgroup computer is WORKGROUP. Windows seems to treat the %computername% as the Domain for some things, and not for others.
Anyways I've attached the script I use. Its a bit complicated. Part of this is due to needing the SID of the user in question, as extra Registry Keys are made when a temp profile is loaded as well.
<?xml version="1.0" encoding="utf-8"?>
<ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
<Procedure name="Fix Current User Profile" treePres="3" id="296401573" folderId="61472212451291624815329252">
<Body description="NOTE: You must be logged in to the user account that has the blown user profile.

phewson 3/21/2012">
<If description="">
<Condition name="UserIsLoggedIn">
<Parameter xsi:type="StringParameter" name="UserName" value="" />
</Condition>
<Then>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Querying WMIC for current user SID." />
</Statement>
<Statement description="Use WMIC to retrieve the SID of the current user." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Command" value="WMIC USERACCOUNT WHERE NAME='%USERNAME%' GET SID >> #vAgentConfiguration.agentTempDir#\sid1.txt" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="WMIC can sometimes take a bit to run, so pause the procedure until it completes." name="PauseScript" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="IntegerParameter" name="Seconds" value="30" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Converting WMIC's output from Unicode to ASCII for parsing..." />
</Statement>
<Statement description="Convert the output from WMIC from Unicode to ASCII so FOR can parse the text file." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Command" value="TYPE #vAgentConfiguration.agentTempDir#\sid1.txt >> #vAgentConfiguration.agentTempDir#\sid2.txt" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Parsing WMIC's converted output to retrieve the current user SID." />
</Statement>
<Statement description="Parse the converted WMIC output to strip out everything but the actual SID." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Command" value="FOR /F "skip=1 tokens=1 delims= " %S IN (#vAgentConfiguration.agentTempDir#\sid2.txt) DO @ECHO (.|SET /P="%S") >> #vAgentConfiguration.agentTempDir#\sid3.txt" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Set the SID to a named procedure variable." name="GetVariable" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />
<Parameter xsi:type="StringParameter" name="SourceContent" value="#vAgentConfiguration.agentTempDir#\sid3.txt" />
<Parameter xsi:type="StringParameter" name="VariableName" value="usersid" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: The current user's SID is #usersid#." />
</Statement>
<Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />
<Parameter xsi:type="StringParameter" name="SourceContent" value="#vMachine.LoginName#" />
<Parameter xsi:type="StringParameter" name="VariableName" value="username" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: The current user is '#username#'." />
</Statement>
<Statement description="If the wrong profile is found in the ProfileImagePath, set the bad location to a named procedure variable." name="GetVariable" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="EnumParameter" name="VariableType" value="RegistryValue" />
<Parameter xsi:type="StringParameter" name="SourceContent" value="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#\ProfileImagePath" />
<Parameter xsi:type="StringParameter" name="VariableName" value="userprofile" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: The ProfileImagePath Registry Key for the current user is set to '#userprofile#'." />
</Statement>
<Statement description="Make sure UPHClean is installed on Windows XP so all hooks to the Registry are released on Logoff." name="ExecuteScript" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="ScriptID" value="732286212" />
<Parameter xsi:type="StringParameter" name="ScriptName" value="UPHClean 1.6d" />
<Parameter xsi:type="StringParameter" name="TimeDelay" value="" />
<Parameter xsi:type="EnumParameter" name="TimeUnit" value="Immediate" />
</Statement>
<Statement description="Execute the specified procedure. - NOTE: this procedure does not complete until the called procedure completes." name="ExecuteScript" continueOnFail="false">
<Parameter xsi:type="StringParameter" name="ScriptID" value="623957549" />
<Parameter xsi:type="StringParameter" name="ScriptName" value="Logoff Current User" />
<Parameter xsi:type="StringParameter" name="TimeDelay" value="" />
<Parameter xsi:type="EnumParameter" name="TimeUnit" value="Immediate" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Verifying OS and testing the current value of the ProfileImagePath key with the expected value." />
</Statement>
<If description="Verify that the OS is Windows 7 before running the following commands.">
<Condition name="CheckVariable">
<Parameter xsi:type="StringParameter" name="VariableName" value="#vMachine.OSType#" />
<Parameter xsi:type="EnumParameter" name="Condition" value="Equals" />
<Parameter xsi:type="StringParameter" name="Value" value="7" />
</Condition>
<Then>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: OS is Windows 7." />
</Statement>
<If description="Check the ProfileImagePath setting for the correct profile value.">
<Condition name="CheckRegistryValue">
<Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#\ProfileImagePath" />
<Parameter xsi:type="EnumParameter" name="Condition" value="NotEquals" />
<Parameter xsi:type="StringParameter" name="Value" value="C:\Users\#username#" />
</Condition>
<Then>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Comment" value="Warning: The user profile is blown! The ProfileImagePath Registry Key does not match the expected value!" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Correcting the ProfileImagePath Registry Key." />
</Statement>
<Statement description="Set the ProfileImagePath to the correct user profile." name="ExecuteShellCommand" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Command" value="REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#" /V ProfileImagePath /T REG_EXPAND_SZ /D "C:\Users\#username#" /F" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Removing temporary profiles." />
</Statement>
<Statement description="Clean up the bad profile from the system." name="ExecuteShellCommand" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Command" value="FOR /F "TOKENS=* DELIMS= " %D IN ('DIR "C:\Users" /B /AD ^| find "TEMP"') DO (RMDIR /S /Q "C:\Users\%D")" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Clean up the bad profile from the system." name="ExecuteShellCommand" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Command" value="FOR /F "TOKENS=* DELIMS= " %D IN ('DIR "C:\Users" /B /AD ^| find "#username#."') DO (RMDIR /S /Q "C:\Users\%D")" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
</Then>
<Else>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="7">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: The user profile is not blown. The ProfileImagePath Registry Key matches the expected value." />
</Statement>
</Else>
</If>
</Then>
</If>
<If description="Verify that the OS is Windows Vista before running the following commands.">
<Condition name="CheckVariable">
<Parameter xsi:type="StringParameter" name="VariableName" value="#vMachine.OSType#" />
<Parameter xsi:type="EnumParameter" name="Condition" value="Equals" />
<Parameter xsi:type="StringParameter" name="Value" value="Vista" />
</Condition>
<Then>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: OS is Windows Vista." />
</Statement>
<If description="Check the ProfileImagePath setting for the correct profile value.">
<Condition name="CheckRegistryValue">
<Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#\ProfileImagePath" />
<Parameter xsi:type="EnumParameter" name="Condition" value="NotEquals" />
<Parameter xsi:type="StringParameter" name="Value" value="C:\Users\#username#" />
</Condition>
<Then>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Comment" value="Warning: The user profile is blown! The ProfileImagePath Registry Key does not match the expected value!" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Correcting the ProfileImagePath Registry Key." />
</Statement>
<Statement description="Set the ProfileImagePath to the correct user profile." name="ExecuteShellCommand" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Command" value="REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#" /V ProfileImagePath /T REG_EXPAND_SZ /D "C:\Users\#username#" /F" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Removing temporary profiles." />
</Statement>
<Statement description="Clean up the bad profile from the system." name="ExecuteShellCommand" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Command" value="FOR /F "TOKENS=* DELIMS= " %D IN ('DIR "C:\Users" /B /AD ^| find "#username#."') DO (RMDIR /S /Q "C:\Users\%D")" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Clean up the bad profile from the system." name="ExecuteShellCommand" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Command" value="FOR /F "TOKENS=* DELIMS= " %D IN ('DIR "C:\Users" /B /AD ^| find "TEMP"') DO (RMDIR /S /Q "C:\Users\%D")" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
</Then>
<Else>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Vista">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: The user profile is not blown. The ProfileImagePath Registry Key matches the expected value." />
</Statement>
</Else>
</If>
</Then>
</If>
<If description="Verify that the OS is Windows 7 before running the following commands.">
<Condition name="CheckVariable">
<Parameter xsi:type="StringParameter" name="VariableName" value="#vMachine.OSType#" />
<Parameter xsi:type="EnumParameter" name="Condition" value="Equals" />
<Parameter xsi:type="StringParameter" name="Value" value="XP" />
</Condition>
<Then>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: OS is Windows XP." />
</Statement>
<If description="Check the ProfileImagePath setting for the correct profile value.">
<Condition name="CheckRegistryValue">
<Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#\ProfileImagePath" />
<Parameter xsi:type="EnumParameter" name="Condition" value="NotEquals" />
<Parameter xsi:type="StringParameter" name="Value" value=""%SystemDrive%\Documents and Settings\"#username#" />
</Condition>
<Then>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="Comment" value="Warning: The user profile is blown! The ProfileImagePath Registry Key does not match the expected value!" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Correcting the ProfileImagePath Registry Key." />
</Statement>
<Statement description="Set the ProfileImagePath to the correct user profile." name="ExecuteShellCommand" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="Command" value="REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#" /V ProfileImagePath /T REG_EXPAND_SZ /D "%SystemDrive%\Documents and Settings\#username#" /F" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Removing temporary profiles." />
</Statement>
<Statement description="Clean up the bad profile from the system." name="ExecuteShellCommand" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="Command" value="FOR /F "TOKENS=* DELIMS= " %D IN ('DIR "C:\Documents and Settings" /B /AD ^| find "#username#."') DO (RMDIR /S /Q "C:\Documents and Settings\%D")" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
</Then>
<Else>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="XP">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: The user profile is not blown. The ProfileImagePath Registry Key matches the expected value." />
</Statement>
</Else>
</If>
</Then>
</If>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Testing for backup Registry Keys and removing them." />
</Statement>
<If description="Check for any backup instances of the user's profile keys.">
<Condition name="TestRegistryKey">
<Parameter xsi:type="StringParameter" name="Path" value="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#.bak" />
<Parameter xsi:type="EnumParameter" name="Condition" value="Exists" />
</Condition>
<Then>
<Statement description="Remove any backup instances of the user's registry keys." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Command" value="REG DELETE "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\#usersid#.bak"/F" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
</Then>
</If>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Cleaning up WMIC's output files used to created procedure variables." />
</Statement>
<Statement description="Clean up text files used to create named procedure variables earlier." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Command" value="FOR /F "TOKENS=* DELIMS= " %F IN ('DIR "#vAgentConfiguration.agentTempDir#" /B ^| find "sid"') DO (DEL #vAgentConfiguration.agentTempDir#\%F" /F /Q")" />
<Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
<Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
</Statement>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Informational: Issuing reboot." />
</Statement>
<Statement description="Reboot the machine this procedure is running on. - WARNING: Reboot must be the last step in a procedure or the procedure will start again from step 1 after the reboot." name="Reboot" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008" />
</Then>
<Else>
<Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="Comment" value="Warning: No user is logged in! Re-scheduling Agent Procedure "#scriptIdTab.scriptName#" and notifying admin #adminDefaults.adminName#." />
</Statement>
<Statement description="Schedule a procedure to run on a specified machine." name="ScheduleScript" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="ScriptName" value="296401573" />
<Parameter xsi:type="StringParameter" name="TimeDelay" value="15" />
<Parameter xsi:type="StringParameter" name="MachineID" value="" />
</Statement>
<Statement description="Send an email from the server (address specified in the Configure function in the System module)." name="SendEmail" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
<Parameter xsi:type="StringParameter" name="To" value="#adminDefaults.adminEmail#" />
<Parameter xsi:type="StringParameter" name="Subject" value="Blown User Profile on #vMachine.machName#" />
<Parameter xsi:type="StringParameter" name="Body" value="Hello #adminDefaults.adminName#,

The computer #vMachine.machName# running Windows #vMachine.OSType# #vMachine.OSInfo# has a blown user profile.

In order for the Agent Procedure #scriptIdTab.scriptName# to run successfully, please make sure the system is logged in to the user account with the blown profile.

Regards, 

The KServer" />
</Statement>
</Else>
</If>
</Body>
</Procedure>
</ScriptExport>
Basically what the procedure does is query WMIC (Windows Management Instrumentation Command-line) and output its results to a text file. We then parse the text file until we just have the SID of the Current User and throw it into a variable. Then I grab the Current User name and throw that into a variable as well. I'll also grab the ProfileImagePath out of the Registry and store it.
Now that I have all the important pieces identified, we install UPHClean on Windows XP if its not already installed (this is a separate agent procedure). This is built into Windows Vista/7 and is absolutely necessary to make sure we can delete the temporary profiles (which may be in use). We then Log Off the Current User. This is another separate script, all it does is execute Logoff.exe as the Current User.
Once the system is logged out, none of the profile files should be in use. We then clean up the Profile List in the Registry and the temporary profiles. For Vista, 7, and XP this will be a little different (I think Vista/7 are the same actually, but I have them broken out separately).
Once everything is complete, we cleanup the files from when we parsed the SID.
If there is not a Current User, we schedule the script to run in 15 minutes and e-mail whomever tried running the script so they know what is up.
This was adapted from an older batch file. I prefer the feedback you get from Kaseya as opposed to just running .CMD/.BAT/.VBS scripts and having to debug them manually. So much nicer to see it fail in Step X and it tell you why it failed (usually). So forgive the Execute Shell command steps!
If you fire up the script in Notepad++ you can Find/Replace all the instances of %computername% with %userdomain% very easily. Hope its helpful!