Solved

powershell

Posted on 2013-01-23
7
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This article will help you understand what HashTables are and how to use them in PowerShell.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦

737 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