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

Have IP addresses need to find ad Name and AD Description

$
0
0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Hello,

I'm trying to get the AD name and Description into a CSV file.

I can put the WMI name into a txt file but it's bringing in the column name for every computer name

name

servername

name

servername

I'm assuming I could nest these 2 statement together somehow !!!

----------------------------

Clear-Host

get-content

 

 

 

c:\temp\serverips.txt |ForEach-Object

{

Get-WmiObject

 

 

 

Win32_Computersystem-ComputerName$_| Select-Objectname |Out-File"C:\temp\hostnames.txt"-Encodinguft-8

}

Get-Content

 

 

 

c:\temp\hostnames.txt |ForEach-Object {$_

Get-ADComputer

 

 

 

$_ -property description | select Name,Description| Export-Csv-Append"C:\temp\hostnames.csv"-encodinguft-8

}

Thank in advance


Viewing all articles
Browse latest Browse all 6937

Latest Images

Trending Articles



Latest Images