Solved

Find logon server of remote host

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
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 …
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

820 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