2

I have test.txt file as below like all ip. (example:)

192.168.xxx.50

192.168.xxx.51

192.168.xxx.52

192.168.xxx.53

192.168.xxx.54

192.168.xxx.55

I want to make batch file with using psexec, wmic by those IP

FOR /F "tokens=* delims=," %%i in (test.txt) do (
psexec \\<i dont know how to do in here..it should be ip in here each line>-u <domain>\administrator -p <password> wmic /output:\\<serverip should be here which is going to save>\d$\%(i want this each ip info)%.txt product get name,vendor
) 

how to do..? i think i don't know about %%parameter

Community
  • 1
  • 1

1 Answers1

1

Wmic can do this without PSExec help. Your file is in correct format for wmic.

wmic /node:@"Computerlist.txt" product get name,vendor /format:htable

See wmic /node /? and wmic /format /?.

Start - All Programs - Accessories - Right click Command Prompt and choose Run As Administrator. Type (or copy and paste by right clicking in the Command Prompt window and choosing Paste). Type for table format

wmic /output:"%userprofile%\desktop\WindowsInstaller.html" product get /format:htable

or in a form format

wmic /output:"%userprofile%\desktop\WindowsInstaller.html" product get /format:hform

It will create a html file on the desktop.

Note

This is not a full list. This is only products installed with Windows Installer. There is no feature for everything.

However as I said in my previous post nearly everything is listed in the registry.

So to see it in a command prompt

reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s

or in a file

reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s>"%userprofile%\desktop\WindowsUninstall.txt"

To see it in notepad in a different format

Click Start - All Programs - Accessories - Right click Command Prompt and choose Run As Administrator. Type Regedit and navigate to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Right click the Uninstall key and choose Export. If you save as a reg file (there is also text file, they are slightly different text formats) you need to right click the file and choose Edit to view it.

To view Windows Updates

wmic /output:"%userprofile%\desktop\WindowsUpdate.html" qfe  get /format:htable
  • yes i know but some of PC can not work with just only wmic (like permission problem. so i used both it works.) i want to make this by batchfile. but i dont know how to make coding... i just want to put and read test.txt for ip (want to put each ip) on batchfile. –  Aug 03 '16 at 04:22
  • `for /f "delims=" %%A in (c:\somefolder\file.ext) do Echo %%A` –  Aug 03 '16 at 04:53
  • it works on command "psexec \\ip -u domain\administrator -p password cmd wmic /output:\\serverip\%userprofile%.txt product get name,vendor" but i made batch file like that "for /f "delims=" %%A in (C:\test\test.txt) do psexec \\%%A -u domain\administrator -p password cmd wmic /output:\\serverip\%userprofile%.txt product get name,vendor" it doesn't work. error message: can not find c:\test\test.txt even there is . –  Aug 04 '16 at 01:22