what happens when you execute the command manually from the command line ?
Does it always stuck ?
What if you put another command say echo "end of wmic" to it ?
If I execute it manually on target server it wont stuck but if I do nsh and execute it remotely it will stuck and release once I press cntrl+z.
How do I pass on "end of wmic" along with my command - "WMIC BIOS Get Name"
cmd /c "WMIC BIOS getname & echo end of wmic"
You need to run like ‘echo QUIT | wmic’ or something like that.
nexec <servername> cmd /C "wmic bios get name" <<!
[press <control-v><control-z> at the same time here]
Pressing <control-v><control-z> will show you '^Z', which is a control-z character that you see on the UNIX terminals.
Thanks Rohit, Bill
But both options did not work for me. I am looking for other options now. I will post here in case I get anything. I am still wondering why it does not work for w2k3 where as it working fine for w2k8. Is it a limitation of RSCD agent?
I have 8.2 SP2.
We don’t load a full environment via nexec so that’s typically the problem, though I’ve also seen wmic hang on the native commandline. Typically the ‘echo QUIT | wmic’ or ‘echo . | wmic ‘ works.
Try piping to /dev/null for WS2K3 at the end of your wmic call.
BMC Global Services
bb pin: 22528500
10 Maguire Road
Lexington, MA 02421-3135
image001.gif 3.2 K
This is how I run my powershell stuff
nexec -i -e cmd /c "echo . | powershell.exe "c:/temp/D-E-E-00001.01.ps1""
cmd /c "echo QUIT | wmic /interactive:off computersystem get currenttimezone /format:textvaluelist.xsl"
So try something like that
For powershell you should be able to use ‘-inputformat NONE’ or something like that and not use the echol