I want to run a powershell or bat file to get info about each machine. The script will get system info and write it to a text file on the network. The intent is to find the specific version of Windows on the machine along with the hostname of the machine and write it to a place where it can be easily accessed on the network.
Here are the commands I have tried as PS and as bat and as command line within DC and all of them fail. I can run them on the local PC thru CMD or within PS without using DC and they produce the desired result.
c:\windows\system32\systeminfo | Findstr /i "OS" >z:\winver.txt
OR
c:\windows\system32\systeminfo | Findstr /i "OS" >\\server1\users\%username%\winver.txt
edit ************ I could also run the following 2 line PS script and get desired results but still need help getting it to run *************
get-itemproperty -path "hklm:\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" | select-object ComputerName -ExpandProperty ComputerName > z:\winver.txt
get-itemproperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | select-object ReleaseID -ExpandProperty ReleaseID >> z:\winver.txt
Please help me understand what I need to do to run these via DC and get the desired output.
Thanks.
Todd