#Powershell and NSPI

So been having some fun with #BlackBerry and DCs only having the default NSPI setting of 50.

Wrote this to dump the NSPI registry key for all DCs

$currentdom = [System.DirectoryServices.ActiveDirectory.Domain]::getcurrentdomain()
$DCs = @(); $currentdom.DomainControllers | Sort Name | ForEach{$DCs += $_.name}
ForEach($item in $DCs){
  $nspi=0
  $srv = $item
  Write-Host $srv –NoNewLine
  $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(‘LocalMachine’, $srv)
  $regKey= $reg.OpenSubKey(“SYSTEM\\CurrentControlSet\\Services\\NTDS\\Parameters” )
  $nspi = $regkey.GetValue(“NSPI max sessions per user”)
  Write-Host “`tNSPI max sessions per user: ” $nspi
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.