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

incorrect indented output

$
0
0

Hi,

I am trying to run the below script which should give me active workstations. Everything is working fine but the actual problem lies in the format of output. 

I need to get values of five attributes of workstations as follows:

"Name","OperatingSystem","location","co","Created"

Which in turn gives me output as follows:

 

"MMANWSL2792","Windows 7 Enterprise","Mänttä

 

 

","Finland","4/24/2013 9:09:08 AM"

"MMANWSL2819","Windows 7 Enterprise","Mänttä

 

 

","Finland","4/24/2013 9:09:08 AM"

"MRMAWSL5004","Windows 7 Enterprise","Rauma

 

 

 

","Finland","4/24/2013 9:15:58 AM"

"MRMAWSL5005","Windows 7 Enterprise","Rauma

 

 

 

","Finland","4/24/2013 9:15:58 AM"

"MRMAWSL5010","Windows 7 Enterprise","Rauma

 

 

 

","Finland","4/24/2013 9:15:58 AM"

"MRMAWSL5016","Windows 7 Enterprise","Rauma

 

 

 

","Finland","4/24/2013 9:15:59 AM"

 

so each time when its trying to print  the value of "location" attribute , the next values comes after 2-3 lines.

Is there anyway to get this output in correct format without any unnecessary line breaks after each location attribute? Below given is the script i am using to get this output.

$ADComputerProperties = @(`

"Name",

"Operatingsystem",

"location",

"co",

"Created"

)

 

$SelectADComputerProperties = @(`

"Name",

"OperatingSystem",

"location",

"co",

"Created"

)

 

Get-ADComputer -Filter * -Properties $ADComputerProperties |Where {$_.DistinguishedName -like "*OU=Laptops*"}| `

Select $SelectADComputerProperties| export-csv "C:\Users\admbharti.gupta\LaptopsCount.txt" -NoTypeInformation -Encoding Unicode


Viewing all articles
Browse latest Browse all 6937

Trending Articles