Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Reading and piping out result.

$
0
0

hi all,

(DECLAIMER I only been playing with powershell for a week now.)

I have hit a wall in trying to figure out why this is not working, any help is greatly appreciated.

what I am trying to do is read a batch of computers from a txt file and then have the computer name, model, mac and user output to a text file for review. this is what I have came up with so far. currently all that outputs is the model. Thanks

$content=Get-Content"C:\test.txt"

 

 

 

Remove-Item

 

 

"C:\result.txt"

ForEach-Object

 

 

 

{

 

 

 

$sertag = get-wmiobject -computer $content Win32_BIOS | Select SerialNumber

$Model = gwmi -computer $content Win32_ComputerSystem | select Model

#$Mac =

$user = gwmi -computer $name Win32_ComputerSystem | Format-Table @{Expression={$_.Username};Label="Current User"}

}

$Sertag , $model, $user 

 

 

| Format-Table-PropertyComputer_Name,Service_Tag,Model,Mac,User|Out-File"result.txt"


Viewing all articles
Browse latest Browse all 6937

Trending Articles