none
WMIC - Query Broken??? RRS feed

  • Question

  • I work in HelpDesk Support and with my company disabling the UACs on our Win7 machines we had to find another way to uninstall software on the client's while Remote Assistance'd into those machine. Yes we could RDP but that take more time. Since Security is still working on allowing us to use PowerShell the next best way was CMD files. We have Tier 1 HelpDesk techs who are very new to computers so having them use CMD to get the .msi and using msiexec.exe to unistall was a little more than my management wanted to give them.

    So my CMD files use this template:
    @echo off
    set /p a=Enter username:
    runas /noprofile /user:%a%@company.com "wmic product where name='Software_Name' call uninstall /nointeractive"

    Recently a co-worker asked if this would work for the Cisco NAC Agent so we change the name thinking it would but it does not. So I ran the link through CMD by itself and it returns: No Instance(s) Available.

    I cannot find anyway using the "...name='Cisco NAC Agent'..." to have WMIC find it. I am having to use "..."name like 'Cisco NAC%'..." because it will not recognize the 'Agent'. I have done the same thing for Caption and Description but receive the same results. However putting the "..."name like 'Cisco NAC%'..." into the CMD file causes the runas to crash and exit the script. I'm guessing it is confused on the "" and ''.

    They may just have to be one we does by MSI and there is no way around it.

    Any help is appreciated,

    XK8Geek

    Friday, July 6, 2012 6:17 PM

Answers

  • Hi is your OS pirated ?

    http://www.pcpitstop.com/pcpitstop/FixWmi.asp


    Guowen Su
    Cisco Certified Network Associate
    Cisco Certified Internetwork professional - MPLS
    Certified Information Systems Security Professional
    Microsoft Partner Network 2011
    Microsoft Certified Professional
    Microsoft Certified Systems Administrator:Security
    Microsoft Certified Systems Engineer: Security
    Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
    Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration
    Microsoft Certified Technology Specialist: Windows Server 2008 Applications Infrastructure, Configuration
    Microsoft Certified Technology Specialist: Windows 7, Configuring
    Microsoft Certified IT Professional: Enterprise Administrator
    Microsoft Certified IT Professional: Server Administrator
    Certified Ethical Hacker
    Computer Hacking Forensics Investigator
    Certified Sonicwall Security Administrator
    Microsoft Geeks

    • Proposed as answer by Soh.M Monday, July 16, 2012 9:52 AM
    • Marked as answer by Kevin Remde Tuesday, December 4, 2012 11:52 AM
    Monday, July 16, 2012 9:52 AM

All replies

  • Hi is your OS pirated ?

    http://www.pcpitstop.com/pcpitstop/FixWmi.asp


    Guowen Su
    Cisco Certified Network Associate
    Cisco Certified Internetwork professional - MPLS
    Certified Information Systems Security Professional
    Microsoft Partner Network 2011
    Microsoft Certified Professional
    Microsoft Certified Systems Administrator:Security
    Microsoft Certified Systems Engineer: Security
    Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
    Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration
    Microsoft Certified Technology Specialist: Windows Server 2008 Applications Infrastructure, Configuration
    Microsoft Certified Technology Specialist: Windows 7, Configuring
    Microsoft Certified IT Professional: Enterprise Administrator
    Microsoft Certified IT Professional: Server Administrator
    Certified Ethical Hacker
    Computer Hacking Forensics Investigator
    Certified Sonicwall Security Administrator
    Microsoft Geeks

    • Proposed as answer by Soh.M Monday, July 16, 2012 9:52 AM
    • Marked as answer by Kevin Remde Tuesday, December 4, 2012 11:52 AM
    Monday, July 16, 2012 9:52 AM
  • i think the link which guowen provided will help u solve the issue
    Monday, July 16, 2012 12:43 PM
  • Hi Guowen,

    Thanks for your reply. Unfortunate the OS is not pirated as we have a volume license and image we lay on all our machines. (However that site did help with another issue but http://community.spiceworks.com/scripts/show/1459-repair-wmi-for-sccm-client-install is the fix I used.)

    But back to this issue...here is a screenshot of just the WMIC queries I ran and all the ones where "=" was used, "No Instance(s) Available." was displayed. The last two use the "like" operator but only after entering the "%" at the end is the query results sent to the text file. Because the Product information is so long it would display correctly if I pasted it for you. I can get it to chose the right the Cisco NAC Agent if I give it another identifier besides its name.

    Tuesday, July 17, 2012 5:34 PM