Solved

Find logon server of remote host

Posted on 2011-09-28
3
3,457 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 500 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

Do email signature updates give you a headache?

Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

OfficeMate Freezes on login or does not load after login credentials are input.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now