0

I found a script to check out how many users or computers are authenticated in a given Domain Controller.

The Script can be found here: https://gallery.technet.microsoft.com/scriptcenter/Check-out-how-many-users-05a8b499#content

Running this under a Server 2008 R2 Domain Controller gives two Errors:

  • $AccountName = ($RegexAccountName.match($_.message).value).Split(":")[1].Trim <<<< ()
    • CategoryInfo : InvalidOperation: (Trim:String) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
  • $DomainName = ($RegexDomainName.match($_.message).value).Split(":")[1].Trim <<<< ()
    • CategoryInfo : InvalidOperation: (Trim:String) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

Any thoughts on how to run this under Server 2008 R2?

2 Answers 2

1

I don't think this has anything to do with the fact of it being Windows Server 2008 R2.

My guess is that you're running non-english Windows Server. Adjust the following lines to match your language:

[regex]$RegexAccountName = "Account Name:\s+\w+.*" [regex]$RegexDomainName = "Account Domain:\s+\w+.*" 

After doing that on my test machine, it worked fine.

I would suggest you find one of the events the script is running for to find the exact wording used in your language.

1
  • As an aside, this is exactly why you should not try to parse natural-language output, especially not in Windows Event Log, which may be in a non-English language. Windows Events are nice and structured with an XML form that can be used to extract this kind of info. (But this is out of scope, since you didn't write this script, you're just trying to use it.) Commented Jun 1, 2016 at 9:52
0

If your primarily after "how many" and not which users or how often, you can get those numbers from the Server object in Perfmon. It has values for "Logons Total" and "Logons/sec"

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.