Solved

powershell

Posted on 2013-01-23
7
253 Views
Last Modified: 2013-01-25
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
0
Comment
Question by:Lidka
  • 4
  • 3
7 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 38810544
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
 

Author Comment

by:Lidka
ID: 38811981
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
 
LVL 40

Expert Comment

by:Subsun
ID: 38811996
Did you try my script?
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:Lidka
ID: 38814269
yes thank you it works great, but it did not give me anything except the dead machines list
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38814289
Do you have anything in result file C:\report.csv?
0
 

Author Comment

by:Lidka
ID: 38814764
only name of servers nothing else
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38814788
What if you run
Get-QADComputer Servername -IncludedProperties lastLogonTimestamp,Location
replace Servername  with the actual server name in your list..
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This article will help you understand what HashTables are and how to use them in PowerShell.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question