Solved

Find logon server of remote host

Posted on 2011-09-28
3
4,106 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

636 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