spgsitsupport Posted October 23, 2015 Report post Posted October 23, 2015 I have a single liner: cmd.exe /c "mkdir c:\windows\sysnative & copy c:\windows\system32\cmd.exe c:\windows\sysnative\" that SCCM manages to fail: Command line arguments when parsed cmd.exe execmgr 23/10/2015 15:52:19 3156 (0x0C54) Command line arguments when parsed /c execmgr 23/10/2015 15:52:19 3156 (0x0C54) Command line arguments when parsed "mkdir c:\windows\sysnative & copy c:\windows\system32\cmd.exe c:\windows\sysnative\" execmgr 23/10/2015 15:52:19 3156 (0x0C54) WTSQueryUserToken[2](SessionID=1) retried 0 times! execmgr 23/10/2015 15:52:19 3156 (0x0C54) !sTempString.empty(), HRESULT=80070057 (e:\qfe\nts\sms\framework\core\ccmcore\string.cpp,1109) execmgr 23/10/2015 15:52:19 3156 (0x0C54) !sTempString.empty(), HRESULT=80070057 (e:\qfe\nts\sms\framework\core\ccmcore\string.cpp,1109) execmgr 23/10/2015 15:52:19 3156 (0x0C54) CProgramExecution::CProgramExecution execmgr 23/10/2015 15:52:19 3156 (0x0C54) Executing program as a script execmgr 23/10/2015 15:52:19 3156 (0x0C54) File cmd.exe is not a valid executable file execmgr 23/10/2015 15:52:19 3156 (0x0C54) Successfully prepared command line "c:\windows\system32\cmd.exe" /c "mkdir c:\windows\sysnative & copy c:\windows\system32\cmd.exe c:\windows\sysnative\" execmgr 23/10/2015 15:52:19 3156 (0x0C54) Command line = "c:\windows\system32\cmd.exe" /c "mkdir c:\windows\sysnative & copy c:\windows\system32\cmd.exe c:\windows\sysnative\", Working Directory = c:\windows\system32\ execmgr 23/10/2015 15:52:19 3156 (0x0C54) Running "c:\windows\system32\cmd.exe" /c "mkdir c:\windows\sysnative & copy c:\windows\system32\cmd.exe c:\windows\sysnative\" with 32bitLauncher execmgr 23/10/2015 15:52:19 3156 (0x0C54) Created Process for the passed command line execmgr 23/10/2015 15:52:19 3156 (0x0C54) Raising event: [SMS_CodePage(850), SMS_LocaleID(2057)] instance of SoftDistProgramStartedEvent { AdvertisementId = "SP1200D3"; ClientID = "GUID:1EB73940-EDF2-4306-A7FB-B3134C80FE41"; CommandLine = "\"c:\\windows\\system32\\cmd.exe\" /c \"mkdir c:\\windows\\sysnative & copy c:\\windows\\system32\\cmd.exe c:\\windows\\sysnative\\\""; DateTime = "20151023145219.802000+000"; MachineName = "E5520-xxxxxx"; PackageName = "SP1000A5"; ProcessID = 3048; ProgramName = "Sysnative"; SiteCode = "SP1"; ThreadID = 3156; UserContext = "NT AUTHORITY\\SYSTEM"; WorkingDirectory = "c:\\windows\\system32\\"; }; execmgr 23/10/2015 15:52:19 3156 (0x0C54) Script for Package:SP1000A5, Program: Sysnative failed with exit code 1 execmgr 23/10/2015 15:52:19 4624 (0x1210) Running it from NT AUTHORITY\\SYSTEM (with psexec) works perfectly fine (how could it fail) Yet it does fail while running from Software Center Anybody any ideas? Thanks Seb Quote Share this post Link to post Share on other sites More sharing options...
spgsitsupport Posted October 23, 2015 Report post Posted October 23, 2015 SCCM run .cmd file gives: C:\Windows\system32>mkdir c:\windows\sysnative & copy c:\windows\system32\cmd. exe c:\windows\sysnative\ A subdirectory or file c:\windows\sysnative already exists. Access is denied. 0 file(s) copied. Same .cmd run by hand from NT AUTHORITY\\SYSTEM CMD gives perfect: C:\Windows\system32>mkdir c:\windows\sysnative & copy c:\windows\system32\cmd. exe c:\windows\sysnative\ 1 file(s) copied. Quote Share this post Link to post Share on other sites More sharing options...
Jaybone Posted October 23, 2015 Report post Posted October 23, 2015 Check for existence first, maybe, so it won't try to overwrite it if it's already there? if not exist c:\windows\sysnative\cmd.exe md c:\windows\sysnative & copy c:\windows\system32\cmd.exe c:\windows\sysnative\ Quote Share this post Link to post Share on other sites More sharing options...
spgsitsupport Posted October 24, 2015 Report post Posted October 24, 2015 No, there is NOTHING there (at least visible). Sysnative is an alias as per this - File System Redirector Which could explain why "A subdirectory or file c:\windows\sysnative already exists" come up, but if that is so then it should come up in both cases .cmd can NOT behave different (or at least SHOULD NOT) if invoked from CM agent or by hand from same security context Seb The whole point of this is that I have a new (Sibelius 8) software that comes as a single .exe but is a mess Comes with silent install switches for install, but no extraction switch exe installer is 32-bit Inside this Installshield executable there are few bits (that I can not extract): prereqs (like runtimes & own set of fonts that gets installed) and two separate msi One msi is 32-bit, second is 64-bit. So when exe runs, it installs prereqs WITHOUT them being explicitly extracted, and then extracts both msi to %userprofile%/Appdata/local/Downloaded Installations As the Package/Program is run with administrative privileges the msi are extracted to: C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Downloaded Installations due to the redirector (32-bit exe on 64-bit OS) But when the msiexec is invoked it wants to run the msi from C:\Windows\System32\config\systemprofile\AppData\Local\Downloaded Installations as at this point it is 64-bit program on 64-bit OS Of course it fails, as the msi is not in there So I need to force the exe to run as native & extract it to System32 If I do create c:\windows\sysnative by hand with above batch file and then run program via CM c:\windows\sysnative\cmd /c executable_to_install_what I need it works fine! But if I use (without anything being created) in CM %systemroot%\sysnative\cmd /c executable_to_install_what I need it does behave in same way as if it was just run directly (with extraction to SysWOW64) (almost as if CM parses the command for execution in some odd way) I even tried the "recommended way" (running batch file) IF "%PROCESSOR_ARCHITEW6432%"=="" GOTO native %SystemRoot%\Sysnative\cmd.exe /c %0 %* Exit :native command_to_execute_goes_here Still lands up in SysWOW64 Ofcourse I can do it via Application (but that is not the point here) In the end I extracted the exe with MSI Based (may not result in a usable image for an InstallScript MSI installation): setup.exe /a /s /v"/qn TARGETDIR=\"choose-a-location\"" or, to also extract prerequisites (for versions where it works), setup.exe /a"choose-another-location" /s /v"/qn TARGETDIR=\"choose-a-location\"" Quote Share this post Link to post Share on other sites More sharing options...