Ich habe mit ChangeDirectory in einem meiner OPSI-Scripte ein kleines Problem. Scheinbar wird, wenn ChangeDirectory mit einer Variable aufgerufen wird, diese nicht aufgelöst. Andere Aktionen und Befehle im gleichen Script mit der gleichen unveränderten Variable klappen ohne Probleme.
Das OPSI-Script sieht (partiell) so aus:
Code: Alles auswählen
DefVar $installation_random_localpath$
Set $installation_random_localpath$ = "%opsiTmpDir%\M365Offfice_" + RandomStrWithParameters("10","5","0","5","0")
DosInAnIcon_Mount_Installsource
Files_Copy_Installer
ChangeDirectory "$installation_random_localpath$"
Winbatch_setup
Sub_check_exitcode
DosInAnIcon_Unmount_Installsource
Files_Delete_Installer
[Files_Copy_Installer]
copy -s $installation_source$\Office\*.* "$installation_random_localpath$\Office"
copy -s $installation_source$\setup.exe "$installation_random_localpath$"
copy -s "$installation_source$\$installation_XMLfile$" "$installation_random_localpath$"
....
Code: Alles auswählen
(104) [6] [2021-01-04 14:14:40.941] [microsoft-microsoft365] Set $installation_random_localpath$ = "c:\opsi.org\tmp\M365Offfice_" + RandomStrWithParameters("10","5","0","5","0")
(105) [6] [2021-01-04 14:14:40.941] [microsoft-microsoft365] The value of the variable "$installation_random_localpath$" is now: "c:\opsi.org\tmp\M365Offfice_o44r9px13o"
...
(137) [5] [2021-01-04 14:14:41.362] [microsoft-microsoft365] Execution of: Files_Copy_Installer
(138) [5] [2021-01-04 14:14:41.362] [microsoft-microsoft365]
(139) [7] [2021-01-04 14:14:41.372] [microsoft-microsoft365] copy -s \\FILESERVER\m365$\Office\*.* "c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office"
(140) [7] [2021-01-04 14:14:41.372] [microsoft-microsoft365] copy
(141) [6] [2021-01-04 14:14:41.373] [microsoft-microsoft365] path c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office created
(142) [6] [2021-01-04 14:14:41.418] [microsoft-microsoft365] Copying \\FILESERVER\m365$\Office\*.* -----> c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office
(143) [6] [2021-01-04 14:14:41.418] [microsoft-microsoft365] 8 File(s) found
(144) [6] [2021-01-04 14:14:41.426] [microsoft-microsoft365] No (non-directory) file with mask \\FILESERVER\m365$\Office\*.* found
(145) [6] [2021-01-04 14:14:41.428] [microsoft-microsoft365] Source \\FILESERVER\m365$\Office\Data\v64.cab
(146) [6] [2021-01-04 14:14:41.466] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\v64.cab copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\
(147) [6] [2021-01-04 14:14:41.468] [microsoft-microsoft365] Source \\FILESERVER\m365$\Office\Data\v64_16.0.12527.21416.cab
(148) [6] [2021-01-04 14:14:41.497] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\v64_16.0.12527.21416.cab copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\
(149) [6] [2021-01-04 14:14:41.502] [microsoft-microsoft365] Source \\FILESERVER\m365$\Office\Data\16.0.12527.21416\i640.cab
(150) [6] [2021-01-04 14:14:44.060] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\16.0.12527.21416\i640.cab copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\16.0.12527.21416\
(151) [6] [2021-01-04 14:14:44.078] [microsoft-microsoft365] Source \\srv001.ad.docemus.de\m365$\Office\Data\16.0.12527.21416\i641031.cab
(152) [6] [2021-01-04 14:14:44.110] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\16.0.12527.21416\i641031.cab copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\16.0.12527.21416\
(153) [6] [2021-01-04 14:14:44.110] [microsoft-microsoft365] Source \\FILESERVER\m365$\Office\Data\16.0.12527.21416\s640.cab
(154) [6] [2021-01-04 14:14:44.503] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\16.0.12527.21416\s640.cab copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\16.0.12527.21416\
(155) [6] [2021-01-04 14:14:44.521] [microsoft-microsoft365] Source \\srv001.ad.docemus.de\m365$\Office\Data\16.0.12527.21416\s641031.cab
(156) [6] [2021-01-04 14:14:44.670] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\16.0.12527.21416\s641031.cab copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\16.0.12527.21416\
(157) [6] [2021-01-04 14:14:44.670] [microsoft-microsoft365] Source \\srv001.ad.docemus.de\m365$\Office\Data\16.0.12527.21416\stream.x64.de-de.dat
(158) [6] [2021-01-04 14:15:17.914] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\16.0.12527.21416\stream.x64.de-de.dat copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\16.0.12527.21416\
(159) [6] [2021-01-04 14:15:17.944] [microsoft-microsoft365] Source \\srv001.ad.docemus.de\m365$\Office\Data\16.0.12527.21416\stream.x64.x-none.dat
(160) [6] [2021-01-04 14:18:42.441] [microsoft-microsoft365] \\FILESERVER\m365$\Office\Data\16.0.12527.21416\stream.x64.x-none.dat copied to c:\opsi.org\tmp\M365Offfice_o44r9px13o\Office\Data\16.0.12527.21416\
(161) [6] [2021-01-04 14:18:42.485] [microsoft-microsoft365] 8 File(s) treated
...
(190) [5] [2021-01-04 14:18:43.745] [microsoft-microsoft365] Finished of: Files_Copy_Installer
(191) [3] [2021-01-04 14:18:43.746] [microsoft-microsoft365] Error at ChangeDirectory: C:\WINDOWS\system32\$installation_random_localpath$ is not a directory
(192) [5] [2021-01-04 14:18:43.746] [microsoft-microsoft365] Execution of: Winbatch_setup
(193) [5] [2021-01-04 14:18:43.746] [microsoft-microsoft365]