Deploy a command to remote computer with switch?

What's the best way to put this command into a CMD, batch or VBS file that can be deployed to a remote computer?

C:\Windows\System32\Fbwfmgr.exe /addexclusion C: \Windows\System32\Microsoft

Open in new window


As you can see here I'm trying to exclude that "Microsoft" folder in system32 from the file based write filter on a thin client that's running Windows XP Embedded.

If I save this code into a .cmd file:
"C:\Windows\System32\Fbwfmgr.exe" /addexclusion C: \Windows\System32\Microsoft

Open in new window


And then deploy it to a remote computer using PDQ Deploy, it says it fails. But when I check the remote computer, I show the C:\Windows\System32\Microsoft patch is now added in the File Based Write Filter exclusion list...
garryshapeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary DewrellSenior Network AdministratorCommented:
What is the error you are getting?
If you ran the command on the server manualy does it still give you an error?
0
garryshapeAuthor Commented:
If I run it manually in the command prompt, no errors.
Says the path will be in the exclusion list after the next reboot.

If I run it via PSExec, it says it cannot find the exe path.
If I run it via PDQ Deploy, it just says failed. Usually would say success if I deployed something like an MSI file. Maybe it has no way of knowing this command has run then, which seems strange.
But via PDQ Deploy it seems to still affect the remote computer successfully, I just see a "failed" still.
0
sgdoughtCommented:
If a command runs in Windows and there is not an error, it sets errorlevel to 0.  If you open a CMD prompt, then type echo %errorlevel%, it will most likely return a zero.

Your batch file could check the value of errorlevel (if errorlevel = 0 or some such) and use that to see if the command actually completed successfully.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

garryshapeAuthor Commented:
It is 0.
PDQ Deploy says it checks for code 0,1641,3010.
Should I just add a new line with "exit" to the cmd file?
0
sgdoughtCommented:
That's what I would do.

And for more info on Windows variables, go here:
http://technet.microsoft.com/en-us/library/cc737438(WS.10).aspx

0
sgdoughtCommented:
You might have your cmd check the %errorlevel% immediately after your command runs and do something if it is not 0.
0
sgdoughtCommented:
another handy thing is Return:
If %errorlevel% not equal 0 then return %errorlevel%

Not sure of the exact syntax, but this way you know what the error number is.
0
garryshapeAuthor Commented:
Looks like I even get the -1 error if I run the command using psexec (launching psexec \\remotecomputer CMD then running.

I type “C:\WINDOWS\system32>fbwfmgr /addexclusion C: \Windows\System32\Microsoft”
Then it returns:
“Path \Windows\System32\Microsoft on volume C: will be in the exclusion list after the next reboot.”
Then I exit:
“C:\WINDOWS\system32>exit”
And I see:
“cmd exited on dfw-tl-2642 with error code -1.”

So it must be this particular command.
0
garryshapeAuthor Commented:
Thanks for help. It appears the particular exe utility I'm working with isn't compatible from what I can tell with returning an error code other than -1 if I run remotely.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.