Function Name: Get-LoggedIn

Function Name: Get-LoggedIn

 

# ——————————————-
# Function Name: Get-LoggedIn
# Return the current logged-in user of a remote machine.
# ——————————————-
function Get-LoggedIn {
[CmdletBinding()]
param (
[Parameter(Mandatory=$True)]
[string[]]$computername
)

foreach ($pc in $computername){
$logged_in = (gwmi win32_computersystem -COMPUTER $pc).username
$name = $logged_in.split(“\”)[1]
“{0}: {1}” -f $pc,$name
}
}

20 Comments

  1. I really appreciate this post. I have been looking everywhere for this! Thank goodness I found it on Bing. You have made my day! Thx again

  2. You can certainly see your enthusiasm within the work you write. The arena hopes for more passionate writers such as you who are not afraid to say how they believe. At all times go after your heart. “If the grass is greener in the other fellow’s yard – let him worry about cutting it.” by Fred Allen.

  3. Definitely consider that which you stated. Your favorite justification appeared to be on the internet the simplest thing to take note of. I say to you, I definitely get irked even as folks consider worries that they plainly do not recognise about. You controlled to hit the nail upon the top as smartly as outlined out the whole thing with no need side-effects , folks can take a signal. Will likely be back to get more. Thanks

  4. Interesting blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog shine. Please let me know where you got your theme. Kudos

  5. Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say great blog!

  6. Hey there would you mind sharing which blog platform you’re working with? I’m looking to start my own blog soon but I’m having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely unique. P.S Sorry for getting off-topic but I had to ask!

Leave a Reply

Your email address will not be published.