Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Find logon server of remote host

Posted on 2011-09-28
3
Medium Priority
?
4,432 Views
Last Modified: 2012-07-16
I would like to simply find out what domain controller a remote workstation that is logged onto the network is binding to.  I believe this would be the %logon server% variable.  I'd prefer to use PowerShell to do this...and it'd be nice to use a text file of workstations as a reference point.  VB script would also do.  I'm a novice at these scripting methods.

Thanks!
0
Comment
Question by:patriots
  • 3
3 Comments
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 36719444
Please try to use this syntax (you need to have enabled WinRM on remote host)

 
invoke-command -computername <ComputerName -credential DomainName\AdminUser -scriptblock {dir $env:logonserver}

Open in new window


and for text file (put there computer names, one by line)

 
get-content c:\comps.txt | %{invoke-command -computername $_ -credential DomainName\AdminUser -scriptblock {dir $env:logonserver} }

Open in new window


Regards,
Krzysztof
0
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 36813144
OK, doesn't work. Forget about this syntax :/

Wait for other experts. Thanks

Krzysztof
0
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 2000 total points
ID: 36897281
I'm reading a book about Exchange 2010 and I found some commands within EMS to connect to remote Exchange server. There was used New-PSSession cmdlet. I read some help for that Get-Help New-PSSession -full and I found how to do that :)

Check that for one PC first (remember, you need to enable remote management)

 
$session = New-PSSession -ComputerName <ComputerName> -Authentication Kerberos
Invoke-Command -Session $session -ScriptBlock { dir env:logonserver }
Remove-PSSession $session

Open in new window


save this code as .ps1 file and run to check results :]

Krzysztof
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Screencast - Getting to Know the Pipeline

926 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