Search is not available for this dataset
filename
stringlengths
5
114
module_name
stringlengths
8
67
content
stringlengths
0
282M
Get-ADObjectOwner.ps1
ADObjectOwner-1.0.1.1
#Requires -Modules ActiveDirectory <#PSScriptInfo .DESCRIPTION Gets the ACL of an ADObject, and returns the Object Owner .VERSION 1.0.1.1 .GUID 266e43f6-5117-47cb-b7d0-9321fc3739ce .AUTHOR Tom Stryhn .COMPANYNAME Tom Stryhn .COPYRIGHT 2021 (c) Tom Stryhn .LICENSEURI https://github.com/tomstryhn/ADObjectOwner/blob/main/LICENSE .PROJECTURI https://github.com/tomstryhn/ADObjectOwner #> function Get-ADObjectOwner { <# .SYNOPSIS Gets Object Owner, from the Access Control List on an ADObject. .DESCRIPTION Gets the ACL of an ADObject, and returns the Object Owner .PARAMETER DistinguishedName The DistinguishedName of the Object you want to get the Owner of. .EXAMPLE PS C:\> Get-ADObjectOwner -DistinguishedName 'OU=TestOU,DC=Dev,DC=local' DistinguishedName Owner ----------------- ----- OU=TestOU,DC=Dev,DC=local Dev\Domain Admins .NOTES FUNCTION: Set-ADObjectOwner AUTHOR: Tom Stryhn GITHUB: https://github.com/tomstryhn/ .INPUTS [string] .OUTPUTS [PSCustomObject] .LINK Set-ADObjectOwner #> [CmdletBinding()] param ( # DistinguishedName [Parameter( ValueFromPipelineByPropertyName = $true, Mandatory = $true )] [string] $DistinguishedName ) process { try { $objectACL = Get-Acl -Path ("ActiveDirectory:://RootDSE/" + $DistinguishedName) -ErrorAction Stop $output = [PSCustomObject]@{ DistinguishedName = $DistinguishedName Owner = $objectACL.Owner } $output } catch { Write-Error -Message "Error getting ACL: [$DistinguishedName]" } } }
ADObjectOwner.psd1
ADObjectOwner-1.0.1.1
@{ # Script module or binary module file associated with this manifest. RootModule = 'ADObjectOwner.psm1' # Version number of this module. ModuleVersion = '1.0.1.1' # ID used to uniquely identify this module GUID = 'fce00063-4fe4-433c-887d-8692586e13d2' # Author of this module Author = 'Tom Stryhn' # Company or vendor of this module CompanyName = 'Tom Stryhn' # Copyright statement for this module Copyright = 'Copyright (c) 2021 Tom Stryhn' # Description of the functionality provided by this module. Description = 'Powershell Module to help manage ADObject ownership in Active Directory' # Modules that must be imported into the global environment prior to importing this module RequiredModules = @('ActiveDirectory') # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = @('Get-ADObjectOwner', 'Set-ADObjectOwner', 'Get-SecurityPrincipalNTAccount') # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() # Variables to export from this module VariablesToExport = '*' # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. AliasesToExport = @() # List of all modules packaged with this module # ModuleList = @() # List of all files packaged with this module FileList = @('ADObjectOwner.psd1', 'ADObjectOwner.psm1', 'LICENSE', '.\src\ps1\Get-ADObjectOwner.ps1', '.\src\ps1\Get-SecurityPrincipalNTAccount.ps1', '.\src\ps1\Set-ADObjectOwner.ps1') # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. Tags = @('PSEdition_Desktop', 'Active-Directory', 'ACL') # A URL to the license for this module. LicenseUri = 'https://opensource.org/licenses/MIT' # A URL to the main website for this project. ProjectUri = 'https://github.com/tomstryhn/ADObjectOwner' # A URL to an icon representing this module. # IconUri = '' # ReleaseNotes of this module # ReleaseNotes = '' ExternalModuleDependencies = @("ActiveDirectory") } # End of PSData hashtable } # End of PrivateData hashtable }
ADPCmdlets.psd1
ADPCmdlets-23.0.8839.1
@{ GUID = '2004941f-f818-4744-b800-14a244343b6d' Author = 'CData Software, Inc.' CompanyName = 'CData Software, Inc.' Copyright = 'Copyright (c) 2024 CData Software, Inc. - All rights reserved.' ModuleVersion = '23.0.8839.1' Description = 'CData Cmdlets for ADP' PowerShellVersion = '3.0' CLRVersion = '4.0' CmdletsToExport = '*' RequiredModules = @() ModuleToProcess = 'ADPCmdlets.psm1' ScriptsToProcess = @() TypesToProcess = @() PrivateData = @{ PSData = @{ Tags = @("CData", "Cmdlets", "ADP") LicenseUri = "http://www.cdata.com/company/legal/terms.aspx" ProjectUri = "http://www.cdata.com/powershell/" IconUri = "http://www.cdata.com/powershell/img/psgallery_icon.png" SKU = "JDMJA" } } }
ADPCmdlets.psm1
ADPCmdlets-23.0.8839.1
Set-StrictMode -Version Latest $PSModule = $ExecutionContext.SessionState.Module $PSModuleRoot = $PSModule.ModuleBase $binaryModuleManifestFile = 'ADPCmdlets.psd1' $binaryModuleRootPath = $PSModuleRoot if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')) { $binaryModuleRootPath = Join-Path -Path $PSModuleRoot -ChildPath 'lib/netstandard2.1' } else { $binaryModuleRootPath = Join-Path -Path $PSModuleRoot -ChildPath 'lib/net40' } $binaryModulePath = Join-Path -Path $binaryModuleRootPath -ChildPath $binaryModuleManifestFile $binaryModule = Import-Module -Name $binaryModulePath -PassThru $PSModule.OnRemove = { Remove-Module -ModuleInfo $binaryModule } # SIG # Begin signature block # MIIt2wYJKoZIhvcNAQcCoIItzDCCLcgCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAeaofVSO8Ff9Iv # U23HmJIfIhR5NFlehz0eIcbksq+DYKCCEzcwggbuMIIE1qADAgECAhAFHswF2GND # 2Gbwxke9mqRRMA0GCSqGSIb3DQEBCwUAMGkxCzAJBgNVBAYTAlVTMRcwFQYDVQQK # Ew5EaWdpQ2VydCwgSW5jLjFBMD8GA1UEAxM4RGlnaUNlcnQgVHJ1c3RlZCBHNCBD # b2RlIFNpZ25pbmcgUlNBNDA5NiBTSEEzODQgMjAyMSBDQTEwHhcNMj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g0IxgseFgQ7tLm1yluEv7MD84krKl+DVRtdNxFcDsXImMkRb # rEDZghuyOWa0M6SN2OcGsJgWeXJXlBiBMf8qhtMiAWWm29zDIeNdE1JGJ6XLX/BN # TExymyIoVLC/78qHQCrLn3ugbwuB6Qni1YfsvS4YJOgSQxutUnDLUDRa+ef6lELi # e66KwXeLAUp4qbIXn57gJu/SyNISvMjp2HiP30h/LXAK6Rc3fJoovYouLqQdh2/p # Jxl/WJV7D2yQlBNPJ7Mkd7+FrsAr6J9WJRR+b49HPH8gEFPB2tqBj1rbTp2OC4pk # 54pGZn1ER4r26minn75SJYFqHrQUzQv0JLtZPyvR2d5yJkLw432fTpq1NnzeCw6w # sjwGBAHYNBYJ0FqEbrcmc4/c6MolhOb/UHaLMrgvrNmmWMLipQMi6cTreVHpfdUd # P9d137hfO773X4Uenlr1KJpAIYL/BrgNoYvHUFPLDCEHTJ4qdLVxJtNSefArpeu4 # UIcdF1x2AmNlQTl6ZXHJnqnI/p/zs+tEE+QSN9ksWSPCHC6EVRpCq/iFlG5pGdlT # kzeXswlYErZVeD1psEP+DnoFiqHMZl4VvE3oXpesyQ== # SIG # End signature block
Get-ADPRegion.ps1
ADPFunctions-2403.2.0
function Get-ADPRegion { <# .SYNOPSIS Get a user's Region from ADP .DESCRIPTION Get a user's Region from ADP .PARAMETER ADPObject Object which holds the Region .EXAMPLE Input Object: ADP Object Return Object: {preferredLanguage, locale} .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localCountry = ( $ADPObject | Get-ADPLocation ).country $localRegion = [PSCustomObject]@{ preferredLanguage = $null; locale = $null; } switch ($localCountry) { "US" { $localRegion.preferredLanguage = "en-US" $localRegion.locale = "en_US" break } "IN" { $localRegion.preferredLanguage = "en-IN" $localRegion.locale = "en_IN" break } "DE" { $localRegion.preferredLanguage = "de-DE" $localRegion.locale = "de_DE" break } default { $localRegion.preferredLanguage = $localCountry $localRegion.locale = $localCountry } } $localRegion.preferredLanguage = ( $localRegion.preferredLanguage | Get-ValidADPReturn ) $localRegion.locale = ( $localRegion.locale | Get-ValidADPReturn ) return $localRegion }
Get-ADPMobilePhone.ps1
ADPFunctions-2403.2.0
function Get-ADPMobilePhone { <# .SYNOPSIS Get a user's Mobile Phone from ADP .DESCRIPTION Get a user's Mobile Phone from ADP .PARAMETER ADPObject Object which holds the Mobile Phone .EXAMPLE Input Object: ADP Object Return String: <Mobile Phone> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localCountry = ( $ADPObject | Get-ADPLocation ).country $areaCode = $null $dialNumber = $null $finishedNumber = $null if ($ADPObject.person.communication.PSobject.Properties.Name -contains "landlines") { $areaCode = $ADPObject.person.communication.landlines.areaDialing $dialNumber = $ADPObject.person.communication.landlines.dialNumber } if ($ADPObject.person.communication.PSobject.Properties.Name -contains "mobiles") { $areaCode = $ADPObject.person.communication.mobiles.areaDialing $dialNumber = $ADPObject.person.communication.mobiles.dialNumber } if ($areaCode) { $areaCode = $areaCode.Trim() } if ($dialNumber) { $dialNumber = $dialNumber.Trim() } if ($areaCode -and $dialNumber) { switch ($localCountry) { "DE" { $finishedNumber = "$areaCode.$dialNumber"; break } "IN" { $finishedNumber = "$areaCode.$dialNumber"; break } default { $finishedNumber = "$areaCode$dialNumber".Insert(3, '.').Insert(7, '.') } } } return ( $finishedNumber | Get-ValidADPReturn ) }
Get-ADPFirstName.ps1
ADPFunctions-2403.2.0
function Get-ADPFirstName { <# .SYNOPSIS Get a user's First Name from ADP .DESCRIPTION Get a user's First Name from ADP .PARAMETER ADPObject Object which holds the First Name .EXAMPLE Input Object: ADP Object Return String: <First Name> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localFirstName = $null try { $localFirstName = $ADPObject.person.preferredName.givenName } catch {} try { if (!$localFirstName) { $localFirstName = $ADPObject.person.legalName.givenName } } catch {} return ( $localFirstName | Get-ValidADPReturn) }
Get-ADPUserType.ps1
ADPFunctions-2403.2.0
function Get-ADPUserType { <# .SYNOPSIS Get a user's User Type from ADP .DESCRIPTION Get a user's User Type from ADP .PARAMETER ADPObject Object which holds the User Type .EXAMPLE Input Object: ADP Object Return String: <User Type> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localUserType = $null try { $localUserType = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).workerTypeCode.shortName } catch {} try { if (!$localUserType) { $localUserType = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).workerTypeCode.longName } } catch {} return ( $localUserType | Get-ValidADPReturn ) }
Get-ADPEmail.ps1
ADPFunctions-2403.2.0
function Get-ADPEmail { <# .SYNOPSIS Get a user's Email from ADP .DESCRIPTION Get a user's Email from ADP .PARAMETER ADPObject Object which holds the Email .EXAMPLE Input Object: ADP Object Return String: <Email> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localEmail = $null try { $localEmail = ( $ADPObject | Get-ADPLogin ) } catch {} return ( $localEmail | Get-ValidADPReturn ) }
Get-ADPTitle.ps1
ADPFunctions-2403.2.0
function Get-ADPTitle { <# .SYNOPSIS Get a user's Title from ADP .DESCRIPTION Get a user's Title from ADP .PARAMETER ADPObject Object which holds the Title .EXAMPLE Input Object: ADP Object Return String: <Title> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localTitle = $null try { $localTitle = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).jobTitle } catch {} return ( $localTitle | Get-ValidADPReturn ) }
Get-ADPLogin.ps1
ADPFunctions-2403.2.0
function Get-ADPLogin { <# .SYNOPSIS Get a user's Login from ADP .DESCRIPTION Get a user's Login from ADP .PARAMETER ADPObject Object which holds the Login .EXAMPLE Input Object: ADP Object Return String: <Login> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localLogin = $null switch ($ADPObject.workerID.idValue) { "L91Q489KS" { $localLogin = "daryoush"; break } "P7UYEW9JQ" { $localLogin = "deidre"; break } "ZCD3V5Q4H" { $localLogin = "sameera"; break } "A20I1ANCI" { $localLogin = "bhavin"; break } "4R3P1JQ32" { $localLogin = "gaurav"; break } "BW1UT7D8X" { $localLogin = "leila"; break } "UAFH7TURT" { $localLogin = "susie"; break } "6HFZ9BX3D" { $localLogin = "stephanieg"; break } "S8509Z5OV" { $localLogin = "rociocalero"; break } "9566ZCAAI" { $localLogin = "saura.naim"; break } "PIL0AHZT5" { $localLogin = "doug.stein"; break } "UEWZLSPXV" { $localLogin = "jim.rs"; break } "DH2W18SD2" { $localLogin = "matthew.bowen"; break } "I9BAAEZGY" { $localLogin = "liz.myrick"; break } "SCXJ9CXUW" { $localLogin = "puttappaiah.muniyappa"; break } "LWHRZ19J9" { $localLogin = "max.may"; break } "B8RVAOWQT" { $localLogin = "ramadevi.harikrishnan"; break } "VUXHVS3LW" { $localLogin = "raudel.garcia"; break } "F2FQFEJDZ" { $localLogin = "samantha.fane-hervey"; break } "7OKI3E190" { $localLogin = "lusana.ornelas"; break } "1ZUG8QWV1" { $localLogin = "krishna.bala"; break } "HM1" { $localLogin = "adithya"; break } "HM8" { $localLogin = "pandi"; break } "HM9" { $localLogin = "reddy"; break } "HM10" { $localLogin = "shivappa"; break } "HM15" { $localLogin = "vadivel"; break } "HM17" { $localLogin = "ankita"; break } "HM21" { $localLogin = "manjusha.annem"; break } "HM23" { $localLogin = "rimpul"; break } "HM24" { $localLogin = "vijeth"; break } Default { $firstName = ( $ADPObject | Get-ADPFirstName ) $lastName = ( $ADPObject | Get-ADPLastName ) $localLogin = "$firstName.$lastName" } } $localLogin = "[email protected]".ToLower().Replace(' ', '') return ( $localLogin | Get-ValidADPReturn ) }
Get-ADPLastName.ps1
ADPFunctions-2403.2.0
function Get-ADPLastName { <# .SYNOPSIS Get a user's Last Name from ADP .DESCRIPTION Get a user's Last Name from ADP .PARAMETER ADPObject Object which holds the Last Name .EXAMPLE Input Object: ADP Object Return String: <Last Name> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localLastName = $null try { $localLastName = $ADPObject.person.preferredName.familyName1 } catch {} try { if (!$localLastName) { $localLastName = $ADPObject.person.legalName.familyName1 } } catch {} return ( $localLastName | Get-ValidADPReturn ) }
Get-ADPTerminationDate.ps1
ADPFunctions-2403.2.0
function Get-ADPTerminationDate { <# .SYNOPSIS Get a user's Termination Date from ADP .DESCRIPTION Get a user's Termination Date from ADP .PARAMETER ADPObject Object which holds the Termination Date .EXAMPLE Input Object: ADP Object Return String: <Termination Date> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localTerminationDate = $null try { $localTerminationDate = $ADPObject.workerDates.terminationDate } catch {} return ( $localTerminationDate | Get-ValidADPReturn ) }
Get-ADPOrganization.ps1
ADPFunctions-2403.2.0
function Get-ADPOrganization { <# .SYNOPSIS Get a user's Organization from ADP .DESCRIPTION Get a user's Organization from ADP .PARAMETER ADPObject Object which holds the Organization .EXAMPLE Input Object: ADP Object Return String: <Organization> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localOrganization = $null $localUserType = ( $ADPObject | Get-ADPUserType ) switch -Regex ($localUserType) { 'Full Time.*|Part Time.*|Intern|Tier 1' { $localOrganization = "WorkBoard" break } 'Tier 2' { try { $localOrganization = ($ADPObject.customFieldGroup.codeFields | Where-Object { $_.itemID -eq "9200397806245_1" }).shortName } catch {} break } default { $localOrganization = "$null" } } return ( $localOrganization | Get-ValidADPReturn ) }
Get-ADPDisplayName.ps1
ADPFunctions-2403.2.0
function Get-ADPDisplayName { <# .SYNOPSIS Get a user's Display Name from ADP .DESCRIPTION Get a user's Display Name from ADP .PARAMETER ADPObject Object which holds the Display Name .EXAMPLE Input Object: ADP Object Return String: <Display Name> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $first = $null $last = $null try { $first = ( $ADPObject | Get-ADPFirstName ) } catch {} try { $last = ( $ADPObject | Get-ADPLastName ) } catch {} return ( "$first $last" | Get-ValidADPReturn ) }
ADPFunctions.psd1
ADPFunctions-2403.2.0
# # Module manifest for module 'ADPFunctions' # # Generated by: Chris Darais # # Generated on: 03/04/2024 # @{ # Script module or binary module file associated with this manifest. RootModule = 'ADPFunctions.psm1' # Version number of this module. ModuleVersion = '2403.2' # Supported PSEditions # CompatiblePSEditions = @() # ID used to uniquely identify this module GUID = 'de8a8167-8b3e-46db-9566-c593cb861d80' # Author of this module Author = 'Chris Darais' # Company or vendor of this module CompanyName = 'SysTechs' # Copyright statement for this module Copyright = '(c) Chris Darais. All rights reserved.' # Description of the functionality provided by this module Description = 'ADP Functions' # Minimum version of the PowerShell engine required by this module # PowerShellVersion = '' # Name of the PowerShell host required by this module # PowerShellHostName = '' # Minimum version of the PowerShell host required by this module # PowerShellHostVersion = '' # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. # ClrVersion = '' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module # RequiredModules = @() # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module # TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module # FormatsToProcess = @() # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = 'Get-ADPAssociateOID', 'Get-ADPDisplayName', 'Get-ADPEmail', 'Get-ADPEmployeeNumber', 'Get-ADPFirstName', 'Get-ADPHireDate', 'Get-ADPLastName', 'Get-ADPLocation', 'Get-ADPLogin', 'Get-ADPManagerAOID', 'Get-ADPMobilePhone', 'Get-ADPObjectFromAPIObject', 'Get-ADPObjectFromID', 'Get-ADPOrganization', 'Get-ADPOrgStructure', 'Get-ADPPronouns', 'Get-ADPRegion', 'Get-ADPSecondEmail', 'Get-ADPTerminationDate', 'Get-ADPTitle', 'Get-ADPUserType', 'Get-ADPWorkLocation' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() # Variables to export from this module VariablesToExport = @() # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. AliasesToExport = @() # DSC resources to export from this module # DscResourcesToExport = @() # List of all modules packaged with this module # ModuleList = @() # List of all files packaged with this module # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. # Tags = @() # A URL to the license for this module. # LicenseUri = '' # A URL to the main website for this project. # ProjectUri = '' # A URL to an icon representing this module. # IconUri = '' # ReleaseNotes of this module # ReleaseNotes = '' # Prerelease string of this module # Prerelease = '' # Flag to indicate whether the module requires explicit user acceptance for install/update/save # RequireLicenseAcceptance = $false # External dependent modules of this module # ExternalModuleDependencies = @() } # End of PSData hashtable } # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' }
Get-ADPEmployeeNumber.ps1
ADPFunctions-2403.2.0
function Get-ADPEmployeeNumber { <# .SYNOPSIS Get a user's Employee Number from ADP .DESCRIPTION Get a user's Employee Number from ADP .PARAMETER ADPObject Object which holds the Employee Number .EXAMPLE Input Object: ADP Object Return String: <Employee Number> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localEmployeeNumber = $null try { $localEmployeeNumber = $ADPObject.workerID.idValue } catch {} return ( $localEmployeeNumber | Get-ValidADPReturn ) }
Get-ADPObjectFromID.ps1
ADPFunctions-2403.2.0
function Get-ADPObjectFromID { <# .SYNOPSIS Get a user's ADP Object from AOID or Employee iD .DESCRIPTION Get a user's ADP Object from AOID or Employee ID .PARAMETER IsAOID Boolean stating type of ID .PARAMETER ID String containing AOID or Employee ID .PARAMETER Certificate Certificate to autenticate to ADP with .PARAMETER Token Token to authenticate to ADP with .PARAMETER UserList List of all the users .EXAMPLE Input Boolean: True = AOID Input String: AOID or Employee ID Input Object: Certificate Input Object: Token Return Object: <ADP Object> .NOTES This is used when passing the full adp worker object from ADP's API .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 1 )] [bool]$IsAOID, [Parameter( Mandatory = $true, Position = 1 )] $ID, [Parameter( Mandatory = $true, Position = 2 )] $Certificate, [Parameter( Mandatory = $true, Position = 3 )] $Token ) $uri = "https://api.adp.com/hr/v2/workers/$ID" if (!$IsAOID) { $uri = "https://api.adp.com/hr/v2/workers?" + '$' + "filter=workers/workerID/idValue eq '" + $ID + "'" } $headers = @{ "Accept" = "application/json" "Authorization" = "Bearer $Token" } $ProgressPreference = 'SilentlyContinue' $response = Invoke-WebRequest -Uri $uri -Method Get -Headers $headers -Certificate $Certificate -UseBasicParsing $ProgressPreference = 'Continue' if ( $response.StatusCode -eq 200 ) { return ( $response.Content | ConvertFrom-Json ).workers[0] } return $null }
Get-ADPWorkLocation.ps1
ADPFunctions-2403.2.0
function Get-ADPWorkLocation { <# .SYNOPSIS Get a user's Work Location from ADP .DESCRIPTION Get a user's Work Location from ADP .PARAMETER ADPObject Object which holds the Work Location .EXAMPLE Input Object: ADP Object Return String: <Work Location> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localWorkLocation = $null try { $localWorkLocation = $ADPObject.workAssignments.homeWorkLocation.nameCode.shortName } catch {} if ($null -eq $localWorkLocation) { try { $localWorkLocation = $ADPObject.workAssignments.homeWorkLocation.nameCode.longName } catch {} } return ( $localWorkLocation | Get-ValidADPReturn ) }
Get-ADPSecondEmail.ps1
ADPFunctions-2403.2.0
function Get-ADPSecondEmail { <# .SYNOPSIS Get a user's Second Email from ADP .DESCRIPTION Get a user's Second Email from ADP .PARAMETER ADPObject Object which holds the Second Email .EXAMPLE Input Object: ADP Object Return String: <Second Email> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $secondEmail = $null try { $secondEmail = $ADPObject.person.communication.emails.emailUri.ToLower() } catch {} return ( $secondEmail | Get-ValidADPReturn ) }
Get-ADPOrgStructure.ps1
ADPFunctions-2403.2.0
function Get-ADPOrgStructure { <# .SYNOPSIS Get a user's Division and Department from ADP .DESCRIPTION Get a user's Division and Department from ADP .PARAMETER ADPObject Object which holds the Division and Department .EXAMPLE Input Object: ADP Object Return Object: {division, department, combined} .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $codes = [PSCustomObject]@{ "FIN - Accounting" = "Finance | Accounting" "FIN - Finance" = "Executive | Finance" "FIN - FP&A" = "Finance | FP&A" "FIN - Legal" = "Operations | Legal" "FIN - Payroll" = "Finance | Payroll" "MKTG - Brand & Content" = "Marketing | Brand & Content" "MKTG - Business Development" = "Marketing | Business Development" "MKTG - Operations" = "Marketing | Operations" "MKTG - Results Foundry" = "Marketing | Results Foundry" "MKTG - Marketing" = "Executive | Marketing" "P&E - Data & Strategy" = "Engineering | Data & Strategy" "P&E - Engineering" = "Executive | Engineering & Product" "P&E - Info Security" = "Engineering | InfoSec" "P&E - Integrations" = "Engineering | Core Services" "P&E - IT" = "Operations | IT" "P&E - Platform" = "Engineering | Platform" "P&E - Product Management" = "Product | Product Management & Design" "P&E - QA" = "Engineering | QA" "P&E - Software Development" = "Engineering | Development" "PPL - People Ops" = "People | Operations" "PPL - Talent Acquisition" = "People | Recruiting" "PTN - Partnerships" = "Executive | Partnerships" "PTN - Operations" = "Partnerships | Operations" "REV - Customer Success" = "Revenue | Customer Success" "REV - Customer Support" = "Revenue | Customer Support" "REV - Revenue" = "Executive | Revenue" "REV - Sales" = "Revenue | Sales" "REV - Solution Consultant" = "Revenue | Pre-Sales" "REV - Strategic Services" = "Revenue | Services" "WorkBoard - Office of the CEO" = "Executive | Office of the CEO" } $localOrgStructure = [PSCustomObject]@{ department = $null costCenter = $null } # $localOrgStructure = $null $localOrgCode = $null $leadershipCode = $null $costCenterCode = $null #department try { $localOrgCode = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).assignedOrganizationalUnits[0].nameCode.shortname if ($null -eq $localOrgCode) { $localOrgCode = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).assignedOrganizationalUnits[0].nameCode.longName } $localOrgStructure.department = $codes.$localOrgCode } catch {} #xlt try { $leadershipCode = ($ADPObject.customFieldGroup.codeFields | Where-Object { $_.nameCode.codeValue -eq "Leadership Team" }).codeValue $leadershipCode = ($leadershipCode | Get-ValidADPReturn) } catch {} if ($leadershipCode -eq "XLT") { $localOrgStructure.department += " XLT" } #cost center try { $localOrgStructure.costCenter = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).assignedOrganizationalUnits[1].nameCode.codeValue $localOrgStructure.costCenter += " - " $costCenterCode = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).assignedOrganizationalUnits[1].nameCode.shortName if ($null -eq $costCenterCode) { $costCenterCode = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).assignedOrganizationalUnits[1].nameCode.longName } $localOrgStructure.costCenter += $costCenterCode } catch {} $localOrgStructure.department = ( $localOrgStructure.department | Get-ValidADPReturn ) $localOrgStructure.costCenter = ( $localOrgStructure.costCenter | Get-ValidADPReturn ) return $localOrgStructure }
Get-ADPPronouns.ps1
ADPFunctions-2403.2.0
function Get-ADPPronouns { <# .SYNOPSIS Get a user's Pronouns from ADP .DESCRIPTION Get a user's Pronouns from ADP .PARAMETER ADPObject Object which holds the Pronouns .EXAMPLE Input Object: ADP Object Return String: <Pronouns> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localPronouns = $null; try { $localPronouns = $ADPObject.person.preferredGenderPronounCode.shortName } catch {} switch ($localPronouns) { "She/Her/Hers" { $localPronouns = "she/her"; break } "He/Him/His" { $localPronouns = "he/him"; break } "They/Them/Theirs" { $localPronouns = "they/them"; break } "Ze/Zir/Zirs" { $localPronouns = "ze/zir"; break } default { $localPronouns = $null } } return ( $localPronouns | Get-ValidADPReturn ) }
Get-ValidADPReturn.ps1
ADPFunctions-2403.2.0
function Get-ValidADPReturn { <# .SYNOPSIS Validate a string by removing invalid characters .DESCRIPTION Helper function to help with getting a valid string .PARAMETER InputString String that needs to be validated. Accepts pipe value .EXAMPLE Input String: th is is a test Return String: th is is a test .NOTES This removes any bad characters .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Position = 0, ValueFromPipeline = $true )] [string]$InputString ) if ($InputString) { $InputString = $InputString.Replace(' ', ' ') $InputString = $InputString.Replace('ß', "ss") $InputString = $InputString.Replace('ü', "u") $InputString = $InputString.Trim() } return $InputString }
Get-ADPAssociateOID.ps1
ADPFunctions-2403.2.0
function Get-ADPAssociateOID { <# .SYNOPSIS Get a user's Associate ID from ADP .DESCRIPTION Get a user's Associate ID from ADP .PARAMETER ADPObject Object which holds the AssociateOID .EXAMPLE Input Object: ADP Object Return String: <Associate OID> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localAssociateOID = $null try { $localAssociateOID = $ADPObject.associateOID } catch {} return ( $localAssociateOID | Get-ValidADPReturn ) }
Get-ADPObjectFromAPIObject.ps1
ADPFunctions-2403.2.0
function Get-ADPObjectFromAPIObject { <# .SYNOPSIS Get a user's ADP Object from ADP API Object .DESCRIPTION Get a user's ADP Object from ADP API Object .PARAMETER ADPObject Object which holds the ADP Object .PARAMETER UserList List of all the users .EXAMPLE Input Object: ADP API Object Input Object: List of users Return Object: <ADP Object> .NOTES This is used when passing the full adp worker object from ADP's API .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $APIObject ) return [PSCustomObject]@{ associateOID = ( $APIObject | Get-ADPAssociateOID ); firstName = ( $APIObject | Get-ADPFirstName ); lastName = ( $APIObject | Get-ADPLastName ); login = ( $APIObject | Get-ADPLogin ); email = ( $APIObject | Get-ADPEmail ); title = ( $APIObject | Get-ADPTitle ); displayName = ( $APIObject | Get-ADPDisplayName ); secondEmail = ( $APIObject | Get-ADPSecondEmail ); mobilePhone = ( $APIObject | Get-ADPMobilePhone ); streetAddress = ( $APIObject | Get-ADPLocation).street; city = ( $APIObject | Get-ADPLocation).city; state = ( $APIObject | Get-ADPLocation).state; zipCode = ( $APIObject | Get-ADPLocation).zipCode; countryCode = ( $APIObject | Get-ADPLocation).country; preferredLanguage = ( $APIObject | Get-ADPRegion).preferredLanguage; locale = ( $APIObject | Get-ADPRegion).locale; userType = ( $APIObject | Get-ADPUserType ); employeeNumber = ( $APIObject | Get-ADPEmployeeNumber ); organization = ( $APIObject | Get-ADPOrganization ); costCenter = ( $APIObject | Get-ADPOrgStructure ).costCenter; department = ( $APIObject | Get-ADPOrgStructure ).department; managerAOID = ( $APIObject | Get-ADPManagerAOID ) managerId = $null; manager = $null; hireDate = ( $APIObject | Get-ADPHireDate ).mmddyyyySlash; pronouns = ( $APIObject | Get-ADPPronouns ); simpplrHireDate = ( $APIObject | Get-ADPHireDate ).yyyymmddHyphen; managerEmail = $null; terminationDate = ( $APIObject | Get-ADPTerminationDate ); workLocation = ( $APIObject | Get-ADPWorkLocation ) } }
ADPFunctions.psm1
ADPFunctions-2403.2.0
#Get public and private function definition files. $public = @( Get-ChildItem -Path $PSScriptRoot/Public/*.ps1 -ErrorAction SilentlyContinue ) $private = @( Get-ChildItem -Path $PSScriptRoot/Private/*.ps1 -ErrorAction SilentlyContinue ) #Dot source the files Foreach ($import in @($public + $private)) { Try { . $import.fullname } Catch { Write-Error -Message "Failed to import function $($import.fullname): $_" } } Export-ModuleMember -Function $public.Basename
Get-ADPHireDate.ps1
ADPFunctions-2403.2.0
function Get-ADPHireDate { <# .SYNOPSIS Get a user's Hire Date from ADP .DESCRIPTION Get a user's Hire Date from ADP .PARAMETER ADPObject Object which holds the Hire Date .EXAMPLE Input Object: ADP Object Return Object: <Hire Date> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localHireDateFormatted = [PSCustomObject]@{ yyyymmddHyphen = $null; mmddyyyySlash = $null; } $localHireDate = $null try { $localHireDate = $ADPObject.workerDates.originalHireDate $localHireDate = ( $localHireDate | Get-ValidADPReturn ) } catch {} $localHireDateArray = $localHireDate.ToCharArray() $localHireDateFormatted.yyyymmddHyphen = $localHireDate $localHireDateFormatted.mmddyyyySlash = "$($localHireDateArray[5])$($localHireDateArray[6])/$($localHireDateArray[8])$($localHireDateArray[9])/$($localHireDateArray[0])$($localHireDateArray[1])$($localHireDateArray[2])$($localHireDateArray[3])" return $localHireDateFormatted }
Get-ADPManagerAOID.ps1
ADPFunctions-2403.2.0
function Get-ADPManagerAOID { <# .SYNOPSIS Get a user's Manager's AOID from ADP .DESCRIPTION Get a user's Manager's AOID from ADP .PARAMETER ADPObject Object which holds the Manager's AOID .EXAMPLE Input Object: ADP Object Return String: <Manager's AOID> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localManagerAOID = $null $localManagerAOID = ($ADPObject.workAssignments | Where-Object { $_.primaryIndicator }).reportsTo.associateOID return ( $localManagerAOID | Get-ValidADPReturn ) }
Get-ADPLocation.ps1
ADPFunctions-2403.2.0
function Get-ADPLocation { <# .SYNOPSIS Get a user's Location from ADP .DESCRIPTION Get a user's Location from ADP .PARAMETER ADPObject Object which holds the Location .EXAMPLE Input Object: ADP Object Return Object: {street, city, state, zipCode, country} .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localOrganization = ( $ADPObject | Get-ADPOrganization ) $localLocation = [PSCustomObject]@{ street = ""; city = ""; state = ""; zipCode = ""; country = ""; } switch ($localOrganization) { "WorkBoard" { try { $localLocation.street += $ADPObject.person.legalAddress.lineOne } catch {} try { $localLocation.street += " " $localLocation.street += $ADPObject.person.legalAddress.lineTwo } catch {} try { $localLocation.street += " " $localLocation.street += $ADPObject.person.legalAddress.lineThree } catch {} try { $localLocation.city = $ADPObject.person.legalAddress.cityName } catch {} try { $localLocation.state = $ADPObject.person.legalAddress.countrySubdivisionLevel1.codeValue } catch {} try { $localLocation.zipCode = $ADPObject.person.legalAddress.postalCode } catch {} try { $localLocation.country = $ADPObject.person.legalAddress.countryCode } catch {} break } "Happiest Minds" { $localLocation.street = "53/1-4, Hosur Main Road, Madiwala" $localLocation.city = "Karnataka" $localLocation.state = "Bangalore" $localLocation.zipCode = "560068" $localLocation.country = "IN" break } "US Launchpad" { $localLocation.street = $null $localLocation.city = $null $localLocation.state = $null $localLocation.zipCode = $null $localLocation.country = $null } "Pop-Up Talent" { $localLocation.street = "50 Woodside Plaza #604" $localLocation.city = "Redwood City" $localLocation.state = "CA" $localLocation.zipCode = "94061" $localLocation.country = "US" } default { } } $localLocation.street = ( $localLocation.street | Get-ValidADPReturn ) $localLocation.city = ( $localLocation.city | Get-ValidADPReturn ) $localLocation.state = ( $localLocation.state | Get-ValidADPReturn ) $localLocation.zipCode = ( $localLocation.zipCode | Get-ValidADPReturn ) $localLocation.country = ( $localLocation.country | Get-ValidADPReturn ) return $localLocation }
ADPlayground.psm1
ADPlayground-0.6.0
# Get library name, from the PSM1 file name $LibraryName = 'ADPlayground.PowerShell' $Library = "$LibraryName.dll" $Class = "ADPlayground.PowerShell.CmdletGetADXDnsLogFile" $AssemblyFolders = Get-ChildItem -Path $PSScriptRoot\Lib -Directory -ErrorAction SilentlyContinue # Lets find which libraries we need to load $Default = $false $Core = $false $Standard = $false foreach ($A in $AssemblyFolders.Name) { if ($A -eq 'Default') { $Default = $true } elseif ($A -eq 'Core') { $Core = $true } elseif ($A -eq 'Standard') { $Standard = $true } } if ($Standard -and $Core -and $Default) { $FrameworkNet = 'Default' $Framework = 'Standard' } elseif ($Standard -and $Core) { $Framework = 'Standard' $FrameworkNet = 'Standard' } elseif ($Core -and $Default) { $Framework = 'Core' $FrameworkNet = 'Default' } elseif ($Standard -and $Default) { $Framework = 'Standard' $FrameworkNet = 'Default' } elseif ($Standard) { $Framework = 'Standard' $FrameworkNet = 'Standard' } elseif ($Core) { $Framework = 'Core' $FrameworkNet = '' } elseif ($Default) { $Framework = '' $FrameworkNet = 'Default' } else { Write-Error -Message 'No assemblies found' } if ($PSEdition -eq 'Core') { $LibFolder = $Framework } else { $LibFolder = $FrameworkNet } try { $ImportModule = Get-Command -Name Import-Module -Module Microsoft.PowerShell.Core if (-not ($Class -as [type])) { & $ImportModule ([IO.Path]::Combine($PSScriptRoot, 'Lib', $LibFolder, $Library)) -ErrorAction Stop } else { $Type = "$Class" -as [Type] & $importModule -Force -Assembly ($Type.Assembly) } } catch { if ($ErrorActionPreference -eq 'Stop') { throw } else { Write-Warning -Message "Importing module $Library failed. Fix errors before continuing. Error: $($_.Exception.Message)" # we will continue, but it's not a good idea to do so # return } } if ($PSEdition -eq 'Core') { Import-Module -Name "$PSScriptRoot\Lib\Core\ADPlayground.PowerShell.dll" -Force -ErrorAction Stop } else { Import-Module -Name "$PSScriptRoot\Lib\Default\ADPlayground.PowerShell.dll" -Force -ErrorAction Stop } # Dot source all libraries by loading external file . $PSScriptRoot\ADPlayground.Libraries.ps1 function Initialize-PSLingeringObject { [CmdletBinding()] param( [switch] $Suppress ) $Script:LingeringObjects = [ADPlayground.LingeringObjects]::new($true, $true, $true) $Script:LingeringObjects.DetectInfrastructure() if (-not $Suppress) { $Script:LingeringObjects } } # Export functions and aliases as required Export-ModuleMember -Function @('Initialize-PSLingeringObject') -Alias @() -Cmdlet 'Get-ADXDnsLogFile', 'Initialize-LingeringObject', 'Remove-LingeringObject' # SIG # Begin signature block # MIItqwYJKoZIhvcNAQcCoIItnDCCLZgCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDZZ/MdwJuecvDO # dVCR5tw+vBK72FITE/yIq3g/azvcnKCCJq4wggWNMIIEdaADAgECAhAOmxiO+dAt # 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV # BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa # Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy # dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lD # ZXJ0IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC # ggIBAL/mkHNo3rvkXUo8MCIwaTPswqclLskhPfKK2FnC4SmnPVirdprNrnsbhA3E # MB/zG6Q4FutWxpdtHauyefLKEdLkX9YFPFIPUh/GnhWlfr6fqVcWWVVyr2iTcMKy # unWZanMylNEQRBAu34LzB4TmdDttceItDBvuINXJIB1jKS3O7F5OyJP4IWGbNOsF # xl7sWxq868nPzaw0QF+xembud8hIqGZXV59UWI4MK7dPpzDZVu7Ke13jrclPXuU1 # 5zHL2pNe3I6PgNq2kZhAkHnDeMe2scS1ahg4AxCN2NQ3pC4FfYj1gj4QkXCrVYJB # MtfbBHMqbpEBfCFM1LyuGwN1XXhm2ToxRJozQL8I11pJpMLmqaB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J1c3RlZCBH # NCBSU0E0MDk2IFNIQTI1NiBUaW1lU3RhbXBpbmcgQ0ECEAuuZrxaun+Vh8b56QTj # MwQwDQYJYIZIAWUDBAIBBQCgaTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwG # CSqGSIb3DQEJBTEPFw0yNDExMTEyMjUzMThaMC8GCSqGSIb3DQEJBDEiBCDB8Tui # S+1Q3zbGHfjrEcVIH/EUksqeRG9hD4BWo84FWTANBgkqhkiG9w0BAQEFAASCAgBQ # NbzlstNo3Xc++jcI5yLYl/8gWs51607D9vM78oUVNKtcub3SSw+k7iTB7YJEJRGZ # J7MV8iJKcRO+J/2woPMvSw0dykiq5DnHYWjvkEI31F0Hf/LZDAt86dWOFFuvdz2l # k2BMChxj27FDJ3naJKHQ0ocpeBkW1u2xi5PtwBwXssxpWVyg+tHqwPzp8+5hK77v # u8aY96sRUkFM+/fmF7I1lMyXUVOLOSf8l2vf8ZfjFZBwxaDvP9ZR7vwGGU/JP8cI # DiVsRY1RoKNP61xr9E1PnC6eUsKP2aCoVBkzUU2WMcukMW+5iTAny9+ZiKcG1BI/ # lT2oc2oLO9nNyuyB3aOCQv3SrkmYC8GtoOm2koyv6KcXHvI6BNdVIWcaUPxRAI3L # csCIGVD021xJQEdJ6SJp9VeBtXK0TKpW9Pqn2Vn+l8n6lcyUAY7yrsb3scS000Ty # 8eQbj+OiDOClSSROOkdP7C5XWkX6mzpE98pB3U31X0UkD0QjlJcgiz8IgL6Ryi9R # rGqqX/KHPiCgXiH5v34a0rzw8ljidwVa1E3Rj+0P0Xr4pQZrxSeh8qq2+kiRQEQN # VK4Dzx1qiiKI2bMeIcYJoLxUVgUe3BbBA7BPkMt1eAm7q89SjF28uIL37YR4imNE # 2+f3yhF2HmzGQRmcAbsirfigmuI8NVC8oJXumirMlw== # SIG # End signature block
ADPlayground.Libraries.ps1
ADPlayground-0.6.0
if ($PSEdition -eq 'Core') { $LibrariesToLoad = @( 'Lib\Core\ADPlayground.dll' 'Lib\Core\ADPlayground.PowerShell.dll' 'Lib\Core\Microsoft.Bcl.AsyncInterfaces.dll' 'Lib\Core\System.Configuration.ConfigurationManager.dll' 'Lib\Core\System.Diagnostics.EventLog.dll' 'Lib\Core\System.DirectoryServices.AccountManagement.dll' 'Lib\Core\System.DirectoryServices.dll' 'Lib\Core\System.DirectoryServices.Protocols.dll' 'Lib\Core\System.Security.Cryptography.ProtectedData.dll' ) foreach ($L in $LibrariesToLoad) { Add-Type -Path $PSScriptRoot\$L } } else { $LibrariesToLoad = @( 'Lib\Default\ADPlayground.dll' 'Lib\Default\ADPlayground.PowerShell.dll' 'Lib\Default\Microsoft.Bcl.AsyncInterfaces.dll' 'Lib\Default\System.Diagnostics.EventLog.dll' 'Lib\Default\System.Runtime.CompilerServices.Unsafe.dll' 'Lib\Default\System.Security.Principal.Windows.dll' 'Lib\Default\System.Threading.Tasks.Extensions.dll' ) foreach ($L in $LibrariesToLoad) { Add-Type -Path $PSScriptRoot\$L } } # SIG # Begin signature block # MIItqwYJKoZIhvcNAQcCoIItnDCCLZgCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAA2wkYnO67Hnq5 # cQsmVQ1jVHhS7D3mYqgoJFTli0kRPKCCJq4wggWNMIIEdaADAgECAhAOmxiO+dAt # 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV # BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa # Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaW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Wav3Bkv0OFb71IW+TQK2a/6NCCzQG6O/y8Y0Slqt # liNrq1brmsmeJyXRuxavIajyC4+9eCf/WREl3A5tfBsSzaQY3Ak4T0ZVymmtOr19 # oLOeOiY9ukbI1ZXVDknxaCmGVcPUNh0q88Bi1wE9kO+doRUtg9rTJPz5ONX5ZQDU # Eet5M8lm0VFvaDQgFpdpx8GEOuCLuL70YpvksR/KFGj7ocT0wpcx2jkQLlkpbCZ5 # 6E8avZZ7wzaD7H3toUnzTx74mLxRL9jyVxzqOek9yuJiZ7+gTaBeIzy8bP8Dmipd # atN3d83U2dWFfB+4z60s6Pn2TqheSEqUBPmWApz+koJuNlRbbiHNSGHpgEWKNNfB # 8VHrR1SA6mpqO8PYthzhwQ/73adXDGosUFBeNotZNA== # SIG # End signature block
ADPlayground.psd1
ADPlayground-0.6.0
@{ AliasesToExport = @() Author = 'Przemyslaw Klys' CmdletsToExport = @('Get-ADXDnsLogFile', 'Initialize-LingeringObject', 'Remove-LingeringObject') CompanyName = 'Evotec' CompatiblePSEditions = @('Desktop', 'Core') Copyright = '(c) 2011 - 2024 Przemyslaw Klys @ Evotec. All rights reserved.' Description = 'ADPlayground is a module that allows you to do some basic Active Directory operations.' FunctionsToExport = 'Initialize-PSLingeringObject' GUID = 'c03ad3dd-6911-4880-8618-de91a8612364' ModuleVersion = '0.6.0' PowerShellVersion = '5.1' PrivateData = @{ PSData = @{ Tags = @('Windows', 'ActiveDirectory', 'LingeringObjects', 'LOL') } } RootModule = 'ADPlayground.psm1' ScriptsToProcess = @() } # SIG # Begin signature block # MIItqwYJKoZIhvcNAQcCoIItnDCCLZgCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDmet6XhBaaGGrH # WN/gcJwR1GWnHDtA3omKQeidVT5tz6CCJq4wggWNM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w0BAQEFAASCAgCJ # jr0qr5ti9UEQDlRXQaEsVhLvIiRdyxYBZXtZWF3KBjveCu9rewBA0M8cf/cG0Acj # ZvyZfOhWVRHJ0K0ZRwlCPQDcpaPmap6NCBfmkyrDz7Ug4GXGja5JzacOTgIpWlvB # u7g8v6XSITl0zlPmswV8ggwfWcmq+ibpW/+7CzBrSZZ4+4ElvQhVCFwne8YIyZAU # ggYHsrGLfcRJ6UHgt0mQweveTzymlPIxFuikZ1yflnXUwE9njDyYR/exXPCBgcix # bTMqVSFuj7depU2a05xaXSK3d4X6uzX33WhZ1n4C9fZ4WT6axCOkIoOZ8Qbbf4BG # 7kGGIAfqU5wuLVYCNmHr0OMM0s0HW7kJ7WtUmBMAm5g1nhk4Ag8NKSoKTLb4GzPL # 9KB3xTJMpd2ZwYdmcbVuyHkAffCXFMqWo1qqs8cmdMopqB7tde/ultP7tseJurOg # hY7ZytvYLnhxJYe3q2TcrSBX2Y1EhDf5BrvV1rseHJjE5ykHEW1tTNdpjxHOIa7I # MmIMEvO2c8QhpuLxfMGcaZ9a+6Ax0jWrqpjXLsXyd4u4aeLCpZAZIBkkhp7vmNa/ # CesNhl/ukiUf4VjwOVYCAI7AxVAK9QaCP4OVotNQY88+CEEzgpF1qaF2sm8fKhuZ # EYDMufg77mF6VcQPJwXVQWDOyvgjAfEkm1t1LDp68A== # SIG # End signature block
ADPolicyAudit.psm1
ADPolicyAudit-1.0.0
<# .Synopsis Returns server password/lockout policy and lockout for a server .DESCRIPTION Gets the server password/lockout policy for one or several servers. For times, a timespan object is returned. For non, time related fields, an integer is returned. .PARAMETER ComputerName Name of a computer to get password policy and lockout policy .EXAMPLE Get-PasswordLockoutPolicy -ComputerName DC01 .NOTES None #> function Get-PasswordLockoutPolicy { [CmdletBinding(SupportsShouldProcess=$true)] Param ( # ComputerName to process policy [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, ValueFromRemainingArguments=$false, Position=0)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $ComputerName ) Begin { } Process { foreach ($Computer in $ComputerName) { try{ $domNamingContext = Get-ADRootDSE -Server $Computer -ErrorAction Stop # get default domain naming context of server $props = @('minPwdAge','maxPwdAge','minPwdLength','pwdHistoryLength', 'lockoutThreshold','lockoutDuration','lockOutObservationWindow') # get password properties for domain that server is in. $pwdProps = Get-ADObject -Identity $domNamingContext.rootDomainNamingContext -Properties $props | Select-Object -Property $props # convert "ticks" to Time-Spans. $obj = @{ ComputerName = $Computer PassMinAgeDays = (New-TimeSpan -Start (get-date).AddTicks($pwdProps.minPwdAge) -End (get-date)).Days PassMaxAgeDays = (New-TimeSpan -Start (Get-Date).AddTicks($pwdProps.maxPwdAge) -End (Get-Date)).Days PassLength = $pwdProps.minPwdLength PassHistoryCount = $pwdProps.pwdHistoryLength FailedLogonsAllowed = $pwdProps.lockoutThreshold PassUnlockoutMins = (New-TimeSpan -Start (Get-Date).AddTicks($pwdProps.lockoutDuration) -End (Get-Date)).Minutes ObservationWindowMins = (New-TimeSpan -Start (get-date).AddTicks($pwdProps.lockOutObservationWindow) -End (get-date)).Minutes } # end obj New-Object -TypeName psobject -Property $obj } catch { $Error[0] } #end try/catch } # end foreach-object } # end process End { } } # end Get-PasswordLockoutPolicy <# .Synopsis Audits Servers for password policy and sends results to email .DESCRIPTION Compares password policy to password requirements of an organization. If any password requirement(s) does not match, they are sent to an output stream such as an email server, slack channel (future), reporting server (future). .PARAMETER ComputerName Server to Audit .PARAMETER SmtpServer SmtpServer to use for email .PARAMETER PassHistoryCount Password to remember before user can reuse a previous password .PARAMETER LockoutTime TimeSpan that User should be locked out .PARAMETER FailedLogonsAllowed Number of failed logon attempts allowed .PARAMETER PassLength Minimum Number of characters that a password has to be .PARAMETER PassMinAgeDays Minimum age of a password in days .PARAMETER PassMaxAgeDays Maximum age of a password in days .PARAMETER PassUnlockoutMins Number of minutes that a password will be unlocked after being locked .EXAMPLE $myargs = @{ ComputerName = "DSDC01","DSDC02" # array of computernames PassHistoryCount = 10 # Number of remembered passwords PassUnlockoutMins = 30 # Number of minutes before password is unlocked FailedLogonsAllowed = 4 # Allowed Failed Logons PassLength = 15 # Required password length PassMinAgeDays = 4 # Minimum age of password in days PassMaxAgeDays = 10 # Maximum age of password in days ObservationWindowMins = 20 # Number of } Test-PasswordAuditResults @myargs Return compliance results of server DSDC01 and DSDC02 #> function Test-PasswordAuditResults { [CmdletBinding()] Param ( # Server to test password compliance [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, ValueFromRemainingArguments=$false, Position=0)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $ComputerName, # pwdHistoryLength [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $PassHistoryCount, # lockoutDuration [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $PassUnlockoutMins, # lockoutThreshold [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $FailedLogonsAllowed, # minPwdLength [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $PassLength, # minPwdAge [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $PassMinAgeDays, # maxPwdAge [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $PassMaxAgeDays, # lockOutObservationWindow [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] $ObservationWindowMins ) Begin { # Get the lockout policy for an array of computers $effectiveServerPolicy = Get-PasswordLockoutPolicy -ComputerName $ComputerName } Process { # create template object computer results to be added to $compObj = New-Object -TypeName psobject -Property @{ ComputerName = "" IsCompliant = $false PassCompliance = @{} } #end property $compObj = @() # filter out results. when policy is different than desired policy, include in results foreach ($policy in $effectiveServerPolicy) { $IsCompliant = $true # overall compliance of the node $obj = @{ PassMinAgeDaysCompliant = $true PassMaxAgeDaysCompliant = $true PassLengthCompliant = $true PassHistoryCountCompliant = $true FailedLogonsAllowedCompliant = $true PassUnlockoutMinsCompliant = $true ObservationWindowMinsCompliant = $true } #close obj if ($policy.PassMinAgeDays -ne (New-TimeSpan -Days $PassMinAgeDays)) { $obj.PassMinAgeDaysCompliant = $false $IsCompliant = $false } #end if if ($policy.PassMaxAgeDays -ne (New-TimeSpan -Days $PassMaxAgeDays)) { $obj.PassMaxAgeDaysCompliant = $false $IsCompliant = $false } #end if if ($policy.PassLength -ne $PassLength) { $obj.PassLengthCompliant = $false $IsCompliant = $false } #end if if ($policy.PassHistoryCount -ne $PassHistoryCount) { $obj.PassHistoryCountCompliant = $false $IsCompliant = $false } #end if if ($policy.FailedLogonsAllowed -eq $FailedLogonsAllowed){ $obj.FailedLogonsAllowedCompliant = $false $IsCompliant = $false } #end if if ($policy.PassUnlockoutMins -ne (New-TimeSpan -Minutes $PassUnlockoutMins)){ $obj.PassUnlockoutMinsCompliant = $false $IsCompliant = $false } #end if if ($policy.ObservationWindowMins -ne (New-TimeSpan -Minutes $ObservationWindowMins)) { $obj.ObservationWindowMinsCompliant = $false $IsCompliant = $false } #end if #add results of current computer to final result if (-not $IsCompliant) { $compObj += New-Object -TypeName psobject -Property @{Computername = $policy.ComputerName IsCompliant = $IsCompliant PassCompliance = $obj } #close prop } #end if } #end foreach $compObj } #end process End { } } <# .Synopsis Formats and Email with Password Audit of a Server or to the console in a pretty format. .DESCRIPTION For servers that are not in compliance with the password policies and lockout policies, will send an email with the names of the attributes that are out of compliance .PARAMETER To Recipient of the compliance results .PARAMETER SMTP SMTP Server used to send email .PARAMETER FailedComputers Custom object containing computers and their password compliance results .NOTES Sends to console in a pretty format. To keep results in objects, use Test-PasswordAuditResults .EXAMPLE Send-PasswordCompliance -To [email protected] -CompObj $Comps -SMTP smtp.mycompany.com #> function Send-PasswordCompliance { [CmdletBinding()] param ( # email address to send to [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, ParameterSetName='Email')] $To, # SMTP Server [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, ParameterSetName='Email')] $SMTP, # Computer objects with compliance results [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] $FailedComputers ) Begin { } Process { #create body of email $complianceReport = @" ServerResults Compliance --------------------------- --------------- "@ #add only items that are not in compliance to report. Parse hash table foreach ($computer in $FailedComputers) { #format here string $complianceReport += $computer.Computername if (-not ($computer.PassCompliance)['PassMinAgeDaysCompliant']) { $complianceReport += "`nPassMinAgeDaysCompliant $(($computer.PassCompliance)['PassMinAgeDaysCompliant'])"} if (-not ($computer.PassCompliance)['PassMaxAgeDaysCompliant']) { $complianceReport += "`nPassMaxAgeDaysCompliant $(($computer.PassCompliance)['PassMaxAgeDaysCompliant'])"} if (-not ($computer.PassCompliance)['ObservationWindowMinsCompliant']) { $complianceReport += "`nObservationWindowMinsCompliant $(($computer.PassCompliance)['ObservationWindowMinsCompliant'])"} if (-not ($computer.PassCompliance)['PassLengthCompliant']) { $complianceReport += "`nPassLengthCompliant $(($computer.PassCompliance)['PassLengthCompliant'])"} if (-not ($computer.PassCompliance)['FailedLogonsAllowedCompliant']) { $complianceReport += "`nFailedLogonsAllowedCompliant $(($computer.PassCompliance)['FailedLogonsAllowedCompliant'])"} if (-not ($computer.PassCompliance)['PassHistoryCountCompliant']) { $complianceReport += "`nPassHistoryCountCompliant $(($computer.PassCompliance)['PassHistoryCountCompliant'])"} if (-not ($computer.PassCompliance)['PassUnlockoutMinsCompliant']) { $complianceReport += "`nPassUnlockoutMinsCompliant $(($computer.PassCompliance)['PassUnlockoutMinsCompliant'])"} $complianceReport += "`n`n" } #end foreach switch ($pscmdlet.ParameterSetName) { 'Email' { Send-MailMessage -Body $complianceReport -SmtpServer $SMTP -To $To -From [email protected] -Subject "Failed Password Policies" break } #end email Default { $complianceReport } #sends to console in a pretty format. To keep in objects, use Test-PasswordAuditResults } } #end Process End { } } #end Send-PasswordCompliance
ADPolicyAudit.psd1
ADPolicyAudit-1.0.0
# # Module manifest for module 'ADPolicyAudit' # # Generated by: Joshua Castillo # # Generated on: 11/16/2016 # @{ # Script module or binary module file associated with this manifest. RootModule = '.\ADPolicyAudit.psm1' # Version number of this module. ModuleVersion = '1.0' # ID used to uniquely identify this module GUID = '907fd66d-2780-4a15-94a1-c4246c90468c' # Author of this module Author = 'Joshua Castillo' # Company or vendor of this module CompanyName = 'DoesItScript.org' # Copyright statement for this module Copyright = '(c) 2016 Joshua Castillo. All rights reserved.' # Description of the functionality provided by this module Description = 'Module to review infrastructure password policy' # Minimum version of the Windows PowerShell engine required by this module # PowerShellVersion = '' # Name of the Windows PowerShell host required by this module # PowerShellHostName = '' # Minimum version of the Windows PowerShell host required by this module # PowerShellHostVersion = '' # Minimum version of Microsoft .NET Framework required by this module # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module # CLRVersion = '' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module # RequiredModules = @() # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module # TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module # FormatsToProcess = @() # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess # NestedModules = @() # Functions to export from this module FunctionsToExport = '*' # Cmdlets to export from this module CmdletsToExport = '*' # Variables to export from this module VariablesToExport = '*' # Aliases to export from this module AliasesToExport = '*' # DSC resources to export from this module # DscResourcesToExport = @() # List of all modules packaged with this module # ModuleList = @() # List of all files packaged with this module # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. # Tags = @() # A URL to the license for this module. # LicenseUri = '' # A URL to the main website for this project. ProjectUri = 'https://github.com/doesitscript/CodeReview' # A URL to an icon representing this module. # IconUri = '' # ReleaseNotes of this module # ReleaseNotes = '' } # End of PSData hashtable } # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' }
get-adgroupuser.ps1
ADReportingTools-1.4.0
Function Get-ADGroupUser { [cmdletbinding()] [OutputType("ADGroupUser")] Param( [Parameter(Position = 0, Mandatory, HelpMessage = "Enter the name of an Active Directory group.", ValueFromPipelineByPropertyName, ValueFromPipeline)] [string]$Name, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" #set some default parameter values $params = "Credential", "Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #foreach } #begin Process { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting members of $Name" $group = Get-ADGroup -Identity "$($Name)" if ($group) { $members = $group | Get-ADGroupMember -Recursive Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Found $($members.name.count) members in total." #get details about each group member $getParams = @{ properties = 'PasswordLastSet', 'Description', 'Title', 'Displayname', 'Department' Identity = "" } foreach ($member in $members) { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] member is a $($member.objectclass)" $getParams.Identity = $member.distinguishedname <# Not using Get-ADObject because it can't return the passwordLastSet property #> if ($member.objectclass -eq "user") { $grpMember = Get-ADUser @getparams } elseif ($member.objectclass -eq "computer") { $grpMember = Get-ADComputer @getparams } Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] $($grpMember.distinguishedname)" [pscustomobject]@{ PSTypeName = "ADGroupUser" DistinguishedName = $grpMember.DistinguishedName Displayname = $grpMember.Displayname Name = $grpMember.name Title = $grpMember.title Department = $grpMember.Department Description = $grpMember.Description Enabled = $grpMember.Enabled PasswordLastSet = $grpMember.PasswordLastSet Group = $group.DistinguishedName } } #foreach } #if group was found else { Write-Warning "Failed to find an Active Directory group called $Name" } } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end } #close Get-ADGroupUser
get-adsummary.ps1
ADReportingTools-1.4.0
Function Get-ADSummary { [cmdletbinding()] [OutPutType("ADSummary")] Param( [Parameter(Position = 0, HelpMessage = "Specify the domain name. The default is the user domain.")] [ValidateNotNullOrEmpty()] [alias("name")] [string]$Identity = $env:USERDOMAIN, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[BEGIN ] Starting: $($MyInvocation.Mycommand)" if (-Not $PSBoundParameters.ContainsKey("ErrorAction")) { $PSBoundParameters.Add("ErrorAction", "Stop") } } #begin Process { Write-Verbose "[PROCESS] Getting domain information for $Identity" Write-Verbose "[PROCESS] Using these PSBoundParameters: `n$(New-Object psobject -Property $PSBoundParameters | Out-String)" Try { $domain = Get-ADDomain @PSBoundParameters } Catch { Write-Warning $_.Exception.message } if ($domain.name) { Write-Verbose "[PROCESS] Getting forest information for $($domain.forest)" #update PSBoundParameters $PSBoundParameters["Identity"] = $domain.forest Write-Verbose "[PROCESS] Using these PSBoundParameters: `n$(New-Object psobject -Property $PSBoundParameters | Out-String)" Try { $forest = Get-ADForest @PSBoundParameters } Catch { Write-Warning $_.exception.message } #create a custom object [pscustomobject]@{ PSTypeName = "ADSummary" Domain = $domain.DNSRoot Forest = $forest.name RootDomain = $forest.RootDomain Domains = $forest.Domains DomainControllers = $domain.ReplicaDirectoryServers DomainMode = $domain.DomainMode ForestMode = $forest.ForestMode GlobalCatalogs = $forest.GlobalCatalogs SiteCount = $forest.sites.count } } #if domain name } #process End { Write-Verbose "[END ] Ending: $($MyInvocation.Mycommand)" } #end } #close Get-ADSummary
get-adbackupstatus.ps1
ADReportingTools-1.4.0
<# [/u:{domain\user}] [/pw:{password|*}] $b =repadmin /showbackup dom2 | where {$_} | Select -skip 2 $b[1].trim() -split "\s+" LocalUSN 8509 OriginatingDSA 5b0e0bf7-dd47-4ef8-b6ed-49158f613bca OriginatingUSN 13777 Date 2021-01-25 Time 14:27:01 Version 1 Attribute dSASignature #> Function Get-ADBackupStatus { [cmdletbinding()] Param( [Parameter(Position = 0, Mandatory, HelpMessage = "Specify the name of a domain controller")] [string[]]$DomainController, [Parameter(HelpMessage = "Specify an alternate credential")] [pscredential]$Credential ) Write-Verbose "Starting $($MyInvocation.MyCommand)" $splat = @{ ErrorAction = "Stop" ScriptBlock = { repadmin /showbackup | Where-Object { $_ } | Select-Object -Skip 3 } Computername = "" } if ($credential.username) { Write-Verbose "Using alternate credential for $($credential.UserName)" $splat.Add("Credential",$Credential) } foreach ($dc in $DomainController) { Write-Verbose "Querying $($dc.ToUpper())" Try { $splat["Computername"] = $dc $data = Invoke-Command @splat If ($data) { $fqdn = _toTitleCase (_getDNSName $dc) Write-Verbose "Parsing readmin.exe results" for ($i = 0; $i -lt $data.count; $i += 2) { Write-Verbose "Partition: $($data[$i])" Write-Verbose "Splitting: $(($data[$i + 1]).trim())" $details = $data[$i + 1].trim() -split "\s+" $info = [PSCustomObject]@{ PSTypeName = "ADBackupStatus" Partition = $data[$i] LocalUSN = $details[0] OriginatingDSA = $details[1] OriginatingUSN = $details[2] Date = "$($details[3]) $($details[4])" -as [datetime] Version = $details[5] Signature = $details[6] DomainController = $fqdn } $Info } #for } } Catch { $_ } } #foreach DC Write-Verbose "Ending $($MyInvocation.MyCommand)" } Update-TypeData -TypeName ADBackupStatus -MemberType ScriptProperty -MemberName Age -Value {New-TimeSpan -start $this.date -end (Get-Date)} -force
ADReportingTools.psd1
ADReportingTools-1.4.0
# # Module manifest for module 'ADReportingTools' # @{ # Script module or binary module file associated with this manifest. RootModule = 'ADReportingTools.psm1' # Version number of this module. ModuleVersion = '1.4.0' # Supported PSEditions CompatiblePSEditions = @("Desktop","Core") # ID used to uniquely identify this module GUID = '1e812b1f-dbe7-4d21-b4ea-7aff65d854ba' # Author of this module Author = 'Jeff Hicks' # Company or vendor of this module CompanyName = 'JDH Information Technology Solutions, Inc.' # Copyright statement for this module Copyright = '(c)2021 JDH Information Technology Solutions, Inc.' # Description of the functionality provided by this module Description = 'A set of PowerShell commands to gather information and create reports from Active Directory.' # Minimum version of the PowerShell engine required by this module PowerShellVersion = '5.1' # Minimum version of the PowerShell host required by this module PowerShellHostVersion = '5.1' # Modules that must be imported into the global environment prior to importing this module RequiredModules = @("ThreadJob") # Type files (.ps1xml) to be loaded when importing this module TypesToProcess = @( 'types\aduser.types.ps1xml', 'types\adgroupreport.types.ps1xml' ) # Format files (.ps1xml) to be loaded when importing this module FormatsToProcess = @( 'formats\adaudittrail.format.ps1xml', 'formats\adfsmorole.format.ps1xml', 'formats\adsitesummary.format.ps1xml', 'formats\adgroupuser.format.ps1xml', 'formats\adbranchmember.format.ps1xml', 'formats\adsummary.format.ps1xml', 'formats\addchealth.format.ps1xml', 'formats\adreportingtool.format.ps1xml', 'formats\aduser.format.ps1xml', 'formats\adgroup.format.ps1xml', 'formats\adgroupreport.format.ps1xml', 'formats\addepartmentmember.format.ps1xml', 'formats\adcomputerreport.format.ps1xml', 'formats\adntds.format.ps1xml', 'formats\adbackup.format.ps1xml', 'formats\admanager.format.ps1xml' ) # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = 'Show-DomainTree','Get-ADUserAudit','Get-ADSummary','Get-ADFSMO','Get-ADSiteSummary','Get-ADSiteDetail', 'Get-ADGroupUser','Get-ADBranch','Get-ADDomainControllerHealth','New-ADDomainReport','Get-ADReportingTools','Get-ADCanonicalUser', 'Get-ADUserCategory','Get-ADGroupReport','Split-DistinguishedName','New-ADChangeReport', 'Get-ADReportingToolsOptions','Set-ADReportingToolsOptions','Get-ADDepartment','Get-ADComputerReport', 'Get-NTDSInfo', 'Get-ADBackupStatus','Open-ADReportingToolsHelp','New-ADGroupReport','Get-ADManager' # Variables to export from this module VariablesToExport = 'ADUserReportingConfiguration','ADReportingToolsOptions','ADReportingDepartments' # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. AliasesToExport = 'dt','fsmo','Get-ADCnUser','Parse-DN' # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. Tags = @("ActiveDirectory","html","reporting") # A URL to the license for this module. LicenseUri = 'https://github.com/jdhitsolutions/ADReportingTools/blob/main/LICENSE.txt' # A URL to the main website for this project. ProjectUri = 'https://github.com/jdhitsolutions/ADReportingTools' # A URL to an icon representing this module. IconUri = 'https://raw.githubusercontent.com/jdhitsolutions/ADReportingTools/main/images/2PopulatedDomain01.png' # ReleaseNotes of this module ReleaseNotes = 'See the changelog at https://github.com/jdhitsolutions/ADReportingTools/blob/main/Changelog.md' # Prerelease string of this module # Prerelease = '' # Flag to indicate whether the module requires explicit user acceptance for install/update/save RequireLicenseAcceptance = $false # External dependent modules of this module ExternalModuleDependencies = @("ActiveDirectory","DNSClient") } # End of PSData hashtable } # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' }
get-adcanonicaluser.ps1
ADReportingTools-1.4.0
Function Get-ADCanonicalUser { [cmdletbinding()] [OutputType("Microsoft.ActiveDirectory.Management.ADUser")] [Alias("Get-ADCNUser")] Param( [Parameter(Position = 0, Mandatory, ValueFromPipeline, HelpMessage = "Enter the username in the form domain\username.")] [ValidatePattern('^\S+\\\S+$')] [string]$Name, [Parameter(HelpMessage = "Enter one or more user properties or * to select everything.")] [string[]]$Properties, [Parameter(HelpMessage = "Search deleted objects if the user account can't be found.")] [switch]$IncludeDeletedObjects, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" #set some default parameter values $params = "Credential", "Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #foreach $get = @{ ErrorAction = "Stop" Identity = "" } if ($Properties) { $get.Add("Properties", $properties) } } #begin Process { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting the AD user account for $Name" $sam = $Name.split("\")[1] $get["Identity"] = $sam Try { Get-ADUser @get } Catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] { if ($IncludeDeletedObjects) { #check for a deleted user account Try { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Searching for deleted objects" $get.remove("Identity") $get["filter"] = "samaccountname -eq '$sam'" $user = Get-ADObject @get -IncludeDeletedObjects $get.remove("filter") If ($user) { $user } else { Write-Warning "Failed to find a user account called $Name." } } Catch { Write-Warning $_.exception.message } } else { Write-Warning "Failed to find a user account called $Name." } } Catch { #all other errors from Get-ADUser Write-Warning $_.exception.message } } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end } #close Get-ADCanonicalUser
get-adcomputerreport.ps1
ADReportingTools-1.4.0
Function Get-ADComputerReport { [cmdletbinding()] [OutputType("ADComputerInfo")] Param ( [parameter(Position = 0, HelpMessage = "Enter an AD computer identity. Wildcard are allowed.", ValueFromPipeline)] [validatenotnullorEmpty()] [string]$Name = "*", [Parameter(HelpMessage = "Filter by the operating system")] [ValidateSet("Any", "Server", "Desktop")] [string]$Category = "Any", [Parameter(HelpMessage = "Filter by location")] [ArgumentCompleter( { (Get-ADSiteSummary).subnetLocation })] [ValidateNotNullOrEmpty()] [string]$Location, [Parameter(HelpMessage = "Enter the distinguished name of the top-level container or organizational unit.")] [string]$SearchBase, [Parameter(HelpMessage = "Specify a domain controller to query for a list of domain controllers.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential. This will be used to query the domain and all domain controllers.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" $properties = "DNSHostname", "OperatingSystem", "LastLogonDate", "Created", "Modified", "Location", "Description", "IPv4Address", "Enabled", "ManagedBy" [void]$PSBoundParameters.Add("Properties", $Properties) [void]$PSBoundParameters.Remove("Category") [void]$PSBoundParameters.Remove("location") $results = [System.Collections.Generic.list[object]]::new() } #begin Process { [void]$PSBoundParameters.Remove("Name") $filter = "name -like '$Name'" if ($Category -eq "server") { $filter += " -AND OperatingSystem -like '*Server*'" } elseif ($category -eq 'Desktop') { $filter += " -AND OperatingSystem -notlike '*Server*'" } if ($Location) { $filter += " -AND Location -eq '$location'" } Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Searching with filter $filter" $PSBoundParameters.Add("filter", $filter) $computers = Get-ADComputer @PSBoundParameters if ($computers) { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Found $(($computers | Measure-Object).count) computer(s)" foreach ($computer in $computers) { #create a custom object $r = [PSCustomObject]@{ PSTypeName = "ADComputerInfo" Name = $Computer.name DNSHostname = $computer.DNSHostname Description = $computer.Description OperatingSystem = $computer.OperatingSystem IsServer = $computer.OperatingSystem -match "Server" Location = $computer.Location LastLogonDate = $computer.LastLogonDate IPAddress = $computer.IPv4Address Created = $computer.Created Modified = $computer.Modified Enabled = $computer.Enabled ManagedBy = $computer.ManagedBy DistinguishedName = $computer.DistinguishedName } $results.add($r) } #foreach computer #sort results and write to the pipeline $results | Sort-Object -Property DistinguishedName } #if computers } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end }
ADChangeReport.ps1
ADReportingTools-1.4.0
# An earlier version was first described at https://jdhitsolutions.com/blog/powershell/8087/an-active-directory-change-report-from-powershell/ #Reporting on deleted items requires the Active Directory Recycle Bin feature Function New-ADChangeReport { [cmdletbinding()] [outputtype("System.IO.FileInfo")] Param( [Parameter(Position = 0, HelpMessage = "Enter a last modified datetime for AD objects. The default is the last 4 hours.")] [ValidateNotNullOrEmpty()] [datetime]$Since = ((Get-Date).AddHours(-4)), [Parameter(HelpMessage = "What is the report title?")] [string]$ReportTitle = "Active Directory Change Report", [Parameter(HelpMessage = "Specify the path to an image file to use as a logo in the report.")] [ValidateScript( { Test-Path $_ })] [string]$Logo, [Parameter(HelpMessage = "Specify the path to the CSS file. If you don't specify one, the default module file will be used.")] [ValidateScript( { Test-Path $_ })] [string]$CSSUri = "$PSScriptRoot\..\reports\changereport.css", [Parameter(HelpMessage = "Embed the CSS file into the HTML document head. You can only embed from a file, not a URL.")] [switch]$EmbedCSS, [Parameter(HelpMessage = "Add a second grouping based on the object's container or OU.")] [switch]$ByContainer, [Parameter(HelpMessage = "Specify the path for the output file.")] [ValidateNotNullOrEmpty()] [string]$Path = ".\ADChangeReport.html", [Parameter(HelpMessage = "Specifies the Active Directory Domain Services domain controller to query. The default is your Logon server.")] [ValidateNotNullOrEmpty()] [string]$Server = $env:LOGONSERVER.Substring(2), [Parameter(HelpMessage = "Specify an alternate credential for authentication.")] [pscredential]$Credential, [ValidateSet("Negotiate", "Basic")] [string]$AuthType ) Begin { Write-Verbose "[$(Get-Date)] Starting $($myinvocation.MyCommand)" #some report metadata $reportVersion = (Get-Module ADReportingTools).Version.toString() $thisScript = $($myinvocation.MyCommand) Write-Verbose "[$(Get-Date)] Detected these bound parameters" $PSBoundParameters | Out-String | Write-Verbose #set some default parameter values $params = "Credential", "AuthType","Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$(Get-Date)] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #who is running the report? if ($Credential) { $who = $Credential.UserName } else { $who = "$($env:USERDOMAIN)\$($env:USERNAME)" } #where are they running the report from? Try { #disable verbose output from Resolve-DNSName $where = (Resolve-DnsName -Name $env:COMPUTERNAME -Type A -ErrorAction Stop -Verbose:$False).Name | Select-Object -Last 1 } Catch { $where = $env:COMPUTERNAME } #What Domain controller was queried? $dc = (Resolve-DnsName -Name $server -Type A | Select-Object -first 1).Name.ToUpper() #text to display in the report $content = @" <br/>Active Directory changes since $since as reported from domain controller $($Server.toUpper()). Replication-only changes may be included in this report. You will need to view event logs for more detail about these changes, including who made the change. "@ #a footer for the report. This could be styled with CSS $post = @" <table class='footer'> <tr align = "right"><td>Report run: <i>$(Get-Date)</i></td></tr> <tr align = "right"><td>Report version: <i>$ReportVersion</i></td></tr> <tr align = "right"><td>Source: <i>$thisScript</i></td></tr> <tr align = "right"><td>Author: <i>$($Who.toUpper())</i></td></tr> <tr align = "right"><td>Computername: <i>$($where.toUpper())</i></td></tr> <tr align = "right"><td>DomainController: <i>$dc</i></td></tr> </table> "@ #my default head $head = @" <Title>$ReportTitle</Title> <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'> </script> <script type='text/javascript'> function toggleDiv(divId) { `$("#"+divId).toggle(); } function toggleAll() { var divs = document.getElementsByTagName('div'); for (var i = 0; i < divs.length; i++) { var div = divs[i]; `$("#"+div.id).toggle(); } } </script> "@ $htmlParams = @{ Head = $head Precontent = $content Body = "" PostContent = $post } If ($EmbedCSS) { if (Test-Path -Path $CSSUri) { Write-Verbose "[$(Get-Date)] Embedding CSS content from $CSSUri" $cssContent = Get-Content -Path $CSSUri | Where-Object { $_ -notmatch "^@" } $head += @" <style> $cssContent </style> "@ } else { Write-Error "Failed to find a CSS file at $CSSUri. You can only embed from a file." #bail out Write-Verbose "[$(Get-Date)] Ending $($myinvocation.mycommand)" return } } else { Write-Verbose "[$(Get-Date)] Adding CSSPath $CSSUri" $htmlParams.Add("CSSUri", $CSSUri) } #create a list object to hold all of the HTML fragments Write-Verbose "[$(Get-Date)] Initializing fragment list" $fragments = [System.Collections.Generic.list[string]]::New() if ($Logo) { #need to use full path $imagefile = Convert-Path -Path $logo Write-Verbose "[$(Get-Date)] Using logo file $imagefile" #encode the graphic file to embed into the HTML $ImageBits = [Convert]::ToBase64String((Get-Content $imagefile -Encoding Byte)) $ImageHTML = "<img alt='logo' class='center' src=data:image/png;base64,$($ImageBits)/>" $top = @" <table class='header'> <tr> <td>$imageHTML</td> <td><H1>$ReportTitle</H1></td> </tr> </table> "@ $fragments.Add($top) } else { $fragments.Add("<H1>$ReportTitle</H1>") } $fragments.Add("<a href='javascript:toggleAll();' title='Click to toggle all sections'>+|-</a>") Write-Verbose "[$(Get-Date)] Getting current Active Directory domain" $domain = Get-ADDomain $fragments.Add("<H2>$($domain.dnsroot)</H2>") } #begin Process { Write-Verbose "[$(Get-Date)] Querying $($domain.dnsroot)" $filter = { (objectclass -eq 'user' -or objectclass -eq 'group' -or objectclass -eq 'organizationalunit' ) -AND (WhenChanged -gt $since ) } Write-Verbose "[$(Get-Date)] Filtering for changed objects since $since" $items = Get-ADObject -Filter $filter -IncludeDeletedObjects -Properties WhenCreated, WhenChanged, IsDeleted -OutVariable all | Group-Object -Property objectclass Write-Verbose "[$(Get-Date)] Found $($all.count) total items" if ($items.count -gt 0) { foreach ($item in $items) { $category = "{0}{1}" -f $item.name[0].ToString().toUpper(), $item.name.Substring(1) Write-Verbose "[$(Get-Date)] Processing $category [$($item.count)]" if ($ByContainer) { Write-Verbose "[$(Get-Date)] Organizing by container" $subgroup = $item.group | Group-Object -Property { $_.distinguishedname.split(',', 2)[1] } | Sort-Object -Property Name $fraghtml = [System.Collections.Generic.list[string]]::new() foreach ($subitem in $subgroup) { Write-Verbose "[$(Get-Date)] $($subItem.name)" $fragGroup = _convertObjects $subitem.group $divid = $subitem.name -replace "=|,", "" $fraghtml.Add($(_inserttoggle -Text "$($subItem.name) [$($subitem.count)]" -div $divid -Heading "H4" -Data $fragGroup -NoConvert)) } #foreach subitem } #if by container else { Write-Verbose "[$(Get-Date)] Organizing by distinguishedname" $fragHtml = _convertObjects $item.group } $code = _insertToggle -Text "$category [$($item.count)]" -div $category -Heading "H3" -Data $fragHtml -NoConvert $fragments.Add($code) } #foreach item Write-Verbose "[$(Get-Date)] Creating report $ReportTitle version $reportversion saved to $path" $htmlParams.Body = $fragments | Out-String ConvertTo-Html @htmlParams | Out-File -FilePath $Path Get-Item -Path $Path } else { Write-Warning "No modified objects found in the $($domain.dnsroot) domain since $since." } } #process End { Write-Verbose "[$(Get-Date)] Ending $($myinvocation.MyCommand)" } } #close function
get-adlog.ps1
ADReportingTools-1.4.0
#an earlier version of this function can be found at https://gist.github.com/jdhitsolutions/a4e6291741ec95e3bfe53f15a380da47 <# you might need to increase the size of the Security eventlog limit-eventlog -LogName security -ComputerName dom2,dom1 -MaximumSize 1024MB #> Function Get-ADUserAudit { [cmdletbinding()] Param( [Parameter(Position = 0, HelpMessage = "Specify one or more domain controllers to query.")] [ValidateNotNullOrEmpty()] [string[]]$DomainController = (Get-ADDomain).ReplicaDirectoryServers, [Parameter(HelpMessage = "Find all matching user management events since what date and time?")] [Datetime]$Since = (Get-Date).Addhours(-24), [Parameter(HelpMessage = "Select one or more user account events")] [ValidateNotNullOrEmpty()] [ValidateSet("Created", "Deleted", "Enabled", "Disabled", "Changed")] [string[]]$Events = "Created", [Parameter(HelpMessage = "Specify an alterate credential")] [PSCredential]$Credential ) Function _getNames { # a private helper function to parse out names from the eventlog message [cmdletbinding()] Param( [Parameter(Mandatory, ValueFromPipeline)] [System.Diagnostics.Eventing.Reader.EventLogRecord]$Data ) Process { #convert the record to XML which makes it easier to parse [xml]$r = $data.toxml() #Target is the user account #Subject is the admin who performed the operation $target = "{0}\{1}" -f ($r.Event.EventData.Data.Where( { $_.name -eq 'TargetDomainName' }).'#text'), ($r.Event.EventData.Data.Where( { $_.name -eq 'TargetUserName' }).'#text') $admin = "{0}\{1}" -f ($r.Event.EventData.Data.Where( { $_.name -eq 'SubjectDomainName' }).'#text'), ($r.Event.EventData.Data.Where( { $_.name -eq 'SubjectUserName' }).'#text') [pscustomobject]@{ Target = $target Administrator = $admin TimeCreated = $data.timeCreated } } #process } # close _getNames # a hashtable of user management event IDs for the Security event log $ADEvent = @{ UserChanged = 4738 UserCreated = 4720 UserDeleted = 4726 UserEnabled = 4722 UserDisabled = 4725 } $EventIDs = @() Switch ($events) { "Created" { $EventIDs += $adevent.getenumerator().Where( { $_.name -match "created" }) } "Deleted" { $eventIDs += $adevent.getenumerator().Where( { $_.name -match "deleted" }) } "Enabled" { $eventIDs += $adevent.getenumerator().Where( { $_.name -match "enabled" }) } "Disabled" { $eventIDs += $adevent.getenumerator().Where( { $_.name -match "disabled" }) } "Changed" { $eventIDs += $adevent.getenumerator().Where( { $_.name -match "changed" }) } } #this hashtable filter will be used by Get-WinEvent $filter = @{LogName = 'Security'; ID = 0; StartTime = $Since } #parameters to eventually splat to Get-WinEvent $getParams = @{ ErrorAction = "Stop" FilterHashtable = $filter Computername = "" } if ($Credential.UserName) { $getParams.add("Credential", $Credential) } Write-Verbose "Searching for AD log entries since $since" #Searching the Security event log on each domain controller foreach ($dc in $DomainController) { Write-Verbose "Processing $dc" foreach ($evt in $eventIDs) { $filter.ID = $evt.value $getParams.FilterHashtable = $filter $getParams.Computername = $DC Write-Verbose "...Looking for $($evt.name) events" Try { $logs = Get-WinEvent @getParams Write-Verbose "Found $($logs.count) log records" } Catch { Write-Warning "No matching $($evt.name) events $since found on $dc." } if ($logs.count -gt 0) { $names = $logs | _getnames $targets = ($names | Select-Object -Property Target -Unique).target $admins = ($names | Select-Object -Property Administrator -Unique).administrator [pscustomobject]@{ PSTypeName = "ADAuditTrail" DomainController = $dc ID = $evt.Value EventType = $evt.Name LogCount = $logs.count Since = $Since Targets = $targets Administrators = $admins } Remove-Variable -Name logs } } } } #close function Update-TypeData -TypeName ADAuditTrail -MemberType ScriptProperty -MemberName TargetCount -Value { $($this.targets).count } -Force
ADReportingTools.psm1
ADReportingTools-1.4.0
# dot source functions Get-ChildItem -Path $PSScriptRoot\Functions\*.ps1 | ForEach-Object { . $_.FullName } #region format and type updates Update-TypeData -TypeName ADBranchMember -MemberType AliasProperty -MemberName DN -Value DistinguishedName -Force Update-TypeData -TypeName "ADDomainControllerHealth" -MemberType ScriptProperty -MemberName "ServiceAlert" -Value { $list = "Stopped", "StartPending", "StopPending", "ContinuePending", "PausePending", "Paused" if ($this.services.state.where( { $list -contains $_ })) { $True } Else { $False } } -Force #endregion #region define module variables $ADUserReportingConfiguration = Get-Content $PSScriptRoot\configurations\aduser-categories.json | ConvertFrom-Json #use $([char]0x1b) because it will work in Windows PowerShell and PowerShell 7. $ADReportingToolsOptions = [ordered]@{ Note = "Use Get-ADReportingToolsOptions and Set-ADReportingToolsOptions" DistributionList = "$([char]0x1b)[92m" Alert = "$([char]0x1b)[91m" Warning = "$([char]0x1b)[38;5;220m" Universal = "$([char]0x1b)[38;5;170m" DomainLocal = "$([char]0x1b)[38;5;191m" Other = "$([char]0x1b)[38;5;212m" Protected = "$([char]0x1b)[38;5;199m" Container = "$([char]0x1b)[38;5;1456m" OrganizationalUnit = "$([char]0x1b)[38;5;191m" DomainDNS = "$([char]0x1b)[1;4;38;5;227m" UserClass = "$([char]0x1b)[30;104m" GroupClass = "$([char]0x1b)[30;48;5;94m" ComputerClass = "$([char]0x1b)[30;48;5;50m" IsDC = "$([char]0x1b)[38;5;155m" IsServer = "$([char]0x1b)[38;5;50m" Reset = "$([char]0x1b)[0m" } #endregion #region import runspace #launch a runspace to gather department information in the background $newRunspace = [RunspaceFactory]::CreateRunspace() $newRunspace.ApartmentState = "STA" $newRunspace.ThreadOptions = "ReuseThread" [void]$newRunspace.Open() $Global:ADReportingHash = [hashtable]::Synchronized(@{ Note = "This hashtable is used by the ADReportingTools module. Do not delete." Departments = @() DomainControllers = @() BackupLimit = 3 } ) $newRunspace.SessionStateProxy.SetVariable("ADReportingHash", $ADReportingHash) $psCmd = [PowerShell]::Create() [void]$pscmd.AddScript( { #this code will run in the background upon module import. Values will populate #the synchronized hashtable. $global:ADReportingHash.Departments = Get-ADUser -Filter "Department -like '*'" -Properties Department | Select-Object -ExpandProperty Department -Unique | Sort-Object $global:ADReportingHash.DomainControllers = (Get-ADDomain).ReplicaDirectoryServers #simulate a large environment for testing purposes #Start-Sleep -Seconds 30 $global:ADReportingHash.Add("LastUpdated", (Get-Date)) }) $psCmd.Runspace = $newRunspace $handle = $psCmd.BeginInvoke() $ADReportingHash.Add("Handle", $handle) #start a job to clean up the runspace after it closes [void](Start-ThreadJob -ScriptBlock { param($handle, $ps, $sleep) Write-Host "[$(Get-Date)] Sleeping in $sleep second loops" Write-Host "Watching this runspace" Write-Host ($ps.runspace | Out-String) do { Start-Sleep -Seconds $sleep } Until ($handle.IsCompleted) Write-Host "[$(Get-Date)] Closing runspace" $ps.runspace.close() Write-Host "[$(Get-Date)] Disposing runspace" $ps.runspace.Dispose() Write-Host "[$(Get-Date)] Disposing PowerShell" $ps.dispose() Write-Host "[$(Get-Date)] Ending job" } -ArgumentList $handle, $pscmd, 10) #endregion #region Other Register-ArgumentCompleter -CommandName Get-ADDepartment -ParameterName Department -ScriptBlock { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $global:ADReportingHash.Departments | Where-Object { $_ -like "$WordToComplete*" } | ForEach-Object { # completion text,listitem text,result type,Tooltip [System.Management.Automation.CompletionResult]::new("'$_'", $_, 'ParameterValue', $_) } } #Add auto complete for SERVER parameter to these commands $cmds = 'Get-ADBranch', 'Get-ADCanonicalUser', 'Get-ADComputerReport', 'Get-ADDepartment', 'Get-ADDomainControllerHealth', 'Get-ADFSMO', 'Get-ADGroupR eport', 'Get-ADGroupUser', 'Get-ADSiteDetail', 'Get-ADSiteSummary', 'Get-ADSummary', 'Get-ADUserCategory', 'New-ADChangeReport', 'New-ADDomain Report', 'New-ADGroupReport', 'Show-DomainTree', 'Get-ADAccountAuthorizationGroup', 'Get-ADAccountResultantPasswordReplicationPolicy', 'Get- ADAuthenticationPolicy', 'Get-ADAuthenticationPolicySilo', 'Get-ADCentralAccessPolicy', 'Get-ADCentralAccessRule', 'Get-ADClaimTransformPol icy', 'Get-ADClaimType', 'Get-ADComputer', 'Get-ADComputerServiceAccount', 'Get-ADDefaultDomainPasswordPolicy', 'Get-ADDomain', 'Get-ADDomain Controller', 'Get-ADDomainControllerPasswordReplicationPolicy', 'Get-ADDomainControllerPasswordReplicationPolicyUsage', 'Get-ADFineGrained PasswordPolicy', 'Get-ADFineGrainedPasswordPolicySubject', 'Get-ADForest', 'Get-ADGroup', 'Get-ADGroupMember', 'Get-ADObject', 'Get-ADOptiona lFeature', 'Get-ADOrganizationalUnit', 'Get-ADPrincipalGroupMembership', 'Get-ADReplicationAttributeMetadata', 'Get-ADReplicationConnection ', 'Get-ADReplicationQueueOperation', 'Get-ADReplicationSite', 'Get-ADReplicationSiteLink', 'Get-ADReplicationSiteLinkBridge', 'Get-ADReplic ationSubnet', 'Get-ADResourceProperty', 'Get-ADResourcePropertyList', 'Get-ADResourcePropertyValueType', 'Get-ADRootDSE', 'Get-ADServiceAcco unt', 'Get-ADTrust', 'Get-ADUser', 'Get-ADUserResultantPasswordPolicy' foreach ($cmd in $cmds) { Register-ArgumentCompleter -CommandName $cmd -ParameterName Server -ScriptBlock { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $global:ADReportingHash.DomainControllers | Where-Object { $_ -like "$WordToComplete*" } | ForEach-Object { # completion text,listitem text,result type,Tooltip [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } } $FunctionsToExport = 'Show-DomainTree','Get-ADUserAudit','Get-ADSummary','Get-ADFSMO','Get-ADSiteSummary','Get-ADSiteDetail', 'Get-ADGroupUser','Get-ADBranch','Get-ADDomainControllerHealth','New-ADDomainReport','Get-ADReportingTools','Get-ADCanonicalUser', 'Get-ADUserCategory','Get-ADGroupReport','Split-DistinguishedName','New-ADChangeReport', 'Get-ADReportingToolsOptions','Set-ADReportingToolsOptions','Get-ADDepartment','Get-ADComputerReport', 'Get-NTDSInfo', 'Get-ADBackupStatus','Open-ADReportingToolsHelp','New-ADGroupReport','Get-ADManager' Export-ModuleMember -function $FunctionsToExport -Variable ADUserReportingConfiguration, ADReportingToolsOptions, ADReportingDepartments #endregion
new-adgroupreport.ps1
ADReportingTools-1.4.0
Function New-ADGroupReport { [cmdletbinding()] [outputtype("System.IO.File")] Param ( [parameter(Position = 0, HelpMessage = "Enter an AD Group name. Wildcards are allowed.")] [validatenotnullorEmpty()] [string]$Name = "*", [Parameter(HelpMessage = "Enter the distinguished name of the top-level container or organizational unit.")] [ValidateScript( { $testDN = $_ Try { [void](Get-ADObject -Identity $_ -ErrorAction Stop) $True } Catch { Write-Warning "Failed to verify $TestDN as a valid searchbase." Throw $_.Exception.message $False } })] [string]$SearchBase, [Parameter(HelpMessage = "Filter on the group category")] [ValidateSet("All", "Distribution", "Security")] [string]$Category = "All", [Parameter(HelpMessage = "Filter on group scope")] [ValidateSet("Any", "DomainLocal", "Global", "Universal")] [string]$Scope = "Any", [Parameter(HelpMessage = "Exclude BuiltIn and Users")] [switch]$ExcludeBuiltIn, [Parameter(Mandatory, HelpMessage = "Specify the output HTML file.")] [ValidateScript( { #validate the parent folder Test-Path (Split-Path $_) })] [string]$FilePath, [Parameter(HelpMessage = "Enter the name of the report to be displayed in the web browser")] [ValidateNotNullOrEmpty()] [string]$ReportTitle = "AD Group Report", [Parameter(HelpMessage = "Specify the path the CSS file. If you don't specify one, the default module file will be used.")] [ValidateScript( { Test-Path $_ })] [string]$CSSUri = "$PSScriptRoot\..\reports\groupreport.css", [Parameter(HelpMessage = "Embed the CSS file into the HTML document head. You can only embed from a file, not a URL.")] [switch]$EmbedCSS, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Write-Verbose "[$((Get-Date).TimeofDay)] Starting $($myinvocation.mycommand)" #set some default parameter values $params = "Credential", "Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$((Get-Date).TimeofDay)] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #foreach #region report metadata $cmd = Get-Command $myinvocation.InvocationName $thisScript = "{0}\{1}" -f $cmd.source, $cmd.name $reportVersion = ( $cmd).version.tostring() #who is running the report? if ($Credential.Username) { $who = $Credential.UserName } else { $who = "$($env:USERDOMAIN)\$($env:USERNAME)" } #where are they running the report from? Try { #disable verbose output from Resolve-DNSName $where = (Resolve-DnsName -Name $env:COMPUTERNAME -Type A -ErrorAction Stop -Verbose:$False).Name | Select-Object -Last 1 } Catch { $where = $env:COMPUTERNAME } $post = @" <table class='footer'> <tr align = "right"><td>Report run: <i>$(Get-Date)</i></td></tr> <tr align = "right"><td>Author: <i>$($Who.toUpper())</i></td></tr> <tr align = "right"><td>Source: <i>$thisScript</i></td></tr> <tr align = "right"><td>Version: <i>$ReportVersion</i></td></tr> <tr align = "right"><td>Computername: <i>$($where.toUpper())</i></td></tr> </table> "@ #endregion #region HTML setup $head = @" <title>$ReportTitle</Title> <style> td[tip]:hover { color: #2112f1cc; position: relative; } td[tip]:hover:after { content: attr(tip); left: 0; top: 100%; margin-left: 80px; margin-top: 10px; width: 400px; padding: 3px 8px; position: absolute; color: #111111; font-family: 'Courier New', Courier, monospace; font-size: 10pt; background-color: #dcdc0d; white-space: pre-wrap; } th.dn { width:40%; } </style> <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'> </script> <script type='text/javascript'> function toggleDiv(divId) { `$("#"+divId).toggle(); } function toggleAll() { var divs = document.getElementsByTagName('div'); for (var i = 0; i < divs.length; i++) { var div = divs[i]; `$("#"+div.id).toggle(); } } </script> "@ #parameters to splat to ConvertTo-Html $cHtml = @{ Head = $head Body = "" PostContent = $post } If ($EmbedCSS) { if (Test-Path -Path $CSSUri) { Write-Verbose "[$((Get-Date).TimeofDay)] Embedding CSS content from $CSSUri" $cssContent = Get-Content -Path $CSSUri | Where-Object { $_ -notmatch "^@" } $head += @" <style> $cssContent </style> "@ #update the hashtable $cHtml.Head = $head } else { Write-Error "Failed to find a CSS file at $CSSUri. You can only embed from a file." #bail out Write-Verbose "[$((Get-Date).TimeofDay)] Ending $($myinvocation.mycommand)" return } } #if embedCSS else { $cHtml.add("CSSUri", $CSSUri) } #endregion #region get group data $splat = @{ ErrorAction = "Stop" Name = $Name Scope = $Scope Category = $Category ExcludeBuiltIn = $ExcludeBuiltIn } if ($SearchBase) { $splat.Add("SearchBase", $SearchBase) } Try { $data = Get-ADGroupReport @splat | Sort-Object -Property Branch, Name } Catch { Throw $_ } #endregion #region format data if ($data) { Write-Verbose "[$((Get-Date).TimeofDay)] Processing $($data.name.count) groups." #get domain root Try { Write-Verbose "[$((Get-Date).TimeofDay)] Getting domain root." $root = Get-ADDomain -ErrorAction stop } Catch { Write-Warning "Failed to get domain information. $($_.Exception.message)" Write-Verbose "[$((Get-Date).TimeofDay)] Ending $($myinvocation.mycommand)" #bail out return } Write-Verbose "[$((Get-Date).TimeofDay)] Creating HTML" $Fragments = [System.Collections.Generic.List[string]]::new() $fragments.Add("<H1>$($root.dnsroot)</H1>") $fragments.Add("<H1>Group Membership Report</H1>") #show report parameters $splat.Remove("ErrorAction") if ($PSBoundParameters.ContainsKey("Server")) { $splat.Add("Server",$server) } $fragments.Add("<a href='javascript:toggleAll();' title='Click to toggle all group sections'>+/-</a>") $Fragments.Add("<br><H3>Report Parameters</H3>") $fragments.Add( $([pscustomobject]$splat | ConvertTo-Html -as List -Fragment )) ForEach ($group in $data) { Write-Verbose "[$((Get-Date).TimeofDay)] Processing group $($group.distinguishedname)" $fragGroup = [System.Collections.Generic.List[string]]::new() $div = $group.DistinguishedName -replace "\W", "" $heading = $group.DistinguishedName [xml]$html = $group | Select-Object -Property Name, Category, Scope, Description, Created, Modified | ConvertTo-Html -As table -Fragment for ($i = 1; $i -le $html.table.tr.count - 1; $i++) { $pop1 = $html.CreateAttribute("tip") $pop1.Value = "Managed by: $($group.ManagedBy)" [void]($html.table.tr[$i].ChildNodes[0].Attributes.append($pop1)) $pop2 = $html.CreateAttribute("tip") $pop2.Value = "Age: $($group.age)" [void]($html.table.tr[$i].ChildNodes[5].Attributes.append($pop2)) } #add members $fragGroup.Add($html.InnerXml) if ($group.members.count -gt 0) { $fragGroup.Add("<H3>Members</H3>") [xml]$html = $group.members | Select-Object -Property DistinguishedName, Name, Description, Enabled | ConvertTo-Html -Fragment -As Table #insert class to set first column width $th = $html.CreateAttribute("class") $th.Value = "dn" [void]($html.table.tr[0].childnodes[0].attributes.append($th)) #process member HTML daa for ($i = 1; $i -le $html.table.tr.count - 1; $i++) { $dn = $html.table.tr[$i].ChildNodes[0]."#text" $pop = $html.CreateAttribute("tip") $pop.value = (_getPopData -Identity $dn | Format-List | Out-String).Trim() [void]($html.table.tr[$i].ChildNodes[0].Attributes.append($pop)) if ($html.table.tr[$i].ChildNodes[3].'#text' -eq 'False') { #flag the account as disabled Write-Verbose "[$((Get-Date).TimeofDay)] Flagging $dn as disabled" $class = $html.CreateAttribute("class") $class.value = "alert" [void]$html.table.tr[$i].Attributes.Append($class) } } $fragGroup.Add($html.InnerXml) } else { $fragGroup.Add("<H3 class='alert'>No Members</H3>") } $H = _inserttoggle -Text $heading -div $div -Heading "H2" -Data $fragGroup -NoConvert $Fragments.add($H) } } else { Write-Warning "No group data found to build a report with." } #endregion #region create report if ($Fragments.count -gt 0) { $cHtml.Body = $Fragments #convert filepath to a valid filesystem name $parent = (Split-Path -Path $filePath) $file = Join-Path -Path $parent -ChildPath (Split-Path -Path $filePath -Leaf) Write-Verbose "[$((Get-Date).TimeofDay)] Saving file to $file" ConvertTo-Html @cHtml | Out-File -FilePath $file } #endregion Write-Verbose "[$((Get-Date).TimeofDay)] Ending $($myinvocation.mycommand)" } #close function
get-admanager.ps1
ADReportingTools-1.4.0
Function Get-ADManager { [cmdletbinding()] [OutputType("ADManager")] Param( [parameter(Position = 0, HelpMessage = "Enter an AD user SAMAccountname")] [validatenotnullorEmpty()] [string]$Name, [Parameter(HelpMessage = "Specify what managed detail you want.")] [ValidateSet("All", "DirectReports", "ManagedObjects")] [string]$Detail = "All", [Parameter(HelpMessage = "Specify what managed object class you want. The default is everything. This parameter has no effect if you only get Direct Reports.")] [ValidateSet("All", "Group", "Computer", "OU")] [string[]]$ObjectClass = "All", [Parameter(HelpMessage = "Enter the distinguished name of the top level container or organizational unit.")] [ValidateNotNullOrEmpty()] [string]$SearchBase, [Parameter(HelpMessage = "Specify a domain controller to query for a list of domain controllers.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential. This will be used to query the domain and all domain controllers.")] [alias("RunAs")] [PSCredential]$Credential ) Write-Verbose "[$((Get-Date).TimeofDay)] Starting $($MyInvocation.MyCommand)" #set some default parameter values $params = "Credential", "Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$((Get-Date).TimeofDay)] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #foreach $properties = "Title", "Description", "DisplayName", "Enabled" Switch ($Detail) { "DirectReports" { $properties += "DirectReports" } "ManagedObjects" { $properties += "ManagedObjects" } "All" { $properties += "ManagedObjects", "DirectReports" } } $get = @{ Filter = "" Properties = $properties ErrorAction = "Stop" } if ($Name) { Write-Verbose "[$((Get-Date).TimeofDay)] Searching for user $Name" $get.Filter = "name -eq '$Name'" } else { Write-Verbose "[$((Get-Date).TimeofDay)] Searching for any manager" $get.filter = "DirectReports -like '*' -OR ManagedObjects -like '*'" } if ($SearchBase) { Write-Verbose "[$((Get-Date).TimeofDay)] Limiting search to $SearchBase" $get.Add("SearchBase", $SearchBase) } Try { $managers = Get-ADUser @get } Catch { Write-Warning $_.Exception.Message } if ($managers.name) { Write-Verbose "[$((Get-Date).TimeofDay)] Found $($managers.name.count) manager(s)" $results = [System.Collections.Generic.list[Object]]::new() foreach ($manager in $managers) { Write-Verbose "[$((Get-Date).TimeofDay)] $($manager.distinguishedname)" Write-Verbose "[$((Get-Date).TimeofDay)] Processing DirectReports" $direct = $manager.DirectReports | Get-ADUser -Properties Title, Description, Department, DisplayName, Enabled | Sort-Object -Property DistinguishedName | ForEach-Object { [pscustomobject]@{ PSTypeName = "ADDirect" DistinguishedName = $_.DistinguishedName Name = $_.Name DisplayName = $_.DisplayName Title = $_.Title Description = $_.Description Department = $_.Department Enabled = $_.Enabled SamAccountName = $_.SamAccountname } } Write-Verbose "[$((Get-Date).TimeofDay)] Processing Managed Objects" $managed = Foreach ($item in $manager.managedObjects) { $adobj = Get-ADObject -Identity $item Switch ($adobj.ObjectClass) { "group" { if ($ObjectClass -contains "All" -OR $ObjectClass -contains "Group") { Write-Verbose "[$((Get-Date).TimeofDay)] Getting managed group $item" $grp = Get-ADGroup -Identity $item -Properties GroupScope, GroupCategory, Description [pscustomobject]@{ PSTypeName = "ADManaged.$($adobj.ObjectClass)" DistinguishedName = $adobj.DistinguishedName Name = $adobj.Name Class = $adobj.objectClass Scope = $grp.GroupScope Category = $Grp.GroupCategory Description = $grp.Description } } } "computer" { if ($ObjectClass -contains "All" -OR $ObjectClass -contains "Computer") { Write-Verbose "[$((Get-Date).TimeofDay)] Getting managed computer $item" $member = Get-ADComputer -Identity $item -Property OperatingSystem, IPv4Address, Enabled, Description, Location, DNSHostName [pscustomobject]@{ PSTypeName = "ADManaged.$($adobj.ObjectClass)" DistinguishedName = $adobj.DistinguishedName Name = $adobj.Name DNSHostName = $member.DNSHostName Class = $adobj.objectClass OperatingSystem = $member.OperatingSystem Description = $member.Description IPAddress = $member.IPv4Address Location = $member.Location Enabled = $member.Enabled } } } "OrganizationalUnit" { if ($ObjectClass -contains "All" -OR $ObjectClass -contains "OU") { Write-Verbose "[$((Get-Date).TimeofDay)] Getting managed OU $item" $ou = Get-ADOrganizationalUnit -Identity $item -Properties ProtectedFromAccidentalDeletion, Description [pscustomobject]@{ PSTypeName = "ADManaged.$($adobj.ObjectClass)" DistinguishedName = $adobj.DistinguishedName Name = $adobj.Name Class = $adobj.objectClass Description = $ou.Description Protected = $ou.ProtectedFromAccidentalDeletion } } } } } #foreach item $mgr = [pscustomobject]@{ PSTypeName = "ADManager" DistinguishedName = $manager.Distinguishedname Name = $Manager.name SamAccountName = $Manager.SamAccountName DisplayName = $manager.DisplayName Title = $Manager.Title Description = $manager.Description DirectReports = $Direct ManagedObjects = $managed | Sort-Object -Property Class, DistinguishedName Enabled = $manager.Enabled } if ($Detail -eq "All") { $results.Add($mgr) } elseif ($detail -eq "DirectReports" -AND $mgr.DirectReports.count -gt 0) { $results.Add($mgr) } elseif ($detail -eq "ManagedObjects" -AND $mgr.ManagedObjects.count -gt 0) { $results.Add($mgr) } } #foreach manager $results } #if managers else { Write-Warning "No matching user(s) found." } Write-Verbose "[$((Get-Date).TimeofDay)] Ending $($MyInvocation.MyCommand)" }
new-domainreport.ps1
ADReportingTools-1.4.0
Function New-ADDomainReport { [cmdletbinding()] [outputtype("System.IO.File")] Param ( [Parameter(Position = 0, HelpMessage = "Specify the domain name. The default is the user domain.")] [ValidateNotNullOrEmpty()] [alias("domain")] [string]$Name = $env:USERDOMAIN, [Parameter(Mandatory, HelpMessage = "Specify the output HTML file.")] [ValidateScript( { #validate the parent folder Test-Path (Split-Path $_) })] [string]$FilePath, [Parameter(HelpMessage = "Enter the name of the report to be displayed in the web browser")] [ValidateNotNullOrEmpty()] [string]$ReportTitle = "Domain Report", [Parameter(HelpMessage = "Specify the path the CSS file. If you don't specify one, the default module file will be used.")] [ValidateScript( { Test-Path $_ })] [string]$CSSUri = "$PSScriptRoot\..\reports\domainreport.css", [Parameter(HelpMessage = "Embed the CSS file into the HTML document head. You can only embed from a file, not a URL.")] [switch]$EmbedCSS, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Write-Verbose "[$((Get-Date).TimeofDay)] Starting $($myinvocation.mycommand)" #region setup $progParams = @{ Activity = $myinvocation.MyCommand Status = "Preparing" CurrentOperation = "Initializing variables" } Write-Progress @progParams #set some default parameter values $params = "Credential", "Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$((Get-Date).TimeofDay)] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #foreach #some report metadata $cmd = Get-Command $myinvocation.InvocationName $thisScript = "{0}\{1}" -f $cmd.source, $cmd.name $reportVersion = ( $cmd).version.tostring() #who is running the report? if ($Credential.Username) { $who = $Credential.UserName } else { $who = "$($env:USERDOMAIN)\$($env:USERNAME)" } #where are they running the report from? Try { #disable verbose output from Resolve-DNSName $where = (Resolve-DnsName -Name $env:COMPUTERNAME -Type A -ErrorAction Stop -Verbose:$False).Name | Select-Object -Last 1 } Catch { $where = $env:COMPUTERNAME } $post = @" <table class='footer'> <tr align = "right"><td>Report run: <i>$(Get-Date)</i></td></tr> <tr align = "right"><td>Author: <i>$($Who.toUpper())</i></td></tr> <tr align = "right"><td>Source: <i>$thisScript</i></td></tr> <tr align = "right"><td>Version: <i>$ReportVersion</i></td></tr> <tr align = "right"><td>Computername: <i>$($where.toUpper())</i></td></tr> </table> "@ $head = @" <title>$ReportTitle</Title> <style> td[tip]:hover { color: #2112f1cc; position: relative; } td[tip]:hover:after { content: attr(tip); left: 0; top: 100%; margin-left: 80px; margin-top: 10px; width: 400px; padding: 3px 8px; position: absolute; color: #111111; font-family: 'Courier New', Courier, monospace; font-size: 10pt; background-color: rgba(210, 212, 198, 0.897); white-space: pre-wrap; } th.dn { width:40%; } </style> <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'> </script> <script type='text/javascript'> function toggleDiv(divId) { `$("#"+divId).toggle(); } function toggleAll() { var divs = document.getElementsByTagName('div'); for (var i = 0; i < divs.length; i++) { var div = divs[i]; `$("#"+div.id).toggle(); } } </script> "@ #parameters to splat to ConvertTo-Html $cHtml = @{ Head = $head Body = "" PostContent = $post } If ($EmbedCSS) { if (Test-Path -Path $CSSUri) { Write-Verbose "[$((Get-Date).TimeofDay)] Embedding CSS content from $CSSUri" $cssContent = Get-Content -Path $CSSUri | Where-Object { $_ -notmatch "^@" } $head += @" <style> $cssContent </style> "@ #update the hashtable $cHtml.Head = $head } else { Write-Error "Failed to find a CSS file at $CSSUri. You can only embed from a file." #bail out Write-Verbose "[$((Get-Date).TimeofDay)] Ending $($myinvocation.mycommand)" return } } #if embedCSS else { $cHtml.add("CSSUri", $CSSUri) } #endregion #region get data Write-Verbose "[$((Get-Date).TimeofDay)] Getting base information for $Name" $progParams.status = "Getting domain information" $progParams.CurrentOperation = " Get-ADDomain -Identity $Name" Write-Progress @progParams Try { $root = Get-ADDomain -Identity $Name -ErrorAction stop } Catch { Write-Warning "Failed to get domain information for $Name. $($_.Exception.message)" Write-Verbose "[$((Get-Date).TimeofDay)] Ending $($myinvocation.mycommand)" #bail out return } $progParams.CurrentOperation = "Get-ADBranch -searchbase $root.DistinguishedName" Write-Progress @progParams Write-Verbose "[$((Get-Date).TimeofDay)] Getting ADBranch data for $($root.distinguishedname)" $dom = Get-ADBranch -searchbase $root.DistinguishedName $fragments = [System.Collections.Generic.List[string]]::New() $fragments.Add("<H1>$($root.dnsroot)</H1>") $fragments.Add("<a href='javascript:toggleAll();' title='Click to toggle all sections'>+/-</a>") $grouped = $dom | Sort-Object -Property Parent | Group-Object -Property Parent $progParams.Status = "Processing domain branches" foreach ($branch in $grouped) { $heading = $branch.name $progParams.CurrentOperation = $heading Write-Progress @progParams $div = $branch.name -replace "\W", "" $classGroup = $branch.group | Sort-Object -Property Class, Name | Group-Object -Property Class $fragGroup = foreach ($item in $classGroup) { if ($item.name -eq 'group') { $childDiv = (New-Guid).guid -replace "-", "X" $child = foreach ($groupItem in $item.group) { if ($groupItem.name -notmatch "Domain Users|Domain Computers") { $groupchildDiv = (New-Guid).guid -replace "-", "X" $groupText = $groupitem.Name [xml]$html = Get-ADGroup -Identity $groupitem.distinguishedname -Properties members, WhenChanged -OutVariable g | Select-Object -Property DistinguishedName, GroupScope, GroupCategory, @{Name = "MemberCount"; Expression = { $_.members.count } }, WhenChanged | ConvertTo-Html -Fragment #insert class to set first column width $th = $html.CreateAttribute("class") $th.Value = "dn" [void]($html.table.tr[0].childnodes[0].attributes.append($th)) $groupData = $html.innerxml if ($g.members) { $groupData += "<H5>Members</H5>" $grpUserData = Get-ADGroupUser $groupitem.distinguishedname | Select-Object -Property distinguishedname, name, description, Enabled if (-Not $grpuserdata) { #must be a special group $grpUserData = Get-ADGroupMember -Identity $groupItem.DistinguishedName | Sort-Object DistinguishedName | Select-Object DistinguishedName, Name, SamAccountName, SID, ObjectClass } [xml]$html = $grpUserData | ConvertTo-Html -Fragment #insert class to set first column width if ($html.table) { $th = $html.CreateAttribute("class") $th.Value = "dn" [void]($html.table.tr[0].childnodes[0].attributes.append($th)) } for ($i = 1; $i -le $html.table.tr.count - 1; $i++) { $dn = $html.table.tr[$i].ChildNodes[0]."#text" $pop = $html.CreateAttribute("tip") $pop.value = (_getPopData -Identity $dn | Format-List | Out-String).Trim() [void]($html.table.tr[$i].ChildNodes[0].Attributes.append($pop)) } $groupData += $html.InnerXml } #if g.members _insertToggle -Text $groupText -div $groupchildDiv -Heading "H4" -data $groupData -NoConvert } } #foreach groupitem } #if group else { [xml]$html = $item.group | Select-Object -Property DistinguishedName, Name, Description, Enabled | ConvertTo-Html -Fragment #insert class to set first column width $th = $html.CreateAttribute("class") $th.Value = "dn" [void]($html.table.tr[0].childnodes[0].attributes.append($th)) for ($i = 1; $i -le $html.table.tr.count - 1; $i++) { $dn = $html.table.tr[$i].ChildNodes[0]."#text" $pop = $html.CreateAttribute("tip") $pop.value = (_getPopData -Identity $dn | Format-List | Out-String).Trim() [void]($html.table.tr[$i].ChildNodes[0].Attributes.append($pop)) } $child = $html.InnerXml } _insertToggle -Text "$($item.name)s [$($item.count)]" -div $childDiv -Heading "H3" -data $child -NoConvert } #foreach item in classgroup $fragments.Add($(_inserttoggle -Text $heading -div $div -Heading "H2" -Data $fragGroup -NoConvert)) } #foreach branch #endregion #region create report $cHtml.Body = $Fragments #convert filepath to a valid filesystem name $parent = (Split-Path -Path $filePath) $file = Join-Path -Path $parent -ChildPath (Split-Path -Path $filePath -Leaf) Write-Verbose "[$((Get-Date).TimeofDay)] Saving file to $file" ConvertTo-Html @cHtml | Out-File -FilePath $file #endregion Write-Verbose "[$((Get-Date).TimeofDay)] Ending $($myinvocation.mycommand)" } #New-ADDomainReport
get-ntdsinfo.ps1
ADReportingTools-1.4.0
Function Get-NTDSInfo { [cmdletbinding()] [outputType("NTDSInfo")] Param( [Parameter(Position = 0, Mandatory, ValueFromPipeline, HelpMessage = "Specify a domain controller name.")] [Alias("name")] [string[]]$Computername, [Parameter(HelpMessage = "Specify an alternate credential.")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" $sb = { $dsa = Get-ItemProperty -path 'HKLM:\system\CurrentControlSet\Services\ntds\Parameters' #send a hashtable of data @{ ntds = Get-Item -Path $dsa.'DSA Database File' logs = Get-ChildItem -Path $dsa.'Database log files path' -Filter edb*.log computername = $env:computername } } } #begin Process { foreach ($Computer in $Computername) { Try { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting NTDS data from $($Computer.toUpper())." Invoke-Command -ScriptBlock $sb -ComputerName $computer -HideComputerName -ErrorAction Stop | ForEach-Object { #disable Verbose output from Resolve-DNSName because it adds no value here. [pscustomobject]@{ PSTypename = "NTDSInfo" DomainController = (Resolve-DnsName -Type A -Name $_.computername -Verbose:$false).Name Path = $_.ntds.FullName Size = $_.ntds.Length FileDate = $_.ntds.LastWriteTime LogCount = $_.logs.count Date = (Get-Date) } } #foreach-object }#try Catch { Write-Warning "Error getting data from $($computer.toUpper()). $($_.Exception.Message)." } } #foreach computer } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end } #close Get-NTDSInfo
Get-ADDepartmentMember.ps1
ADReportingTools-1.4.0
Function Get-ADDepartment { [cmdletbinding()] [outputtype("ADDeptMember")] [alias("gdp")] Param( [Parameter(Position = 0, Mandatory, HelpMessage = "Specify one or more department names.")] [string[]]$Department, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("DC")] [string]$Server, [Parameter(HelpMessage = "Specify alternate credentials for authentication.")] [Alias("runas")] [pscredential]$Credential ) Write-Verbose "[$(Get-Date -Format G)] Starting $($myinvocation.mycommand)" #remove Department from bound parameters [void]$PSBoundParameters.remove("Department") #add additional parameters $Properties = "Title", "City", "State", "OfficePhone", "DisplayName", "Department", "Manager", "Country", "Enabled", "Description" $PSBoundParameters.Add("Properties", $Properties) if ($Server) { Write-Verbose "[$(Get-Date -Format G)] Connecting to domain controller $($server.toupper())" } If ($credential.username) { Write-Verbose "[$(Get-Date -Format G)] Connecting as $($credential.username)" } #create a list to hold results $list = [System.Collections.Generic.list[object]]::New() foreach ($dept in $department) { Write-Verbose "[$(Get-Date -Format G)] Getting users from the $dept department" $PSBoundParameters["filter"] = "Department -eq '$dept'" $users = Get-ADUser @PSBoundParameters if ($users.count -gt 0) { Write-Verbose "[$(Get-Date -Format G)] Retrieved $($users.count) members" foreach ($user in $users) { $obj = [pscustomobject]@{ PSTypename = "ADDeptMember" Department = $user.Department Name = $user.Displayname Title = $user.Title SamAccount = $user.Samaccountname Firstname = $user.GivenName Lastname = $user.Surname City = $user.City Phone = $user.OfficePhone OUPath = ($user.distinguishedname -split ",", 2)[1] Enabled = $user.Enabled Manager = $user.manager Description = $user.Description DistinguishedName = $user.DistinguishedName } $list.Add($obj) } #foreach user #clear $users so it isn't accidentally re-used Clear-Variable -Name users } } #foreach department #sort objects for output $list | Sort-Object -Property Manager, Name, City Write-Verbose "[$(Get-Date -Format G)] Ending $($myinvocation.mycommand)" }
get-adusercategory.ps1
ADReportingTools-1.4.0
#get user information based on a defined category. #Category properties are defined in configuration json files. Function Get-ADUserCategory { [cmdletbinding(DefaultParameterSetName = "filter")] [OutputType("ADUserCategory")] Param( [parameter(Position = 0, Mandatory, HelpMessage = "Enter an AD user identity", ParameterSetName = "id")] [validatenotnullorEmpty()] [string]$Identity, [parameter(HelpMessage = "Specify an AD filter like department -eq 'sales'. The default is all Enabled user accounts.", ParameterSetName = "filter")] [validatenotnullorEmpty()] [string]$Filter = "-not (UserAccountControl -BAND 0x2)", [Parameter(HelpMessage = "Enter the distinguished name of the top level container or organizational unit.", ParameterSetName = "filter")] [string]$SearchBase, [Parameter(Mandatory, HelpMessage = "Select a defined category.")] [ArgumentCompleter( { $ADUserReportingConfiguration.Name })] [ValidateScript( { If ($ADUserReportingConfiguration.Name -contains $_) { $True } else { Throw "You must select a valid name from `$ADUserReportingConfiguration." $False } })] [string]$Category, [Parameter(HelpMessage = "Specify a domain controller to query for a list of domain controllers.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential. This will be used to query the domain and all domain controllers.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" [void]($PSBoundParameters.Remove("Category")) #add the filter category if not bound if ($pscmdlet.ParameterSetName -eq 'filter' -AND (-not $PSBoundParameters.ContainsKey("filter"))) { $PSBoundParameters.Add("Filter", "-Not(UserAccountControl -BAND 0x2)") } $catProp = $ADUserReportingConfiguration.Where( { $_.name -eq $Category }).Properties if ($catProp) { $PSBoundParameters.Add("Properties", $catProp) } else { Write-Warning "Failed to find any properties for a category called $category. Using defaults." } } #begin Process { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting user information for category $Category " if ($pscmdlet.ParameterSetName -eq 'id') { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting user $identity" } else { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Using filter $filter" if ($SearchBase) { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Searching under $Searchbase" } } $PSBoundParameters | Out-String | Write-Verbose $users = Get-ADUser @PSBoundParameters if ($users) { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Found $(($users | Measure-Object).count) user(s)" foreach ($user in $users) { #create a temp hashtable $h = [ordered]@{ PSTypeName = "ADUserCategory.$category" DistinguishedName = $user.DistinguishedName } #add category properties foreach ($prop in $catProp) { $h.Add($prop, $user.$prop) } #write as a custom object New-Object -TypeName PSObject -Property $h } } else { Write-Warning "Failed to find any matching user accounts." } } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end } #close Get-ADUserCategory
get-adcontainer.ps1
ADReportingTools-1.4.0
Function Get-ADBranch { [cmdletbinding()] [OutputType("ADBranchMember")] Param ( [Parameter(Position = 0, Mandatory, HelpMessage = "Enter the distinguished name of the top level container or organizational unit.")] [string]$SearchBase, [Parameter(HelpMessage = "Only show objects of the matching classes")] [ValidateSet("User", "Computer", "Group")] [string[]]$ObjectClass, [switch]$IncludeDeletedObjects, [Parameter(HelpMessage = "Exclude containers like USERS. This will only have no effect unless your search base is the domain root.")] [switch]$ExcludeContainers, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" #set some default parameter values $params = "Credential", "Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #foreach #define a hashtable of parameters for recursive calls to this command $recurse = @{} $params = "SearchBase", "ObjectClass", "ExcludeContainers", "IncludeDeletedObjects" foreach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { $recurse.Add($param, $PSBoundParameters.Item($param)) } } #define a private helper function function _getbranchmember { [cmdletbinding()] Param ( [object[]]$Items, $parent) foreach ($item in $items) { #write-verbose $item.distinguishedname [pscustomobject]@{ PSTypeName = "ADBranchMember" DistinguishedName = $item.DistinguishedName Name = $item.Name Description = $item.Description Class = [System.Globalization.CultureInfo]::CurrentCulture.TextInfo.ToTitleCase($item.objectClass) Parent = _formatdn $Parent Deleted = $item.Deleted Enabled = -Not(( $item.UserAccountControl -band 0x2) -as [bool]) } } } # _getbranchmember #begin defining the search filter [string]$filter = "objectclass -eq 'organizationalunit'" if ($ExcludeContainers) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Excluding containers" } else { $filter += " -or objectclass -eq 'container' -or objectclass -eq 'builtindomain'" } if ($ObjectClass) { foreach ($item in $ObjectClass) { $filter += " -or objectclass -eq '$item'" } } else { $filter += " -or objectclass -eq 'computer' -or objectclass -eq 'user' -or objectclass -eq 'group'" } Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Using filter $filter" Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Enumerating $searchBase" } #begin Process { $getParams = @{ filter = $filter SearchScope = "OneLevel" SearchBase = $SearchBase ErrorAction = "Stop" Properties = "Description", "UserAccountControl" IncludeDeletedObjects = $IncludeDeletedObjects } Try { $data = Get-ADObject @getParams | Sort-Object DistinguishedName | Group-Object -Property ObjectClass #display users if ($data.name -contains "user") { $item = $data.where( { $_.name -eq 'user' }) Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Found $(($item.group | Measure-Object).count) user[s]" _getbranchmember -Items $item.group -parent $searchBase } #if user #display groups if ($data.name -contains "group") { $item = $data.where( { $_.name -eq 'group' }) Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Found $(($item.group | Measure-Object).count) group[s]" _getbranchmember -Items $item.group -parent $searchBase } #if group #display computers if ($data.name -contains "computer") { $item = $data.where( { $_.name -eq 'computer' }) Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Found $(($item.group | Measure-Object).count) computer[s]" _getbranchmember -Items $item.group -parent $searchBase } #if user #display organizational units if ($data.name -contains "organizationalUnit") { $data.where( { $_.name -eq 'organizationalUnit' }).group | ForEach-Object { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Recursive calling Get-ADBranch" $recurse.searchBase = $_.DistinguishedName Get-ADBranch @recurse } } #display containers if ($data.name -contains "container") { $data.where( { $_.name -eq 'container' }).group | ForEach-Object { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Recursive calling Get-ADBranch" $recurse.searchBase = $_.DistinguishedName Get-ADBranch @recurse } } #display builtin if ($data.name -contains "builtinDomain") { $data.where( { $_.name -eq 'BuiltInDomain' }).group | ForEach-Object { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Recursive calling Get-ADBranch" $recurse.searchBase = $_.DistinguishedName Get-ADBranch @recurse } } } Catch { Write-Warning "Failed to enumerate $SearchBase. $($_.exception.message)" } } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end }
Show-Domain.ps1
ADReportingTools-1.4.0
Function Show-DomainTree { [cmdletbinding()] [OutputType("String")] [alias("dt")] Param( [Parameter(Position = 0, HelpMessage = "Specify the domain name. The default is the user domain.")] [ValidateNotNullOrEmpty()] [string]$Name = $env:USERDOMAIN, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential, [Parameter(HelpMessage = "Display the domain tree using distinguished names.")] [alias("dn")] [switch]$UseDN, [Parameter(HelpMessage = "Include containers and non-OU elements. Items with a GUID in the name will be omitted.")] [alias("cn")] [switch]$Containers ) Write-Verbose "Starting $($myinvocation.MyCommand)" Function Get-OUTree { [cmdletbinding()] Param( [string]$Path = (Get-ADDomain).DistinguishedName, [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential")] [PSCredential]$Credential, [Parameter(HelpMessage = "Display the distinguishedname")] [switch]$UseDN, [Parameter(HelpMessage = "Include containers")] [alias("cn")] [switch]$Containers, [Parameter(HelpMessage = "Used in recursion only. You don't need to specify anything")] [Int]$Indent = 1, [Parameter(HelpMessage = "Used in recursion only. You don't need to specify anything")] [switch]$Children ) Write-Verbose "Searching path $path" function GetIndentString { [CmdletBinding()] Param([int]$Indent) $charHash = @{ upperLeft = [char]0x250c upperRight = [char]0x2510 lowerRight = [char]0x2518 lowerLeft = [char]0x2514 horizontal = [char]0x2500 vertical = [char]0x2502 join = [char]0x251c } if ($Children) { if ($indent -eq 5) { $indent += 2 } elseif ($indent -eq 7) { $indent += 4 } $pad = " " * ($Indent) if ($script:IsLast) { #write-Host "LAST" -ForegroundColor magenta $str += " $pad{0}{1} " -f $charHash.join, ([string]$charHash.horizontal * 2 ) } else { $str += "{0}$pad{1}{2} " -f $charHash.vertical, $charHash.join, ([string]$charHash.horizontal * 2 ) } } else { if ($script:IsLast) { $c = $charHash.lowerleft } else { $c = $charHash.join } $str = "{0}{1} " -f $c, ([string]$charHash.horizontal * 2 ) } $str } #GUID Regex [regex]$Guid = "\w{8}-(\w{4}-){3}\w{12}" #parameters to splat for the search if ($Containers) { $filter = "(|(objectclass=container)(objectclass=organizationalUnit))" } else { $filter = "objectclass=organizationalUnit" } $search = @{ LDAPFilter = $filter SearchScope = "OneLevel" SearchBase = $path Properties = "ProtectedFromAccidentalDeletion" } "Server", "Credential" | ForEach-Object { if ($PSBoundParameters.ContainsKey($_)) { $search.Add($_, $PSBoundParameters[$_]) } } $data = Get-ADObject @search | Sort-Object -Property DistinguishedName if ($Containers) { #filter out GUID named entries $data = $data | Where-Object { $_.name -notmatch $GUID } } if ($path -match "^DC\=") { $top = $data $last = $top[-1].distinguishedname $script:IsLast = $False Write-Verbose "Last top level is $last" } if ($data ) { $data | ForEach-Object { if ($UseDN) { $name = $_.distinguishedname } else { $name = $_.name } if ($script:IsLast) { Write-Verbose "Processing last items" } else { $script:IsLast = $_.distinguishedname -eq $last } if ($_.ProtectedFromAccidentalDeletion) { #display protected OUs in color $nameValue = "$($ADReportingToolsOptions.Protected)$name$([char]0x1b)[0m" } elseif ($_.objectclass -eq 'container') { $nameValue = "$($ADReportingToolsOptions.Container)$name$([char]0x1b)[0m" } elseif ($_.objectclass -eq 'organizationalUnit') { #display non-OU and non-Container in a different color $nameValue = "$($ADReportingToolsOptions.OrganizationalUnit)$name$([char]0x1b)[0m" } else { $nameValue = "$($ADReportingToolsOptions.Other)$name$([char]0x1b)[0m" } "{0}{1}" -f (GetIndentString -indent $indent), $nameValue $PSBoundParameters["Path"] = $_.DistinguishedName $PSBoundParameters["Indent"] = $Indent + 2 $PSBoundParameters["children"] = $True #call the nested function recursively Get-OUTree @PSBoundParameters } } #if $data } if ($host.name -match 'ConsoleHost') { $getAD = @{ ErrorAction = "stop" Identity = $Name } "Server", "Credential" | ForEach-Object { if ($PSBoundParameters.ContainsKey($_)) { $getAD.Add($_, $PSBoundParameters[$_]) } } Try { Write-Verbose "Getting distinguished name for $($Name.toUpper())" $getAD | Out-String | Write-Verbose [string]$Path = (Get-ADDomain @getAD).DistinguishedName #Passing these bound parameters to another function which needs the Path $PSBoundParameters.add("Path", $Path) [void]($PSBoundParameters.remove("Name")) } Catch { Throw $_ } #display to top level container and then get children $top = @" $($ADReportingToolsOptions.DomainDNS)$Path$([char]0x1b)[0m $([char]0x2502) "@ $top #get child OUs Get-OUTree @PSBoundParameters #display a footer $tz = Get-TimeZone if ((Get-Date).IsDaylightSavingTime()) { $tzname = $tz.daylightName } else { $tzname = $tz.StandardName } $date = Get-Date -Format g $footer = @" $($ADReportingToolsOptions.OrganizationalUnit)Organizational Units$([char]0x1b)[0m $($ADReportingToolsOptions.Protected)Protected from Deletion$([char]0x1b)[0m $($ADReportingToolsOptions.Container)Containers$([char]0x1b)[0m $($ADReportingToolsOptions.Other)Other$([char]0x1b)[0m $date $tzname "@ $footer } else { Write-Host "This command should be run in a PowerShell Console host. It will NOT run in the PowerShell ISE or VS Code." -ForegroundColor magenta } Write-Verbose "Ending $($myinvocation.MyCommand)" }
adreportingtoolsoptions.ps1
ADReportingTools-1.4.0
#commands to manage ADReportingTools options # color options are stored in $ADReportingToolsOptions which is defined in the root module function Get-ADReportingToolsOptions { [cmdletbinding()] [OutputType("ADReportingToolsOption")] param () if (Get-Variable -Name ADReportingToolsOptions) { # April 2, 2021 filter out Note and Reset JDH $ADReportingToolsOptions.GetEnumerator() | Where-Object { $_.Key -notmatch "Note|Reset"} | ForEach-Object { [pscustomobject]@{ PSTypename = "ADReportingToolsOption" Name = $_.key Value = "{0}{1}$([char]0x1b)[0m" -f $_.value, ($_.value -replace $([char]0x1b), "`$([char]0x1b)") } } #foreach } #if variable found else { Write-Warning "Cant' find the `$ADReportingToolsOptions variable." } } function Set-ADReportingToolsOptions { [cmdletbinding()] [OutputType("None")] param ( [Parameter(Position = 0, Mandatory, HelpMessage = "Specify an option.")] [ValidateNotNullOrEmpty()] [ArgumentCompleter( { (Get-ADReportingToolsOptions).Name })] [string]$Name, [Parameter(Mandatory, HelpMessage = "Specify the opening ANSI sequence.")] [ValidateNotNullOrEmpty()] [string]$ANSI ) Write-Verbose "Updating $Name" $ADReportingToolsOptions[$Name] = $ANSI }
private.ps1
ADReportingTools-1.4.0
#private helper functions # private helper function to insert javascript code into my html function _insertToggle { [cmdletbinding()] #The text to display, the name of the div, the data to collapse, and the heading style #the div Id needs to be alphanumeric text Param([string]$Text, [string]$div, [object[]]$Data, [string]$Heading = "H2", [switch]$NoConvert) $out = [System.Collections.Generic.list[string]]::New() if (-Not $div) { $div = $Text.Replace(" ", "_") } $out.add("<a href='javascript:toggleDiv(""$div"");' title='click to collapse or expand this section'><$Heading>$Text</$Heading></a><div id=""$div"">") if ($NoConvert) { $out.Add($Data) } else { $out.Add($($Data | ConvertTo-Html -Fragment)) } $out.Add("</div>") $out } Function _getPopData { [cmdletbinding()] param([string]$Identity) Try { $class = (Get-ADObject -Identity $identity -ErrorAction stop).objectclass } Catch { #don't do anything } if ($class -eq 'user') { $props = 'SamAccountName', 'Displayname', 'Title', 'Department', 'PasswordLastSet', 'LastLogonDate', 'Enabled', 'WhenCreated', 'WhenChanged' Get-ADUser -Identity $identity -Property $props | Select-Object -Property $props } elseif ($class -eq 'computer') { $props = 'DnsHostName', 'OperatingSystem', 'IPv4Address', 'Location', 'Enabled', 'WhenCreated', 'WhenChanged' Get-ADComputer -Identity $identity -Property $props | Select-Object -Property $props } } function _formatdn { #format a distinguished name to look nicer [CmdletBinding()] Param([string]$DN) $parts = $dn -split "\," $updates = [System.Collections.Generic.list[string]]::new() foreach ($part in $parts) { $split = $part -split "\=" $name = [System.Globalization.CultureInfo]::CurrentCulture.TextInfo.ToTitleCase($split[1].trim().toLower()) $transform = "{0}={1}" -f $split[0].trim().toUpper(), $name $updates.Add($transform) } $updates -join "," } #a private helper function to convert the objects to html fragments Function _convertObjects { Param([object[]]$Objects) #convert each table to an XML fragment so I can insert a class attribute [xml]$frag = $objects | Sort-Object -property WhenChanged | Select-Object -Property DistinguishedName,Name,WhenCreated,WhenChanged,IsDeleted | ConvertTo-Html -Fragment for ($i = 1; $i -lt $frag.table.tr.count;$i++) { if (($frag.table.tr[$i].td[2] -as [datetime]) -ge $since) { #highlight new objects in green $class = $frag.CreateAttribute("class") $class.value="new" [void]$frag.table.tr[$i].Attributes.append($class) } #if new #insert the alert attribute if the object has been deleted. if ($frag.table.tr[$i].td[-1] -eq 'True') { #highlight deleted objects in red $class = $frag.CreateAttribute("class") $class.value="alert" [void]$frag.table.tr[$i].Attributes.append($class) } #if deleted } #for #write the innerXML (ie HTML code) as the function output $frag.InnerXml } function _getDNSName { [cmdletbinding()] Param([string]$Name) Try { $r = Resolve-DnsName -Name $Name -type A -ErrorAction Stop | Select-Object -first 1 if ($r.name) { $r.name } else { #this should only happen if Resolve-DNSName compeletes without error but no result. $name } } Catch { write-warning $_.exception.message $name } } function _ToTitleCase { [cmdletbinding()] Param( [string]$Text ) [System.Globalization.CultureInfo]::CurrentCulture.TextInfo.ToTitleCase($text) }
get-adsitesubnet.ps1
ADReportingTools-1.4.0
Function Get-ADSiteSummary { [cmdletbinding()] [OutPutType("ADSiteSummary")] Param( [Parameter(Position = 0,HelpMessage = "Specify the name of an Active Directory site. The default is all sites.")] [ValidateNotNullOrEmpty()] [string]$Name, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Write-Verbose "Starting $($MyInvocation.MyCommand)" $getParams = @{ ErrorAction = "Stop" Properties = "Subnets", "WhenChanged", "WhenCreated" } if ($Name) { Write-Verbose "Getting site $Name" $getparams.Add("Identity",$Name) } else { Write-Verbose "Getting all sites" $getParams.Add("Filter", "*") } if ($server) { Write-Verbose "Querying domain controller $server" $getParams.Add("server", $server) } if ($Credential.UserName) { Write-Verbose "Using alternate credential for $($credential.username)" $getParams.Add("Credential", $Credential) } try { Write-Verbose "Getting AD Replication sites" #get sites first and then subnets for each site. This will make grouping and formatting #results easier $sites = Get-ADReplicationSite @getParams Write-Verbose "Found $(($sites | Measure-Object).count) sites" $getParams["Properties"] = "Name", "Description", "Location", "WhenChanged", "WhenCreated" $getParams.Remove("Identity") $getParams.Remove("filter") foreach ($site in $sites) { Write-Verbose "Getting subnets associated with $($site.name)" #"site -eq $($site.distinguishedname)" Write-Verbose "Found $($site.subnets.count) subnets" $data = $site.subnets | Sort-Object | Get-ADReplicationSubnet @getParams foreach ($item in $data) { [pscustomobject]@{ PSTypename = "ADSiteSummary" Site = $site.Name SiteDescription = $site.Description Subnet = $item.Name SubnetDescription = $item.Description SubnetLocation = $item.Location SiteCreated = $site.WhenCreated SiteModified = $site.WhenChanged SubnetCreated = $item.WhenCreated SubnetModified = $item.WhenChanged } } #foreach item } #foreach site } Catch { throw $_ } Write-Verbose "Ending $($MyInvocation.MyCommand)" } Function Get-ADSiteDetail { [cmdletbinding()] [OutPutType("ADSiteDetail")] Param( [Parameter(Position = 0,HelpMessage = "Specify the name of an Active Directory site. The default is all sites.")] [ValidateNotNullOrEmpty()] [string]$Name, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Write-Verbose "Starting $($MyInvocation.MyCommand)" $data = Get-ADSiteSummary @psboundparameters | Group-Object -Property Site if ($data) { foreach ($item in $data) { #create a new custom object [PSCustomObject]@{ PSTypename = "ADSiteDetail" Name = $item.Name Description = $item.group[0].SiteDescription SubnetCount = $item.count Subnets = $item.group.subnet Created = $item.group[0].SubnetCreated Modified = $item.group[0].SubnetModified } } } else { Write-Warning "Failed to get site and subnet information." } Write-Verbose "Ending $($MyInvocation.MyCommand)" }
get-adreportingtools.ps1
ADReportingTools-1.4.0
function Get-ADReportingTools { [cmdletbinding()] [OutputType("ADReportingTool")] param () $cmds = (Get-Module adreportingtools).ExportedFunctions.keys | Get-Command $all = foreach ($cmd in $cmds) { [PSCustomObject]@{ PSTypeName = "ADReportingTool" Name = $cmd.Name Verb = $cmd.Verb Noun = $cmd.Noun Version = $cmd.Version Alias = (Get-Alias -Definition $cmd.name -ErrorAction SilentlyContinue).Name Synopsis = (Get-Help $cmd.name).Synopsis } } #write sorted results to the pipeline $all | Sort-Object -Property Verb, Name }
Open-ADReportingHelp.ps1
ADReportingTools-1.4.0
Function Open-ADReportingToolsHelp { [cmdletbinding()] [outputtype("None")] Param() Write-Verbose "Starting $($myinvocation.mycommand)" $modBase = (Get-Module ADReportingTools).ModuleBase $pdf = Join-Path -path $modBase -ChildPath ADReportingToolsManual.pdf Write-Verbose "Testing the path $pdf" if (Test-Path -Path $pdf) { Try { write-Verbose "Invoking the PDF" Invoke-Item -Path $pdf -ErrorAction Stop } Catch { Write-Warning "Failed to automatically open the PDF. You will need to manually open $pdf." } } else { Write-Warning "Can't find $pdf." } Write-Verbose "Ending $($myinvocation.MyCommand)" }
get-addchealth.ps1
ADReportingTools-1.4.0
Function Get-ADDomainControllerHealth { [cmdletbinding()] [OutputType("ADDomainControllerHealth")] Param( [Parameter(HelpMessage = "Specify a domain controller to query for a list of domain controllers.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential. This will be used to query the domain and all domain controllers.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" #set some default parameter values if ($PSBoundParameters.ContainsKey("Server")) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Adding 'Get-AD*:Server' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:Server"] = $PSBoundParameters.Item("server") } #use the credential with any command that supports alternate credentials if ($PSBoundParameters.ContainsKey("Credential")) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Adding '*:Credential' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["*:Credential"] = $PSBoundParameters.Item("Credential") } } #begin Process { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting a list of all domain controllers" $dcs = Get-ADDomainController -Filter * Foreach ($dc in $dcs) { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting health detail for $($dc.hostname)" #create a temporary cimSession Try { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Creating a temporary CIMSession" $tmpCS = New-CimSession -ComputerName $dc.name -ErrorAction Stop $cimParam = @{ CimSession = $tmpCS Classname = "" Property = "" } } Catch { Write-Warning "Failed to create a temporary CIMSession to $($dc.name). $($_.Exception.message)" Remove-Variable -Name tmpCS -ErrorAction SilentlyContinue } if ($tmpCS) { #get additional information via CIM $cimParam["Classname"] = "win32_logicaldisk" $cimParam["filter"] = "deviceid='c:'" $cimParam["Property"] = "Freespace", "Size" Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting free space on C:" $c = Get-CimInstance @cimParam $cimParam["Classname"] = "win32_NTEventLogFile" $cimParam["filter"] = "logfilename='security'" $cimParam["Property"] = "FileSize", "MaxFileSize" Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting security log percent used" $seclog = Get-CimInstance @cimParam $cimParam["Classname"] = "win32_service" $cimParam["filter"] = "name='ntds' or name='kdc' or name='adws' or name='dfsr' or name='dfs' or name='netlogon' or name = 'samss' or name='w32time'" $cimParam["Property"] = "Displayname", "Name", "State", "ProcessID", "StartMode", "Started" Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting critical service satus" $services = Get-CimInstance @cimParam | ForEach-Object { #create a custom typed object for each service $h = [ordered]@{ PSTypename = "ADDomainControllerService" Computername = $dc.hostname } foreach ($p in $cimParam.property) { $h.Add($p, $_.$p) } New-Object -TypeName psobject -Property $h } $cimParam["Classname"] = "win32_operatingsystem" $cimParam.remove("filter") $cimParam["Property"] = "LastBootUpTime", "TotalVisibleMemorySize", "FreePhysicalMemory" Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting uptime and memory utilization" $os = Get-CimInstance @cimParam #remove the temporary cimsession Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Removing the temporary CIMSession" $tmpCS | Remove-CimSession } #create a custom object [pscustomobject]@{ PSTypename = "ADDomainControllerHealth" Hostname = $dc.hostname IPAddress = $dc.IPv4Address OperatingSystem = $dc.OperatingSystem Uptime = (New-TimeSpan -Start $os.LastBootUpTime -End (Get-Date)) PctFreespace = [math]::Round(($c.Freespace / $c.Size) * 100, 2) PctFreeMemory = [math]::Round(($os.FreePhysicalMemory / $os.TotalVisibleMemorySize) * 100, 2) PctSecurityLog = [math]::Round( ($seclog.filesize / $seclog.MaxFileSize) * 100, 2 ) Services = $Services Roles = $dc.OperationMasterRoles IsGlobalCatalog = $dc.IsGlobalCatalog IsReadOnly = $dc.IsReadOnly DistinguishedName = $dc.ComputerObjectDN } } #foreach DC } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end } #close Get-ADDomainControllerHealth
Split-DN.ps1
ADReportingTools-1.4.0
Function Split-DistinguishedName { [cmdletbinding()] [Alias("Parse-DN")] [outputtype("ADDistinguishedNameInfo")] Param( [Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName, HelpMessage = "Enter an Active Directory DistinguisdedName.")] [alias("dn")] [string]$DistinguishedName ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" } #begin Process { $data = _formatdn $DistinguishedName Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Splitting $data " $split = $DistinguishedName -split "," $dc = $split | Where-Object { $_ -match "^DC" } $domainDN = $dc -join ',' [pscustomobject]@{ PSTypename = "ADDistinguishedNameInfo" Name = ($split[0]).split("=")[-1] Branch = ($split[1]).split("=")[-1] BranchDN = ($split | Select-Object -Skip 1) -join ',' Domain = ($dc[0]).split("=")[-1] DomainDN = $domainDN DomainDNS = $domaindn.replace("DC=", "").replace(",", ".") } } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end } #close function <# DistinguishedName = CN=SupportTech,OU=Help Desk,OU=IT,DC=Company,DC=Pri Name = SupportTech Branch = Help Desk BranchDN = OU=Help Desk,OU=IT,DC=Company,DC=Pri Domain = Company DomainDN = DC=Company,DC=Pri $$DomainDNS = Company.pri #>
get-adfsmo.ps1
ADReportingTools-1.4.0
Function Get-ADFSMO { [cmdletbinding()] [alias('fsmo')] [outputtype("ADFSMORole")] Param( [Parameter(Position = 0, HelpMessage = "Specify the domain name. The default is the user domain.")] [ValidateNotNullOrEmpty()] [alias("name")] [string]$Identity = $env:USERDOMAIN, [Parameter(HelpMessage = "Specify a domain controller to query.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[BEGIN ] Starting: $($MyInvocation.Mycommand)" } #begin Process { Write-Verbose "[PROCESS] Getting domain information for $Identity" Try { $domain = Get-ADDomain @PSBoundParameters -ErrorAction Stop } Catch { throw $_ } if ($domain.name) { Write-Verbose "[PROCESS] Getting forest information for $($domain.forest)" $PSBoundParameters["Identity"] = $domain.forest Try { $forest = Get-ADForest @psboundparameters -ErrorAction Stop } Catch { throw $_ } } [pscustomobject]@{ PSTypeName = "ADFSMORole" Domain = $domain.DNSRoot Forest = $forest.Name PDCEmulator = $domain.PDCEmulator RIDMaster = $domain.RIDMaster InfrastructureMaster = $domain.InfrastructureMaster SchemaMaster = $forest.SchemaMaster DomainNamingMaster = $forest.DomainNamingMaster } } #process End { Write-Verbose "[END ] Ending: $($MyInvocation.Mycommand)" } #end } #close Get-ADFSMO
get-adgroupreport.ps1
ADReportingTools-1.4.0
<# Get group membership report #> Function Get-ADGroupReport { [cmdletbinding()] [OutputType("ADGroupReport")] Param( [parameter(Position = 0, HelpMessage = "Enter an AD Group name. Wildcards are allowed.")] [validatenotnullorEmpty()] [string]$Name = "*", [Parameter(HelpMessage = "Enter the distinguished name of the top level container or organizational unit.")] [ValidateScript( { $testDN = $_ Try { [void](Get-ADObject -Identity $_ -ErrorAction Stop) $True } Catch { Write-Warning "Failed to verify $TestDN as a valid searchbase." Throw $_.Exception.message $False } })] [string]$SearchBase, [Parameter(HelpMessage = "Filter on the group category")] [ValidateSet("All", "Distribution", "Security")] [string]$Category = "All", [Parameter(HelpMessage = "Filter on group scope")] [ValidateSet("Any", "DomainLocal", "Global", "Universal")] [string]$Scope = "Any", [Parameter(HelpMessage="Exclude BuiltIn and Users")] [switch]$ExcludeBuiltIn, [Parameter(HelpMessage = "Specify a domain controller to query for a list of domain controllers.")] [alias("dc", "domaincontroller")] [string]$Server, [Parameter(HelpMessage = "Specify an alternate credential. This will be used to query the domain and all domain controllers.")] [alias("RunAs")] [PSCredential]$Credential ) Begin { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)" #set some default parameter values $params = "Credential", "Server" ForEach ($param in $params) { if ($PSBoundParameters.ContainsKey($param)) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Adding 'Get-AD*:$param' to script PSDefaultParameterValues" $script:PSDefaultParameterValues["Get-AD*:$param"] = $PSBoundParameters.Item($param) } } #foreach if ($ExcludeBuiltIn) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Excluding CN=Users and CN=BuiltIn" $Exclude = {$_.DistinguishedName -notMatch "CN\=(Users)|(BuiltIn)"} } else { #Exclude these items using late filtering to keep the AD filter from getting out of control $Exclude ={ @("Domain Users","Domain Computers", "Domain Guests") -notcontains $_.name} } $filter = "Name -like '$name'" if ($Category -ne "All") { $filter += " -AND GroupCategory -eq '$Category'" } if ($scope -ne "Any") { $filter += " -AND GroupScope -eq '$Scope'" } $get = @{ Filter = $filter Properties = @("Description", "Created", "Modified","ManagedBy") ErrorAction = "Stop" } if ($SearchBase) { Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Searching for group(s) under $SearchBase" $get.Add("Searchbase", $SearchBase) } } #begin Process { if ($PSCmdlet.ParameterSetName -eq 'id') { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Getting group $Identity" } else { Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Searching for groups with filter $filter" } Try { $group = Get-ADGroup @get | Where-Object $Exclude if ($group) { foreach ($item in $Group ) { #get group members recursively $Members =Get-ADGroupUser -name $item.distinguishedName [PSCustomObject]@{ PSTypeName = "ADGroupReport" DistinguishedName = $item.DistinguishedName Name = $item.Name Category = $item.GroupCategory Scope = $item.GroupScope Description = $item.Description Branch = (Split-DistinguishedName -dn $item.DistinguishedName).branchdn Created = $item.Created Modified = $item.Modified Members = $members ManagedBy = $item.ManagedBy } } #foreach item } #if $group else { Write-Warning "No matching groups found." } } #try Catch { Write-Warning $_.Exception.Message } } #process End { Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)" } #end } #close Get-ADGroupReport <# These have been exported to a types file Update-TypeData -TypeName "ADGroupReport" -MemberType AliasProperty -MemberName DN -Value DistinguishedName -force Update-TypeData -TypeName "ADGroupReport" -MemberType ScriptProperty -MemberName MemberCount -Value {($this.members | Measure-Object).Count} -force Update-TypeData -TypeName "ADGroupReport" -MemberType ScriptProperty -MemberName Age -value ({New-Timespan -Start $this.Modified -end (Get-Date)}) #>
Convert-AdsGithubWikiToNotebook.ps1
ADSNotebook-0.0.20201008.1
<# .SYNOPSIS Converts a Github Wiki markdown page to a notebook .DESCRIPTION Converts a Github Wiki markdown page to a notebook .PARAMETER FilePath The full path to the markdown page .PARAMETER NotebookDirectory The directory to store the notebook .PARAMETER NotebookType The type of notebook to create .EXAMPLE $Wikilocation = 'C:\Users\mrrob\OneDrive\Documents\GitHub\ClonedForked\SqlServerAndContainersGuide.wiki' $GitLocation = 'C:\Users\mrrob\OneDrive\Documents\GitHub\ClonedForked\SqlServerAndContainersGuide' $dotnetnotebookpath = "$GitLocation\Notebooks\dotnet\" $notdotnetnotebookpath = "$GitLocation\Notebooks\notdotnet\" Copy-Item -Path $Wikilocation\images -Destination $GitLocation\Notebooks\ -Recurse -Force $wikipages = Get-ChildItem $Wikilocation\*md foreach ($page in $wikipages) { Convert-AdsGithubWikiToNotebook -FilePath $page.FullName -NotebookDirectory $dotnetnotebookpath -NotebookType DotNetPowerShell -WhatIf Convert-AdsGithubWikiToNotebook -FilePath $page.FullName -NotebookDirectory $notdotnetnotebookpath -NotebookType PowerShell -WhatIf } Gets all of the markdown pages in the wiki location and converts them to dot net and not dotnet notebooks .NOTES Rob Sewell 15/08/2020 - Rob Sewell @SQLDbaWithBeard blog.robsewell.com #> function Convert-AdsGithubWikiToNotebook { [cmdletbinding(SupportsShouldProcess)] Param( [Parameter(Mandatory)] [string]$FilePath, [Parameter(Mandatory)] [string]$NotebookDirectory, [Parameter(Mandatory)] [ValidateSet('SQL', 'PowerShell', 'DotNetPowerShell')] [string]$NotebookType ) if (Test-Path $FilePath) { $page = Get-Item $FilePath } else { Write-Warning "There doesn't appear to be anything here $filepath" Return } $content = Get-Content $page.FullName $cells = @() $lasttype = 'Text' $vars = 'Text', 'Code' $blockcontent = '' $content.ForEach{ Write-Verbose "Starting Line" $line = $psitem $line = $line.Replace('[[', '![](..').Replace(']]', ')') if ($line.StartsWith(' ')) { Write-Verbose "This is a code line: $line" $type = 'code' } else { $type = 'text' Write-Verbose "This is a not code line: $line" } if ($lasttype -eq $type) { Write-Verbose "Set blockcontent" $blockcontent = $blockcontent + "`r" + $line } else { $celltype = $vars -ne $type | Out-String $celltype = $celltype.Replace("`r`n", '') $block = New-ADSWorkBookCell -Type $celltype -Text $blockcontent $blockcontent = $line $cells = $cells + $block } $lasttype = $type $message = "Text $text " Write-Verbose $message Write-Verbose "Code - $code" Write-Verbose "Finished Line" } Write-Verbose "Set Line to new cell" $block = New-ADSWorkBookCell -Type $type -Text $blockcontent $blockcontent = $line $cells = $cells + $block $message = $cells | Out-String Write-Verbose $message if ($cells) { $path = $NotebookDirectory + $page.Name.replace('.md', '.ipynb') switch ($NotebookType) { DotNetPowerShell { if ($PSCmdlet.ShouldProcess("$path", "Creating DotNetPowerShell Notebook ")) { New-ADSWorkBook -Path $path -cells $cells -Type DotNetPowerShell } } PowerShell { if ($PSCmdlet.ShouldProcess("$path", "Creating PowerShell Notebook ")) { New-ADSWorkBook -Path $path -cells $cells -Type PowerShell } } SQL { if ($PSCmdlet.ShouldProcess("$path", "Creating SQL Notebook ")) { New-ADSWorkBook -Path $path -cells $cells -Type SQL } } } } else { Write-Warning "Don't appear to have any content in $($page.Name)" } }
Feature.Tests.ps1
ADSNotebook-0.0.20201008.1
$script:ModuleName = 'ADSNotebook' # Removes all versions of the module from the session before importing Get-Module $ModuleName | Remove-Module $ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path # For tests in .\Tests subdirectory if ((Split-Path $ModuleBase -Leaf) -eq 'Tests') { $ModuleBase = Split-Path $ModuleBase -Parent } Import-Module $ModuleBase\$ModuleName.psd1 -PassThru -ErrorAction Stop | Out-Null Describe "Basic function feature tests" -Tags Build { }
Convert-ADSPowerShellForMarkdown.ps1
ADSNotebook-0.0.20201008.1
<# .SYNOPSIS Converts PowerShell code into valid Markdown URI Link text .DESCRIPTION Converts PowerShell code into valid Markdown URI Link Text .PARAMETER inputstring The PowerShell to encode. IMPORTANT escap $ with a ` .PARAMETER LinkText The text to show for the link .PARAMETER ToClipBoard Will not output to screen but instead will set the clipboard .EXAMPLE Convert-ADSPowerShellForMarkdown -InputText "Get-ChildItem" -LinkText 'This will list the files' -ToClipBoard Converts the PowerShell so that it works with MarkDown and sets it to the clipboard .NOTES June 2019 - Rob Sewell @SQLDbaWithBeard blog.robsewell.com #> function Convert-ADSPowerShellForMarkdown { [cmdletbinding()] [OutputType('System.String')] Param( [Parameter(Mandatory = $true)] [string]$InputString, [string]$LinkText = " LINK TEXT HERE ", [switch]$ToClipBoard ) [Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null $encodedstring = [System.Web.HttpUtility]::UrlEncode($inputstring) $linkage = $encodedstring.Replace('+', ' ').Replace('%3a', ':').Replace('%5c', '%5c%5c').Replace('%22', '\u0022').Replace('%27', '\u0027').Replace('%0D%0A', '').Replace('%3b%0a','\u003B ').Replace('%0a','\u000A') $outputstring = @" <a href="command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22 $linkage \u000D %22%7D">$linktext</a> "@ if ($ToClipBoard) { if (-not ($IsLinux -or $IsMacOS) ) { $outputstring | Set-Clipboard } else { Write-Warning "Set-Clipboard - Doesnt work on Linux - Outputting to screen" $outputstring } } else { $outputstring } }
New-ADSWorkBook.ps1
ADSNotebook-0.0.20201008.1
<# .SYNOPSIS Creates a New Azure Data Studio WorkBook .DESCRIPTION This will create a new Azure Data Studio Notebook .PARAMETER Path The full path where you want the notebook saved - must end with .ipynb .PARAMETER cells An array of New-AdsWorkBookCells to add to the WorkBook .PARAMETER Type The type of WorkBook to create - SQL or PowerShell or DotNetPowerShell .EXAMPLE $introCelltext = "# Welcome to my Auto Generated SQL Notebook ## Automation Using this we can automate the creation of notebooks for our use " $SecondCelltext = "## Running code The next cell will have some code in it for running ## Server Principals Below is the code to run against your instance to find the server principals that are enabled" $thirdcelltext = "SELECT Name FROM sys.server_principals WHERE is_disabled = 0" $Intro = New-ADSWorkBookCell -Type Text -Text $introCelltext $second = New-ADSWorkBookCell -Type Text -Text $SecondCelltext $third = New-ADSWorkBookCell -Type Code -Text $thirdcelltext $path = 'C:\temp\AutoGenerated.ipynb' New-ADSWorkBook -Path $path -cells $Intro,$second,$third -Type SQL Creates 3 cells with New-AdsWorkBookCells to add to the workbook, two text ones and a code one, then creates a SQL Notebook with those cells and saves it as C:\temp\AutoGenerated.ipynb .EXAMPLE $introCelltext = "# Welcome to my Auto Generated PowerShell Notebook ## dbatools ![image](https://user-images.githubusercontent.com/6729780/68845538-7afcd200-06c3-11ea-952e-e4fe72a68fc8.png) dbatools is an open-source PowerShell Module for administering SQL Servers. You can read more about dbatools and find the documentation at [dbatools.io](dbatools.io) " $SecondCelltext = "### Installation You can install dbatools from the PowerShell Gallery using `Install-Module dbatools` " $thirdcelltext = "Install-Module dbatools" $fourthCelltext = "### Getting Help You should always use `Get-Help` to fins out how to use dbatools (and any PowerShell) commands" $fifthcelltext = "Get-Help Get-DbaDatabase" $sixthCelltext = "Try a command now. get the name, owner and collation of the user databases on the local instance" $seventhCellText = "Get-DbaDatabase -SqlInstance localhost -ExcludeSystem | Select Name, Owner, Collation" $Intro = New-ADSWorkBookCell -Type Text -Text $introCelltext $second = New-ADSWorkBookCell -Type Text -Text $SecondCelltext $third = New-ADSWorkBookCell -Type Code -Text $thirdcelltext $fourth = New-ADSWorkBookCell -Type Text -Text $fourthCelltext $fifth = New-ADSWorkBookCell -Type Code -Text $fifthcelltext $sixth = New-ADSWorkBookCell -Type Text -Text $sixthCelltext $seventh = New-ADSWorkBookCell -Type Code -Text $seventhCellText $path = 'C:\temp\dbatools.ipynb' New-ADSWorkBook -Path $path -cells $Intro,$second,$third,$fourth,$fifth,$sixth,$Seventh -Type PowerShell Creates 7 cells with New-AdsWorkBookCells to add to the workbook, four text ones and three code ones, then creates a PowerShell Notebook with those cells and saves it as C:\temp\dbatools.ipynb .NOTES Rob Sewell 10/10/2019 - Initial Rob Sewell 14/11/2019 - Added PowerShell Notebooks type Rob Sewell 23/07/2020 - Added DotNetPowerShell Notebook Rob Sewell @SQLDbaWithBeard blog.robsewell.com #> function New-ADSWorkBook { [cmdletbinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidTrailingWhitespace", "", Justification = "the markdown requires a trailing space to work correctly")] Param( # The full path to the file [Parameter(Mandatory)] [ValidateScript({ if($_ -match '^*.ipynb'){ $true } else{ Throw [System.Management.Automation.ValidationMetadataException] "The path $($_) does not have the correct extension. It needs to be .ipynb" } })] [string] $Path, # The cells (in order) created by New-ADSWorkBookCell to build the notebook [Parameter(Mandatory)] [pscustomobject[]] $cells, # The type of notebook [Parameter(Mandatory)] [ValidateSet('SQL','PowerShell','DotNetPowerShell')] [string] $Type ) $PSCmdlet.WriteVerbose('Lets create a Notebook of type $type') $PSCmdlet.WriteVerbose('Creating the base object') switch ($type) { 'DotNetPowerShell' { $Base = [PSCustomObject]@{ metadata = [PSCustomObject]@{ kernelspec = [PSCustomObject]@{ name = '.net-powershell' language = "PowerShell" display_name = '.NET (PowerShell)' } } language_info = [PSCustomObject]@{ name = 'PowerShell' version = '7.0' pygments_lexer = 'powershell' mimetype = 'text/x-powershell' file_extension = '.ps1' } nbformat_minor = 4 nbformat = 4 cells = @() } } 'PowerShell' { $Base = [PSCustomObject]@{ metadata = [PSCustomObject]@{ kernelspec = [PSCustomObject]@{ name = 'powershell' display_name = 'PowerShell' } } language_info = [PSCustomObject]@{ name = 'powershell' version = '' codemirror_mode = 'shell' mimetype = 'text/x-sh' file_extension = '.ps1' } nbformat_minor = 2 nbformat = 4 cells = @() } } 'SQL' { $Base = [PSCustomObject]@{ metadata = [PSCustomObject]@{ kernelspec = [PSCustomObject]@{ name = 'SQL' display_name = 'SQL' language = 'sql' } } language_info = [PSCustomObject]@{ name = 'sql' version = '' } nbformat_minor = 2 nbformat = 4 cells = @() } } } $PSCmdlet.WriteVerbose('Adding the array of cells to the base object') foreach ($cell in $cells) { $base.cells += $cell } $PSCmdlet.WriteVerbose('Finished adding the array of cells to the base object') $PSCmdlet.WriteVerbose('Creating the json and replacing the back slashes and double quotes') try { if($IsCoreCLR){ $base = ($Base | ConvertTo-Json -Depth 4 ).Replace('\\r ', '\r').Replace('\\n ', '\n').Replace('"\', '').Replace('\""','"') } else{ # Grr PowwerShell $base = ($Base | ConvertTo-Json -Depth 4 ).Replace('\\r ', '\r').Replace('\\n ', '\n').Replace('\"\u003e','\">').Replace('"\"\u003c','"<').Replace('"\"', '"').Replace('\""','"').Replace('\u003c','<').Replace('\u003e','>') } } catch { $PSCmdlet.WriteWarning('Failed to create the json for some reason. Run `$error[0] | fl -force to find out why') Return } $PSCmdlet.WriteVerbose('json created') if ($PSCmdlet.ShouldProcess("$path", "Creating File")) { $Base | Set-Content -Path $path } $PSCmdlet.WriteVerbose('Created json file at' + $path + ' - Go and open it in Azure Data Studio') }
Regression.Tests.ps1
ADSNotebook-0.0.20201008.1
$script:ModuleName = 'ADSNotebook' # Removes all versions of the module from the session before importing Get-Module $ModuleName | Remove-Module $ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path # For tests in .\Tests subdirectory if ((Split-Path $ModuleBase -Leaf) -eq 'Tests') { $ModuleBase = Split-Path $ModuleBase -Parent } Import-Module $ModuleBase\$ModuleName.psd1 -PassThru -ErrorAction Stop | Out-Null Describe "Regression tests" -Tag Build { }
PSScriptAnalyzerSettings.psd1
ADSNotebook-0.0.20201008.1
# PSScriptAnalyzerSettings.psd1 # Settings for PSScriptAnalyzer invocation. @{ Rules = @{ PSUseCompatibleCommands = @{ # Turns the rule on Enable = $true # Lists the PowerShell platforms we want to check compatibility with TargetProfiles = @( 'win-8_x64_10.0.17763.0_6.1.3_x64_4.0.30319.42000_core', 'ubuntu_x64_18.04_6.1.3_x64_4.0.30319.42000_core', 'win-8_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework' # 'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework' ) # You can specify commands to not check like this, which also will ignore its parameters: IgnoreCommands = @( 'Set-ClipBoard', # Because we explicitly check for OS before using in ADSNotebooks module 'It', # Because Pester! 'Should', # Because Pester! 'Context', # Because Pester! 'BeforeAll', # Because Pester! 'Describe' # Because Pester! ) } PSUseCompatibleSyntax = @{ # This turns the rule on (setting it to false will turn it off) Enable = $true # Simply list the targeted versions of PowerShell here TargetVersions = @( '5.1' '6.1', '6.2' ) } } # Do not analyze the following rules. Use ExcludeRules when you have # commented out the IncludeRules settings above and want to include all # the default rules except for those you exclude below. # Note: if a rule is in both IncludeRules and ExcludeRules, the rule # will be excluded. ExcludeRules = @('PSAvoidTrailingWhitespace') }
Help.Tests.ps1
ADSNotebook-0.0.20201008.1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.119 Created on: 4/12/2016 1:11 PM Created by: June Blender Organization: SAPIEN Technologies, Inc Filename: *.Help.Tests.ps1 =========================================================================== .DESCRIPTION To test help for the commands in a module, place this file in the module folder. To test any module from any path, use https://github.com/juneb/PesterTDD/Module.Help.Tests.ps1 #> $ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path $FunctionHelpTestExceptions = Get-Content -Path "$ModuleBase\Help.Exceptions.ps1" # For tests in .\Tests subdirectory if ((Split-Path $ModuleBase -Leaf) -eq 'Tests') { $ModuleBase = Split-Path $ModuleBase -Parent } # Handles modules in version directories $leaf = Split-Path $ModuleBase -Leaf $parent = Split-Path $ModuleBase -Parent $parsedVersion = $null if ([System.Version]::TryParse($leaf, [ref]$parsedVersion)) { $ModuleName = Split-Path $parent -Leaf } # for VSTS build agent elseif ($leaf -eq 's') { $ModuleName = $Env:Build_Repository_Name.Split('/')[1] } else { $ModuleName = $leaf } # Removes all versions of the module from the session before importing Get-Module $ModuleName | Remove-Module # Because ModuleBase includes version number, this imports the required version # of the module $Module = Import-Module $ModuleBase\$ModuleName.psd1 -PassThru -ErrorAction Stop $commands = Get-Command -Module $module -CommandType Cmdlet, Function, Workflow # Not alias ## When testing help, remember that help is cached at the beginning of each session. ## To test, restart session. foreach ($command in $commands) { $commandName = $command.Name # Skip all functions that are on the exclusions list if ($script:FunctionHelpTestExceptions -contains $commandName) { continue } ## may not be correct check with a functionthat needs exceptions # The module-qualified command fails on Microsoft.PowerShell.Archive cmdlets $Help = Get-Help $commandName -ErrorAction SilentlyContinue Describe "Test help for $commandName" -Tag Help{ # If help is not found, synopsis in auto-generated help is the syntax diagram It "should not be auto-generated" { $Help.Synopsis | Should Not BeLike '*`[`<CommonParameters`>`]*' } # Should be a description for every function It "gets description for $commandName" { $Help.Description | Should Not BeNullOrEmpty } # Should be at least one example It "gets example code from $commandName" { ($Help.Examples.Example | Select-Object -First 1).Code | Should Not BeNullOrEmpty } # Should be at least one example description It "gets example help from $commandName" { ($Help.Examples.Example.Remarks | Select-Object -First 1).Text | Should Not BeNullOrEmpty } Context "Test parameter help for $commandName" { $Common = 'Confirm','WhatIf', 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable' $parameters = $command.ParameterSets.Parameters | Sort-Object -Property Name -Unique | Where-Object Name -notin $common $parameterNames = $parameters.Name $HelpParameters = $Help.Parameters.Parameter| Sort-Object -Unique | Where-Object Name -notin $common $HelpParameterNames = $HelpParameters.Name foreach ($parameter in $parameters) { $parameterName = $parameter.Name $parameterHelp = $Help.parameters.parameter | Where-Object Name -EQ $parameterName # Should be a description for every parameter It "gets help for parameter: $parameterName : in $commandName" { $parameterHelp.Description.Text | Should Not BeNullOrEmpty } # Required value in Help should match IsMandatory property of parameter It "help for $parameterName parameter in $commandName has correct Mandatory value" { $codeMandatory = $parameter.IsMandatory.toString() $parameterHelp.Required | Should Be $codeMandatory } # Parameter type in Help should match code It "help for $commandName has correct parameter type for $parameterName" { $codeType = $parameter.ParameterType.Name # To avoid calling Trim method on a null object. $helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() } $helpType | Should be $codeType } } foreach ($helpParm in $HelpParameterNames) { # Shouldn't find extra parameters in help. It "finds help parameter in code: $helpParm" { $helpParm -in $parameterNames | Should Be $true } } } } }
create notebook demo.ps1
ADSNotebook-0.0.20201008.1
Import-Module Git:\ADSNotebook\ADSNotebook.psd1 Get-Command -Module ADSNotebook $introCelltext = "# Welcome to my Auto Generated Notebook ## Automation Using this we can automate the creation of notebooks for our use " $SecondCelltext = "## Running code The next cell will have some code in it for running ## Server Principals Below is the code to run against your instance to find the server principals that are enabled" $thirdcelltext = "SELECT Name FROM sys.server_principals WHERE is_disabled = 0" $fourthcelltext = "## SA renamed? You should check if the sa account is in that list" $fifthCellText = "We should try another Code cell" $sixthcelltext = "## Are these sysadmin role members correct? You should check the accounts in this list" $seventhcelltext = "EXEC sp_helpsrvrolemember 'sysadmin'" $eighthcelltext = 'Thats all folks!! <img src="https://media.giphy.com/media/8P7y2ARUPFpNaaWEZ3/giphy.gif" height="264" title="Windmill"> ' $Intro = New-ADSWorkBookCell -Type Text -Text $introCelltext $second = New-ADSWorkBookCell -Type Text -Text $SecondCelltext $third = New-ADSWorkBookCell -Type Code -Text $thirdcelltext $fourth = New-ADSWorkBookCell -Type Text -Text $fourthcelltext $fifth = New-ADSWorkBookCell -Type Text -Text $fifthCellText $sixth = New-ADSWorkBookCell -Type Text -Text $sixthcelltext $seventh = New-ADSWorkBookCell -Type Code -Text $seventhcelltext $eighth = New-ADSWorkBookCell -Type Text -Text $eighthcelltext $path = 'C:\temp\AutoGenerated.ipynb' New-ADSWorkBook -Path $path -cells $Intro,$second,$third,$fourth,$fifth,$sixth,$seventh,$eighth Invoke-Item $path
New-ADSWorkBookCell.ps1
ADSNotebook-0.0.20201008.1
<# .SYNOPSIS Creates a cell for an Azure Data Studio Notebook .DESCRIPTION Creates a text (markdown) or code (T-SQL) cell for an Azure Data Studio Notebook .PARAMETER Type The type of cell to create (code or text) .PARAMETER Text The value for the cell (markdown for text and T-SQL for celll) .PARAMETER Collapse Should the code cell be collapsed .EXAMPLE $introCelltext = "# Welcome to my Auto Generated Notebook ## Automation Using this we can automate the creation of notebooks for our use " $Intro = New-ADSWorkBookCell -Type Text -Text $introCelltext Creates an Azure Data Studio Text cell and sets it to a variable for passing to New-AdsWorkBook .EXAMPLE $thirdcelltext = "SELECT Name FROM sys.server_principals WHERE is_disabled = 0" $Third = New-ADSWorkBookCell -Type Code -Text $thirdcelltext Creates an Azure Data Studio Code cell which will be collapsed and sets it to a variable for passing to New-AdsWorkBook .NOTES Rob Sewell 10/10/2019 - Initial Rob Sewell 19/11/2019 - Added Collapse parameter Rob Sewell @SQLDbaWithBeard blog.robsewell.com #> function New-ADSWorkBookCell { [cmdletbinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "", Justification = "Because it doesnt really change anything")] Param ( # The Type of cell [Parameter(Mandatory)] [ValidateSet('Code', 'Text')] [string] $Type, # The source for the cell [Parameter(Mandatory)] [string] $Text, [switch] $Collapse ) $PSCmdlet.WriteVerbose('Lets create a Notebook Cell') switch ($type) { Text { $PSCmdlet.WriteVerbose('We are going to create a Text Cell') $PSCmdlet.WriteVerbose('Creating base object') $guid = [guid]::NewGuid().guid $basecell = [pscustomobject]@{ cell_type = 'markdown' source = @( ) metadata = [pscustomobject]@{ azdata_cell_guid = "$guid" } } } Code { $PSCmdlet.WriteVerbose('We are going to create a Code Cell') $PSCmdlet.WriteVerbose('Creating base object') $guid = [guid]::NewGuid().guid $basecell = [pscustomobject]@{ cell_type = 'code' source = @( ) metadata = [pscustomobject]@{ azdata_cell_guid = "$guid" } outputs = @() execution_count = 0 } } } if($Collapse -and $Type -eq 'Code'){ $basecell.metadata | Add-Member -Name tags -Value @('hide_input') -MemberType NoteProperty } $PSCmdlet.WriteVerbose('Now we need to parse the text, first split it by line ending') $rawtext = $text -split "[`r`n]+" $PSCmdlet.WriteVerbose('Recreate the code as an array of strings with the correct line ending') $source = @() foreach ($line in $rawtext) { $source += '"' + $Line + '\r \n "' } $PSCmdlet.WriteVerbose('Source now looks like this - Each line should be a double quote and end with \r\n' + $source) $PSCmdlet.WriteVerbose('Add source to the base cell') $basecell.source = $source $basecell $PSCmdlet.WriteVerbose('Finished creating cell') }
Convert-AdsDotNetToNotDotNet.ps1
ADSNotebook-0.0.20201008.1
<# .SYNOPSIS Converts a dotnet interactive PowerShell notebook to a Not DotNet PowerShell notebook for Azure Data Studio .DESCRIPTION Converts a dotnet interactive PowerShell notebook to a Not DotNet PowerShell notebook for Azure Data Studio .PARAMETER SourceNotebook The path to the Source Notebook .PARAMETER DestinationDirectory The directory to create the Not DotNet Notebook (will be created if it doesnt exist) .PARAMETER DestinationNotebook Optional - The name of the Destination Notebook - will retain the orignal name by default .EXAMPLE Convert-AdsDotNetToNotDotNet -SourceNotebook Number1.ipynb -DestinationDirectory Git:\dbatoolsnotebooks Will convert the dotnet interactive notebook Number1.iynb to not dotnet notebook and save in the Git:\dbatoolsnotebooks directory .EXAMPLE Convert-AdsDotNetToNotDotNet -SourceNotebook Number1.ipynb -DestinationDirectory Git:\dbatoolsnotebooks -DestinationNotebook NotNumber1 Will convert the dotnet interactive notebook Number1.iynb to not dotnet notebook and save in the Git:\dbatoolsnotebooks directory and rename it to NotNumber1 .NOTES Some Month in 2020 - Rob Sewell @SQLDbaWithBeard blog.robsewell.com #> Function Convert-AdsDotNetToNotDotNet { [cmdletbinding(SupportsShouldProcess)] Param( [Parameter(Mandatory)] [string]$SourceNotebook, [Parameter(Mandatory)] [string]$DestinationDirectory, [Parameter()] [string]$DestinationNotebook ) if (Test-Path $SourceNotebook) { $SourceNotebookObject = Get-Item $SourceNotebook if($SourceNotebookObject.Extension -eq '.ipynb'){ $Source = Get-Content $SourceNotebook | ConvertFrom-Json } else { Write-Warning "$SourceNotebook doesnt appear to be a notebook" Return } } else { Write-Warning "There doesn't appear to be anything here $SourceNotebook" Return } if($source.metadata.kernelspec.name -eq '.net-powershell'){ }else{ Write-Warning "This notebook $SourceNotebook does not appear to be a dotnet PowerShell notebook " Return } if (Test-Path $DestinationDirectory) { Write-Verbose "Destination Directory $DestinationDirectory exists " } else { if ($PSCmdlet.ShouldProcess("$DestinationDirectory", "Creating ")) { $null = New-Item $DestinationDirectory -ItemType Directory } } $Source.metadata.kernelspec.name = 'powershell' $Source.metadata.kernelspec.display_name = 'PowerShell' $Source.metadata.language_info.name = 'powershell' $Source.metadata.language_info.mimetype = 'text/x-sh' $Source.metadata.language_info | Add-Member -Name "codemirror_mode" -Value 'shell' -MemberType NoteProperty $Source.metadata.language_info.PSObject.Properties.Remove('version') $Source.metadata.language_info.PSObject.Properties.Remove('pygments_lexer') if($DestinationNotebook){ if($DestinationNotebook.EndsWith('.ipynb')){ }else{ $DestinationNotebook = $DestinationNotebook + '.ipynb' } $Destination = $DestinationDirectory + '\' + $DestinationNotebook } else{ $Destination = $DestinationDirectory + '\' + $SourceNotebookObject.Name } if ($PSCmdlet.ShouldProcess("$Destination", "Creating NotDotNet Notebook")) { $Source | ConvertTo-Json -Depth 5 |Set-Content $Destination } }
ADSNotebook.psm1
ADSNotebook-0.0.20201008.1
[cmdletbinding()] param() Write-Verbose $PSScriptRoot Write-Verbose 'Import everything in sub folders folder' foreach($folder in @('internal', 'functions')) { $root = Join-Path -Path $PSScriptRoot -ChildPath $folder if(Test-Path -Path $root) { Write-Verbose "processing folder $root" $files = Get-ChildItem -Path $root -Filter *.ps1 -Recurse # dot source each file $files | where-Object{ $_.name -NotLike '*.Tests.ps1'} | ForEach-Object{Write-Verbose $_.basename; . $_.FullName} } } Export-ModuleMember -function (Get-ChildItem -Path "$PSScriptRoot\functions\*.ps1").basename
Project.Tests.ps1
ADSNotebook-0.0.20201008.1
$packages = get-package if ($packages.Name -contains "PSScriptAnalyzer") { #PSScriptAnalyzer is installed on the system } else { Write-Output "Installing latest version of PSScriptAnalyzer" #install PSScriptAnalyzer Install-Package PSScriptAnalyzer -Force -Scope CurrentUser } $script:ModuleName = 'ADSNotebook' # Removes all versions of the module from the session before importing Get-Module $ModuleName | Remove-Module $ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path $FunctionHelpTestExceptions = Get-Content -Path "$ModuleBase\Help.Exceptions.ps1" # For tests in .\Tests subdirectory if ((Split-Path $ModuleBase -Leaf) -eq 'Tests') { $ModuleBase = Split-Path $ModuleBase -Parent } Import-Module $ModuleBase\$ModuleName.psd1 -PassThru -ErrorAction Stop | Out-Null Describe "PSScriptAnalyzer rule-sets" -Tag Build , ScriptAnalyzer { $Rules = Get-ScriptAnalyzerRule $scripts = Get-ChildItem $ModuleBase -Include *.ps1, *.psm1, *.psd1 -Recurse | Where-Object fullname -notmatch 'classes' foreach ( $Script in $scripts ) { Context "Script '$($script.FullName)'" { foreach ( $rule in $rules ) { # Skip all rules that are on the exclusions list if ($FunctionHelpTestExceptions -contains $rule.RuleName) { continue } It "Rule [$rule]" { (Invoke-ScriptAnalyzer -Path $script.FullName -IncludeRule $rule.RuleName -Settings $ModuleBase\PSScriptAnalyzerSettings.psd1 ).Count | Should Be 0 } } } } } Describe "General project validation: $moduleName" -Tags Build { BeforeAll { Get-Module $ModuleName | Remove-Module } It "Module '$moduleName' can import cleanly" { {Import-Module $ModuleBase\$ModuleName.psd1 -force } | Should Not Throw } }
Unit.Tests.ps1
ADSNotebook-0.0.20201008.1
$script:ModuleName = 'ADSNotebook' # Removes all versions of the module from the session before importing Get-Module $ModuleName | Remove-Module $ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path # For tests in .\Tests subdirectory if ((Split-Path $ModuleBase -Leaf) -eq 'Tests') { $ModuleBase = Split-Path $ModuleBase -Parent } ## this variable is for the VSTS tasks and is to be used for refernecing any mock artifacts $Env:ModuleBase = $ModuleBase Import-Module $ModuleBase\$ModuleName.psd1 -PassThru -ErrorAction Stop | Out-Null Describe "Basic function unit tests" -Tags Build , Unit{ }
Convert-AdsNotDotNetToDotNet.ps1
ADSNotebook-0.0.20201008.1
<# .SYNOPSIS Converts a Not DotNet PowerShell notebook to a dotnet interactive PowerShell notebook for Azure Data Studio .DESCRIPTION Converts a Not DotNet PowerShell notebook to a dotnet interactive PowerShell notebook for Azure Data Studio .PARAMETER SourceNotebook The path to the Source Notebook .PARAMETER DestinationDirectory The directory to create the DotNet Notebook (will be created if it doesnt exist) .PARAMETER DestinationNotebook Optional - The name of the Destination Notebook - will retain the original name by default .EXAMPLE Convert-AdsNotDotNetToDotNet -SourceNotebook Number1.ipynb -DestinationDirectory Git:\dbatoolsnotebooks Will convert the not dotnet notebook Number1.iynb to a dotnet interactive notebook and save in the Git:\dbatoolsnotebooks directory .EXAMPLE Convert-AdsNotDotNetToDotNet -SourceNotebook Number1.ipynb -DestinationDirectory Git:\dbatoolsnotebooks -DestinationNotebook NotNumber1 Will convert the not dotnet notebook Number1.iynb to a dotnet interactive notebook and save in the Git:\dbatoolsnotebooks directory and rename it to NotNumber1 .NOTES Some Month in 2020 - Rob Sewell @SQLDbaWithBeard blog.robsewell.com #> function Convert-AdsNotDotNetToDotNet { [cmdletbinding(SupportsShouldProcess)] Param( [Parameter(Mandatory)] [string]$SourceNotebook, [Parameter(Mandatory)] [string]$DestinationDirectory, [Parameter()] [string]$DestinationNotebook ) if (Test-Path $SourceNotebook) { $SourceNotebookObject = Get-Item $SourceNotebook if($SourceNotebookObject.Extension -eq '.ipynb'){ $Source = Get-Content $SourceNotebook | ConvertFrom-Json } else { Write-Warning "$SourceNotebook doesnt appear to be a notebook" Return } } else { Write-Warning "There doesn't appear to be anything here $SourceNotebook" Return } if (Test-Path $DestinationDirectory) { Write-Verbose "Destination Directory $DestinationDirectory exists " } else { if ($PSCmdlet.ShouldProcess("$DestinationDirectory", "Creating ")) { $null = New-Item $DestinationDirectory -ItemType Directory } } if ($source.metadata.kernelspec.name -eq 'powershell') { } else { Write-Warning "This notebook $SourceNotebook does not appear to be a notdotnet PowerShell notebook " Return } $Source.metadata.kernelspec.name = '.net-powershell' $Source.metadata.kernelspec.display_name = '.NET (PowerShell)' $Source.metadata.language_info.name = 'PowerShell' $Source.metadata.language_info | Add-Member -Name "version" -Value '7.0' -MemberType NoteProperty $Source.metadata.language_info.mimetype = 'text/x-powershell' $Source.metadata.language_info.PSObject.Properties.Remove('codemirror_mode') $Source.metadata.language_info | Add-Member -Name "pygments_lexer" -Value 'powershell' -MemberType NoteProperty if($DestinationNotebook){ if($DestinationNotebook.EndsWith('.ipynb')){ }else{ $DestinationNotebook = $DestinationNotebook + '.ipynb' } $Destination = $DestinationDirectory + '\' + $DestinationNotebook } else{ $Destination = $DestinationDirectory + '\' + $SourceNotebookObject.Name } if ($PSCmdlet.ShouldProcess("$Destination", "Creating NotDotNet Notebook")) { $Source | ConvertTo-Json -Depth 5 |Set-Content $Destination } }
ADSNotebook.psd1
ADSNotebook-0.0.20201008.1
# # Module manifest for module 'ADSNotebook' # # Generated by: Rob Sewell # # Generated on: 16/10/2019 # @{ # Script module or binary module file associated with this manifest. RootModule = 'ADSNotebook.psm1' # Version number of this module. ModuleVersion = '0.0.20201008.1' # Supported PSEditions # CompatiblePSEditions = @() # ID used to uniquely identify this module GUID = '7844ea9f-88f7-46e2-ac8a-b4f562573b24' # Author of this module Author = 'Rob Sewell' # Company or vendor of this module CompanyName = 'Unknown' # Copyright statement for this module Copyright = '(c) 2019 Rob Sewell. All rights reserved.' # Description of the functionality provided by this module Description = 'For creating Azure Data Studio Notebooks and adding PowerShell to the MarkDown' # Minimum version of the Windows PowerShell engine required by this module # PowerShellVersion = '' # Name of the Windows PowerShell host required by this module # PowerShellHostName = '' # Minimum version of the Windows PowerShell host required by this module # PowerShellHostVersion = '' # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. # CLRVersion = '' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module # RequiredModules = @() # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module # TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module # FormatsToProcess = @() # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = 'New-ADSWorkBook','New-ADSWorkBookCell','Convert-ADSPowerShellForMarkdown','Convert-AdsGithubWikiToNotebook','Convert-AdsNotDotNetToDotNet','Convert-AdsDotNetToNotDotNet' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() # Variables to export from this module VariablesToExport = @() # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. AliasesToExport = @() # DSC resources to export from this module # DscResourcesToExport = @() # List of all modules packaged with this module # ModuleList = @() # List of all files packaged with this module # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. # Tags = @() # A URL to the license for this module. # LicenseUri = '' # A URL to the main website for this project. # ProjectUri = '' # A URL to an icon representing this module. # IconUri = '' # ReleaseNotes of this module # ReleaseNotes = '' } # End of PSData hashtable } # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' }
Help.Exceptions.ps1
ADSNotebook-0.0.20201008.1
Add-ADSchemaAttributeToClass.ps1
ADSchema-0.0.3
<# .SYNOPSIS Adds an attribute to a class. .DESCRIPTION Add a New Custom Class to an existing Structural Class in Active Directory. For example if you want to add attributes to the User Class: 1. Create a new Auxiliary Class. 2. Add Attributes to that new Auxiliary Class. 3. Assign the new class as an Auxiliary Class to the User Class. .PARAMETER AuxiliaryClass The class that will be holding the new attributes you are creating. This will be an Auxiliary Class of the structural class. .PARAMETER Class The Structural Class you are adding an Auxiliary Class to. .EXAMPLE PS> Add-ADSchemaAuxiliaryClassToClass -AuxiliaryClass asTest -Class User Set the 'asTest' class as an Auxiliary Class of the User Class. #> Function Add-ADSchemaAttributeToClass { param( $Attribute, $Class ) $schemaPath = (Get-ADRootDSE).schemaNamingContext $Schema = Get-ADObject -SearchBase $schemaPath -Filter "name -eq `'$Class`'" $Schema | Set-ADObject -Add @{mayContain = $Attribute} }
Get-ADSchemaClass.ps1
ADSchema-0.0.3
<# .SYNOPSIS Gets classes in an AD Schema .DESCRIPTION Use this function to list or search for existing classes in the Active Directory Schema .PARAMETER Class The name of the class you want to search for. Supports wildcards .EXAMPLE Get-ADSchemaClass -Name User .EXAMPLE Get-ADSchemaClass com* #> Function Get-ADSchemaClass { param( [Parameter()] $Class = '*' ) $schema = [directoryservices.activedirectory.activedirectoryschema]::getcurrentschema() $classes = $schema.FindAllClasses() return $classes | Where-Object {$_.Name -like $Class} }
ADSchema.psd1
ADSchema-0.0.3
@{ # Script module or binary module file associated with this manifest. RootModule = 'ADSchema.psm1' # Version number of this module. ModuleVersion = '0.0.3' # Supported PSEditions # CompatiblePSEditions = @() # ID used to uniquely identify this module GUID = '211804eb-1c03-48ac-bfed-f3b309a9d7b2' # Author of this module Author = 'Andy Schneider' # Company or vendor of this module CompanyName = 'Get-PowerShell' # Copyright statement for this module Copyright = '(c) 2017 Andy Schneider. All rights reserved.' # Description of the functionality provided by this module Description = 'Used to manage the schema in Active Directory' # Minimum version of the Windows PowerShell engine required by this module # PowerShellVersion = '' # Name of the Windows PowerShell host required by this module # PowerShellHostName = '' # Minimum version of the Windows PowerShell host required by this module # PowerShellHostVersion = '' # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. # CLRVersion = '' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module #RequiredModules = @('ActiveDirectory') # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module # TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module # FormatsToProcess = @() # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = @('Add-ADSchemaAttributeToClass', 'Add-ADSchemaAuxiliaryClassToClass', 'Get-ADSchemaAttribute', 'Get-ADSchemaClass', 'Invoke-ADSchemaReload', 'New-ADSchemaAttribute', 'New-ADSchemaClass', 'New-ADSchemaTestOID') # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = '*' # Variables to export from this module VariablesToExport = '*' # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. AliasesToExport = '*' # DSC resources to export from this module # DscResourcesToExport = @() # List of all modules packaged with this module # ModuleList = @() # List of all files packaged with this module # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. Tags = @('AD','ActiveDirectory','Schema','SchemaExtensions') # A URL to the license for this module. LicenseUri = 'https://github.com/SchneiderAndy/ADSchema/blob/master/LICENSE' # A URL to the main website for this project. ProjectUri = 'https://github.com/SchneiderAndy/ADSchema' # A URL to an icon representing this module. # IconUri = '' # ReleaseNotes of this module ReleaseNotes = 'documentation clean up' } # End of PSData hashtable } # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' }
Get-ADSchemaAttribute.ps1
ADSchema-0.0.3
<# .Synopsis Gets attributes in an AD Schema .DESCRIPTION Gets attributes in an AD Schema .EXAMPLE Get-ADSchemaAttribute -class User -Attribute c* .EXAMPLE Get-ADSchemaAttribute -class asTestClass -attribute asFavoriteColor #> Function Get-ADSchemaAttribute { param( [Parameter()] $Attribute = '*', [Parameter()] $Class = 'user' ) $schema = [directoryservices.activedirectory.activedirectoryschema]::getcurrentschema() $attributes = $schema.FindClass($Class).mandatoryproperties $attributes += $schema.FindClass($Class).optionalproperties return $attributes | Where-Object {$_.Name -like $Attribute} }
ADSchemaAttribute.tests.ps1
ADSchema-0.0.3
Describe "ADSchema Attribute Functions" { Context "Get-ADSchemaAttribute" { It "exists as a function in the module" { (Get-Command Get-ADSchemaAttribute).count | should be 1 } It "returns a schema object - test use CN Attribute" { (Get-ADSchemaAttribute -class User -Attribute cn).Oid | Should Be '2.5.4.3' } It "accepts wildcards" { ((Get-ADSchemaAttribute -class User -Attribute c*) | Where-Object {$_.Name -eq 'CN'}).count | Should Be 1 } } Context "New-ADSchemaAttribute" { It "exists as a function in the module" { (Get-Command New-ADSchemaAttribute).count | should be 1 } } }
ADSchema.psm1
ADSchema-0.0.3
$Scripts = @( Get-ChildItem -Path $PSScriptRoot\Scripts\*.ps1 ) #Dot source the files Foreach($Script in @($Scripts)) { Try { Write-Verbose "Importing $($Script.Fullname)" . $Script.fullname } Catch { Write-Error -Message "Failed to import function $($import.fullname): $_" } } Export-ModuleMember -Function $Scripts.Basename
ADSchemaModule.tests.ps1
ADSchema-0.0.3
Describe "ADSchema Class Functions" { Context "Help for functions" { foreach ($command in Get-Command -Module ADSchema) { It "$command has examples in the help" { $help = get-help -Full $command $help.examples.example | should not be $null } } } }
Invoke-ADSchemaReload.ps1
ADSchema-0.0.3
<# .SYNOPSIS Reloads the Active Directory Schema .DESCRIPTION After the schema has been updated, it needs to be reloaded so your updates can be seen immediately. .EXAMPLE PS C:\> Invoke-ADSchemaReload #> Function Invoke-ADSchemaReload { $dse = Get-ADRootDSE $dse.schemaUpdateNow = $true }
New-ADSchemaClass.ps1
ADSchema-0.0.3
<# .SYNOPSIS Create a new class in the Active Directory Schema .DESCRIPTION New-ADSchemaClass will add a new class to the AD Schema. The majority of the time, any new classes will likely be an Auxiliary Class. It is a best practice to create an auxiliary class and add it as an auxliary class to an existing class. .PARAMETER Name The name of the attribute you are creating. This will be the CN and the LDAP Display Name, and Admin Display Name. Using a standard prefix is a good practice to follow. .PARAMETER AdminDescription This is the description of the class being created. Usually, a 3 or 4 word description is sufficient. .PARAMETER Category 99% of the time, you will chose an Auxiliary class. Becuase of this, the default value is automatically set to Auxililary. Please see https://technet.microsoft.com/en-us/library/cc961751.aspx for info on other categories if you wish to overwrite. .EXAMPLE $oid = New-ADSchemaTestOID New-ADSchemaClass -Name asPerson -AdminDescription 'host custom user attributes' -Category Auxiliary -AttributeID $oid #> Function New-ADSchemaClass { [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param( [Parameter(Mandatory, ValueFromPipelinebyPropertyName)] $Name, [Parameter(Mandatory, ValueFromPipelinebyPropertyName)] [Alias('Description')] $AdminDescription, [Parameter(ValueFromPipelinebyPropertyName)] [ValidateSet("Auxiliary","Abstract","Structural","88 Class")] $Category = 'Auxiliary', [Parameter(ValueFromPipelinebyPropertyName)] [Alias('OID')] $AttributeID = (New-ADSchemaTestOID) ) BEGIN {} PROCESS { $schemaPath = (Get-ADRootDSE).schemaNamingContext switch ($Category) { 'Auxiliary' {$ObjectCategory = 3} 'Abstract' {$ObjectCategory = 2} 'Structural' {$ObjectCategory = 1} '88 Class' {$ObjectCategory = 0} } $attributes = @{ governsId = $AttributeID adminDescription = $AdminDescription objectClass = 'classSchema' ldapDisplayName = $Name adminDisplayName = $Name objectClassCategory = $ObjectCategory systemOnly = $FALSE # subclassOf: top subclassOf = "2.5.6.0" # rdnAttId: cn rdnAttId = "2.5.4.3" } $ConfirmationMessage = "$Name in $schemaPath. This cannot be undone" $Caption = 'Adding a new class to Active Directory Schema' if($AttributeID.StartsWith('1.2.840.113556.1.8000.2554')){ Write-Warning 'You are using a test OID. For Production use, use an OID with your registered PEN. See help about_adschema for more details. ' } if ($PSCmdlet.ShouldProcess($ConfirmationMessage, $Caption)) { New-ADObject -Name $Name -Type 'classSchema' -Path $schemapath -OtherAttributes $attributes } } END {} }
ADSchemaClass.tests.ps1
ADSchema-0.0.3
Describe "ADSchema Class Functions" { Context "Get-ADSchemaClass" { It "exists as a function in the module" { (Get-Command Get-ADSchemaClass).count | should be 1 } It "returns a schema object - test uses user class" { (Get-ADSchemaClass -Class 'User').Oid | Should Be '1.2.840.113556.1.5.9' } It "accepts wildcards" { ((Get-ADSchemaClass -class use*) | Where-Object {$_.Name -eq 'User'}).count | Should Be 1 } } Context "New-ADSchemaAttribute" { It "exists as a function in the module" { (Get-Command New-ADSchemaClass).count | should be 1 } } }
New-ADSchemaTestOID.ps1
ADSchema-0.0.3
<# .SYNOPSIS Creates a random OID for dev and test purposes. .DESCRIPTION Creates a random Object Identifier for dev and test purposes. For production uses, use an OID with your company OID prefix and Private Enterprise Number. See help about_adschema for more information. .EXAMPLE PS> New-ADSchemaTestOID 1.2.840.113556.1.8000.2554.9398 .EXAMPLE PS> New-ADSchemaTestOID -Parts 5 -Prefix 1.2.3 1.2.3.6317.60671.47166.17019.42042 .EXAMPLE PS> New-ADSchemaTestOID -Parts 4 -Prefix 1.2.3 1.2.3.7279.9696.19673.18618 .EXAMPLE PS> New-ADSchemaTestOID -Parts 6 1.2.840.113556.1.8000.2554.59800.33270.113.17098.41534.37654 #> Function New-ADSchemaTestOID { param( [Parameter()] $Prefix = "1.2.840.113556.1.8000.2554", [Parameter()] [ValidateRange(1,6)] $Parts = 2 ) $guid = (New-Guid).Guid $p = @() for ($i = 0; $i -lt $Parts * 5 ; $i+=5) { if($i -eq 0) {$p += [UInt64]::Parse($guid.SubString($i , 4), "AllowHexSpecifier")} else {$p += [UInt64]::Parse($guid.SubString($i-1 , 4), "AllowHexSpecifier")} } return $prefix + '.' + ($p -join '.') }
Add-ADSchemaAuxiliaryClassToClass.ps1
ADSchema-0.0.3
<# .SYNOPSIS Adds an Auxiliary Class to a Structural Class. .DESCRIPTION Add a new Custom Class to an existing Structural Class in Active Directory. For example if you want to add attributes to the user class, you should: 1) Create a new Auxiliary Class. 2) Add attributes to that Auxiliary Class. 3) Finally assign the New Class as an Auxiliary Class to the User Class. .PARAMETER AuxiliaryClass The class that will be holding the new attributes you are creating. This will be an auxiliary class of the structural class. .PARAMETER Class The structural class you are adding an Auxiliary Class to.. .EXAMPLE PS> Add-ADSchemaAuxiliaryClassToClass -AuxiliaryClass asTest -Class User Set the asTest class as an aux class of the User class. #> Function Add-ADSchemaAuxiliaryClassToClass { param( [Parameter()] $AuxiliaryClass, [Parameter()] $Class ) $schemaPath = (Get-ADRootDSE).schemaNamingContext $auxClass = Get-ADObject -SearchBase $schemaPath -Filter "name -eq `'$AuxiliaryClass`'" -Properties governsID $classToAddTo = Get-ADObject -SearchBase $schemaPath -Filter "name -eq `'$Class`'" $classToAddTo | Set-ADObject -Add @{auxiliaryClass = $($auxClass.governsID)} }
New-ADSchemaAttribute.ps1
ADSchema-0.0.3
<# .SYNOPSIS Create a new attribute in the Active Directory Schema .DESCRIPTION New-ADSchemaAttribute will add a new attribute to the AD Schema. Once the new attribute is created, you will need to add it to a class. AD Schema best practices suggest that you: 1) Create a new Auxiliary Class. 2) Add your attribute to that class. 3) Add your Auxiliary Class (containing your new Attribute) to an Existing Class. See help about_ADSchema for more details .PARAMETER Name The name of the attribute you are creating. This will be the CN and the LDAP Display Name. Using a standard prefix is a good practice to follow. .PARAMETER Description The Administrator description is a short description that is added as metadata to the attribute. Should not be much more than 3 or 4 words. .PARAMETER IsSingleValued Determine whether the new attribute can hold one value or an array of values. .PARAMETER AttributeType Determines what type of attribute you are creating. Use a DN to create an attribute that will hold a reference to another object in Active Directory. One example of an existing DN attribute is a user's manager, or a group's "ManagedBy" attribute. Strings are case-insenstive. .PARAMETER AttributeID AttributeID is the Object Identifier (OID) for the new attribute. OIDs have a specific syntax that looks something like '1.2.840.113556.1.8000.2554.13769.13577.20614' You can use the New-ADSchemaTestOid to generate one. However, in production, you should use your own OID based on your company's defined OID structure and your Private Enterprise Number. For more inforation, please look at help about_ADSchema. .PARAMETER SchemaAttributeHashTable This parameter is the rope that will let you hang yourself if you are not careful. It is for advanced users that want to generate highly customized attributes. Any of the attributes found in https://technet.microsoft.com/en-us/library/cc961746.aspx could be used. You will need to store them in a hashtable with their corresponding values. Using a custom hashtable, you can specify any of the attributes in attributeSchema objects and use any attributeSyntax you want. .EXAMPLE $oid = New-ADSchemaTestOID New-ADSchemaAttribute -Name as-favoriteColor -Description 'Favorite Color' -IsSingleValued $true -AttributeType String -AtributeID $oid .EXAMPLE $hash - Get-ADSchemaClass com* #> Function New-ADSchemaAttribute { [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param( [Parameter(Mandatory,ValueFromPipelinebyPropertyName, ParameterSetName = 'basic')] [String] $Name, [Parameter(Mandatory, ValueFromPipelinebyPropertyName, ParameterSetName = 'basic')] [Alias('AdminDescription')] [String] $Description, [Parameter(ValueFromPipelinebyPropertyName, ParameterSetName = 'basic')] [Alias('SingleValued')] [Boolean] $IsSingleValued = $True, [Parameter(Mandatory, ValueFromPipelinebyPropertyName, ParameterSetName = 'basic')] [ValidateSet('String','StringOctet','DN','Int','GeneralizedTime','Boolean')] [String] $AttributeType , [Parameter(ValueFromPipelinebyPropertyName,ParameterSetName = 'basic')] [Alias('OID')] [String] $AttributeID = (New-ADSchemaTestOID), [Parameter(ValueFromPipelineByPropertyName,ParameterSetName = 'advanced')] [String] $SchemaAttributeHashTable ) BEGIN {} PROCESS { $schemaPath = (Get-ADRootDSE).schemaNamingContext $type = 'attributeSchema' if($SchemaAttributeHashTable){ $attributes = $SchemaAttributeHashTable } else { # based on https://technet.microsoft.com/en-us/library/cc961740.aspx switch ($AttributeType) { 'String' {$attributeSyntax = '2.5.5.4'; $omSyntax = 20} 'StringOctet' {$attributeSyntax = '2.5.5.10'; $omSyntax = 4} 'DN' {$attributeSyntax = '2.5.5.1'; $omSyntax = 127} 'Int' {$attributeSyntax = '2.5.5.9'; $omSyntax = 2} 'GeneralizedTime' {$attributeSyntax = '2.5.5.11'; $omSyntax = 24} 'Boolean' {$attributeSyntax = '2.5.5.8'; $omSyntax = 1} Default {} } $attributes = @{ lDAPDisplayName = $Name; attributeId = $AttributeID; oMSyntax = $omSyntax; attributeSyntax = $attributeSyntax; isSingleValued = $IsSingleValued; adminDescription = $Description; searchflags = 1 } } $ConfirmationMessage = "$schemaPath. This cannot be undone" $Caption = "Updating Active Directory Schema. Creating attribute $Name" if($AttributeID.StartsWith('1.2.840.113556.1.8000.2554')){ Write-Warning 'You are using a test OID. For Production use, use an OID with your registered PEN. See help about_adschema for more details. ' } if ($PSCmdlet.ShouldProcess($ConfirmationMessage, $Caption)) { New-ADObject -Name $Name -Type $type -Path $schemapath -OtherAttributes $attributes } } END {} }
example.tepp.ps1
ADSec-1.0.1
<# # Example: Register-PSFTeppScriptblock -Name "ADSec.alcohol" -ScriptBlock { 'Beer','Mead','Whiskey','Wine','Vodka','Rum (3y)', 'Rum (5y)', 'Rum (7y)' } #>
scriptblocks.ps1
ADSec-1.0.1
<# Stored scriptblocks are available in [PsfValidateScript()] attributes. This makes it easier to centrally provide the same scriptblock multiple times, without having to maintain it in separate locations. It also prevents lengthy validation scriptblocks from making your parameter block hard to read. Set-PSFScriptblock -Name 'ADSec.ScriptBlockName' -Scriptblock { } #>
preimport.ps1
ADSec-1.0.1
# Add all things you want to run before importing the main code # Load the strings used in messages . Import-ModuleFile -Path "$($script:ModuleRoot)\internal\scripts\strings.ps1"
pester.ps1
ADSec-1.0.1
param ( $TestGeneral = $true, $TestFunctions = $true, [ValidateSet('None', 'Normal', 'Detailed', 'Diagnostic')] [Alias('Show')] $Output = "None", $Include = "*", $Exclude = "" ) Write-PSFMessage -Level Important -Message "Starting Tests" Write-PSFMessage -Level Important -Message "Importing Module" $global:testroot = $PSScriptRoot $global:__pester_data = @{ } Remove-Module ADSec -ErrorAction Ignore Import-Module "$PSScriptRoot\..\ADSec.psd1" Import-Module "$PSScriptRoot\..\ADSec.psm1" -Force # Need to import explicitly so we can use the configuration class Import-Module Pester Write-PSFMessage -Level Important -Message "Creating test result folder" $null = New-Item -Path "$PSScriptRoot\..\.." -Name TestResults -ItemType Directory -Force $totalFailed = 0 $totalRun = 0 $testresults = @() $config = [PesterConfiguration]::Default $config.TestResult.Enabled = $true #region Run General Tests if ($TestGeneral) { Write-PSFMessage -Level Important -Message "Modules imported, proceeding with general tests" foreach ($file in (Get-ChildItem "$PSScriptRoot\general" | Where-Object Name -like "*.Tests.ps1")) { if ($file.Name -notlike $Include) { continue } if ($file.Name -like $Exclude) { continue } Write-PSFMessage -Level Significant -Message " Executing <c='em'>$($file.Name)</c>" $config.TestResult.OutputPath = Join-Path "$PSScriptRoot\..\..\TestResults" "TEST-$($file.BaseName).xml" $config.Run.Path = $file.FullName $config.Run.PassThru = $true $config.Output.Verbosity = $Output $results = Invoke-Pester -Configuration $config foreach ($result in $results) { $totalRun += $result.TotalCount $totalFailed += $result.FailedCount $result.Tests | Where-Object Result -ne 'Passed' | ForEach-Object { $testresults += [pscustomobject]@{ Block = $_.Block Name = "It $($_.Name)" Result = $_.Result Message = $_.ErrorRecord.DisplayErrorMessage } } } } } #endregion Run General Tests $global:__pester_data.ScriptAnalyzer | Out-Host #region Test Commands if ($TestFunctions) { Write-PSFMessage -Level Important -Message "Proceeding with individual tests" foreach ($file in (Get-ChildItem "$PSScriptRoot\functions" -Recurse -File | Where-Object Name -like "*Tests.ps1")) { if ($file.Name -notlike $Include) { continue } if ($file.Name -like $Exclude) { continue } Write-PSFMessage -Level Significant -Message " Executing $($file.Name)" $config.TestResult.OutputPath = Join-Path "$PSScriptRoot\..\..\TestResults" "TEST-$($file.BaseName).xml" $config.Run.Path = $file.FullName $config.Run.PassThru = $true $config.Output.Verbosity = $Output $results = Invoke-Pester -Configuration $config foreach ($result in $results) { $totalRun += $result.TotalCount $totalFailed += $result.FailedCount $result.Tests | Where-Object Result -ne 'Passed' | ForEach-Object { $testresults += [pscustomobject]@{ Block = $_.Block Name = "It $($_.Name)" Result = $_.Result Message = $_.ErrorRecord.DisplayErrorMessage } } } } } #endregion Test Commands $testresults | Sort-Object Describe, Context, Name, Result, Message | Format-List if ($totalFailed -eq 0) { Write-PSFMessage -Level Critical -Message "All <c='em'>$totalRun</c> tests executed without a single failure!" } else { Write-PSFMessage -Level Critical -Message "<c='em'>$totalFailed tests</c> out of <c='sub'>$totalRun</c> tests failed!" } if ($totalFailed -gt 0) { throw "$totalFailed / $totalRun tests failed!" }
strings.ps1
ADSec-1.0.1
<# This file loads the strings documents from the respective language folders. This allows localizing messages and errors. Load psd1 language files for each language you wish to support. Partial translations are acceptable - when missing a current language message, it will fallback to English or another available language. #> Import-PSFLocalizedString -Path "$($script:ModuleRoot)\en-us\*.psd1" -Module 'ADSec' -Language 'en-US'
Manifest.Tests.ps1
ADSec-1.0.1
Describe "Validating the module manifest" { $moduleRoot = (Resolve-Path "$global:testroot\..").Path $manifest = ((Get-Content "$moduleRoot\ADSec.psd1") -join "`n") | Invoke-Expression Context "Basic resources validation" { $files = Get-ChildItem "$moduleRoot\functions" -Recurse -File | Where-Object Name -like "*.ps1" It "Exports all functions in the public folder" -TestCases @{ files = $files; manifest = $manifest } { $functions = (Compare-Object -ReferenceObject $files.BaseName -DifferenceObject $manifest.FunctionsToExport | Where-Object SideIndicator -Like '<=').InputObject $functions | Should -BeNullOrEmpty } It "Exports no function that isn't also present in the public folder" -TestCases @{ files = $files; manifest = $manifest } { $functions = (Compare-Object -ReferenceObject $files.BaseName -DifferenceObject $manifest.FunctionsToExport | Where-Object SideIndicator -Like '=>').InputObject $functions | Should -BeNullOrEmpty } It "Exports none of its internal functions" -TestCases @{ moduleRoot = $moduleRoot; manifest = $manifest } { $files = Get-ChildItem "$moduleRoot\internal\functions" -Recurse -File -Filter "*.ps1" $files | Where-Object BaseName -In $manifest.FunctionsToExport | Should -BeNullOrEmpty } } Context "Individual file validation" { It "The root module file exists" -TestCases @{ moduleRoot = $moduleRoot; manifest = $manifest } { Test-Path "$moduleRoot\$($manifest.RootModule)" | Should -Be $true } foreach ($format in $manifest.FormatsToProcess) { It "The file $format should exist" -TestCases @{ moduleRoot = $moduleRoot; format = $format } { Test-Path "$moduleRoot\$format" | Should -Be $true } } foreach ($type in $manifest.TypesToProcess) { It "The file $type should exist" -TestCases @{ moduleRoot = $moduleRoot; type = $type } { Test-Path "$moduleRoot\$type" | Should -Be $true } } foreach ($assembly in $manifest.RequiredAssemblies) { if ($assembly -like "*.dll") { It "The file $assembly should exist" -TestCases @{ moduleRoot = $moduleRoot; assembly = $assembly } { Test-Path "$moduleRoot\$assembly" | Should -Be $true } } else { It "The file $assembly should load from the GAC" -TestCases @{ moduleRoot = $moduleRoot; assembly = $assembly } { { Add-Type -AssemblyName $assembly } | Should -Not -Throw } } } foreach ($tag in $manifest.PrivateData.PSData.Tags) { It "Tags should have no spaces in name" -TestCases @{ tag = $tag } { $tag -match " " | Should -Be $false } } } }
Help.Tests.ps1
ADSec-1.0.1
<# .NOTES The original test this is based upon was written by June Blender. After several rounds of modifications it stands now as it is, but the honor remains hers. Thank you June, for all you have done! .DESCRIPTION This test evaluates the help for all commands in a module. .PARAMETER SkipTest Disables this test. .PARAMETER CommandPath List of paths under which the script files are stored. This test assumes that all functions have their own file that is named after themselves. These paths are used to search for commands that should exist and be tested. Will search recursively and accepts wildcards, make sure only functions are found .PARAMETER ModuleName Name of the module to be tested. The module must already be imported .PARAMETER ExceptionsFile File in which exceptions and adjustments are configured. In it there should be two arrays and a hashtable defined: $global:FunctionHelpTestExceptions $global:HelpTestEnumeratedArrays $global:HelpTestSkipParameterType These can be used to tweak the tests slightly in cases of need. See the example file for explanations on each of these usage and effect. #> [CmdletBinding()] Param ( [switch] $SkipTest, [string[]] $CommandPath = @("$global:testroot\..\functions", "$global:testroot\..\internal\functions"), [string] $ModuleName = "ADSec", [string] $ExceptionsFile = "$global:testroot\general\Help.Exceptions.ps1" ) if ($SkipTest) { return } . $ExceptionsFile $includedNames = (Get-ChildItem $CommandPath -Recurse -File | Where-Object Name -like "*.ps1").BaseName $commandTypes = @('Cmdlet', 'Function') if ($PSVersionTable.PSEdition -eq 'Desktop' ) { $commandTypes += 'Workflow' } $commands = Get-Command -Module (Get-Module $ModuleName) -CommandType $commandTypes | Where-Object Name -In $includedNames ## When testing help, remember that help is cached at the beginning of each session. ## To test, restart session. foreach ($command in $commands) { $commandName = $command.Name # Skip all functions that are on the exclusions list if ($global:FunctionHelpTestExceptions -contains $commandName) { continue } # The module-qualified command fails on Microsoft.PowerShell.Archive cmdlets $Help = Get-Help $commandName -ErrorAction SilentlyContinue Describe "Test help for $commandName" { # If help is not found, synopsis in auto-generated help is the syntax diagram It "should not be auto-generated" -TestCases @{ Help = $Help } { $Help.Synopsis | Should -Not -BeLike '*`[`<CommonParameters`>`]*' } # Should be a description for every function It "gets description for $commandName" -TestCases @{ Help = $Help } { $Help.Description | Should -Not -BeNullOrEmpty } # Should be at least one example It "gets example code from $commandName" -TestCases @{ Help = $Help } { ($Help.Examples.Example | Select-Object -First 1).Code | Should -Not -BeNullOrEmpty } # Should be at least one example description It "gets example help from $commandName" -TestCases @{ Help = $Help } { ($Help.Examples.Example.Remarks | Select-Object -First 1).Text | Should -Not -BeNullOrEmpty } Context "Test parameter help for $commandName" { $common = 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable' $parameters = $command.ParameterSets.Parameters | Sort-Object -Property Name -Unique | Where-Object Name -notin $common $parameterNames = $parameters.Name $HelpParameterNames = $Help.Parameters.Parameter.Name | Sort-Object -Unique foreach ($parameter in $parameters) { $parameterName = $parameter.Name $parameterHelp = $Help.parameters.parameter | Where-Object Name -EQ $parameterName # Should be a description for every parameter It "gets help for parameter: $parameterName : in $commandName" -TestCases @{ parameterHelp = $parameterHelp } { $parameterHelp.Description.Text | Should -Not -BeNullOrEmpty } $codeMandatory = $parameter.IsMandatory.toString() It "help for $parameterName parameter in $commandName has correct Mandatory value" -TestCases @{ parameterHelp = $parameterHelp; codeMandatory = $codeMandatory } { $parameterHelp.Required | Should -Be $codeMandatory } if ($HelpTestSkipParameterType[$commandName] -contains $parameterName) { continue } $codeType = $parameter.ParameterType.Name if ($parameter.ParameterType.IsEnum) { # Enumerations often have issues with the typename not being reliably available $names = $parameter.ParameterType::GetNames($parameter.ParameterType) # Parameter type in Help should match code It "help for $commandName has correct parameter type for $parameterName" -TestCases @{ parameterHelp = $parameterHelp; names = $names } { $parameterHelp.parameterValueGroup.parameterValue | Should -be $names } } elseif ($parameter.ParameterType.FullName -in $HelpTestEnumeratedArrays) { # Enumerations often have issues with the typename not being reliably available $names = [Enum]::GetNames($parameter.ParameterType.DeclaredMembers[0].ReturnType) It "help for $commandName has correct parameter type for $parameterName" -TestCases @{ parameterHelp = $parameterHelp; names = $names } { $parameterHelp.parameterValueGroup.parameterValue | Should -be $names } } else { # To avoid calling Trim method on a null object. $helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() } # Parameter type in Help should match code It "help for $commandName has correct parameter type for $parameterName" -TestCases @{ helpType = $helpType; codeType = $codeType } { $helpType | Should -be $codeType } } } foreach ($helpParm in $HelpParameterNames) { # Shouldn't find extra parameters in help. It "finds help parameter in code: $helpParm" -TestCases @{ helpParm = $helpParm; parameterNames = $parameterNames } { $helpParm -in $parameterNames | Should -Be $true } } } } }
license.ps1
ADSec-1.0.1
New-PSFLicense -Product 'ADSec' -Manufacturer 'Friedrich Weinmann' -ProductVersion $script:ModuleVersion -ProductType Module -Name MIT -Version "1.0.0.0" -Date (Get-Date "2019-10-01") -Text @" Copyright (c) 2019 Friedrich Weinmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. "@
Get-LdapObject.ps1
ADSec-1.0.1
function Get-LdapObject { <# .SYNOPSIS Use LDAP to search in Active Directory .DESCRIPTION Utilizes LDAP to perform swift and efficient LDAP Queries. .PARAMETER LdapFilter The search filter to use when searching for objects. Must be a valid LDAP filter. .PARAMETER Properties The properties to retrieve. Keep bandwidth in mind and only request what is needed. .PARAMETER SearchRoot The root path to search in. This generally expects either the distinguished name of the Organizational unit or the DNS name of the domain. Alternatively, any legal LDAP protocol address can be specified. .PARAMETER Configuration Rather than searching in a specified path, switch to the configuration naming context. .PARAMETER Raw Return the raw AD object without processing it for PowerShell convenience. .PARAMETER PageSize Rather than searching in a specified path, switch to the schema naming context. .PARAMETER SearchScope Whether to search all OUs beneath the target root, only directly beneath it or only the root itself. .PARAMETER Server The server / domain to connect to. .PARAMETER Credential The credentials to use. .EXAMPLE PS C:\> Get-LdapObject -LdapFilter '(PrimaryGroupID=516)' Searches for all objects with primary group ID 516 (hint: Domain Controllers). #> [CmdletBinding(DefaultParameterSetName = 'SearchRoot')] param ( [Parameter(Mandatory = $true)] [string] $LdapFilter, [string[]] $Properties = "*", [Parameter(ParameterSetName = 'SearchRoot')] [string] $SearchRoot, [Parameter(ParameterSetName = 'Configuration')] [switch] $Configuration, [switch] $Raw, [ValidateRange(1, 1000)] [int] $PageSize = 1000, [System.DirectoryServices.SearchScope] $SearchScope = 'Subtree', [string] $Server, [System.Management.Automation.PSCredential] $Credential ) begin { $searcher = New-Object system.directoryservices.directorysearcher $searcher.PageSize = $PageSize $searcher.SearchScope = $SearchScope if ($Credential) { $searcher.SearchRoot.Username = $Credential.UserName try { $searcher.SearchRoot.Password = $Credential.GetNetworkCredential().Password } catch { Stop-PSFFunction -String 'Get-LdapObject.CredentialError' -ErrorRecord $_ -Cmdlet $PSCmdlet -EnableException $true } } if ($SearchRoot) { if ($SearchRoot -like "LDAP://*") { $searcher.SearchRoot.Path = $SearchRoot } elseif ($SearchRoot -notlike "*=*") { $searcher.SearchRoot.Path = "LDAP://DC={0}" -f ($SearchRoot -split "\." -join ",DC=") } else { $searcher.SearchRoot.Path = "LDAP://$($SearchRoot)" } } if ($Configuration) { $searcher.SearchRoot.Path = "LDAP://CN=Configuration,{0}" -f $searcher.SearchRoot.distinguishedName[0] } if ($Server -and ($searcher.SearchRoot.Path -notmatch '^LDAP://[\w\.]+/')) { $searcher.SearchRoot.Path = $searcher.SearchRoot.Path -replace '^LDAP://', "LDAP://$Server/" } Write-PSFMessage -String Get-LdapObject.SearchRoot -StringValues $SearchScope, $searcher.SearchRoot.Path -Level Debug $searcher.Filter = $LdapFilter foreach ($property in $Properties) { $null = $searcher.PropertiesToLoad.Add($property) } Write-PSFMessage -String Get-LdapObject.Searchfilter -StringValues $LdapFilter -Level Debug } process { try { foreach ($ldapobject in $searcher.FindAll()) { if ($Raw) { $ldapobject continue } $resultHash = @{ } foreach ($key in $ldapobject.Properties.Keys) { # Write-Output verwandelt Arrays mit nur einem Wert in nicht-Array Objekt $resultHash[$key] = $ldapobject.Properties[$key] | Write-Output } if ($resultHash.ContainsKey("ObjectClass")) { $resultHash["PSTypeName"] = $resultHash["ObjectClass"] } [pscustomobject]$resultHash } } catch { Stop-PSFFunction -String 'Get-LdapObject.SearchError' -ErrorRecord $_ -Cmdlet $PSCmdlet -EnableException $true } } }
FileIntegrity.Exceptions.ps1
ADSec-1.0.1
# List of forbidden commands $global:BannedCommands = @( 'Write-Host', 'Write-Verbose', 'Write-Warning', 'Write-Error', 'Write-Output', 'Write-Information', 'Write-Debug', # Use CIM instead where possible 'Get-WmiObject', 'Invoke-WmiMethod', 'Register-WmiEvent', 'Remove-WmiObject', 'Set-WmiInstance' ) <# Contains list of exceptions for banned cmdlets. Insert the file names of files that may contain them. Example: "Write-Host" = @('Write-PSFHostColor.ps1','Write-PSFMessage.ps1') #> $global:MayContainCommand = @{ "Write-Host" = @() "Write-Verbose" = @() "Write-Warning" = @() "Write-Error" = @() "Write-Output" = @('Get-LdapObject.ps1', 'Remove-AdsOrphanAce.ps1') "Write-Information" = @() "Write-Debug" = @() }
Enable-AdsInheritance.ps1
ADSec-1.0.1
function Enable-AdsInheritance { <# .SYNOPSIS Enables inheritance on an Active Directoey object. .DESCRIPTION Enables inheritance on an Active Directoey object. .PARAMETER Path The distinguished name of the object to process. .PARAMETER RemoveExplicit By default, all previous access rules will be preserved. Using this parameter, all explicit access rules will instead be removed. .PARAMETER Server The server / domain to connect to. .PARAMETER Credential The credentials to use for AD operations. .PARAMETER EnableException This parameters disables user-friendly warnings and enables the throwing of exceptions. This is less user friendly, but allows catching exceptions in calling scripts. .PARAMETER Confirm If this switch is enabled, you will be prompted for confirmation before executing any operations that change state. .PARAMETER WhatIf If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run. .EXAMPLE PS C:\> Get-ADUser administrator | Enable-AdsInheritance Enables inheritance on the administrator object. .EXAMPLE PS C:\> Get-ADComputer -LDAPFilter '(primaryGroupID=516)' | Enable-AdsInheritance -RemoveExplicit Remove all explicit permissions for deletion. #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] Param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true)] [Alias('DistinguishedName')] [string[]] $Path, [switch] $RemoveExplicit, [string] $Server, [System.Management.Automation.PSCredential] $Credential, [switch] $EnableException ) begin { $adParameters = $PSBoundParameters | ConvertTo-PSFHashtable -Include Server, Credential Assert-ADConnection @adParameters -Cmdlet $PSCmdlet # Wrap as nested pipeline to avoid asserting connection each time $getCmd = { Get-AdsAcl @adParameters -EnableException:$EnableException } $getAdsAcl = $getCmd.GetSteppablePipeline() $getAdsAcl.Begin($true) $setCmd = { Set-AdsAcl @adParameters -EnableException:$EnableException } $setAdsAcl = $setCmd.GetSteppablePipeline() $setAdsAcl.Begin($true) } process { foreach ($pathItem in $Path) { Write-PSFMessage -String 'Enable-AdsInheritance.Processing' -StringValues $pathItem -Target $pathItem try { $aclObject = ($getAdsAcl.Process($pathItem))[0] } catch { Stop-PSFFunction -String 'Enable-AdsInheritance.ReadAcl.Failed' -StringValues $pathItem -ErrorRecord $_ -EnableException $EnableException -Continue -Target $pathItem } $changedAnything = $false if ($aclObject.AreAccessRulesProtected) { $aclObject.SetAccessRuleProtection($false, $true) $changedAnything = $true } if ($RemoveExplicit -and ($aclObject.Access | Where-Object IsInherited -EQ $false)) { ($aclObject.Access) | Where-Object IsInherited -EQ $false | & { process { Write-PSFMessage -Level Debug -String 'Enable-AdsInheritance.AccessRule.Remove' -StringValues $_.IdentityReference, $_.ActiveDirectoryRights, $_.AccessControlType -Target $pathItem $null = $aclObject.RemoveAccessRule($_) } } $changedAnything = $true } if (-not $changedAnything) { Write-PSFMessage -String 'Enable-AdsInheritance.NoChange.Skipping' -StringValues $pathItem -Target $pathItem continue } Invoke-PSFProtectedCommand -ActionString 'Enable-AdsInheritance.Updating.Acl' -Target $pathItem -ScriptBlock { $setAdsAcl.Process($aclObject) } -EnableException $EnableException.ToBool() -PSCmdlet $PSCmdlet -Continue } } end { $getAdsAcl.End() $setAdsAcl.End() } }