The easiest way to calculate the licensing is to do a test installation of migRaven.24/7.
Licensing is based on the following values:
- all user accounts, logged in in the last 90 days,
- minus all accounts that start with “healthmailbox” (Exchange Accounts)
- minus all accounts that do not have a first name and surname in the AD object (e.g. NAC accounts for computers)
Can be read out the correct number after installing migRaven.24/7 on the licensing page:
Determination of the accounts to be licensed via Powershell script:
param([Parameter(Mandatory=$False,HelpMessage="Um das Zählen auf eine OU zu beschränken, Geben Sie den Namen der OU ein: (im Format: OU=meine OU,DN=X,DN=Y)")]$SearchBase)
cls
$DefaultNamingContext=([ADSI]"LDAP://RootDSE").defaultNamingContext
if ([string]::IsNullOrWhiteSpace($SearchBase)) {
#write-host "Searchbase-Parameter nicht festgelegt, Verwendung des Standardnamenskontexts $DefaultNamingContext (Oder Übergeben Sie das Argument -searchBase, um eins im vorhand zu setzen)"
if ((read-host "Wollen Sie das Zählen auf eine OU beschränken?") -match "^y$|^j$|Ja|Yes") {
$searchBase=read-host "Geben Sie den Namen der OU ein: (im Format: OU=meine OU..,$(([ADSI]"LDAP://RootDSE").rootDomainNamingContext)"
} else {
$SearchBase=$DefaultNamingContext.toString()
write-host "Rückfall auf Standardwert $SearchBase"
}
}
if ([string]::IsNullOrWhiteSpace($SearchBase) -or (-not (($searchBase -eq ([ADSI]"LDAP://RootDSE").rootDomainNamingContext.toString() ) -or ($searchBase -eq $DefaultNamingContext.toString()) -or ([ADSI]::Exists($searchBase)) ))){
$SearchBase=$DefaultNamingContext.toString()
write-warning "Ungültiger Suchbasiswert, Rückfall auf Standardwert $SearchBase"
}
$domain_user_all = (Get-ADUser -searchbase $SearchBase -Filter *).Count
$domain_user_active = (Get-ADUser -searchbase $SearchBase -LDAPFilter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))").count
$domain_user_login_90days = (Get-ADUser -searchbase $SearchBase -Filter *).Count - (Get-ADUser -searchbase $SearchBase -Filter * -Properties LastLogonTimeStamp | select @{Name="LastLogonTimeStamp";Expression={([datetime]::FromFileTime($_.LastLogonTimeStamp))}} | where {$_.LastLogonTimeStamp -lt (Get-Date).AddDays(-90)}).Count
$domain_user_HealthMailbox = (Get-ADUser -searchbase $SearchBase -Filter "name -like 'HealthMailbox*' ").count
Write-Host "Domaincontrollern werden abgefragt . . ."
Write-Host ""
Get-ADDomainController -Filter * |Select Name |% { $_.Name+": "+ ((Get-ADUser -searchbase $SearchBase -Server $_.Name -Filter *).Count - (Get-ADUser -searchbase $SearchBase -Server $_.Name -Filter * -Properties LastLogonTimeStamp | select @{Name="LastLogonTimeStamp";Expression={([datetime]::FromFileTime($_.LastLogonTimeStamp))}} | where {$_.LastLogonTimeStamp -lt (Get-Date).AddDays(-90)}).Count) }
Write-Host ""
Write-Host "Anzahl aller Accounts unter $searchBase : " $domain_user_all
Write-Host ""
Write-Host "Anzahl aller aktiven Accounts unter $searchBase : " $domain_user_active
Write-Host ""
Write-Host "Anzahl der Benutzeraccounts unter $searchBase, die sich in den letzten 90 Tage angemeldet haben: " $domain_user_login_90days
Write-Host ""
Write-Host "aktive HealthMailboxen: " $domain_user_HealthMailbox
Write-Host ""
Write-Host "Anzahl der Benutzeraccounts unter $searchBase (ohne aktive HealthMailboxen), die sich in den letzten 90 Tage angemeldet haben: " ($domain_user_login_90days - $domain_user_HealthMailbox)
Write-Host "------------------------------------------------------------------------------------------------------------------"
Write-Host "Anzahl der berechneten Konten: " ($domain_user_login_90days - $domain_user_HealthMailbox) -ForegroundColor yellow
Write-Host ""
Get-ADDomainController -Filter * |Select Name |% { (Get-ADUser -searchbase $SearchBase -Server $_.Name -Filter * -Properties LastLogonTimeStamp | select samAccountName,@{Name="LastLogonTimeStamp";Expression={([datetime]::FromFileTime($_.LastLogonTimeStamp))}} | where {$_.LastLogonTimeStamp -gt (Get-Date).AddDays(-90)}) | Out-File "Benutzerdatei $($_.Name).txt" ; write-Host "Benutzerdatei $($_.Name).txt ist erstellt (internen Gebrauch des Kunden)" }
Write-Host ""