The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

431999 (7) [Avatar] Offline
#1
I've checked various resources at Manning to easily copy the .Net code for testing the AD schema version (pg 359 Listing B.2) but all are bitmaps.

Can you make the code available for easy copy please?
Susan Harkins (424) [Avatar] Offline
#2
I'll check this out and get back to you.

Susan Harkins
Errata Editor
431999 (7) [Avatar] Offline
#3
Any luck finding?
Susan Harkins (424) [Avatar] Offline
#4
From the author -- hope this is helpful.

Listing B.1
Get-ADObject -Filter {objectclass -eq 'user'} ` -SearchBase "OU=ADMLusers,ou=ADMLunches,DC=manticore,dc=org" | foreach {
Set-ADObject -Identity $($_.distinguishedname) `
-ProtectedFromAccidentalDeletion:$false

Move-ADObject -Identity $($_.distinguishedname) `
-TargetPath "OU=ADMLnewUsers,ou=ADMLunches,DC=manticore,dc=org" `
-verbose

}

Get-ADObject -Filter {objectclass -eq 'user'} ` -SearchBase "OU=ADMLnewUsers,ou=ADMLunches,DC=manticore,dc=org" | Set-ADObject -ProtectedFromAccidentalDeletion:$true

----------------------------------------------------------------------------
------------------------------------------------------------

Listing B.2
##
## NOTE: this list only includes production versions
## Intermediate values may indicate beta or technical preview
software
##
$sch =
[System.DirectoryServices.ActiveDirectory.ActiveDirectorySchema]::GetCurrent
Schema()
$de = $sch.GetDirectoryEntry()
switch ($de.ObjectVersion)
{
13{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2000"
break}
30{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2003"
break}
31{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2003 R2"
break}
44{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2008"
break}
47{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2008 R2"
break}
56{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2012"
break}
69{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2012 R2"
break}
87{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2016"
break}
default{"{0,25} {1,2} " -f "Unknown Schema Version", $($de.ObjectVersion)
break}
}

----------------------------------------------------------------------------
---------------------------------------