Sign in with
Sign up | Sign in
Your question

Command line scripting

Last response: in Business Computing
Share
October 6, 2011 8:18:12 PM

We have created a script to delete files in the Java cache and various other folders to run on login for our domain users (Citrix Romaing Profiles). However some of the domain user names are different for example For Joe Plumber it could be either joeplumber OR joeplumber.DOMAINNAME.

Would the %userprofile% work for both users profiles? If it won't is there a method to have it possibly search for joeplumber and if it doesn't exist search for joeplumber.DOMAINNAME ?

Any idea why it would attach the domain name to the end of users profiles/how to fix that?

More about : command line scripting

October 10, 2011 2:37:59 PM

if exist %username% (del files)
if exist %username%.DOMAINNAME (del files)


Just add the extra line in to cover it.
October 11, 2011 2:02:12 AM

I dont have what i ended up usign from memory but it went
IF exist %USERPROFILE% rd /varibles ELSE %USERPROFILE%.Domainname rd /variables
There were some parens in there though
Related resources
October 13, 2011 6:51:09 PM

Did it work?
October 13, 2011 8:17:51 PM

It did not, reason being it gave invalid path doing it that way. Instead we did two seperate command lines (also slightly different as this was doing the Citrix roaming profiles).
  1. pushd \\network location\tsroam\%username%\application data
  2. Del /f /Q/ S /A sun\*
  3.  
  4. pushd \\network location\tsroam\%username%.DOMAIN\application data
  5. Del /f /Q/ S /A sun\*

Side note (I wonder if the .DOMAIN may be unneeded as I think %USERPROFILE% should do it)

But for profiles stored on the Citrix Servers, however doing an rd %USERPROFILE%\Application Data\Sun failed to find the specified path, I instead used:
  1. cd %userprofile%\Application Data\
  2. rd /q Sun
Which works


Unfortunately this scripting is causing more overhead than there should be, as it loads the roaming profile locally when a citrix application is launched then when the session is closed it copies all the information back to the roaming profile, we are looking at a script to also run at logoff to basically do the same thing as the above script, so there is less copying. I believe we can set modify the group policy for the OU the servers are in to run that script at log off.

Its kind of hard to explain so I tried my best.
October 13, 2011 8:38:44 PM

Are you dealing with the WFCRUN32 error?
October 13, 2011 8:54:39 PM

I am not. The reason why we are trying to do this is that the roaming profile get to large and take over a minute for a user to load an application, deleting the Java cache and various other stuff cuts the loading time by alot.

I have encountered a WFCRUN32 error on local machines (Failure to set event logging) and fixed them.
October 17, 2011 6:18:04 PM

You may want to consider running a scheduled task on the computer to periodically clean out stale profiles, or profiles that are over a certain size. I would at using Powershell or VBS to do this.

You may even find a built in maintenance task with Win7 or Win2k8.
!