0

I'm wanting to run WMIC to call an uninstall for a certain bit of software, and, I have a working WMIC command, but I don't know how to create a .txt file with all of our computer names. Does anyone know how to do that? I know that the WMIC switch is /node:@"FILENAME.txt" but I don't know how to get a txt file with all our PC names and what the format should be, whether it should be separated by commas or one on each new row? Can WMIC create this list of PCs?

Thanks.

1 Answer 1

0

cite from Useful Wmic queries for host and domain enumeration

--- List All Computers ---

wmic /NAMESPACE:\\root\directory\ldap PATH ds_computer GET ds_samaccountname

OR

wmic /NAMESPACE:\\root\directory\ldap PATH ds_computer GET ds_dnshostname
4
  • Hello @LotPings, thank you so much for that. I tried the second command and it does work, I guess this takes a list of all PCs that are on on the network at the moment, right? To then run the node:@ command to uninstall, do I just paste the output from the above command into a text file and feed it to WMIC? Thanks.
    – user757392
    Commented Nov 8, 2018 at 13:58
  • I know that this is a long shot, but, could I add the WMIC uninstall command into a user's logon script? I read online that I can't apparently? It would be more effective if this could run on each machine as and when it starts up. At the moment my command is WMIC /failfast:on product where "name like 'LogMeIn%'" call uninstall /nointeractive And since I couldn't put it into a login script I looked for the way to run it through a list... Thanks.
    – user757392
    Commented Nov 8, 2018 at 14:08
  • I'd simply redirect the output of wmic /NAMESPACE:\\root\directory\ldap PATH ds_computer GET ds_dnshostname >FILENAME.txt and use that file as input /node:@"FILENAME.txt"
    – LotPings
    Commented Nov 8, 2018 at 14:13
  • I know but this will only work for PCs that are on now and not for laptops that are at home or devices that are powered off hence me wanting to put the command into a login script so that it would run when users power machines on. I don't suppose one could use a GPO perhaps?
    – user757392
    Commented Nov 8, 2018 at 14:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .