header1   header
header
header : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
IMPORTANT: PowerShellCommunity.org is moving! - Wednesday, August 15, 2012

PowerShellCommunity.org is moving!  This community software, and the hardware that it sits on, are no longer serving the purposes of this community.  As a result, we have decided to move this community to a new home at PowerShell.org.  PowerShell.org is already up and running with the new community software and in its new location, so please post any new questions that you have on the forums over there instead of posting them on this site.  We've already started getting some great questions from members of the community over there so please, come on over and join us!

While we are going through this transition, this site will remain up for the short term.  New posts may no longer be created on these forums, however replies to existing posts are allowed so that users who posted questions don't have to re-post the same question on the new site.

[UPDATE 28/02/2013] New user registration has been disabled and forums have now been switched to read-only, including for existing posts since all threads that were started should now be completed. If you have a question about content on this site or about PowerShell in general, head over to PowerShell.org and ask it there where there are people actively using the site and answering questions.

If you have any questions, please let us know on the PowerShell.org site.

Thank you,

Kirk "Poshoholic" Munro

 
Inventory accuracy
Last Post 21 May 2012 10:23 AM by Sreid. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SreidUser is Offline
New Member
New Member
Posts:3
Avatar

--
03 May 2012 08:29 AM
    Hey Guys,

    Im new here and I am new to powershell.. I know there are many way's to skin a cat in PS so I am seeking advice on a simple task that I will need to perform often.

    Here is my feeble start on this,  I thought about using a wmi class to do this but it seemed to much for what I want to do. My goal is that I take this list exported from LanDesk and then I ping it and pipe the output to a file that I can refer to. The point of this is to align my AD and LanDesk along with my Kaspersky servers.. there are to many machine accounts that I cant account for and one server says one thing and one says another.
    Im not asking for anyone to write a script for me I just need a little guidance..

    $ip = import-csv 'c:\temp\ip.csv'

    $result = export-csv 'c:\temp\result.csv'

    "I know the syntax is wrong this is essentially what I want to do."

    test-connection ForEach-Object{$ip | Select-Object -property devicename} | format-wide 4 | export-csv $result
    EBGreenUser is Offline
    Veteran Member
    Veteran Member
    Posts:1276
    Avatar

    --
    04 May 2012 07:44 AM
    I'm sorry, but I'm having a hard time understanding exactly what you are asking. you want to take a list of IPs and from that generate a list of device names?
    "Look Ma...no strings!"
    SreidUser is Offline
    New Member
    New Member
    Posts:3
    Avatar

    --
    04 May 2012 09:23 AM

    Sorry Id like to take a list that includes names and Ip addresses and verifiy that they in fact do exist on the network. Id like to use the ping method if possible and I will basically scan the list for a few weeks to determine if the devices are still around.

    Thanks for the help -Steve

    EBGreenUser is Offline
    Veteran Member
    Veteran Member
    Posts:1276
    Avatar

    --
    04 May 2012 10:40 AM
    Ok, so this is untested, but it would hopefully give you something to work with:

    $ipList = Import-CSV 'c:\temp\ip.csv'
    $result = @()
    foreach($ip in $ipList){
    If(Test-Connection $ip -count 1 -quiet){
    $name = [System.Net.DNS]::GetHostByAddress($ip)
    $temp = New-Object -Type PSCustomObject -Property @{ip = $ip; name = $name}
    $result += $temp
    }
    $temp | Export-CSV c:\temp\result.csv
    "Look Ma...no strings!"
    SreidUser is Offline
    New Member
    New Member
    Posts:3
    Avatar

    --
    21 May 2012 10:23 AM
    Thanks Ill give that a try!
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Many thanks to our original sponsors: Quest Software • SAPIEN Technologies • Compellent • Microsoft footer
    footer   footer