WMIC Remote uninstall [SOLVED]
Posted: 28 May 2012 03:36
Hi All,
This is my first post, and I'm hoping i'll get a good impression by getting an answer to my first issue. Batch files are the only way of scripting that I know, and I like to think i'm getting pretty good at it.
I've written this file:
@echo off
::Ask for Target PC Name
SET target=
SET /P target=Type Target PC Name Here:
wmic /node:"%target%" product where vendor="Mindjet LLC" call uninstall
in order to remove installations of Mind Manager remotely. Now, the weird thing is that when no one is logged into the target PC, it works fine. ReturnValue is 0, and when i then log on, it's all done.
However, if someone is logged into the target PC, it fails with ReturnValue 1603. I know this can be to do with rights, but since i run my Win7 PC in test mode, with UAC turned off, everything comes up with admin rights anyway.
Any ideas? I've tried adding a /nointeractive switch as i've seen on some websites, and i've also tried adding a /interactive:off switch too, but none seem to make a difference. I've logged in on the target PC with both my login, and a random other login to check. I know my script is good because it works when no one is logged in. Would it work better if i used an @file for the node? If so, I have another command underneath this (PSEXEC to run an uninstall file that can't be removed using WMIC). How do i make a normal batch file command work on a text file?
Thanks.
Andy
This is my first post, and I'm hoping i'll get a good impression by getting an answer to my first issue. Batch files are the only way of scripting that I know, and I like to think i'm getting pretty good at it.
I've written this file:
@echo off
::Ask for Target PC Name
SET target=
SET /P target=Type Target PC Name Here:
wmic /node:"%target%" product where vendor="Mindjet LLC" call uninstall
in order to remove installations of Mind Manager remotely. Now, the weird thing is that when no one is logged into the target PC, it works fine. ReturnValue is 0, and when i then log on, it's all done.
However, if someone is logged into the target PC, it fails with ReturnValue 1603. I know this can be to do with rights, but since i run my Win7 PC in test mode, with UAC turned off, everything comes up with admin rights anyway.
Any ideas? I've tried adding a /nointeractive switch as i've seen on some websites, and i've also tried adding a /interactive:off switch too, but none seem to make a difference. I've logged in on the target PC with both my login, and a random other login to check. I know my script is good because it works when no one is logged in. Would it work better if i used an @file for the node? If so, I have another command underneath this (PSEXEC to run an uninstall file that can't be removed using WMIC). How do i make a normal batch file command work on a text file?
Thanks.
Andy