Batch script to copy/create file/folder in AppData

siming
Beiträge: 4
Registriert: 26 Okt 2017, 21:52

Batch script to copy/create file/folder in AppData

Beitragvon siming » 27 Okt 2017, 15:44

Hello,

Do you know if it is possible to copy or move a file to C:\Users\Username\AppData\Roaming through OPSI ?
I have tried using the OPSI command (winst) copy with parameter 's' and also without parameter, but impossible. I cannot manage with a Dos batch too (by asking OPSI to execute the batch).
What is the exact variable I should use (Windows variable/value): %appdatadir% or %CurrentAppdataDir% ?
If I use Dos commands, do I have to use %appdata% or still using OPSI variable integrated to my Dos commands (%appdatadir% or %CurrentAppdataDir%) ?
It seems impossible to ask OPSI to make any action in C:\Users\Username\AppData\Roaming

Here is a part of my script:

[Files_install_1]
; Example of recursively copying some files into the installation directory:
copy "%ScriptPath%\spark.bat" "%ProgramFiles32Dir%\"
copy "%ScriptPath%\spark.properties" "%ProgramFiles32Dir%\"

[Registry_install]
; Example of setting some values of an registry key:
;
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\UsnNotifier\Windows\Catalogs\SystemIndex]
set "{1337E3EF-24E8-11E7-B165-806E6F6E6963}" = REG_DWORD:11169827240
; set "name2" = REG_DWORD:0001
; set "name3" = REG_BINARY:00 af 99 cd

[DOSInAnIcon_1]
; Commandes batch de Windows (sans affichage de l'invite de commandes)
cd %ProgramFiles32Dir%
spark.bat

;[Files_install_2]
; Example of recursively copying some files into the installation directory:
; copy -s "%ScriptPath%\spark.properties" "%AppDataDir%\Spark\"


Thanks for your help.

Siming

Benutzeravatar
SisterOfMercy
Beiträge: 990
Registriert: 22 Jun 2012, 19:18

Re: Batch script to copy/create file/folder in AppData

Beitragvon SisterOfMercy » 31 Okt 2017, 16:09

Don't use a dos batch file, too much trouble. It isn't that hard to do in OPSI:

[Actions]
Files_install_AllProfiles /AllNtUserProfiles

[Files_install_AllProfiles]
copy -s "%ScriptPath%\files\Roaming\*" "%UserProfileDir%\AppData\Roaming\Autodesk"
copy -s "%ScriptPath%\files\Local\*" "%UserProfileDir%\AppData\Local\Autodesk"
copy "%ScriptPath%\files\acaddoc.lsp" "%UserProfileDir%\AppData\Roaming\Autodesk\AutoCAD 2015\r20.0\enu\Support"


More information is in the winst manual: http://download.uib.de/opsi_stable/doc/ ... inst-files
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!

Benutzeravatar
ngbr
Ex-uib-Team
Beiträge: 130
Registriert: 27 Sep 2010, 11:41

Re: Batch script to copy/create file/folder in AppData

Beitragvon ngbr » 06 Nov 2017, 11:39

hi siming,

if you want to operate on local profiles, use the modifier /AllNTUSerProfiles for your sections.

if you are working with roaming profiles, use User Profile Mangement https://download.uib.de/opsi4.0/doc/htm ... serprofile.

essentially you need to
> activate the login commands in your server properties
> set a userlogin script in the control file
> have a [ProfileActions] section within this script.
---
hoping to help :)

if your problem was solved, pls mark this thread as 'SOLVED'. thank you .

-- no PN support --

Andre