powershell

I have a list in the text file by a computer name (400 names)
I need to get all IP from this list and the last logon time and location if it is possible using a powershell
LidkaAsked:
Who is Participating?
 
SubsunConnect With a Mentor Commented:
Try this..
The script make use of Quest AD Cmdlets
Ref : http://www.quest.com/powershell/activeroles-server.aspx

C:\server.txt is the input file with server names..

GC C:\server.txt | % {
$Ping = Test-Connection $_ -ErrorAction SilentlyContinue
If ($Ping){
Get-QADComputer $ping[0].Address -IncludedProperties lastLogonTimestamp,Location | 
Select @{N="Server";e={$ping[0].Address}},@{N="IP";e={$ping[0].IPV4Address.IPAddressToString}},lastLogonTimestamp,Location
 }
Else{
 Write-Host "$_ not reachable"
 $_ | Select @{N="Server";e={$_}},IP,lastLogonTimestamp,Location
 }
} | Export-Csv C:\report.csv -NoTypeInformation

Open in new window

0
 
LidkaAuthor Commented:
I have a list of computers in a text file. How can I get the lastlogontimestamp on them and expoert them to csv file
0
 
SubsunCommented:
Did you try my script?
0
SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

 
LidkaAuthor Commented:
yes thank you it works great, but it did not give me anything except the dead machines list
0
 
SubsunCommented:
Do you have anything in result file C:\report.csv?
0
 
LidkaAuthor Commented:
only name of servers nothing else
0
 
SubsunCommented:
What if you run
Get-QADComputer Servername -IncludedProperties lastLogonTimestamp,Location
replace Servername  with the actual server name in your list..
0
All Courses

From novice to tech pro — start learning today.