could you help me with, i'm trying to get the computer name and the output from this command below in a txt file.
for /f %1 in (user_plant.txt) do >>\brspd010\c$\users\machael1\desktop\nic.txt ((wmic /node:%i computersystem get caption | more) & (powershell -command "& {Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName %i. | Format-Table -Property IPAddress, DHCPEnabled}))
the command powershell when i run without the rest, it's works fine, but when i try to put together not work.
userplant.txt has: brspd001 brspd002 ...
My needly is: A txt file with Name of machine and IPV4,DHCP status as the same showed when i run only the powershell command. example:
Computername: BRSPD001 IP 172 ... DHCP Enabled true.
or someone like it.
could you help me?
%i
in your command, but%1
as the index to yourfor
loop - is this a typo, and your intent to use%i
? Also, doesuser_plant.txt
contain the list of computers you want this for? Please edit your question to include some sample input and output. - Jeff Zeitlin