A *NEW* Kaseya Community is coming! Get the details & update your profile this week: https://www.community.connectit.com/discussion/41381/a-new-kaseya-community-is-coming

Need a procedure for replacing template file for all the users on the machine.

rehankhan011 Member, IT Pro CHOCOLATE MILK
edited June 20 in Request

The template file is stored at "C:\Users\user name\AppData\Roaming\Microsoft\Templates\Normal.dotm." I want to replace that file with a new file. Problem I am facing is that "user name" will be different for all the users. Please help me with a query for the same. Suppose file name is Normal.dotm

1 votes

Active · Last Updated


  • rehankhan011
    rehankhan011 Member, IT Pro CHOCOLATE MILK

    I want the file to be replaced for all users. It is a default file by MS.

  • tom@tbkconsulting.biz
    [email protected] Member, Managed Service Provider CAPPUCCINO

    You can use the windows variable %USERNAME% … but this will only work for the currently logged on user!

    Knowing this you can tick the boxes here for all users on a PC by setting up a policy to auto-run your script every time a user logs in.

    In the new VSA X you can create a workflow much easier for this, but will have host the file somewhere on the web that you want to use to replace the file and use the GetURL in order to download it properly (right now I don't think there is a way to use VSA File Storage with scripts, etc for files like this)

  • Compass_Jared
    Compass_Jared Member, Managed Service Provider CHOCOLATE MILK
    edited August 2

    So, what you do is this:

    First, verify that Microsoft Office Word is installed with your views, Create a new custom view Name it MSWord, Hit Save, Expand Applications, Check the Contains box, add word.exe after the * in the box, Hit Save. Limit your view by machine group if you want. Then continue on.

    Open Procedures. Click Mange Files. Upload the normal.dotm file. Do not Drag and drop.

    Make your procedure write the normal.dotm file to C:\kworking\System with writeFile and select your normal.dotm file. It should automatically assign the file to the correct directory.

    Then write yourself a executeShellCommandToVariable("For /f "tokens=* delims=" %A in ('dir /a:d "C:\users" /b ^|findstr /i /v "Public Default All Users User DefaultAccount Administrator WDAGUtilityAccount"') do (Copy /y "#vAgentConfiguration.agentTempSecureDir#/AccountResults.txt" "C:\users\%A\AppData\Roaming\Microsoft\Templates")", "System", false, "All Windows Operating Systems, "Halt on fail")

    Add a writeProcedureLogEntry("#global:cmdresults#", "All Windows Operating Systems, "Halt on fail") To catch error messages.

    Then add anything else you might want. The above should give you a rough idea of what to do.