Command line scripting

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?
7 answers Last reply
More about command line scripting
  1. if exist %username% (del files)
    if exist %username%.DOMAINNAME (del files)

    Just add the extra line in to cover it.
  2. 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
  3. Did it work?
  4. 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).
    pushd \\network location\tsroam\%username%\application data
    Del /f /Q/ S /A sun\*
    pushd \\network location\tsroam\%username%.DOMAIN\application data
    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:
    cd %userprofile%\Application Data\
    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.
  5. Are you dealing with the WFCRUN32 error?
  6. 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.
  7. 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.
Ask a new question

Read More

Management Command Line Business Computing