|
 |
|
 |
 |
|
 |
 |
 |
 |
|
 |
 |
|
| IMPORTANT: PowerShellCommunity.org is moving! - Wednesday, August 15, 2012PowerShellCommunity.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 |
|
|
|
|
Script Returns HostName,PingStatus,IP,FQDN, Logged on User
Last Post 05 Jan 2013 04:22 PM by juangans. 8 Replies.
|
Sort:
|
|
Prev Next |
You are not authorized to post a reply. |
|
| Author |
Messages |
 |
dot45
 New Member Posts:2

 |
| 03 Mar 2011 10:04 AM |
|
"LN,HostName,PingStatus,IP,FQDN, Logged on User" # Loop through each argument foreach ($item in $args) { if ((!($item.Contains("SHOW=")) -AND (!($item.toupper() -eq "-Q")))) { # # if argument is a filename, process the contents of the file, ignoring any comment lines # if (test-path($item)) { if (!($qMode)) {[string]::Format("##`n## Processing contents of file: '{0}'`n##",$item)} foreach ($hostname in get-content $item) { $hostname = $hostname.trim() if (($hostname -notlike "#*") -and ($hostname -notlike "")) { $recCount += 1 $d1 = DoPing($hostname) if ($d1 -like "OK*") { $tmp = Get-WmiObject win32_process | where {$_.name -eq "explorer.exe"} $user = [string]::Format("{1}",$item,$tmp.getowner().user) }
if (($paramSHOW -eq "ALL") -or (($paramSHOW -eq "FAIL") -and ($d1 -like "FAIL*")) -or (($paramSHOW -eq "SUCCESS") -and ($d1 -like "OK*"))) { [string]::Format($user,"{3},{0},{1}{2}", $hostname,$d1,"",$recCount) } }
Attached is my full script and the unmodified version of it. I am modifying a script that i found on the net, to add the currently logged on user to the list of returned values. I know i borked up something, but this is one of my first attempts at powershell.
|
getuser.ps1
getuser_unmodified.ps1
|
|
|
|
dot45
 New Member Posts:2

 |
| 04 Mar 2011 05:56 AM |
|
I was able to get it working, attached is a function copy of the script. Comments are welcome. |
001_getuser_working.ps1
|
|
|
|
wandybrad
 New Member Posts:3

 |
| 08 Apr 2012 10:54 PM |
|
Wonderful blog! I certainly adore how it is straightforward on my eye balls as well as the particulars are properly written.I bookmarked your site! Academic writing help |
|
|
|
|
lisajhon20
 New Member Posts:2

 |
| 28 May 2012 02:58 AM |
|
Thanks for sharing this tip. But i would only want to remove the register link only and not the "read more". It would be nice if you could give another tip or article regarding it. Thanks a lot! Custom Home Builder in Austin Texas |
|
|
|
|
tonyjames176
 New Member Posts:2

 |
| 10 Oct 2012 06:44 AM |
|
I am totally agree with your opinion.this blog post is very encouraging to people who want to know these topics. literature review research paper |
|
|
|
|
nitin khare
 New Member Posts:1

 |
| 07 Nov 2012 04:41 PM |
|
Hi, this is my first visit to your blog! Our group of volunteers and start a new initiative in a coHi, this is my first visit to your blog! research paper writing |
|
|
|
|
sam
 New Member Posts:1

 |
| 02 Dec 2012 01:12 AM |
|
Very creative, i even can’t believe it is true. The author must be very love life. As work from the picture out. Thank you so much for sharing! I can’t wait to take a peek, love your blog and style boats for sale |
|
|
|
|
melissasmith
 New Member Posts:1

 |
| 07 Dec 2012 03:42 AM |
|
Admittedly, the look before this is channeling Nike Free Run Sale the same Penny Lane
vibe. You know, Penny Lane the ultimate Band-Aid (aka Groupie) from Almost
Famous? Love the Cheap Nike Free
hippie top over a pair of leggings with chunky boots. We're pretty happy that
the whole shorts-with-tights trend is still around. It's definitely Womens Nike
Free Run+ 3 the best way to make summer style feel fall fresh. Yes, we're
talking about Sandy from Womens
Nike Free Run 4.0 Grease. When her black-clad self goes country, she throws
on a denim vest, cowboy boots, and statement earrings. Sometimes keeping things
simple is the best way to let certain accessories Mens Nike
Free Run 4.0 shine. This has a romantic country vibe with the limited color
palette of high fashion style. |
|
|
|
|
juangans
 New Member Posts:1

 |
| 05 Jan 2013 04:22 PM |
|
Thanks a lot for sharing this. I have never thought that surfing online can be so much beneficial and entertained in a good shape. I feel really happy and grateful for providing me with such priceless sound track. All are good here simply best. I want such article again and again grosir jilbab murah |
|
|
|
|
| You are not authorized to post a reply. |
|
Active Forums 4.3
|
|
 |
 |
|
 |
 |
Many thanks to our original sponsors: Quest Software • SAPIEN Technologies • Compellent • Microsoft
|
 |
|
|