Environment
Novell ZENworks 11 Configuration Management Bundles
Novell ZENworks 10 Configuration Management Bundles
Novell ZENworks 10 Configuration Management Bundles
Situation
This can happen when Environment Variables are in use.
Example scenario:
Example scenario:
- Create c:\temp\test.bat on a test workstation containing a simple test line; e.g. time /t >> c:\temp\flag.txt
- ZCC > Bundles > New Bundle > Windows Bundle > Empty Bundle > Name=MyBundle
- Define Additional > Actions > Launch > Add > Launch Executable
- General > Command=c:\temp\test.bat (i.e. as above)
- Advanced > Run as Logged-in User, Display Mode Hidden
- Associate the bundle and run it
- Now edit the bundle
- General > Environment variables > Add > MyVar=Something
- Rerun the bundle on the workstation.
Resolution
Add environment variables at the bundle level rather than action level; e.g.
- Navigate to <bundle> > Settings > System Variables > Add (under system variables)
Additional Information
This is a documented Microsoft issue: http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.windowstyle.aspx (check notes under Remarks header).
Whilst investigating this, engineering did a test which showed that this is not specific to batch files and is seen with all executables. For example, a sample program running outside of ZCM that creates the process (notepad.exe) with the following start info:
myProcess.StartInfo.UseShellExecute = false
myProcess.StartInfo.CreateNoWindow = true
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
Even in this case, the notepad is visible, showing that the issue is with Microsoft.
The UseShellExecutable property should be set to false whenever environment variables defined in process start info are used. If it is set to true, there is an exception saying - "The Process object must have the UseShellExecute property set to false in order to use environment variables". When UseShellExecutable property is true, the properties set in the process start info are respected. If it is set to false, some of the properties might get ignored. In short, to use Hidden, UseShellExecute should be true, but it cant be true in this case as environment variables are in use. These are all Microsoft requirements.
Whilst investigating this, engineering did a test which showed that this is not specific to batch files and is seen with all executables. For example, a sample program running outside of ZCM that creates the process (notepad.exe) with the following start info:
myProcess.StartInfo.UseShellExecute = false
myProcess.StartInfo.CreateNoWindow = true
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
Even in this case, the notepad is visible, showing that the issue is with Microsoft.
The UseShellExecutable property should be set to false whenever environment variables defined in process start info are used. If it is set to true, there is an exception saying - "The Process object must have the UseShellExecute property set to false in order to use environment variables". When UseShellExecutable property is true, the properties set in the process start info are respected. If it is set to false, some of the properties might get ignored. In short, to use Hidden, UseShellExecute should be true, but it cant be true in this case as environment variables are in use. These are all Microsoft requirements.