Mark Minasi's Reader Forum
Mark Minasi's Reader Forum
Home | Profile | Register | Active Topics | Active Polls | Members | Search | FAQ | Minasi Forum RSS Feed
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 HALP! Questions on Windows and Windows Server
 PowerShell
 Domain Controller PowerShell Prompt
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JSCLMEDAVE
Administrator

USA
6116 Posts
Status: online

Posted - 11/15/2011 :  10:03:45 AM  Show Profile  Visit JSCLMEDAVE's Homepage  Click to see JSCLMEDAVE's MSN Messenger address  Reply with Quote
Jeffery showed me this cool function the other day.
http://jdhitsolutions.com/blog/2011/11/domain-controller-powershell-prompt/

"The other day I passed on a tweet I came across about creating a PowerShell prompt that displayed the domain controller that authenticated you. The original post was in a NetApp forum. Later I realized what was posted was something specific to NetApp’s PowerShell Toolkit. But you can use the same idea in a regular PowerShell session using the %LOGONSERVER% system environmental variable. "


function prompt {

#check and see if logon server is the same as the computername
if ( $env:logonserver -ne "\\$env:computername" ) {
#strip off the \$label = ($env:logonserver).Substring(2)
$color = "Green"
}
else {
$label = "Not Connected"
$color = "gray"
}

Write-Host ("[$label]") -ForegroundColor $color -NoNewline
Write (" PS " + (Get-Location) + "> ")
}



Tim-

“This too shall pass"

wkasdo
Administrator

Netherlands
7404 Posts
Status: offline

Posted - 11/15/2011 :  10:12:57 AM  Show Profile  Click to see wkasdo's MSN Messenger address  Reply with Quote
> the domain controller that authenticated you.

That was sort of true in the NT4 days, but no longer. It tells you the last time an RPC logon call was made to a DC. It says nothing about LDAP, Kerberos, SYSVOL, DFS, secure channels... When you have a single DC in a site, these are all the same and logonserver tells you something useful. Otherwise, ignore it.

Just so you know :-)

Make it as simple as you can, but not simpler -- Albert Einstein
Go to Top of Page

JSCLMEDAVE
Administrator

USA
6116 Posts
Status: online

Posted - 11/15/2011 :  10:16:38 AM  Show Profile  Visit JSCLMEDAVE's Homepage  Click to see JSCLMEDAVE's MSN Messenger address  Reply with Quote
quote:
Originally posted by wkasdo

> the domain controller that authenticated you.

That was sort of true in the NT4 days, but no longer. It tells you the last time an RPC logon call was made to a DC. It says nothing about LDAP, Kerberos, SYSVOL, DFS, secure channels... When you have a single DC in a site, these are all the same and logonserver tells you something useful. Otherwise, ignore it.

Just so you know :-)



As I sat here re-reading my post, I just knew someone was going to say that.

Tim-

“This too shall pass"
Go to Top of Page

wkasdo
Administrator

Netherlands
7404 Posts
Status: offline

Posted - 11/15/2011 :  10:44:22 AM  Show Profile  Click to see wkasdo's MSN Messenger address  Reply with Quote
I know that you know, but who knows who will read this...

Make it as simple as you can, but not simpler -- Albert Einstein
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Mark Minasi's Reader Forum © 2002-2011 Mark Minasi Go To Top Of Page
This page was generated in 0.08 seconds. Snitz Forums 2000