Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, February 21, 2013 9:29 PM
Hi all,
I have been racking my brain for two days now and I can't seem to find anything on the net that can point me in the right direction. First let me say I'm a novice in PowerShell so any help anyone could provide would greatly be appreciated.
On to my issue.
I have been fiddiling around with PS for 2 days trying to figure out how I can get the logonserver for a remote user and machine.
I know this line will provide my local logonserver $a = $env:logonserver by saving the info to $a
So my script
Function Get-LogonServer {
$username = Read-host "Enter Username"
write-host $username Has Authenticated to Domain Controller $env:LOGONSERVER } < I know this line is not correct as it is only reporting back the server my local account has authenticated to.
Is there away to get remote logonserver info?
I hope this makes sence once again I appreciate anypnes help
All replies (5)
Friday, February 22, 2013 4:22 PM âś…Answered | 3 votes
Another way you could look at this. Generally all user logons go to the DC that the member computer has established it's secure channel with. You can query the secure channel with NLTEST. So you can query it at the machine level instead of for each logon.
C:\Windows\System32>nltest /sc_query:yourDomain /server:userWorkstation
Flags: 30 HAS_IP HAS_TIMESERV
Trusted DC Name \yourdc.yourdomain.com
Trusted DC Connection Status Status = 0 0x0 NERR_Success
The command completed successfully
Thursday, February 21, 2013 10:16 PM
This was addressed in a whole thread here: http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/67c96f29-4e60-4e36-beeb-40674097c88a
Friday, February 22, 2013 3:45 AM
function get-logonserver {
$computer = read-host "Enterservername"
$logon=Get-WmiObject Win32_NetworkLoginProfile -ComputerName $computer | select name,logonserver | ft -AutoSize
$logon
}
Thanks Azam When you see answers please Mark as Answer if Helpful..vote as helpful.
Friday, February 22, 2013 2:46 PM
Thanks for your reply I do appreciate it. Unfortunately this solution does not work for me. The ultimate goal of this script is to provide a tool the Help desk can use to obtain said info on an adhoc need.
Thank you,
Oscar
Tuesday, October 14, 2014 3:47 PM
Thanks - this helped a lot
Dan Heim