This is probably set to silently fail in Vista and later unless elevated. The SetEnvironmentVariable method works, but when setting it as "User" i. Yopu are correct. I fooled myself by inadvertently pikog a name vlue pair that I had used months ago. I though it was new so when I checked the value was there.
What I was thinking of was how we pass variables beteen processes nd parent processes If the calling processcreate a custom environment and creates the child with it it can get teh values by reading them out of teh copy ot the process block handed to the child.
It's a guess as I have never tried that with CMD. IIRC, I've tried that without success. I believe my conclusion before was that cmd. This appears to me to be the same problem encountered with WSH.
The solution there was to wrap the script in a FOR statement. So I offer that for the PS, assuming it can be made to write its output to the console. Since I have barely started in PS, I leave that part to someone with some expertise in that. I would think the batch part would be something like this I know it's a little bit late to answer this question, but I would like to give it a try just in case any one needs more details solution.
So, here it goes. I created a batch function that would execute ps script for you and return a value, something like this:. Let's assume that we want to check if a VM is Up or Down, meaning if it's powered on or off, so we can do the following:. Office Office Exchange Server. Not an IT pro?
Script Center. Sign in. United States English. Ask a question. Quick access. Search related threads. Remove From My Forums. Answered by:. Save Close. Incorrect function. Indicates that Action has attempted to execute non-recognized command in Windows command prompt cmd. The system cannot find the file specified. Indicates that the file cannot be found in specified location. Program is not recognized as an internal or external command, operable program or batch file.
Indicates that command, application name or path has been misspelled when configuring the Action. Not enough virtual memory is available. It indicates that Windows has run out of memory. The application failed to initialize properly. Indicates that the application has been launched on a Desktop to which the current user has no access rights.
If you ask your own question - our Certified Experts will team up with you to help you get the answers you need. Who are the certified experts?
How quickly will I get my solution? We can't guarantee quick solutions - Experts Exchange isn't a help desk. We're a community of IT professionals committed to sharing knowledge. Our experts volunteer their time to help other people in the technology industry learn and succeed. Plans and Pricing. Contact Us. Certified Expert Program.
0コメント