i'm trying to get the Installation ID for a few windows 7 units. this is what i have. iv'e tried moving the brackets and that helps or makes it worse depending on where i move it.
i have a list of ip addresses and i want it to output it with the ID and IP and it does that but it just repeats the first ip address. i'm assuming its just a formatting issue but thought id ask for help.
tried moving the array around, had to fiddle with the split command to get the output how i want it. now i just need to go ip by ip address and output like shown.
# Read all the computers from the file
$computers = Get-Content "C:\Users\Administrator\Desktop\DavidsScripts\Test\input.txt"
# Perform an operation for each row in the file
$result = @(
foreach ($strComputer in $computers) {
cscript C:\Windows\System32\slmgr.vbs $strComputer username password /dti
}
)
$result.split(":")[3, 4, 6] | Out-File -FilePath .\output.txt -Append
no errors just not going ip by ip address
changed username and password for obvious security reasons