├── GPO-Archive_V1.0.zip ├── Example └── Example-TestRegistryValue.ps1 ├── .gitignore ├── Classes └── Class.LoadCSharpFiles.ps1 ├── LICENSE ├── Docs ├── Get-OsBuild.md ├── Get-AdSite.md ├── New-WsusObjects.md ├── Get-AllAdSubnet.md ├── Get-AllAdSiteLink.md ├── about_EguibarIT.md ├── Test-IPv4MaskString.md ├── New-EitAdSite.md ├── Import-MyModule.md ├── Get-RandomHex.md ├── ConvertTo-IntegerIPv4.md ├── ConvertTo-IPv4Integer.md ├── ConvertTo-IPv4MaskString.md ├── ConvertTo-IPv4MaskBit.md ├── New-DelegateAdGpo.md ├── Test-RegistryValue.md ├── New-TemplateOID.md ├── ConvertTo-WmiFilter.md ├── Get-CurrentErrorToDisplay.md ├── Revoke-Inheritance.md ├── New-CaObject.md ├── New-CaObjects.md ├── New-DfsObject.md ├── New-DfsObjects.md ├── Set-FunctionDisplay.md ├── New-DHCPobject.md ├── New-DHCPobjects.md ├── Grant-NTFSPermission.md ├── Get-IniContent.md ├── New-LAPSobject.md ├── New-LAPSobjects.md ├── Publish-CertificateTemplate.md ├── Test-IsValidDN.md ├── Set-AdAclDelegateGalAdmin.md ├── Test-IsValidSID.md ├── Get-ADCSTemplate.md ├── Set-AdAclDelegateUserAdmin.md ├── Add-AdGroupNesting.md ├── New-AGPMObject.md ├── New-ExchangeObject.md ├── New-AGPMObjects.md ├── New-ExchangeObjects.md ├── New-Template.md ├── Test-IsUniqueOID.md ├── Start-AdCleanOU.md ├── Set-AdAclLaps.md ├── Revoke-NTFSPermissions.md ├── ConvertTo-IPv4NetworkAddress.md ├── New-TimePolicyGPO.md ├── New-LocalLogonTask.md ├── Set-AdAclDelegateComputerAdmin.md ├── Start-AdDelegateSite.md └── New-AreaShareNTFS.md ├── Tests ├── Test-IPv4MaskString.Tests.ps1 └── EguibarIT.Tests.ps1 ├── Public ├── Test-IPv4MaskString.ps1 ├── Get-AdSite.ps1 ├── ConvertTo-IPv4MaskString.ps1 ├── ConvertTo-IPv4MaskBit.ps1 ├── Get-AllAdSubnet.ps1 ├── ConvertTo-IntegerIPv4.ps1 ├── Get-AllAdSiteLink.ps1 ├── ConvertTo-IPv4Integer.ps1 ├── Test-RegistryValue.ps1 └── New-EitAdSite.ps1 ├── .vscode ├── extensions.json ├── launch.json └── tasks.json ├── EguibarIT.psm1 ├── Enums └── Enum.Constants.ps1 └── Private ├── Get-SafeVariable.ps1 ├── Test-IsValidGUID.ps1 ├── Test-IsValidDN.ps1 └── Get-RandomHex.ps1 /GPO-Archive_V1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vreguibar/EguibarIT/HEAD/GPO-Archive_V1.0.zip -------------------------------------------------------------------------------- /Example/Example-TestRegistryValue.ps1: -------------------------------------------------------------------------------- 1 | Import-Module $PSScriptRoot\..\EguibarIT 2 | 3 | Test-RegistryValue -Path "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Value "AutoAdminLogon" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.old 3 | *.bak* 4 | *.new 5 | *.corrupted 6 | *.tmp 7 | *.fixed 8 | .gitignore 9 | ### VisualStudioCode Patch ### 10 | # Ignore all local history of files 11 | .history 12 | .ionide 13 | # Built Visual Studio Code Extensions 14 | *.vsix 15 | build.ps1 16 | GPO-Archive_V1.0.zip 17 | Publish.ps1 18 | To-Do.txt 19 | .github/* 20 | # Local History for Visual Studio Code 21 | .history/ 22 | .vs/* 23 | .vscode/* 24 | Artefacts/* 25 | Docs/* 26 | Example/* 27 | Examples/Logs/* 28 | Ignore/* 29 | Lib/Default/* 30 | Lib/Standard/* 31 | Lib/Core/* 32 | Output/* 33 | Releases/* 34 | ReleasedUnpacked/* 35 | Tests/* 36 | Sources/.vs 37 | Sources/*/.vs 38 | Sources/*/obj 39 | Sources/*/bin 40 | Sources/*/*/obj 41 | Sources/*/*/bin 42 | Sources/packages/* 43 | -------------------------------------------------------------------------------- /Classes/Class.LoadCSharpFiles.ps1: -------------------------------------------------------------------------------- 1 | # Function to check if a class is already loaded 2 | function Test-ClassExist { 3 | param( 4 | [string]$ClassName 5 | ) 6 | 7 | # Try to get the type by its full name 8 | $type = [Type]::GetType($ClassName, $false, $false) 9 | 10 | # Return true if the type exists, otherwise false 11 | return [bool]$type 12 | } #end Function 13 | 14 | # Define the class only if it doesn't already exist 15 | if ((-not (Test-ClassExist 'EventIdInfo')) -or 16 | (-not (Test-ClassExist 'EventIDs')) -or 17 | (-not (Test-ClassExist 'EventID')) -or 18 | (-not (Test-ClassExist 'EventSeverity')) -or 19 | (-not (Test-ClassExist 'EventCategory')) 20 | ) { 21 | Write-Verbose -Message 'Event Info class not loaded. Proceed to load...!' 22 | #$EventsFileCS = Get-Content -Path "$PSScriptRoot\Class.Events.cs" -Raw 23 | $EventsFileCS = [System.IO.File]::ReadAllText("$PSScriptRoot\Class.Events.cs") 24 | Add-Type -Language CSharp -TypeDefinition $EventsFileCS 25 | } #end If 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Vicente Rodriguez Eguibar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Docs/Get-OsBuild.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-OsBuild 9 | 10 | ## SYNOPSIS 11 | Function to Identify OS Build number 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-OsBuild [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Function to Identify OS Build number. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-OsBuild 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -ProgressAction 32 | {{ Fill ProgressAction Description }} 33 | 34 | ```yaml 35 | Type: ActionPreference 36 | Parameter Sets: (All) 37 | Aliases: proga 38 | 39 | Required: False 40 | Position: Named 41 | Default value: None 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### CommonParameters 47 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | ## INPUTS 50 | 51 | ### No Imputs needed 52 | ## OUTPUTS 53 | 54 | ## NOTES 55 | Version: 1.0 56 | DateModified: 02/Dic/2014 57 | LasModifiedBy: Vicente Rodriguez Eguibar 58 | vicente@eguibar.com 59 | Eguibar Information Technology S.L. 60 | http://www.eguibarit.com 61 | 62 | ## RELATED LINKS 63 | -------------------------------------------------------------------------------- /Tests/Test-IPv4MaskString.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe -Name 'Testing Test-IPv4MaskStringt' { 2 | It 'Simple test' { 3 | $AllMaskString = @( 4 | '255.255.255.128', 5 | '255.255.255.192', 6 | '255.255.255.224', 7 | '255.255.255.240', 8 | '255.255.255.248', 9 | '255.255.255.252', 10 | '255.255.255.254', 11 | '255.255.255.255', 12 | '255.255.128.0', 13 | '255.255.192.0', 14 | '255.255.224.0', 15 | '255.255.240.0', 16 | '255.255.248.0', 17 | '255.255.252.0', 18 | '255.255.254.0', 19 | '255.255.255.0', 20 | '255.128.0.0', 21 | '255.192.0.0', 22 | '255.224.0.0', 23 | '255.240.0.0', 24 | '255.248.0.0', 25 | '255.252.0.0', 26 | '255.254.0.0', 27 | '255.255.0.0', 28 | '128.0.0.0', 29 | '192.0.0.0', 30 | '224.0.0.0', 31 | '240.0.0.0', 32 | '248.0.0.0', 33 | '252.0.0.0', 34 | '254.0.0.0', 35 | '255.0.0.0' 36 | ) 37 | ForEach($_ in $AllMaskString) { 38 | $result = Test-IPv4MaskString -MaskString $_ 39 | If( $result) { 40 | $TestOutput++ 41 | } 42 | } 43 | $TestOutput.Count | Should -Be $AllMaskString.Count 44 | } 45 | } -------------------------------------------------------------------------------- /Docs/Get-AdSite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-AdSite 9 | 10 | ## SYNOPSIS 11 | Get AD Sites from current Forest 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-AdSite [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Reads all Sites from the current Forest and store those on an array. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-AdSites 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -ProgressAction 32 | {{ Fill ProgressAction Description }} 33 | 34 | ```yaml 35 | Type: ActionPreference 36 | Parameter Sets: (All) 37 | Aliases: proga 38 | 39 | Required: False 40 | Position: Named 41 | Default value: None 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### CommonParameters 47 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | ## INPUTS 50 | 51 | ### No input needed. 52 | ## OUTPUTS 53 | 54 | ### System.Array 55 | ## NOTES 56 | Version: 1.0 57 | DateModified: 31/Mar/2015 58 | LasModifiedBy: Vicente Rodriguez Eguibar 59 | vicente@eguibar.com 60 | Eguibar Information Technology S.L. 61 | http://www.eguibarit.com 62 | 63 | ## RELATED LINKS 64 | -------------------------------------------------------------------------------- /Docs/New-WsusObjects.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-WsusObjects 9 | 10 | ## SYNOPSIS 11 | Create WSUS Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-WsusObjects [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Create the WSUS Objects used to manage 21 | this organization by following the defined Delegation Model. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | New-WsusObjects 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -ProgressAction 33 | {{ Fill ProgressAction Description }} 34 | 35 | ```yaml 36 | Type: ActionPreference 37 | Parameter Sets: (All) 38 | Aliases: proga 39 | 40 | Required: False 41 | Position: Named 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### CommonParameters 48 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 49 | 50 | ## INPUTS 51 | 52 | ## OUTPUTS 53 | 54 | ## NOTES 55 | Version: 1.1 56 | DateModified: 22/Apr/2021 57 | LasModifiedBy: Vicente Rodriguez Eguibar 58 | vicente@eguibar.com 59 | Eguibar Information Technology S.L. 60 | http://www.eguibarit.com 61 | 62 | ## RELATED LINKS 63 | -------------------------------------------------------------------------------- /Docs/Get-AllAdSubnet.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-AllAdSubnet 9 | 10 | ## SYNOPSIS 11 | Get AD subnets from current Forest 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-AllAdSubnet [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Reads all Subnets from the current Forest and store those on an array. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-AdSubnets 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -ProgressAction 32 | {{ Fill ProgressAction Description }} 33 | 34 | ```yaml 35 | Type: ActionPreference 36 | Parameter Sets: (All) 37 | Aliases: proga 38 | 39 | Required: False 40 | Position: Named 41 | Default value: None 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### CommonParameters 47 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | ## INPUTS 50 | 51 | ### No input needed. 52 | ## OUTPUTS 53 | 54 | ### System.Array 55 | ## NOTES 56 | Version: 1.0 57 | DateModified: 31/Mar/2015 58 | LasModifiedBy: Vicente Rodriguez Eguibar 59 | vicente@eguibar.com 60 | Eguibar Information Technology S.L. 61 | http://www.eguibarit.com 62 | 63 | ## RELATED LINKS 64 | -------------------------------------------------------------------------------- /Docs/Get-AllAdSiteLink.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-AllAdSiteLink 9 | 10 | ## SYNOPSIS 11 | Get AD Site Links from current Forest 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-AllAdSiteLink [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Reads all Site Links from the current Forest and store those on an array. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-AdSiteLinks 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -ProgressAction 32 | {{ Fill ProgressAction Description }} 33 | 34 | ```yaml 35 | Type: ActionPreference 36 | Parameter Sets: (All) 37 | Aliases: proga 38 | 39 | Required: False 40 | Position: Named 41 | Default value: None 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### CommonParameters 47 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | ## INPUTS 50 | 51 | ### No input needed. 52 | ## OUTPUTS 53 | 54 | ### System.Array 55 | ## NOTES 56 | Version: 1.0 57 | DateModified: 31/Mar/2015 58 | LasModifiedBy: Vicente Rodriguez Eguibar 59 | vicente@eguibar.com 60 | Eguibar Information Technology S.L. 61 | http://www.eguibarit.com 62 | 63 | ## RELATED LINKS 64 | -------------------------------------------------------------------------------- /Tests/EguibarIT.Tests.ps1: -------------------------------------------------------------------------------- 1 | $PSVersionTable.PSVersion 2 | 3 | $ModuleName = (Get-ChildItem $PSScriptRoot\*.psd1).BaseName 4 | $PrimaryModule = Get-ChildItem -Path $PSScriptRoot -Filter '*.psd1' -Recurse -ErrorAction SilentlyContinue -Depth 1 5 | if (-not $PrimaryModule) { 6 | throw "Path $PSScriptRoot doesn't contain PSD1 files. Failing tests." 7 | } 8 | if ($PrimaryModule.Count -ne 1) { 9 | throw 'More than one PSD1 files detected. Failing tests.' 10 | } 11 | 12 | $PSDInformation = Import-PowerShellDataFile -Path $PrimaryModule.FullName 13 | $RequiredModules = @( 14 | 'Pester' 15 | if ($PSDInformation.RequiredModules) { 16 | $PSDInformation.RequiredModules 17 | } 18 | ) 19 | 20 | foreach ($Module in $RequiredModules) { 21 | if ($Module -is [System.Collections.IDictionary]) { 22 | $Exists = Get-Module -ListAvailable -Name $Module.ModuleName 23 | if (-not $Exists) { 24 | Write-Warning "$ModuleName - Downloading $($Module.ModuleName) from PSGallery" 25 | Install-Module -Name $Module.ModuleName -Force -SkipPublisherCheck 26 | } 27 | } else { 28 | $Exists = Get-Module -ListAvailable $Module -ErrorAction SilentlyContinue 29 | if (-not $Exists) { 30 | Install-Module -Name $Module -Force -SkipPublisherCheck 31 | } 32 | } 33 | } 34 | 35 | Import-Module $PSScriptRoot\*.psd1 -Force 36 | 37 | $result = Invoke-Pester -Path $PSScriptRoot\Tests -Verbose -EnableExit #-Output Detailed 38 | 39 | if ($result.FailedCount -gt 0) { 40 | throw "$($result.FailedCount) tests failed." 41 | } -------------------------------------------------------------------------------- /Docs/about_EguibarIT.md: -------------------------------------------------------------------------------- 1 | # EguibarIT 2 | ## about_EguibarIT 3 | 4 | ``` 5 | ABOUT TOPIC NOTE: 6 | The first header of the about topic should be the topic name. 7 | The second header contains the lookup name used by the help system. 8 | 9 | IE: 10 | # Some Help Topic Name 11 | ## SomeHelpTopicFileName 12 | 13 | This will be transformed into the text file 14 | as `about_SomeHelpTopicFileName`. 15 | Do not include file extensions. 16 | The second header should have no spaces. 17 | ``` 18 | 19 | # SHORT DESCRIPTION 20 | {{ Short Description Placeholder }} 21 | 22 | ``` 23 | ABOUT TOPIC NOTE: 24 | About topics can be no longer than 80 characters wide when rendered to text. 25 | Any topics greater than 80 characters will be automatically wrapped. 26 | The generated about topic will be encoded UTF-8. 27 | ``` 28 | 29 | # LONG DESCRIPTION 30 | {{ Long Description Placeholder }} 31 | 32 | ## Optional Subtopics 33 | {{ Optional Subtopic Placeholder }} 34 | 35 | # EXAMPLES 36 | {{ Code or descriptive examples of how to leverage the functions described. }} 37 | 38 | # NOTE 39 | {{ Note Placeholder - Additional information that a user needs to know.}} 40 | 41 | # TROUBLESHOOTING NOTE 42 | {{ Troubleshooting Placeholder - Warns users of bugs}} 43 | 44 | {{ Explains behavior that is likely to change with fixes }} 45 | 46 | # SEE ALSO 47 | {{ See also placeholder }} 48 | 49 | {{ You can also list related articles, blogs, and video URLs. }} 50 | 51 | # KEYWORDS 52 | {{List alternate names or titles for this topic that readers might use.}} 53 | 54 | - {{ Keyword Placeholder }} 55 | - {{ Keyword Placeholder }} 56 | - {{ Keyword Placeholder }} 57 | - {{ Keyword Placeholder }} 58 | -------------------------------------------------------------------------------- /Docs/Test-IPv4MaskString.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-IPv4MaskString 9 | 10 | ## SYNOPSIS 11 | Tests whether an IPv4 network mask string (e.g., "255.255.255.0") is valid. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Test-IPv4MaskString [[-MaskString] ] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Tests whether an IPv4 network mask string (e.g., "255.255.255.0") is valid. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Test-IPv4MaskString -MaskString "255.255.255.0" 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -MaskString 32 | Specifies the IPv4 network mask string (e.g., "255.255.255.0"). 33 | 34 | ```yaml 35 | Type: String 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: False 40 | Position: 2 41 | Default value: None 42 | Accept pipeline input: True (ByPropertyName, ByValue) 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -ProgressAction 47 | {{ Fill ProgressAction Description }} 48 | 49 | ```yaml 50 | Type: ActionPreference 51 | Parameter Sets: (All) 52 | Aliases: proga 53 | 54 | Required: False 55 | Position: Named 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### CommonParameters 62 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 63 | 64 | ## INPUTS 65 | 66 | ## OUTPUTS 67 | 68 | ## NOTES 69 | 70 | ## RELATED LINKS 71 | -------------------------------------------------------------------------------- /Docs/New-EitAdSite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-EitAdSite 9 | 10 | ## SYNOPSIS 11 | Create new AD Site 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-EitAdSite [-NewSiteName] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Create new AD Site 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | New-EitAdSite -NewSiteName $SiteName 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -NewSiteName 32 | Param1 New Site name 33 | 34 | ```yaml 35 | Type: String 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: True 40 | Position: 1 41 | Default value: None 42 | Accept pipeline input: True (ByPropertyName, ByValue) 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -ProgressAction 47 | {{ Fill ProgressAction Description }} 48 | 49 | ```yaml 50 | Type: ActionPreference 51 | Parameter Sets: (All) 52 | Aliases: proga 53 | 54 | Required: False 55 | Position: Named 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### CommonParameters 62 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 63 | 64 | ## INPUTS 65 | 66 | ### Param1 NewSiteName - Name for the new site. 67 | ## OUTPUTS 68 | 69 | ### System.String 70 | ## NOTES 71 | Version: 1.0 72 | DateModified: 31/Mar/2015 73 | LasModifiedBy: Vicente Rodriguez Eguibar 74 | vicente@eguibar.com 75 | Eguibar Information Technology S.L. 76 | http://www.eguibarit.com 77 | 78 | ## RELATED LINKS 79 | -------------------------------------------------------------------------------- /Docs/Import-MyModule.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Import-MyModule 9 | 10 | ## SYNOPSIS 11 | Function to Import Modules with error handling 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Import-MyModule [-name] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Function to Import Modules as with Import-Module Cmdlet but 21 | with error handling on it. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Import-MyModule ActiveDirectory 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -name 33 | Param1 STRING for the Module Name 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: True (ByPropertyName, ByValue) 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -ProgressAction 48 | {{ Fill ProgressAction Description }} 49 | 50 | ```yaml 51 | Type: ActionPreference 52 | Parameter Sets: (All) 53 | Aliases: proga 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### CommonParameters 63 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 64 | 65 | ## INPUTS 66 | 67 | ### Param1 name:........String representing Module Name 68 | ## OUTPUTS 69 | 70 | ## NOTES 71 | Version: 1.0 72 | DateModified: 19/Feb/2015 73 | LasModifiedBy: Vicente Rodriguez Eguibar 74 | vicente@eguibar.com 75 | Eguibar Information Technology S.L. 76 | http://www.eguibarit.com 77 | 78 | ## RELATED LINKS 79 | -------------------------------------------------------------------------------- /Docs/Get-RandomHex.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-RandomHex 9 | 10 | ## SYNOPSIS 11 | Generates a random hexadecimal string of specified length. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-RandomHex [-Length] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | This function generates a random hexadecimal string of the specified length. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-RandomHex -Length 8 27 | Generates a random hexadecimal string of length 8. 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Length 33 | The length of the hexadecimal string to generate. 34 | 35 | ```yaml 36 | Type: Int32 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: 0 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -ProgressAction 48 | {{ Fill ProgressAction Description }} 49 | 50 | ```yaml 51 | Type: ActionPreference 52 | Parameter Sets: (All) 53 | Aliases: proga 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### CommonParameters 63 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 64 | 65 | ## INPUTS 66 | 67 | ### None 68 | ## OUTPUTS 69 | 70 | ### System.String 71 | ### A random hexadecimal string. 72 | ## NOTES 73 | Version: 1.0 74 | DateModified: 22/Jun/2016 75 | LasModifiedBy: Vicente Rodriguez Eguibar 76 | vicente@eguibar.com 77 | Eguibar Information Technology S.L. 78 | http://www.eguibarit.com 79 | 80 | ## RELATED LINKS 81 | -------------------------------------------------------------------------------- /Docs/ConvertTo-IntegerIPv4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # ConvertTo-IntegerIPv4 9 | 10 | ## SYNOPSIS 11 | Returns the IP Address from given integer 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | ConvertTo-IntegerIPv4 [-Integer] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Returns the IP Address from given integer 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | ConvertTo-IntegerIPv4 -Integer 24 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | ConvertTo-IntegerIPv4 24 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -Integer 37 | Specifies the integer representing the IP Address (e.g., 3232235776 will return "192.168.1.0") 38 | 39 | ```yaml 40 | Type: UInt32 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: 0 47 | Accept pipeline input: True (ByPropertyName, ByValue) 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -ProgressAction 52 | {{ Fill ProgressAction Description }} 53 | 54 | ```yaml 55 | Type: ActionPreference 56 | Parameter Sets: (All) 57 | Aliases: proga 58 | 59 | Required: False 60 | Position: Named 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### CommonParameters 67 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 68 | 69 | ## INPUTS 70 | 71 | ## OUTPUTS 72 | 73 | ### System.Net.IPAddress 74 | ## NOTES 75 | Version: 1.0 76 | DateModified: 13/Apr/2022 77 | LasModifiedBy: Vicente Rodriguez Eguibar 78 | vicente@eguibar.com 79 | Eguibar Information Technology S.L. 80 | http://www.eguibarit.com 81 | 82 | ## RELATED LINKS 83 | -------------------------------------------------------------------------------- /Docs/ConvertTo-IPv4Integer.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # ConvertTo-IPv4Integer 9 | 10 | ## SYNOPSIS 11 | Returns the integer representing the given IP Address 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | ConvertTo-IPv4Integer [-Ipv4Address] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Returns the integer representing the given IP Address 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | ConvertTo-IPv4Integer -Ipv4Address "192.168.1.200" 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | ConvertTo-IPv4Integer "192.168.1.200" 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -Ipv4Address 37 | Specifies the IPv4 Address as a string (e.g., "192.168.1.200") 38 | 39 | ```yaml 40 | Type: String 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: True (ByPropertyName, ByValue) 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -ProgressAction 52 | {{ Fill ProgressAction Description }} 53 | 54 | ```yaml 55 | Type: ActionPreference 56 | Parameter Sets: (All) 57 | Aliases: proga 58 | 59 | Required: False 60 | Position: Named 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### CommonParameters 67 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 68 | 69 | ## INPUTS 70 | 71 | ## OUTPUTS 72 | 73 | ### System.UInt32 74 | ## NOTES 75 | Version: 1.0 76 | DateModified: 13/Apr/2022 77 | LasModifiedBy: Vicente Rodriguez Eguibar 78 | vicente@eguibar.com 79 | Eguibar Information Technology S.L. 80 | http://www.eguibarit.com 81 | 82 | ## RELATED LINKS 83 | -------------------------------------------------------------------------------- /Docs/ConvertTo-IPv4MaskString.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # ConvertTo-IPv4MaskString 9 | 10 | ## SYNOPSIS 11 | Converts a number of bits (0-32) to an IPv4 network mask string (e.g., "255.255.255.0"). 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | ConvertTo-IPv4MaskString [-MaskBits] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Converts a number of bits (0-32) to an IPv4 network mask string (e.g., "255.255.255.0"). 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | ConvertTo-IPv4MaskString -MaskBits "24" 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | ConvertTo-IPv4MaskString "24" 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -MaskBits 37 | Specifies the number of bits in the mask. 38 | 39 | ```yaml 40 | Type: Int32 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: 0 47 | Accept pipeline input: True (ByPropertyName, ByValue) 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -ProgressAction 52 | {{ Fill ProgressAction Description }} 53 | 54 | ```yaml 55 | Type: ActionPreference 56 | Parameter Sets: (All) 57 | Aliases: proga 58 | 59 | Required: False 60 | Position: Named 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### CommonParameters 67 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 68 | 69 | ## INPUTS 70 | 71 | ## OUTPUTS 72 | 73 | ## NOTES 74 | Version: 1.0 75 | DateModified: 13/Apr/2022 76 | LasModifiedBy: Vicente Rodriguez Eguibar 77 | vicente@eguibar.com 78 | Eguibar Information Technology S.L. 79 | http://www.eguibarit.com 80 | 81 | ## RELATED LINKS 82 | -------------------------------------------------------------------------------- /Docs/ConvertTo-IPv4MaskBit.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # ConvertTo-IPv4MaskBit 9 | 10 | ## SYNOPSIS 11 | Returns the number of bits (0-32) in a network mask string (e.g., "255.255.255.0"). 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | ConvertTo-IPv4MaskBit [-MaskString] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Returns the number of bits (0-32) in a network mask string (e.g., "255.255.255.0"). 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | ConvertTo-IPv4MaskBit -MaskString "255.255.255.0" 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | ConvertTo-IPv4MaskBit "192.168.1.200" 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -MaskString 37 | Specifies the IPv4 network mask string (e.g., "255.255.255.0"). 38 | 39 | ```yaml 40 | Type: String 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: True (ByPropertyName, ByValue) 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -ProgressAction 52 | {{ Fill ProgressAction Description }} 53 | 54 | ```yaml 55 | Type: ActionPreference 56 | Parameter Sets: (All) 57 | Aliases: proga 58 | 59 | Required: False 60 | Position: Named 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### CommonParameters 67 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 68 | 69 | ## INPUTS 70 | 71 | ## OUTPUTS 72 | 73 | ### System.Int32 74 | ## NOTES 75 | Version: 1.0 76 | DateModified: 13/Apr/2022 77 | LasModifiedBy: Vicente Rodriguez Eguibar 78 | vicente@eguibar.com 79 | Eguibar Information Technology S.L. 80 | http://www.eguibarit.com 81 | 82 | ## RELATED LINKS 83 | -------------------------------------------------------------------------------- /Public/Test-IPv4MaskString.ps1: -------------------------------------------------------------------------------- 1 | function Test-IPv4MaskString { 2 | <# 3 | .SYNOPSIS 4 | Tests whether an IPv4 network mask string (e.g., "255.255.255.0") is valid. 5 | .DESCRIPTION 6 | Tests whether an IPv4 network mask string (e.g., "255.255.255.0") is valid. 7 | .PARAMETER MaskString 8 | Specifies the IPv4 network mask string (e.g., "255.255.255.0"). 9 | .EXAMPLE 10 | Test-IPv4MaskString -MaskString "255.255.255.0" 11 | #> 12 | 13 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] 14 | [OutputType([bool])] 15 | 16 | Param ( 17 | [Parameter(Mandatory = $false, 18 | ValueFromPipeline = $true, 19 | ValueFromPipelineByPropertyName = $true, 20 | ValueFromRemainingArguments = $true, 21 | HelpMessage = 'Specifies the IPv4 network mask string (e.g., 255.255.255.0)', 22 | Position = 1)] 23 | [String] 24 | $MaskString 25 | ) 26 | 27 | Begin { 28 | $txt = ($Variables.Header -f 29 | (Get-Date).ToString('dd/MMM/yyyy'), 30 | $MyInvocation.Mycommand, 31 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 32 | ) 33 | Write-Verbose -Message $txt 34 | 35 | ############################## 36 | # Module imports 37 | 38 | } #end Begin 39 | 40 | Process { 41 | $validBytes = '0|128|192|224|240|248|252|254|255' 42 | $maskPattern = ('^((({0})\.0\.0\.0)|' -f $validBytes) + 43 | ('(255\.({0})\.0\.0)|' -f $validBytes) + 44 | ('(255\.255\.({0})\.0)|' -f $validBytes) + 45 | ('(255\.255\.255\.({0})))$' -f $validBytes) 46 | $MaskString -match $maskPattern 47 | } #end Process 48 | 49 | End { 50 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 51 | 'testing whether an IPv4 network mask string.' 52 | ) 53 | Write-Verbose -Message $txt 54 | } #end End 55 | 56 | } #end Function 57 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "aaron-bond.better-comments", 4 | "azps-tools.azps-tools", 5 | "azps-tools.azps-tools", 6 | "bagetx.inf", 7 | "davidanson.vscode-markdownlint", 8 | "dbaeumer.vscode-eslint", 9 | "donjayamanne.githistory", 10 | "dotjoshjohnson.xml", 11 | "ecmel.vscode-html-css", 12 | "editorconfig.editorco", 13 | "formulahendry.auto-rename-tag", 14 | "grapecity.gc-excelviewer", 15 | "github.codespaces", 16 | "github.copilot", 17 | "github.copilot-chat", 18 | "github.copilot-workspace", 19 | "github.remotehub", 20 | "github.vscode-github-actions", 21 | "github.vscode-pull-request-github", 22 | "janisdd.vscode-edit-csv", 23 | "khaeransori.json2csv", 24 | "marvhen.reflow-markdown", 25 | "mechatroner.rainbow-csv", 26 | "meezilla.json", 27 | "ms-azuretools.vscode-azureappservice", 28 | "ms-azure-devops.azure-pipelines", 29 | "ms-azuretools.vscode-azureresourcegroups", 30 | "ms-azuretools.vscode-azurecontainerapps", 31 | "ms-dotnettools.csdevkit", 32 | "ms-dotnettools.csharp", 33 | "ms-dotnettools.vscode-dotnet-runtime", 34 | "ms-edgedevtools.vscode-edge-devtools", 35 | "ms-vscode.azure-repos", 36 | "ms-vscode.vscode-copilot-vision", 37 | "ms-vscode.powershell", 38 | "ms-vscode.remote-explorer", 39 | "ms-vscode.remote-repositories", 40 | "ms-vscode.vscode-typescript-tslint-plugin", 41 | "ms-vscode.vscode-websearchforcopilot", 42 | "pspester.pester-test", 43 | "redhat.vscode-xml", 44 | "redhat.vscode-yaml", 45 | "shuworks.vscode-table-formatter", 46 | "streetsidesoftware.code-spell-checker", 47 | "shuworks.vscode-table-formatter", 48 | "tylerleonhardt.vscode-inline-values-powershell", 49 | "visualstudioexptteam.vscodeintellicode", 50 | "visualstudioexptteam.vscodeintellicode-completions", 51 | "usernamehw.errorlens", 52 | "wmaurer.change-case", 53 | "zainchen.json" 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /Docs/New-DelegateAdGpo.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-DelegateAdGpo 9 | 10 | ## SYNOPSIS 11 | Create Central OU and aditional Tier 0 infrastructure OUs 12 | 13 | ## SYNTAX 14 | 15 | ## DESCRIPTION 16 | Create Central OU including sub-OUs, secure them accordingly, move built-in objects 17 | and secure them, create needed groups and secure them, make nesting and delegations 18 | and finaly create PSO and delegate accordingly. 19 | This function is mainly a wrapper used to create Tier0 objects 20 | 21 | ## EXAMPLES 22 | 23 | ### EXAMPLE 1 24 | ``` 25 | New-CentralItOu -ConfigXMLFile 'C:\PsScripts\Configuration.xml' 26 | ``` 27 | 28 | ### EXAMPLE 2 29 | ``` 30 | # Get the Config.xml file 31 | $param = @{ 32 | ConfigXMLFile = Join-Path -Path $DMscripts -ChildPath Config.xml -Resolve 33 | verbose = $true 34 | } 35 | ``` 36 | 37 | # Check if Exchange needs to be created 38 | if($confXML.N.Domains.Prod.CreateExContainers) { 39 | $param.add("CreateExchange", $true) 40 | } 41 | 42 | # Check if DFS needs to be created 43 | if($confXML.N.Domains.Prod.CreateDFS) { 44 | $param.add("CreateDFS", $true) 45 | } 46 | 47 | # Check if CA needs to be created 48 | if($confXML.N.Domains.Prod.CreateCa) { 49 | $param.add("CreateCa", $true) 50 | } 51 | 52 | # Check if LAPS needs to be created 53 | if($confXML.N.Domains.Prod.CreateLAPS) { 54 | $param.add("CreateLAPS", $true) 55 | } 56 | 57 | # Check if DHCP needs to be created 58 | if($confXML.N.Domains.Prod.CreateDHCP) { 59 | $param.add("CreateDHCP", $true) 60 | } 61 | 62 | #Create Central OU Structure 63 | New-CentralItOu @param 64 | 65 | ## PARAMETERS 66 | 67 | ### CommonParameters 68 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 69 | 70 | ## INPUTS 71 | 72 | ## OUTPUTS 73 | 74 | ### System.String 75 | ## NOTES 76 | Version: 1.3 77 | DateModified: 21/Oct/2021 78 | LasModifiedBy: Vicente Rodriguez Eguibar 79 | vicente@eguibar.com 80 | Eguibar Information Technology S.L. 81 | http://www.eguibarit.com 82 | 83 | ## RELATED LINKS 84 | -------------------------------------------------------------------------------- /Docs/Test-RegistryValue.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-RegistryValue 9 | 10 | ## SYNOPSIS 11 | Function to Test Registry Values 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Test-RegistryValue [-Path] [-Value] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Function to Test Registry Values 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Test-RegistryValue -Path "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Value "AutoAdminLogon" 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | Test-RegistryValue "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "AutoAdminLogon" 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -Path 37 | Registry path to be tested 38 | 39 | ```yaml 40 | Type: String 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: True (ByPropertyName, ByValue) 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -Value 52 | Registry value to be tested 53 | 54 | ```yaml 55 | Type: String 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: True 60 | Position: 2 61 | Default value: None 62 | Accept pipeline input: True (ByPropertyName, ByValue) 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -ProgressAction 67 | {{ Fill ProgressAction Description }} 68 | 69 | ```yaml 70 | Type: ActionPreference 71 | Parameter Sets: (All) 72 | Aliases: proga 73 | 74 | Required: False 75 | Position: Named 76 | Default value: None 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### CommonParameters 82 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 83 | 84 | ## INPUTS 85 | 86 | ## OUTPUTS 87 | 88 | ### System.Boolean 89 | ## NOTES 90 | Version: 1.0 91 | DateModified: 16/Ene/2018 92 | LasModifiedBy: Vicente Rodriguez Eguibar 93 | vicente@eguibar.com 94 | Eguibar Information Technology S.L. 95 | http://www.eguibarit.com 96 | 97 | ## RELATED LINKS 98 | -------------------------------------------------------------------------------- /Docs/New-TemplateOID.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-TemplateOID 9 | 10 | ## SYNOPSIS 11 | Generates a new OID for certificate templates. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-TemplateOID [-Server] [-ConfigNC] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | This function generates a new OID (Object Identifier) for certificate templates within Active Directory. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | $result = New-TemplateOID -Server "DC01" -ConfigNC "DC=example,DC=com" 28 | $result.TemplateOID # Output: ForestBaseOID.12345678.87654321 29 | $result.TemplateName # Output: 87654321.0123456789ABCDEF0123456789ABCDEF 30 | ``` 31 | 32 | ## PARAMETERS 33 | 34 | ### -Server 35 | FQDN of a Domain Controller. 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: True (ByPropertyName, ByValue) 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -ConfigNC 50 | Configuration Naming Context of the domain. 51 | 52 | ```yaml 53 | Type: String 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: True 58 | Position: 2 59 | Default value: None 60 | Accept pipeline input: True (ByPropertyName, ByValue) 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -ProgressAction 65 | {{ Fill ProgressAction Description }} 66 | 67 | ```yaml 68 | Type: ActionPreference 69 | Parameter Sets: (All) 70 | Aliases: proga 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | ## INPUTS 83 | 84 | ## OUTPUTS 85 | 86 | ### System.Collections.Hashtable 87 | ## NOTES 88 | Version: 1.4 89 | DateModified: 08/Oct/2021 90 | LasModifiedBy: Vicente Rodriguez Eguibar 91 | vicente@eguibar.com 92 | Eguibar Information Technology S.L. 93 | http://www.eguibarit.com 94 | 95 | ## RELATED LINKS 96 | -------------------------------------------------------------------------------- /Docs/ConvertTo-WmiFilter.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # ConvertTo-WmiFilter 9 | 10 | ## SYNOPSIS 11 | 12 | ## SYNTAX 13 | 14 | ``` 15 | ConvertTo-WmiFilter [[-ADObject] ] [-ProgressAction ] [-WhatIf] [-Confirm] 16 | [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | ConvertTo-WmiFilter 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -ADObject 32 | {{ Fill ADObject Description }} 33 | 34 | ```yaml 35 | Type: ADObject[] 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: False 40 | Position: 1 41 | Default value: None 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -WhatIf 47 | Shows what would happen if the cmdlet runs. 48 | The cmdlet is not run. 49 | 50 | ```yaml 51 | Type: SwitchParameter 52 | Parameter Sets: (All) 53 | Aliases: wi 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -Confirm 63 | Prompts you for confirmation before running the cmdlet. 64 | 65 | ```yaml 66 | Type: SwitchParameter 67 | Parameter Sets: (All) 68 | Aliases: cf 69 | 70 | Required: False 71 | Position: Named 72 | Default value: None 73 | Accept pipeline input: False 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -ProgressAction 78 | {{ Fill ProgressAction Description }} 79 | 80 | ```yaml 81 | Type: ActionPreference 82 | Parameter Sets: (All) 83 | Aliases: proga 84 | 85 | Required: False 86 | Position: Named 87 | Default value: None 88 | Accept pipeline input: False 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### CommonParameters 93 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 94 | 95 | ## INPUTS 96 | 97 | ## OUTPUTS 98 | 99 | ## NOTES 100 | Version: 1.0 101 | DateModified: 25/Mar/2014 102 | LasModifiedBy: Vicente Rodriguez Eguibar 103 | vicente@eguibar.com 104 | Eguibar Information Technology S.L. 105 | http://www.eguibarit.com 106 | 107 | ## RELATED LINKS 108 | -------------------------------------------------------------------------------- /EguibarIT.psm1: -------------------------------------------------------------------------------- 1 | # Get Enums 2 | if (Test-Path -Path "$PSScriptRoot\Enums") { 3 | $Enums = @( Get-ChildItem -Path "$PSScriptRoot\Enums\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse ) 4 | 5 | # Import Enums 6 | foreach ($Item in $Enums) { 7 | Try { 8 | . $Item.FullName 9 | Write-Verbose -Message ('Enum Imported {0}' -f $($Item.BaseName)) 10 | } Catch { 11 | Write-Error -Message "Could not load Enum [$($Item.Name)] : $($_.Message)" 12 | throw 13 | } #end Try-Catch 14 | } #end Foreach 15 | } #end If 16 | 17 | # Get Classes 18 | if (Test-Path -Path "$PSScriptRoot\Classes") { 19 | $Classes = @( Get-ChildItem -Path "$PSScriptRoot\Classes\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse ) 20 | 21 | foreach ($Item in $Classes) { 22 | Try { 23 | . $Item.FullName 24 | Write-Verbose -Message ('Class Imported {0}' -f $($Item.BaseName)) 25 | } Catch { 26 | Write-Error -Message "Could not load Class [$($Item.Name)] : $($_.Message)" 27 | throw 28 | } #end Try-Catch 29 | } #end Foreach 30 | } #end If 31 | 32 | 33 | # Load Private Functions 34 | $Private = @( Get-ChildItem -Path "$PSScriptRoot\Private\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse ) 35 | foreach ($Item in $Private) { 36 | Try { 37 | . $Item.Fullname 38 | Write-Verbose -Message ('Private Function Imported {0}' -f $($Item.BaseName)) 39 | } Catch { 40 | Write-Error -Message "Failed to import private function from $($Item.Fullname): $($_.Exception.Message)" 41 | Throw 42 | } #end try-catch 43 | } #end foreach 44 | 45 | # Load Public Functions 46 | $Public = @( Get-ChildItem -Path "$PSScriptRoot\Public\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse ) 47 | foreach ($Item in $Public) { 48 | Try { 49 | . $Item.Fullname 50 | Write-Verbose -Message ('Public Function Imported {0}' -f $($Item.BaseName)) 51 | } Catch { 52 | Write-Error -Message "Failed to import public function from $($Item.Fullname): $($_.Exception.Message)" 53 | Throw 54 | } #end try-catch 55 | } #end foreach 56 | 57 | 58 | Try { 59 | # Call function Initialize-ModuleVariable to fill-up $Variables 60 | Initialize-ModuleVariable 61 | return $true 62 | } catch { 63 | Write-Error -Message ('Failed to update AD variables: {0}' -f $_) 64 | return $false 65 | } #end try-catch 66 | 67 | Export-ModuleMember -Function '*' -Alias '*' -Variable @('Constants', 'Variables') -Verbose:$false | Out-Null 68 | -------------------------------------------------------------------------------- /Docs/Get-CurrentErrorToDisplay.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-CurrentErrorToDisplay 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-CurrentErrorToDisplay [[-CurrentError] ] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ```powershell 27 | PS C:\> {{ Add example code here }} 28 | ``` 29 | 30 | {{ Add example description here }} 31 | 32 | ## PARAMETERS 33 | 34 | ### -Confirm 35 | Prompts you for confirmation before running the cmdlet. 36 | 37 | ```yaml 38 | Type: SwitchParameter 39 | Parameter Sets: (All) 40 | Aliases: cf 41 | 42 | Required: False 43 | Position: Named 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -CurrentError 50 | Current error (usually from $Error variable) which is going to be proccessed. 51 | If no error is provided then $error\[0\] will be used instead. 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: False 59 | Position: 0 60 | Default value: None 61 | Accept pipeline input: True (ByPropertyName, ByValue) 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -WhatIf 66 | Shows what would happen if the cmdlet runs. 67 | The cmdlet is not run. 68 | 69 | ```yaml 70 | Type: SwitchParameter 71 | Parameter Sets: (All) 72 | Aliases: wi 73 | 74 | Required: False 75 | Position: Named 76 | Default value: None 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### -ProgressAction 82 | {{ Fill ProgressAction Description }} 83 | 84 | ```yaml 85 | Type: ActionPreference 86 | Parameter Sets: (All) 87 | Aliases: proga 88 | 89 | Required: False 90 | Position: Named 91 | Default value: None 92 | Accept pipeline input: False 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### CommonParameters 97 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 98 | 99 | ## INPUTS 100 | 101 | ### System.Object 102 | 103 | ## OUTPUTS 104 | 105 | ### System.String 106 | 107 | ## NOTES 108 | 109 | ## RELATED LINKS 110 | -------------------------------------------------------------------------------- /Docs/Revoke-Inheritance.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Revoke-Inheritance 9 | 10 | ## SYNOPSIS 11 | Function to remove NTFS inheritance of a folder 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Revoke-Inheritance [-path] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Function to remove NTFS inheritance of a folder 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Revoke-Inheritance path 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -path 33 | Param1 path to the resource|folder 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: True (ByPropertyName, ByValue) 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -WhatIf 48 | Shows what would happen if the cmdlet runs. 49 | The cmdlet is not run. 50 | 51 | ```yaml 52 | Type: SwitchParameter 53 | Parameter Sets: (All) 54 | Aliases: wi 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -Confirm 64 | Prompts you for confirmation before running the cmdlet. 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: (All) 69 | Aliases: cf 70 | 71 | Required: False 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -ProgressAction 79 | {{ Fill ProgressAction Description }} 80 | 81 | ```yaml 82 | Type: ActionPreference 83 | Parameter Sets: (All) 84 | Aliases: proga 85 | 86 | Required: False 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### CommonParameters 94 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 95 | 96 | ## INPUTS 97 | 98 | ### Param1 path = The path to the folder 99 | ## OUTPUTS 100 | 101 | ### System.String 102 | ## NOTES 103 | Version: 1.0 104 | DateModified: 31/Mar/2015 105 | LasModifiedBy: Vicente Rodriguez Eguibar 106 | vicente@eguibar.com 107 | Eguibar Information Technology S.L. 108 | http://www.eguibarit.com 109 | 110 | ## RELATED LINKS 111 | -------------------------------------------------------------------------------- /Docs/New-CaObject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-CaObject 9 | 10 | ## SYNOPSIS 11 | Create Certificate Authority Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-CaObject [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the Certificate Authority Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-CaObjects 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | Full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ## OUTPUTS 100 | 101 | ## NOTES 102 | Version: 1.3 103 | DateModified: 01/Feb/2018 104 | LasModifiedBy: Vicente Rodriguez Eguibar 105 | vicente@eguibar.com 106 | Eguibar Information Technology S.L. 107 | http://www.eguibarit.com 108 | 109 | ## RELATED LINKS 110 | -------------------------------------------------------------------------------- /Docs/New-CaObjects.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-CaObjects 9 | 10 | ## SYNOPSIS 11 | Create Certificate Authority Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-CaObjects [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the Certificate Authority Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-CaObjects 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | Full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ## OUTPUTS 100 | 101 | ## NOTES 102 | Version: 1.3 103 | DateModified: 01/Feb/2018 104 | LasModifiedBy: Vicente Rodriguez Eguibar 105 | vicente@eguibar.com 106 | Eguibar Information Technology S.L. 107 | http://www.eguibarit.com 108 | 109 | ## RELATED LINKS 110 | -------------------------------------------------------------------------------- /Docs/New-DfsObject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-DfsObject 9 | 10 | ## SYNOPSIS 11 | Create DFS Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-DfsObject [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the DFS Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-DfsObjects -ConfigXMLFile 'C:\PsScripts\Config.xml' 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | \[String\] Full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ## OUTPUTS 100 | 101 | ## NOTES 102 | Version: 1.3 103 | DateModified: 01/Feb/2018 104 | LasModifiedBy: Vicente Rodriguez Eguibar 105 | vicente@eguibar.com 106 | Eguibar Information Technology S.L. 107 | http://www.eguibarit.com 108 | 109 | ## RELATED LINKS 110 | -------------------------------------------------------------------------------- /Docs/New-DfsObjects.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-DfsObjects 9 | 10 | ## SYNOPSIS 11 | Create DFS Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-DfsObjects [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the DFS Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-DfsObjects -ConfigXMLFile 'C:\PsScripts\Config.xml' 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | \[String\] Full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ## OUTPUTS 100 | 101 | ## NOTES 102 | Version: 1.3 103 | DateModified: 01/Feb/2018 104 | LasModifiedBy: Vicente Rodriguez Eguibar 105 | vicente@eguibar.com 106 | Eguibar Information Technology S.L. 107 | http://www.eguibarit.com 108 | 109 | ## RELATED LINKS 110 | -------------------------------------------------------------------------------- /Docs/Set-FunctionDisplay.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-FunctionDisplay 9 | 10 | ## SYNOPSIS 11 | Formats and displays the PsBoundParameters in a visually appealing way. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-FunctionDisplay [-HashTable] [[-TabCount] ] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | This advanced function formats and displays the contents of a hashtable, typically PsBoundParameters, 22 | making it easier to read and understand in verbose output. 23 | It supports customization of indentation. 24 | 25 | ## EXAMPLES 26 | 27 | ### EXAMPLE 1 28 | ``` 29 | Get-FunctionDisplay $PsBoundParameters 30 | ``` 31 | 32 | ### EXAMPLE 2 33 | ``` 34 | Get-FunctionDisplay -HashTable $PsBoundParameters 35 | ``` 36 | 37 | ## PARAMETERS 38 | 39 | ### -HashTable 40 | The hashtable to format and display. 41 | This is usually the $PsBoundParameters variable. 42 | 43 | ```yaml 44 | Type: Hashtable 45 | Parameter Sets: (All) 46 | Aliases: 47 | 48 | Required: True 49 | Position: 1 50 | Default value: None 51 | Accept pipeline input: True (ByPropertyName, ByValue) 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ### -TabCount 56 | The number of tabs to prepend to each line of output for indentation. 57 | Defaults to 2 if not specified or less than 2. 58 | 59 | ```yaml 60 | Type: Int32 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: False 65 | Position: 2 66 | Default value: 0 67 | Accept pipeline input: True (ByPropertyName, ByValue) 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### -ProgressAction 72 | {{ Fill ProgressAction Description }} 73 | 74 | ```yaml 75 | Type: ActionPreference 76 | Parameter Sets: (All) 77 | Aliases: proga 78 | 79 | Required: False 80 | Position: Named 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### CommonParameters 87 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 88 | 89 | ## INPUTS 90 | 91 | ## OUTPUTS 92 | 93 | ### System.Collections.Hashtable 94 | ## NOTES 95 | Version: 1.1 96 | DateModified: 13/Feb/2024 97 | LasModifiedBy: Vicente Rodriguez Eguibar 98 | vicente@eguibar.com 99 | Eguibar IT 100 | http://www.eguibarit.com 101 | 102 | ## RELATED LINKS 103 | -------------------------------------------------------------------------------- /Enums/Enum.Constants.ps1: -------------------------------------------------------------------------------- 1 | $Constants = [ordered] @{ 2 | 3 | # Null GUID which is considered as "All" 4 | #$guidNull = New-Object -TypeName Guid -ArgumentList 00000000-0000-0000-0000-000000000000 5 | guidNull = [System.guid]::New('00000000-0000-0000-0000-000000000000') 6 | 7 | # Horizontal Tab 8 | HTab = "`t" 9 | 10 | # New NewLine 11 | NL = [System.Environment]::NewLine 12 | 13 | # Regular Expression (RegEx) for SIDs 14 | SidRegEx = [RegEx]::new('^S-1-(0|1|2|3|4|5|16|59)-\d+(-\d+)*$', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) 15 | 16 | # Regular Expression (RegEx) for DistinguishedName 17 | DnRegEx = [RegEx]::new('^(?:(CN=(?(?:[^,\\]|\\.)+),)*)?(OU=(?(?:[^,\\]|\\.)+),)*(DC=(?(?:[^,\\]|\\.)+))(,DC=(?(?:[^,\\]|\\.)+))+?$', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) 18 | 19 | # Regular Expression (RegEx) for GUID 20 | <# Define GUID Regex 21 | Active Directory GUID is represented as a 128-bit number, typically displayed as a 22 | string of 32 hexadecimal characters, such as "550e8400-e29b-41d4-a716-446655440000" 23 | ^ asserts the start of the string. 24 | [0-9a-fA-F] matches any hexadecimal digit. 25 | {8} specifies that the preceding character class should appear exactly 8 times. 26 | - matches the hyphen character literally. 27 | {4} specifies that the preceding character class should appear exactly 4 times. 28 | {12} specifies that the preceding character class should appear exactly 12 times. 29 | $ asserts the end of the string. 30 | #> 31 | GuidRegEx = [RegEx]::new('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) 32 | 33 | # Regular Expression (RegEx) for Email 34 | EmailRegEx = [RegEx]::new("^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) 35 | } 36 | 37 | $Splat = @{ 38 | Name = 'Constants' 39 | Value = $Constants 40 | Description = 'Contains the Constant values used on this module, like GUIDnull, Horizontal Tab or NewLine.' 41 | Scope = 'Global' 42 | Option = 'Constant' 43 | Force = $true 44 | } 45 | 46 | # Check if the 'Constants' variable exists. Create it if not. 47 | if (-not (Get-Variable -Name 'Constants' -Scope Global -ErrorAction SilentlyContinue)) { 48 | New-Variable @Splat 49 | } 50 | 51 | # Optional: Output the Constants for verification (verbose) 52 | Write-Verbose -Message ('Constants have been initialized: {0}' -f $Constants) 53 | -------------------------------------------------------------------------------- /Docs/New-DHCPobject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-DHCPobject 9 | 10 | ## SYNOPSIS 11 | Create DHCP Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-DHCPobject [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the DHCP Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-DHCPobjects 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | New-DfsObjects -ConfigXMLFile 'C:\PsScripts\Config.xml' 34 | ``` 35 | 36 | ## PARAMETERS 37 | 38 | ### -ConfigXMLFile 39 | \[String\] Full path to the configuration.xml file 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: True (ByPropertyName, ByValue) 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -WhatIf 54 | Shows what would happen if the cmdlet runs. 55 | The cmdlet is not run. 56 | 57 | ```yaml 58 | Type: SwitchParameter 59 | Parameter Sets: (All) 60 | Aliases: wi 61 | 62 | Required: False 63 | Position: Named 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -Confirm 70 | Prompts you for confirmation before running the cmdlet. 71 | 72 | ```yaml 73 | Type: SwitchParameter 74 | Parameter Sets: (All) 75 | Aliases: cf 76 | 77 | Required: False 78 | Position: Named 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -ProgressAction 85 | {{ Fill ProgressAction Description }} 86 | 87 | ```yaml 88 | Type: ActionPreference 89 | Parameter Sets: (All) 90 | Aliases: proga 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### CommonParameters 100 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 101 | 102 | ## INPUTS 103 | 104 | ## OUTPUTS 105 | 106 | ## NOTES 107 | Version: 1.0 108 | DateModified: 29/Oct/2019 109 | LasModifiedBy: Vicente Rodriguez Eguibar 110 | vicente@eguibar.com 111 | Eguibar Information Technology S.L. 112 | http://www.eguibarit.com 113 | 114 | ## RELATED LINKS 115 | -------------------------------------------------------------------------------- /Docs/New-DHCPobjects.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-DHCPobjects 9 | 10 | ## SYNOPSIS 11 | Create DHCP Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-DHCPobjects [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the DHCP Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-DHCPobjects 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | New-DfsObjects -ConfigXMLFile 'C:\PsScripts\Config.xml' 34 | ``` 35 | 36 | ## PARAMETERS 37 | 38 | ### -ConfigXMLFile 39 | \[String\] Full path to the configuration.xml file 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: True (ByPropertyName, ByValue) 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -WhatIf 54 | Shows what would happen if the cmdlet runs. 55 | The cmdlet is not run. 56 | 57 | ```yaml 58 | Type: SwitchParameter 59 | Parameter Sets: (All) 60 | Aliases: wi 61 | 62 | Required: False 63 | Position: Named 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -Confirm 70 | Prompts you for confirmation before running the cmdlet. 71 | 72 | ```yaml 73 | Type: SwitchParameter 74 | Parameter Sets: (All) 75 | Aliases: cf 76 | 77 | Required: False 78 | Position: Named 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -ProgressAction 85 | {{ Fill ProgressAction Description }} 86 | 87 | ```yaml 88 | Type: ActionPreference 89 | Parameter Sets: (All) 90 | Aliases: proga 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### CommonParameters 100 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 101 | 102 | ## INPUTS 103 | 104 | ## OUTPUTS 105 | 106 | ## NOTES 107 | Version: 1.0 108 | DateModified: 29/Oct/2019 109 | LasModifiedBy: Vicente Rodriguez Eguibar 110 | vicente@eguibar.com 111 | Eguibar Information Technology S.L. 112 | http://www.eguibarit.com 113 | 114 | ## RELATED LINKS 115 | -------------------------------------------------------------------------------- /Docs/Grant-NTFSPermission.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Grant-NTFSPermission 9 | 10 | ## SYNOPSIS 11 | Function to Add NTFS permissions to a folder 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Grant-NTFSPermission [-path] [-object] [-permission] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Function to Add NTFS permissions to a folder 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Grant-NTFSPermissions path object permission 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -path 33 | Param1 path to the resource|folder 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: True (ByPropertyName, ByValue) 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -object 48 | Param2 object or SecurityPrincipal 49 | 50 | ```yaml 51 | Type: String 52 | Parameter Sets: (All) 53 | Aliases: 54 | 55 | Required: True 56 | Position: 2 57 | Default value: None 58 | Accept pipeline input: True (ByPropertyName, ByValue) 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -permission 63 | Param3 permission 64 | 65 | ```yaml 66 | Type: String 67 | Parameter Sets: (All) 68 | Aliases: 69 | 70 | Required: True 71 | Position: 3 72 | Default value: None 73 | Accept pipeline input: True (ByPropertyName, ByValue) 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -ProgressAction 78 | {{ Fill ProgressAction Description }} 79 | 80 | ```yaml 81 | Type: ActionPreference 82 | Parameter Sets: (All) 83 | Aliases: proga 84 | 85 | Required: False 86 | Position: Named 87 | Default value: None 88 | Accept pipeline input: False 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### CommonParameters 93 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 94 | 95 | ## INPUTS 96 | 97 | ### Param1 path:......... The path to the folder 98 | ### Param2 object:....... the identity which will get the permissions 99 | ### Param3 permission:... the permissions to be modified 100 | ## OUTPUTS 101 | 102 | ## NOTES 103 | Version: 1.1 104 | DateModified: 03/Oct/2016 105 | LasModifiedBy: Vicente Rodriguez Eguibar 106 | vicente@eguibar.com 107 | Eguibar Information Technology S.L. 108 | http://www.eguibarit.com 109 | 110 | ## RELATED LINKS 111 | -------------------------------------------------------------------------------- /Docs/Get-IniContent.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-IniContent 9 | 10 | ## SYNOPSIS 11 | Gets the content of an INI file 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-IniContent [-FilePath] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets the content of an INI file and returns it as a hashtable 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | $FileContent = Get-IniContent "C:\myinifile.ini" 27 | ----------- 28 | Description 29 | Saves the content of the c:\myinifile.ini in a hashtable called $FileContent 30 | ``` 31 | 32 | ### EXAMPLE 2 33 | ``` 34 | $inifilepath | $FileContent = Get-IniContent 35 | ----------- 36 | Description 37 | Gets the content of the ini file passed through the pipe into a hashtable called $FileContent 38 | ``` 39 | 40 | ### EXAMPLE 3 41 | ``` 42 | $FileContent = Get-IniContent "c:\settings.ini" 43 | C:\PS>$FileContent["Section"]["Key"] 44 | ----------- 45 | Description 46 | Returns the key "Key" of the section "Section" from the C:\settings.ini file 47 | ``` 48 | 49 | ## PARAMETERS 50 | 51 | ### -FilePath 52 | Specifies the path to the input file. 53 | 54 | ```yaml 55 | Type: String 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: True 60 | Position: 1 61 | Default value: None 62 | Accept pipeline input: True (ByValue) 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -ProgressAction 67 | {{ Fill ProgressAction Description }} 68 | 69 | ```yaml 70 | Type: ActionPreference 71 | Parameter Sets: (All) 72 | Aliases: proga 73 | 74 | Required: False 75 | Position: Named 76 | Default value: None 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### CommonParameters 82 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 83 | 84 | ## INPUTS 85 | 86 | ### System.String 87 | ## OUTPUTS 88 | 89 | ### System.Collections.Hashtable 90 | ## NOTES 91 | Author : Oliver Lipkau \ 92 | Blog : http://oliver.lipkau.net/blog/ 93 | Source : https://github.com/lipkau/PsIni 94 | http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91 95 | Version : 1.0 - 2010/03/12 - Initial release 96 | 1.1 - 2014/12/11 - Typo (Thx SLDR) 97 | Typo (Thx Dave Stiff) 98 | 99 | #Requires -Version 2.0 100 | 101 | ## RELATED LINKS 102 | 103 | [Out-IniFile]() 104 | 105 | -------------------------------------------------------------------------------- /Docs/New-LAPSobject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LAPSobject 9 | 10 | ## SYNOPSIS 11 | Create Local Administration Password Services (LAPS) Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LAPSobject [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the LAPS Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-LAPSobjects -PawOuDn "OU=PAW,OU=Admin,DC=EguibarIT,DC=local" -ServersOuDn "OU=Servers,DC=EguibarIT,DC=local" -SitesOuDn "OU=Sites,DC=EguibarIT,DC=local" 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | \[String\] Full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ## OUTPUTS 100 | 101 | ## NOTES 102 | Version: 1.1 103 | DateModified: 11/Feb/2019 104 | LasModifiedBy: Vicente Rodriguez Eguibar 105 | vicente@eguibar.com 106 | Eguibar Information Technology S.L. 107 | http://www.eguibarit.com 108 | 109 | ## RELATED LINKS 110 | -------------------------------------------------------------------------------- /Docs/New-LAPSobjects.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LAPSobjects 9 | 10 | ## SYNOPSIS 11 | Create Local Administration Password Services (LAPS) Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LAPSobjects [-ConfigXMLFile] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the LAPS Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-LAPSobjects -PawOuDn "OU=PAW,OU=Admin,DC=EguibarIT,DC=local" -ServersOuDn "OU=Servers,DC=EguibarIT,DC=local" -SitesOuDn "OU=Sites,DC=EguibarIT,DC=local" 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | \[String\] Full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ## OUTPUTS 100 | 101 | ## NOTES 102 | Version: 1.1 103 | DateModified: 11/Feb/2019 104 | LasModifiedBy: Vicente Rodriguez Eguibar 105 | vicente@eguibar.com 106 | Eguibar Information Technology S.L. 107 | http://www.eguibarit.com 108 | 109 | ## RELATED LINKS 110 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "PowerShell: DC1 - Debug Module", 9 | "type": "PowerShell", 10 | "request": "launch", 11 | "script": "$session = New-PSSession -ComputerName 'DC1' -Credential (Get-Credential -Username TheGood -Message 'Enter credentials for DC1'); Import-Module EguibarIT -Force; Debug-Runspace -Name (Get-Runspace | Select-Object -First 1).Name", 12 | "cwd": "${workspaceFolder}", 13 | "createTemporaryIntegratedConsole": true 14 | }, 15 | { 16 | "name": "PowerShell: Module Interactive Session", 17 | "type": "PowerShell", 18 | "request": "launch", 19 | "script": "Import-Module -Force ${workspaceFolderBasename}", 20 | "args": [], 21 | "cwd": "${workspaceRoot}" 22 | }, 23 | { 24 | "type": "PowerShell", 25 | "request": "launch", 26 | "name": "PowerShell Launch (current file)", 27 | "script": "${file}", 28 | "args": [], 29 | "cwd": "${file}" 30 | }, 31 | { 32 | "type": "PowerShell", 33 | "request": "launch", 34 | "name": "PowerShell Launch Current File in Temporary Console", 35 | "script": "${file}", 36 | "args": [], 37 | "cwd": "${file}", 38 | "createTemporaryIntegratedConsole": true 39 | }, 40 | { 41 | "type": "PowerShell", 42 | "request": "launch", 43 | "name": "PowerShell Launch Current File w/Args Prompt", 44 | "script": "${file}", 45 | "args": [ 46 | "${command:SpecifyScriptArgs}" 47 | ], 48 | "cwd": "${file}" 49 | }, 50 | { 51 | "type": "PowerShell", 52 | "request": "attach", 53 | "name": "PowerShell Attach to Host Process", 54 | "processId": "${command.PickPSHostProcess}", 55 | "runspaceId": 1 56 | }, 57 | { 58 | "type": "PowerShell", 59 | "request": "launch", 60 | "name": "PowerShell Interactive Session", 61 | "cwd": "${workspaceRoot}" 62 | }, 63 | { 64 | "type": "PowerShell", 65 | "request": "launch", 66 | "name": "PowerShell Pester Tests", 67 | "script": "Invoke-Pester", 68 | "args": [], 69 | "cwd": "${workspaceRoot}" 70 | } 71 | ] 72 | } 73 | -------------------------------------------------------------------------------- /Docs/Publish-CertificateTemplate.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Publish-CertificateTemplate 9 | 10 | ## SYNOPSIS 11 | Publishes a certificate template to all available Certification Authorities (CAs) in the Active Directory environment. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Publish-CertificateTemplate [-CertDisplayName] [-ProgressAction ] [-WhatIf] 17 | [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | This function publishes a specified certificate template to all Certification Authorities in the Active Directory. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Publish-CertificateTemplate -CertDisplayName "MyCertificateTemplate" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -CertDisplayName 33 | Specifies the display name of the certificate template to be published. 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -WhatIf 48 | Shows what would happen if the cmdlet runs. 49 | The cmdlet is not run. 50 | 51 | ```yaml 52 | Type: SwitchParameter 53 | Parameter Sets: (All) 54 | Aliases: wi 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -Confirm 64 | Prompts you for confirmation before running the cmdlet. 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: (All) 69 | Aliases: cf 70 | 71 | Required: False 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -ProgressAction 79 | {{ Fill ProgressAction Description }} 80 | 81 | ```yaml 82 | Type: ActionPreference 83 | Parameter Sets: (All) 84 | Aliases: proga 85 | 86 | Required: False 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### CommonParameters 94 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 95 | 96 | ## INPUTS 97 | 98 | ## OUTPUTS 99 | 100 | ## NOTES 101 | Version: 1.0 102 | DateModified: 22/Jun/2016 103 | LasModifiedBy: Vicente Rodriguez Eguibar 104 | vicente@eguibar.com 105 | Eguibar Information Technology S.L. 106 | http://www.eguibarit.com 107 | 108 | ## RELATED LINKS 109 | -------------------------------------------------------------------------------- /Docs/Test-IsValidDN.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-IsValidDN 9 | 10 | ## SYNOPSIS 11 | Cmdlet will check if the input string is a valid distinguishedname. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Test-IsValidDN [-ObjectDN] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Cmdlet will check if the input string is a valid distinguishedname. 22 | 23 | Cmdlet is intended as a dignostic tool for input validation 24 | 25 | ## EXAMPLES 26 | 27 | ### EXAMPLE 1 28 | ``` 29 | Test-IsValidDN -ObjectDN 'Value1' 30 | ``` 31 | 32 | ## PARAMETERS 33 | 34 | ### -ObjectDN 35 | A string representing the object distinguishedname. 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: DN, DistinguishedName 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: True (ByPropertyName, ByValue) 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -WhatIf 50 | Shows what would happen if the cmdlet runs. 51 | The cmdlet is not run. 52 | 53 | ```yaml 54 | Type: SwitchParameter 55 | Parameter Sets: (All) 56 | Aliases: wi 57 | 58 | Required: False 59 | Position: Named 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Confirm 66 | Prompts you for confirmation before running the cmdlet. 67 | 68 | ```yaml 69 | Type: SwitchParameter 70 | Parameter Sets: (All) 71 | Aliases: cf 72 | 73 | Required: False 74 | Position: Named 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -ProgressAction 81 | {{ Fill ProgressAction Description }} 82 | 83 | ```yaml 84 | Type: ActionPreference 85 | Parameter Sets: (All) 86 | Aliases: proga 87 | 88 | Required: False 89 | Position: Named 90 | Default value: None 91 | Accept pipeline input: False 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### CommonParameters 96 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ## OUTPUTS 101 | 102 | ### System.Boolean 103 | ## NOTES 104 | https://pscustomobject.github.io/powershell/howto/identity%20management/PowerShell-Check-If-String-Is-A-DN/ 105 | Version: 1.0 106 | DateModified: 08/Oct/2021 107 | LasModifiedBy: Vicente Rodriguez Eguibar 108 | vicente@eguibar.com 109 | Eguibar Information Technology S.L. 110 | http://www.eguibarit.com 111 | 112 | ## RELATED LINKS 113 | -------------------------------------------------------------------------------- /Docs/Set-AdAclDelegateGalAdmin.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-AdAclDelegateGalAdmin 9 | 10 | ## SYNOPSIS 11 | Wrapper for all rights used for GAL admin. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-AdAclDelegateGalAdmin [-Group] [-LDAPpath] [-RemoveRule] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The function will consolidate all rights used for GAL admin. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Set-AdAclDelegateGalAdmin -Group "SG_SiteAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Set-AdAclDelegateGalAdmin -Group "SG_SiteAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" -RemoveRule 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -Group 38 | Delegated Group Name 39 | 40 | ```yaml 41 | Type: String 42 | Parameter Sets: (All) 43 | Aliases: 44 | 45 | Required: True 46 | Position: 1 47 | Default value: None 48 | Accept pipeline input: True (ByPropertyName, ByValue) 49 | Accept wildcard characters: False 50 | ``` 51 | 52 | ### -LDAPpath 53 | Distinguished Name of the OU where given group will manage a User GAL. 54 | 55 | ```yaml 56 | Type: String 57 | Parameter Sets: (All) 58 | Aliases: 59 | 60 | Required: True 61 | Position: 2 62 | Default value: None 63 | Accept pipeline input: True (ByPropertyName, ByValue) 64 | Accept wildcard characters: False 65 | ``` 66 | 67 | ### -RemoveRule 68 | If present, the access rule will be removed 69 | 70 | ```yaml 71 | Type: SwitchParameter 72 | Parameter Sets: (All) 73 | Aliases: 74 | 75 | Required: False 76 | Position: 3 77 | Default value: False 78 | Accept pipeline input: True (ByPropertyName, ByValue) 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -ProgressAction 83 | {{ Fill ProgressAction Description }} 84 | 85 | ```yaml 86 | Type: ActionPreference 87 | Parameter Sets: (All) 88 | Aliases: proga 89 | 90 | Required: False 91 | Position: Named 92 | Default value: None 93 | Accept pipeline input: False 94 | Accept wildcard characters: False 95 | ``` 96 | 97 | ### CommonParameters 98 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 99 | 100 | ## INPUTS 101 | 102 | ## OUTPUTS 103 | 104 | ## NOTES 105 | Version: 1.1 106 | DateModified: 12/Feb/2018 107 | LasModifiedBy: Vicente Rodriguez Eguibar 108 | vicente@eguibar.com 109 | Eguibar Information Technology S.L. 110 | http://www.eguibarit.com 111 | 112 | ## RELATED LINKS 113 | -------------------------------------------------------------------------------- /Docs/Test-IsValidSID.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-IsValidSID 9 | 10 | ## SYNOPSIS 11 | Cmdlet will check if the input string is a valid SID. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Test-IsValidSID [-ObjectSID] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Cmdlet will check if the input string is a valid SID. 22 | 23 | Cmdlet is intended as a dignostic tool for input validation 24 | 25 | ## EXAMPLES 26 | 27 | ### EXAMPLE 1 28 | ``` 29 | Test-IsValidDN -ObjectSID 'S-1-5-21-2562450185-1914323539-512974444-1234' 30 | ``` 31 | 32 | ## PARAMETERS 33 | 34 | ### -ObjectSID 35 | A string representing the object Security Identifier (SID). 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: SID, SecurityIdentifier 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: True (ByPropertyName, ByValue) 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -WhatIf 50 | Shows what would happen if the cmdlet runs. 51 | The cmdlet is not run. 52 | 53 | ```yaml 54 | Type: SwitchParameter 55 | Parameter Sets: (All) 56 | Aliases: wi 57 | 58 | Required: False 59 | Position: Named 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Confirm 66 | Prompts you for confirmation before running the cmdlet. 67 | 68 | ```yaml 69 | Type: SwitchParameter 70 | Parameter Sets: (All) 71 | Aliases: cf 72 | 73 | Required: False 74 | Position: Named 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -ProgressAction 81 | {{ Fill ProgressAction Description }} 82 | 83 | ```yaml 84 | Type: ActionPreference 85 | Parameter Sets: (All) 86 | Aliases: proga 87 | 88 | Required: False 89 | Position: Named 90 | Default value: None 91 | Accept pipeline input: False 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### CommonParameters 96 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ## OUTPUTS 101 | 102 | ### System.Boolean 103 | ## NOTES 104 | https://pscustomobject.github.io/powershell/howto/identity%20management/PowerShell-Check-If-String-Is-A-DN/ 105 | Version: 1.0 106 | DateModified: 08/Oct/2021 107 | LasModifiedBy: Vicente Rodriguez Eguibar 108 | vicente@eguibar.com 109 | Eguibar Information Technology S.L. 110 | http://www.eguibarit.com 111 | 112 | ## RELATED LINKS 113 | -------------------------------------------------------------------------------- /Docs/Get-ADCSTemplate.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ADCSTemplate 9 | 10 | ## SYNOPSIS 11 | Returns the properties of either a single or all Active Directory Certificate Template(s). 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ADCSTemplate [[-DisplayName] ] [[-Server] ] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Returns the properties of either a single or list of Active Directory Certificate Template(s) 22 | depending on whether a DisplayName parameter was passed. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | Get-ADCSTemplate 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | Get-ADCSTemplate -DisplayName PowerShellCMS 34 | ``` 35 | 36 | ### EXAMPLE 3 37 | ``` 38 | Get-ADCSTemplate | Sort-Object Name | ft Name, Created, Modified 39 | ``` 40 | 41 | ### EXAMPLE 4 42 | ``` 43 | ###View template permissions 44 | (Get-ADCSTemplate pscms).nTSecurityDescriptor 45 | (Get-ADCSTemplate pscms).nTSecurityDescriptor.Sddl 46 | (Get-ADCSTemplate pscms).nTSecurityDescriptor.Access 47 | ConvertFrom-SddlString -Sddl (Get-ADCSTemplate pscms).nTSecurityDescriptor.sddl -Type ActiveDirectoryRights 48 | ``` 49 | 50 | ## PARAMETERS 51 | 52 | ### -DisplayName 53 | Name of an AD CS template to retrieve. 54 | 55 | ```yaml 56 | Type: String 57 | Parameter Sets: (All) 58 | Aliases: 59 | 60 | Required: False 61 | Position: 1 62 | Default value: None 63 | Accept pipeline input: True (ByPropertyName, ByValue) 64 | Accept wildcard characters: False 65 | ``` 66 | 67 | ### -Server 68 | FQDN of Active Directory Domain Controller to target for the operation. 69 | When not specified it will search for the nearest Domain Controller. 70 | 71 | ```yaml 72 | Type: String 73 | Parameter Sets: (All) 74 | Aliases: 75 | 76 | Required: False 77 | Position: 2 78 | Default value: None 79 | Accept pipeline input: True (ByPropertyName, ByValue) 80 | Accept wildcard characters: False 81 | ``` 82 | 83 | ### -ProgressAction 84 | {{ Fill ProgressAction Description }} 85 | 86 | ```yaml 87 | Type: ActionPreference 88 | Parameter Sets: (All) 89 | Aliases: proga 90 | 91 | Required: False 92 | Position: Named 93 | Default value: None 94 | Accept pipeline input: False 95 | Accept wildcard characters: False 96 | ``` 97 | 98 | ### CommonParameters 99 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 100 | 101 | ## INPUTS 102 | 103 | ## OUTPUTS 104 | 105 | ## NOTES 106 | https://www.powershellgallery.com/packages/ADCSTemplate/1.0.1.0/Content/ADCSTemplate.psm1 107 | 108 | ## RELATED LINKS 109 | -------------------------------------------------------------------------------- /Docs/Set-AdAclDelegateUserAdmin.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-AdAclDelegateUserAdmin 9 | 10 | ## SYNOPSIS 11 | Wrapper for all rights used for USER object container. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-AdAclDelegateUserAdmin [-Group] [-LDAPpath] [-RemoveRule] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The function will consolidate all rights used for USER object container. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Set-AdAclDelegateComputerAdmin -Group "SG_SiteAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Set-AdAclDelegateComputerAdmin -Group "SG_SiteAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" -RemoveRule 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -Group 38 | Delegated Group Name 39 | 40 | ```yaml 41 | Type: String 42 | Parameter Sets: (All) 43 | Aliases: 44 | 45 | Required: True 46 | Position: 1 47 | Default value: None 48 | Accept pipeline input: True (ByPropertyName, ByValue) 49 | Accept wildcard characters: False 50 | ``` 51 | 52 | ### -LDAPpath 53 | Distinguished Name of the OU where given group will fully manage a User object. 54 | 55 | ```yaml 56 | Type: String 57 | Parameter Sets: (All) 58 | Aliases: 59 | 60 | Required: True 61 | Position: 2 62 | Default value: None 63 | Accept pipeline input: True (ByPropertyName, ByValue) 64 | Accept wildcard characters: False 65 | ``` 66 | 67 | ### -RemoveRule 68 | If present, the access rule will be removed 69 | 70 | ```yaml 71 | Type: SwitchParameter 72 | Parameter Sets: (All) 73 | Aliases: 74 | 75 | Required: False 76 | Position: 3 77 | Default value: False 78 | Accept pipeline input: True (ByPropertyName, ByValue) 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -ProgressAction 83 | {{ Fill ProgressAction Description }} 84 | 85 | ```yaml 86 | Type: ActionPreference 87 | Parameter Sets: (All) 88 | Aliases: proga 89 | 90 | Required: False 91 | Position: Named 92 | Default value: None 93 | Accept pipeline input: False 94 | Accept wildcard characters: False 95 | ``` 96 | 97 | ### CommonParameters 98 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 99 | 100 | ## INPUTS 101 | 102 | ## OUTPUTS 103 | 104 | ## NOTES 105 | Version: 1.1 106 | DateModified: 12/Feb/2018 107 | LasModifiedBy: Vicente Rodriguez Eguibar 108 | vicente@eguibar.com 109 | Eguibar Information Technology S.L. 110 | http://www.eguibarit.com 111 | 112 | ## RELATED LINKS 113 | -------------------------------------------------------------------------------- /Docs/Add-AdGroupNesting.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Add-AdGroupNesting 9 | 10 | ## SYNOPSIS 11 | Same as Add-AdGroupMember but with error handling and logging 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Add-AdGroupNesting [-Identity] [-Members] [-ProgressAction ] [-WhatIf] 17 | [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Same as Add-AdGroupMember but with error handling and logging 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Add-AdGroupNesting -Identity "Domain Admins" -Members TheUgly 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Identity 33 | Param1 Group which membership is to be changed 34 | 35 | ```yaml 36 | Type: Object 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: True (ByPropertyName, ByValue) 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -Members 48 | Param2 ID of New Member of the group 49 | 50 | ```yaml 51 | Type: Object 52 | Parameter Sets: (All) 53 | Aliases: 54 | 55 | Required: True 56 | Position: 2 57 | Default value: None 58 | Accept pipeline input: True (ByPropertyName, ByValue) 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -WhatIf 63 | Shows what would happen if the cmdlet runs. 64 | The cmdlet is not run. 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: (All) 69 | Aliases: wi 70 | 71 | Required: False 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -Confirm 79 | Prompts you for confirmation before running the cmdlet. 80 | 81 | ```yaml 82 | Type: SwitchParameter 83 | Parameter Sets: (All) 84 | Aliases: cf 85 | 86 | Required: False 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -ProgressAction 94 | {{ Fill ProgressAction Description }} 95 | 96 | ```yaml 97 | Type: ActionPreference 98 | Parameter Sets: (All) 99 | Aliases: proga 100 | 101 | Required: False 102 | Position: Named 103 | Default value: None 104 | Accept pipeline input: False 105 | Accept wildcard characters: False 106 | ``` 107 | 108 | ### CommonParameters 109 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 110 | 111 | ## INPUTS 112 | 113 | ## OUTPUTS 114 | 115 | ## NOTES 116 | Version: 1.3 117 | DateModified: 24/Jan/2024 118 | LastModifiedBy: Vicente Rodriguez Eguibar 119 | vicente@eguibar.com 120 | Eguibar Information Technology S.L. 121 | http://www.eguibarit.com 122 | 123 | ## RELATED LINKS 124 | -------------------------------------------------------------------------------- /Docs/New-AGPMObject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-AGPMObject 9 | 10 | ## SYNOPSIS 11 | Create Advanced Group Policy Management Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-AGPMObject [-ConfigXMLFile] [[-DMscripts] ] [-ProgressAction ] [-WhatIf] 17 | [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the AGPM Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-AGPMObjects 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | PARAM1 full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -DMscripts 49 | Param2 Location of all scripts & files 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: C:\PsScripts\ 59 | Accept pipeline input: True (ByPropertyName, ByValue) 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -WhatIf 64 | Shows what would happen if the cmdlet runs. 65 | The cmdlet is not run. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: wi 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Confirm 80 | Prompts you for confirmation before running the cmdlet. 81 | 82 | ```yaml 83 | Type: SwitchParameter 84 | Parameter Sets: (All) 85 | Aliases: cf 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -ProgressAction 95 | {{ Fill ProgressAction Description }} 96 | 97 | ```yaml 98 | Type: ActionPreference 99 | Parameter Sets: (All) 100 | Aliases: proga 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ## NOTES 117 | Version: 1.3 118 | DateModified: 05/Feb/2019 119 | LasModifiedBy: Vicente Rodriguez Eguibar 120 | vicente@eguibar.com 121 | Eguibar Information Technology S.L. 122 | http://www.eguibarit.com 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /Docs/New-ExchangeObject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ExchangeObject 9 | 10 | ## SYNOPSIS 11 | Create Exchange Objects and Containers 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-ExchangeObject [-ConfigXMLFile] [[-DMscripts] ] [-ProgressAction ] 17 | [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the Exchange OU structure and objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-ExchangeObjects 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | PARAM1 full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -DMscripts 49 | Param2 Location of all scripts & files 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: C:\PsScripts\ 59 | Accept pipeline input: True (ByPropertyName, ByValue) 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -WhatIf 64 | Shows what would happen if the cmdlet runs. 65 | The cmdlet is not run. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: wi 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Confirm 80 | Prompts you for confirmation before running the cmdlet. 81 | 82 | ```yaml 83 | Type: SwitchParameter 84 | Parameter Sets: (All) 85 | Aliases: cf 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -ProgressAction 95 | {{ Fill ProgressAction Description }} 96 | 97 | ```yaml 98 | Type: ActionPreference 99 | Parameter Sets: (All) 100 | Aliases: proga 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ## NOTES 117 | Version: 1.0 118 | DateModified: 19/Apr/2016 119 | LasModifiedBy: Vicente Rodriguez Eguibar 120 | vicente@eguibar.com 121 | Eguibar Information Technology S.L. 122 | http://www.eguibarit.com 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /Docs/New-AGPMObjects.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-AGPMObjects 9 | 10 | ## SYNOPSIS 11 | Create Advanced Group Policy Management Objects and Delegations 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-AGPMObjects [-ConfigXMLFile] [[-DMscripts] ] [-ProgressAction ] 17 | [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the AGPM Objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-AGPMObjects 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | PARAM1 full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -DMscripts 49 | Param2 Location of all scripts & files 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: C:\PsScripts\ 59 | Accept pipeline input: True (ByPropertyName, ByValue) 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -WhatIf 64 | Shows what would happen if the cmdlet runs. 65 | The cmdlet is not run. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: wi 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Confirm 80 | Prompts you for confirmation before running the cmdlet. 81 | 82 | ```yaml 83 | Type: SwitchParameter 84 | Parameter Sets: (All) 85 | Aliases: cf 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -ProgressAction 95 | {{ Fill ProgressAction Description }} 96 | 97 | ```yaml 98 | Type: ActionPreference 99 | Parameter Sets: (All) 100 | Aliases: proga 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ## NOTES 117 | Version: 1.3 118 | DateModified: 05/Feb/2019 119 | LasModifiedBy: Vicente Rodriguez Eguibar 120 | vicente@eguibar.com 121 | Eguibar Information Technology S.L. 122 | http://www.eguibarit.com 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /Docs/New-ExchangeObjects.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ExchangeObjects 9 | 10 | ## SYNOPSIS 11 | Create Exchange Objects and Containers 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-ExchangeObjects [-ConfigXMLFile] [[-DMscripts] ] [-ProgressAction ] 17 | [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Create the Exchange OU structure and objects used to manage 22 | this organization by following the defined Delegation Model. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-ExchangeObjects 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ConfigXMLFile 34 | PARAM1 full path to the configuration.xml file 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -DMscripts 49 | Param2 Location of all scripts & files 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: C:\PsScripts\ 59 | Accept pipeline input: True (ByPropertyName, ByValue) 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -WhatIf 64 | Shows what would happen if the cmdlet runs. 65 | The cmdlet is not run. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: wi 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Confirm 80 | Prompts you for confirmation before running the cmdlet. 81 | 82 | ```yaml 83 | Type: SwitchParameter 84 | Parameter Sets: (All) 85 | Aliases: cf 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -ProgressAction 95 | {{ Fill ProgressAction Description }} 96 | 97 | ```yaml 98 | Type: ActionPreference 99 | Parameter Sets: (All) 100 | Aliases: proga 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ## NOTES 117 | Version: 1.0 118 | DateModified: 19/Apr/2016 119 | LasModifiedBy: Vicente Rodriguez Eguibar 120 | vicente@eguibar.com 121 | Eguibar Information Technology S.L. 122 | http://www.eguibarit.com 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /Docs/New-Template.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-Template 9 | 10 | ## SYNOPSIS 11 | Creates a new PKI template. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-Template [-DisplayName] [-TemplateOtherAttributes] 17 | [-ProgressAction ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | This function creates a new PKI template in Active Directory Certificate Services. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | New-Template -DisplayName "CustomTemplate" -TemplateOtherAttributes @{ 28 | 'KeyType' = 'ExchangeSignature' 29 | 'KeyUsage' = 'DigitalSignature' 30 | } 31 | ``` 32 | 33 | ## PARAMETERS 34 | 35 | ### -DisplayName 36 | Display Name of the new template. 37 | 38 | ```yaml 39 | Type: String 40 | Parameter Sets: (All) 41 | Aliases: 42 | 43 | Required: True 44 | Position: 1 45 | Default value: None 46 | Accept pipeline input: True (ByPropertyName, ByValue) 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### -TemplateOtherAttributes 51 | attributes in the form of a Hashtable for the new template. 52 | 53 | ```yaml 54 | Type: Hashtable 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: True (ByPropertyName, ByValue) 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -WhatIf 66 | Shows what would happen if the cmdlet runs. 67 | The cmdlet is not run. 68 | 69 | ```yaml 70 | Type: SwitchParameter 71 | Parameter Sets: (All) 72 | Aliases: wi 73 | 74 | Required: False 75 | Position: Named 76 | Default value: None 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### -Confirm 82 | Prompts you for confirmation before running the cmdlet. 83 | 84 | ```yaml 85 | Type: SwitchParameter 86 | Parameter Sets: (All) 87 | Aliases: cf 88 | 89 | Required: False 90 | Position: Named 91 | Default value: None 92 | Accept pipeline input: False 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### -ProgressAction 97 | {{ Fill ProgressAction Description }} 98 | 99 | ```yaml 100 | Type: ActionPreference 101 | Parameter Sets: (All) 102 | Aliases: proga 103 | 104 | Required: False 105 | Position: Named 106 | Default value: None 107 | Accept pipeline input: False 108 | Accept wildcard characters: False 109 | ``` 110 | 111 | ### CommonParameters 112 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 113 | 114 | ## INPUTS 115 | 116 | ## OUTPUTS 117 | 118 | ## NOTES 119 | Version: 1.4 120 | DateModified: 08/Oct/2021 121 | LasModifiedBy: Vicente Rodriguez Eguibar 122 | vicente@eguibar.com 123 | Eguibar Information Technology S.L. 124 | http://www.eguibarit.com 125 | 126 | ## RELATED LINKS 127 | -------------------------------------------------------------------------------- /Docs/Test-IsUniqueOID.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-IsUniqueOID 9 | 10 | ## SYNOPSIS 11 | Checks if a given Certificate Template OID is unique within the specified context. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Test-IsUniqueOID [-cn] [-TemplateOID] [-Server] [-ConfigNC] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | This function queries Active Directory to determine if a given Certificate Template OID 22 | is already in use within the specified configuration context. 23 | It returns $True if the OID 24 | is unique and $False if it already exists. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | ``` 30 | Test-IsUniqueOID -cn "MyTemplate" -TemplateOID "1.2.3.4" -Server "ADServer01" -ConfigNC "DC=example,DC=com" 31 | Checks if the Certificate Template with the specified OID is unique in the given context. 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -cn 37 | Specifies the Common Name (CN) of the Certificate Template. 38 | 39 | ```yaml 40 | Type: String 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -TemplateOID 52 | Specifies the OID (Object Identifier) of the Certificate Template. 53 | 54 | ```yaml 55 | Type: String 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: True 60 | Position: 2 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -Server 67 | Specifies the Active Directory server to query. 68 | 69 | ```yaml 70 | Type: String 71 | Parameter Sets: (All) 72 | Aliases: 73 | 74 | Required: True 75 | Position: 3 76 | Default value: None 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### -ConfigNC 82 | Specifies the Configuration Naming Context (ConfigNC) to search for the Certificate Template. 83 | 84 | ```yaml 85 | Type: String 86 | Parameter Sets: (All) 87 | Aliases: 88 | 89 | Required: True 90 | Position: 4 91 | Default value: None 92 | Accept pipeline input: False 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### -ProgressAction 97 | {{ Fill ProgressAction Description }} 98 | 99 | ```yaml 100 | Type: ActionPreference 101 | Parameter Sets: (All) 102 | Aliases: proga 103 | 104 | Required: False 105 | Position: Named 106 | Default value: None 107 | Accept pipeline input: False 108 | Accept wildcard characters: False 109 | ``` 110 | 111 | ### CommonParameters 112 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 113 | 114 | ## INPUTS 115 | 116 | ## OUTPUTS 117 | 118 | ### System.Boolean 119 | ### Returns $True if the Certificate Template OID is unique, and $False if it already exists. 120 | ## NOTES 121 | 122 | ## RELATED LINKS 123 | -------------------------------------------------------------------------------- /Docs/Start-AdCleanOU.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Start-AdCleanOU 9 | 10 | ## SYNOPSIS 11 | Clean default OU permissions. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Start-AdCleanOU [-LDAPpath] [-RemoveAuthenticatedUsers] [-RemoveUnknownSIDs] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The function will remove some of the default premission on 22 | the provided OU. 23 | It will remove the "Account Operators" and 24 | "Print Operators" built-in groups. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | ``` 30 | Start-AdCleanOU -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" 31 | ``` 32 | 33 | ### EXAMPLE 2 34 | ``` 35 | Start-AdCleanOU -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" -RemoveAuthenticatedUsers 36 | ``` 37 | 38 | ### EXAMPLE 3 39 | ``` 40 | Start-AdCleanOU -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" -RemoveUnknownSIDs 41 | ``` 42 | 43 | ### EXAMPLE 4 44 | ``` 45 | Start-AdCleanOU -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" -RemoveAuthenticatedUsers -RemoveUnknownSIDs 46 | ``` 47 | 48 | ## PARAMETERS 49 | 50 | ### -LDAPpath 51 | Distinguished name of the OU to be cleaned. 52 | 53 | ```yaml 54 | Type: String 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: 1 60 | Default value: None 61 | Accept pipeline input: True (ByPropertyName, ByValue) 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -RemoveAuthenticatedUsers 66 | If present, Remove Authenticated Users. 67 | 68 | ```yaml 69 | Type: SwitchParameter 70 | Parameter Sets: (All) 71 | Aliases: 72 | 73 | Required: False 74 | Position: 2 75 | Default value: False 76 | Accept pipeline input: True (ByPropertyName, ByValue) 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -RemoveUnknownSIDs 81 | If present, Remove Unknown SIDs. 82 | 83 | ```yaml 84 | Type: SwitchParameter 85 | Parameter Sets: (All) 86 | Aliases: 87 | 88 | Required: False 89 | Position: 3 90 | Default value: False 91 | Accept pipeline input: True (ByPropertyName, ByValue) 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### -ProgressAction 96 | {{ Fill ProgressAction Description }} 97 | 98 | ```yaml 99 | Type: ActionPreference 100 | Parameter Sets: (All) 101 | Aliases: proga 102 | 103 | Required: False 104 | Position: Named 105 | Default value: None 106 | Accept pipeline input: False 107 | Accept wildcard characters: False 108 | ``` 109 | 110 | ### CommonParameters 111 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 112 | 113 | ## INPUTS 114 | 115 | ## OUTPUTS 116 | 117 | ## NOTES 118 | Version: 1.2 119 | DateModified: 19/Dec/2017 120 | LasModifiedBy: Vicente Rodriguez Eguibar 121 | vicente@eguibar.com 122 | Eguibar Information Technology S.L. 123 | http://www.eguibarit.com 124 | 125 | ## RELATED LINKS 126 | -------------------------------------------------------------------------------- /Docs/Set-AdAclLaps.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-AdAclLaps 9 | 10 | ## SYNOPSIS 11 | Wrapper for all rights used for LAPS on a given container. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-AdAclLaps [-ReadGroup] [-ResetGroup] [-LDAPpath] [-RemoveRule] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The function will consolidate all rights used for LAPS on a given container. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Set-AdAclLaps -ResetGroup "SG_SiteAdmins_XXXX" -ReadGroup "SG_GalAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Set-AdAclLaps -ResetGroup "SG_SiteAdmins_XXXX" -ReadGroup "SG_GalAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" -RemoveRule 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -ReadGroup 38 | Identity of the group getting being able to READ the password 39 | 40 | ```yaml 41 | Type: String 42 | Parameter Sets: (All) 43 | Aliases: 44 | 45 | Required: True 46 | Position: 1 47 | Default value: None 48 | Accept pipeline input: True (ByPropertyName, ByValue) 49 | Accept wildcard characters: False 50 | ``` 51 | 52 | ### -ResetGroup 53 | Identity of the group getting being able to RESET the password 54 | 55 | ```yaml 56 | Type: String 57 | Parameter Sets: (All) 58 | Aliases: 59 | 60 | Required: True 61 | Position: 2 62 | Default value: None 63 | Accept pipeline input: True (ByPropertyName, ByValue) 64 | Accept wildcard characters: False 65 | ``` 66 | 67 | ### -LDAPpath 68 | Distinguished Name of the OU where LAPS will apply to computer object. 69 | 70 | ```yaml 71 | Type: String 72 | Parameter Sets: (All) 73 | Aliases: 74 | 75 | Required: True 76 | Position: 3 77 | Default value: None 78 | Accept pipeline input: True (ByPropertyName, ByValue) 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -RemoveRule 83 | If present, the access rule will be removed 84 | 85 | ```yaml 86 | Type: SwitchParameter 87 | Parameter Sets: (All) 88 | Aliases: 89 | 90 | Required: False 91 | Position: 4 92 | Default value: False 93 | Accept pipeline input: True (ByPropertyName, ByValue) 94 | Accept wildcard characters: False 95 | ``` 96 | 97 | ### -ProgressAction 98 | {{ Fill ProgressAction Description }} 99 | 100 | ```yaml 101 | Type: ActionPreference 102 | Parameter Sets: (All) 103 | Aliases: proga 104 | 105 | Required: False 106 | Position: Named 107 | Default value: None 108 | Accept pipeline input: False 109 | Accept wildcard characters: False 110 | ``` 111 | 112 | ### CommonParameters 113 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 114 | 115 | ## INPUTS 116 | 117 | ## OUTPUTS 118 | 119 | ## NOTES 120 | Version: 1.0 121 | DateModified: 19/Oct/2016 122 | LasModifiedBy: Vicente Rodriguez Eguibar 123 | vicente@eguibar.com 124 | Eguibar Information Technology S.L. 125 | http://www.eguibarit.com 126 | 127 | ## RELATED LINKS 128 | -------------------------------------------------------------------------------- /Private/Get-SafeVariable.ps1: -------------------------------------------------------------------------------- 1 | function Get-SafeVariable { 2 | <# 3 | .SYNOPSIS 4 | Retrieves a variable from the current or global scope, creating it if it doesn't exist. 5 | 6 | .DESCRIPTION 7 | This function checks if a variable exists in the current or global scope. 8 | If it does, it returns its value. 9 | If it doesn't, it can create the variable using a provided script block. 10 | 11 | .PARAMETER Name 12 | The name of the variable to retrieve. 13 | 14 | .PARAMETER CreateIfNotExist 15 | A script block that defines how to create the variable if it doesn't exist. 16 | 17 | .INPUTS 18 | None 19 | This function does not accept pipeline input. 20 | 21 | .OUTPUTS 22 | [System.Object] 23 | Returns the value of the requested variable or the newly created value. 24 | 25 | .EXAMPLE 26 | $myVar = Get-SafeVariable -Name 'MyVariable' -CreateIfNotExist { 'DefaultValue' } 27 | 28 | This example retrieves the variable 'MyVariable'. If it doesn't exist, it creates it with the value 'DefaultValue'. 29 | 30 | .EXAMPLE 31 | $myVar = Get-SafeVariable -Name 'MyVariable' 32 | 33 | This example retrieves the variable 'MyVariable'. If it doesn't exist, it returns $null. 34 | 35 | .NOTES 36 | Used Functions: 37 | Name ║ Module/Namespace 38 | ═══════════════════════════════════════╬══════════════════════════════ 39 | Write-Debug ║ Microsoft.PowerShell.Utility 40 | Get-Variable ║ Microsoft.PowerShell.Utility 41 | 42 | .NOTES 43 | Version: 1.0 44 | DateModified: 22/May/2025 45 | LastModifiedBy: Vicente Rodriguez Eguibar 46 | vicente@eguibar.com 47 | Eguibar IT 48 | http://www.eguibarit.com 49 | 50 | .LINK 51 | https://github.com/vreguibar/EguibarIT/blob/main/Private/Get-SafeVariable.ps1 52 | 53 | .COMPONENT 54 | Variable Management 55 | 56 | .ROLE 57 | Utility 58 | 59 | .FUNCTIONALITY 60 | Variable Safety 61 | #> 62 | 63 | [CmdletBinding()] 64 | [OutputType([object])] 65 | 66 | param ( 67 | [Parameter(Mandatory = $true)] 68 | [string]$Name, 69 | 70 | [Parameter(Mandatory = $false)] 71 | [scriptblock]$CreateIfNotExist 72 | ) 73 | 74 | # Check if variable exists in any scope 75 | $var = Get-Variable -Name $Name -Scope Global -ErrorAction SilentlyContinue 76 | if ($null -eq $var) { 77 | $var = Get-Variable -Name $Name -Scope Script -ErrorAction SilentlyContinue 78 | } 79 | 80 | if ($null -ne $var) { 81 | Write-Debug -Message ('Variable {0} already exists, using existing value' -f $Name) 82 | return $var.Value 83 | } elseif ($null -ne $CreateIfNotExist) { 84 | Write-Debug -Message ('Variable {0} does not exist, creating new value' -f $Name) 85 | $newValue = & $CreateIfNotExist 86 | return $newValue 87 | } else { 88 | Write-Debug -Message ('Variable {0} not found and no creation logic provided' -f $Name) 89 | return $null 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Docs/Revoke-NTFSPermissions.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Revoke-NTFSPermissions 9 | 10 | ## SYNOPSIS 11 | Function to remove NTFS permissions to a folder 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Revoke-NTFSPermissions [-path] [-object] [-permission] 17 | [-ProgressAction ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Function to remove NTFS permissions to a folder 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Revoke-NTFSPermissions path object permission 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -path 33 | Param1 path to the resource|folder 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: True (ByPropertyName, ByValue) 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -object 48 | Param2 object or SecurityPrincipal 49 | 50 | ```yaml 51 | Type: String 52 | Parameter Sets: (All) 53 | Aliases: 54 | 55 | Required: True 56 | Position: 2 57 | Default value: None 58 | Accept pipeline input: True (ByPropertyName, ByValue) 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -permission 63 | Param3 permission 64 | 65 | ```yaml 66 | Type: String 67 | Parameter Sets: (All) 68 | Aliases: 69 | 70 | Required: True 71 | Position: 3 72 | Default value: None 73 | Accept pipeline input: True (ByPropertyName, ByValue) 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -WhatIf 78 | Shows what would happen if the cmdlet runs. 79 | The cmdlet is not run. 80 | 81 | ```yaml 82 | Type: SwitchParameter 83 | Parameter Sets: (All) 84 | Aliases: wi 85 | 86 | Required: False 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -Confirm 94 | Prompts you for confirmation before running the cmdlet. 95 | 96 | ```yaml 97 | Type: SwitchParameter 98 | Parameter Sets: (All) 99 | Aliases: cf 100 | 101 | Required: False 102 | Position: Named 103 | Default value: None 104 | Accept pipeline input: False 105 | Accept wildcard characters: False 106 | ``` 107 | 108 | ### -ProgressAction 109 | {{ Fill ProgressAction Description }} 110 | 111 | ```yaml 112 | Type: ActionPreference 113 | Parameter Sets: (All) 114 | Aliases: proga 115 | 116 | Required: False 117 | Position: Named 118 | Default value: None 119 | Accept pipeline input: False 120 | Accept wildcard characters: False 121 | ``` 122 | 123 | ### CommonParameters 124 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 125 | 126 | ## INPUTS 127 | 128 | ### Param1 path = The path to the folder 129 | ### Param2 object = the identity which will get the permissions 130 | ### Param3 permission = the permissions to be modified 131 | ## OUTPUTS 132 | 133 | ## NOTES 134 | Version: 1.0 135 | DateModified: 31/Mar/2015 136 | LasModifiedBy: Vicente Rodriguez Eguibar 137 | vicente@eguibar.com 138 | Eguibar Information Technology S.L. 139 | http://www.eguibarit.com 140 | 141 | ## RELATED LINKS 142 | -------------------------------------------------------------------------------- /Docs/ConvertTo-IPv4NetworkAddress.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # ConvertTo-IPv4NetworkAddress 9 | 10 | ## SYNOPSIS 11 | Find network address based on IP Address and Subnet Mask (e. 12 | g. 13 | 192.168.1.0 is the Network Address of 192.168.1.200/24) 14 | 15 | ## SYNTAX 16 | 17 | ### SubnetMask 18 | ``` 19 | ConvertTo-IPv4NetworkAddress [-IPv4Address] [-SubnetMask] 20 | [-ProgressAction ] [] 21 | ``` 22 | 23 | ### PrefixLength 24 | ``` 25 | ConvertTo-IPv4NetworkAddress [-IPv4Address] [-PrefixLength] 26 | [-ProgressAction ] [] 27 | ``` 28 | 29 | ## DESCRIPTION 30 | Find network address based on IP Address and Subnet Mask (e. 31 | g. 32 | 192.168.1.0 is the Network Address of 192.168.1.200/24) 33 | 34 | ## EXAMPLES 35 | 36 | ### EXAMPLE 1 37 | ``` 38 | ConvertTo-IPv4NetworkAddress -IPv4Address "192.168.1.200" -SubnetMask "255.255.255.0" 39 | ``` 40 | 41 | ### EXAMPLE 2 42 | ``` 43 | ConvertTo-IPv4NetworkAddress -IPv4Address "192.168.1.200" -PrefixLength "24" 44 | ``` 45 | 46 | ### EXAMPLE 3 47 | ``` 48 | ConvertTo-IPv4NetworkAddress "192.168.1.200" "255.255.255.0" 49 | ``` 50 | 51 | ### EXAMPLE 4 52 | ``` 53 | ConvertTo-IPv4NetworkAddress "192.168.1.200" "24" 54 | ``` 55 | 56 | ## PARAMETERS 57 | 58 | ### -IPv4Address 59 | Specifies the IPv4 Address as string (e.g., 192.168.1.200) 60 | 61 | ```yaml 62 | Type: String 63 | Parameter Sets: (All) 64 | Aliases: 65 | 66 | Required: True 67 | Position: 1 68 | Default value: None 69 | Accept pipeline input: True (ByPropertyName, ByValue) 70 | Accept wildcard characters: False 71 | ``` 72 | 73 | ### -SubnetMask 74 | Specifies the IPv4 network mask as string (e.g., 255.255.255.0) 75 | 76 | ```yaml 77 | Type: String 78 | Parameter Sets: SubnetMask 79 | Aliases: 80 | 81 | Required: True 82 | Position: 2 83 | Default value: None 84 | Accept pipeline input: True (ByPropertyName, ByValue) 85 | Accept wildcard characters: False 86 | ``` 87 | 88 | ### -PrefixLength 89 | Specifies the network prefix length, also known as CIDR (e.g., 24) 90 | 91 | ```yaml 92 | Type: String 93 | Parameter Sets: PrefixLength 94 | Aliases: 95 | 96 | Required: True 97 | Position: 2 98 | Default value: None 99 | Accept pipeline input: True (ByPropertyName, ByValue) 100 | Accept wildcard characters: False 101 | ``` 102 | 103 | ### -ProgressAction 104 | {{ Fill ProgressAction Description }} 105 | 106 | ```yaml 107 | Type: ActionPreference 108 | Parameter Sets: (All) 109 | Aliases: proga 110 | 111 | Required: False 112 | Position: Named 113 | Default value: None 114 | Accept pipeline input: False 115 | Accept wildcard characters: False 116 | ``` 117 | 118 | ### CommonParameters 119 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 120 | 121 | ## INPUTS 122 | 123 | ## OUTPUTS 124 | 125 | ### System.Net.IPAddress 126 | ## NOTES 127 | Version: 1.0 128 | DateModified: 12/Apr/2022 129 | LasModifiedBy: Vicente Rodriguez Eguibar 130 | vicente@eguibar.com 131 | Eguibar Information Technology S.L. 132 | http://www.eguibarit.com 133 | 134 | ## RELATED LINKS 135 | -------------------------------------------------------------------------------- /Docs/New-TimePolicyGPO.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-TimePolicyGPO 9 | 10 | ## SYNOPSIS 11 | 12 | ## SYNTAX 13 | 14 | ``` 15 | New-TimePolicyGPO [-gpoName] [[-NtpServer] ] [-AnnounceFlags] [-Type] 16 | [-WMIFilter] [-DisableVMTimeSync] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | New-TimePolicyGPO 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -gpoName 32 | Param1 GPO Name 33 | 34 | ```yaml 35 | Type: String 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: True 40 | Position: 1 41 | Default value: None 42 | Accept pipeline input: True (ByPropertyName, ByValue) 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -NtpServer 47 | Param2 NTP servers 48 | 49 | ```yaml 50 | Type: String 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: False 55 | Position: 2 56 | Default value: None 57 | Accept pipeline input: True (ByPropertyName, ByValue) 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -AnnounceFlags 62 | Param3 AnnounceFlags for reliable time server 63 | 64 | ```yaml 65 | Type: Int32 66 | Parameter Sets: (All) 67 | Aliases: 68 | 69 | Required: True 70 | Position: 3 71 | Default value: 0 72 | Accept pipeline input: True (ByPropertyName, ByValue) 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### -Type 77 | Param4 Type of Sync 78 | 79 | ```yaml 80 | Type: String 81 | Parameter Sets: (All) 82 | Aliases: 83 | 84 | Required: True 85 | Position: 4 86 | Default value: None 87 | Accept pipeline input: True (ByPropertyName, ByValue) 88 | Accept wildcard characters: False 89 | ``` 90 | 91 | ### -WMIFilter 92 | Param5 WMIFilter to be created and used 93 | 94 | ```yaml 95 | Type: Object 96 | Parameter Sets: (All) 97 | Aliases: 98 | 99 | Required: True 100 | Position: 4 101 | Default value: None 102 | Accept pipeline input: True (ByPropertyName, ByValue) 103 | Accept wildcard characters: False 104 | ``` 105 | 106 | ### -DisableVMTimeSync 107 | Param6 Disable Virtual Machine time sync clock 108 | 109 | ```yaml 110 | Type: SwitchParameter 111 | Parameter Sets: (All) 112 | Aliases: 113 | 114 | Required: False 115 | Position: 5 116 | Default value: False 117 | Accept pipeline input: True (ByPropertyName, ByValue) 118 | Accept wildcard characters: False 119 | ``` 120 | 121 | ### -ProgressAction 122 | {{ Fill ProgressAction Description }} 123 | 124 | ```yaml 125 | Type: ActionPreference 126 | Parameter Sets: (All) 127 | Aliases: proga 128 | 129 | Required: False 130 | Position: Named 131 | Default value: None 132 | Accept pipeline input: False 133 | Accept wildcard characters: False 134 | ``` 135 | 136 | ### CommonParameters 137 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 138 | 139 | ## INPUTS 140 | 141 | ## OUTPUTS 142 | 143 | ## NOTES 144 | Version: 1.0 145 | DateModified: 25/Mar/2014 146 | LasModifiedBy: Vicente Rodriguez Eguibar 147 | vicente@eguibar.com 148 | Eguibar Information Technology S.L. 149 | http://www.eguibarit.com 150 | 151 | ## RELATED LINKS 152 | -------------------------------------------------------------------------------- /Public/Get-AdSite.ps1: -------------------------------------------------------------------------------- 1 | function Get-AdSite { 2 | <# 3 | .SYNOPSIS 4 | Retrieves all Active Directory sites from the current forest. 5 | 6 | .DESCRIPTION 7 | This function retrieves all Active Directory sites from the current forest using 8 | the .NET DirectoryServices API. It returns an array of site objects containing 9 | information such as name, subnets, site links, and other site-related properties. 10 | 11 | This function is useful for inventory, documentation, and network topology analysis. 12 | 13 | .INPUTS 14 | None 15 | This function does not accept pipeline input. 16 | 17 | .OUTPUTS 18 | System.Array 19 | Returns an array of DirectoryServices.ActiveDirectory.ActiveDirectorySite objects. 20 | 21 | .EXAMPLE 22 | Get-AdSite 23 | 24 | Returns all AD sites in the current forest. 25 | 26 | .EXAMPLE 27 | Get-AdSite | Select-Object Name, Subnets 28 | 29 | Returns all AD sites with only their names and associated subnets. 30 | 31 | .NOTES 32 | Used Functions: 33 | Name ║ Module/Namespace 34 | ═══════════════════════════════════════╬══════════════════════════════ 35 | Import-MyModule ║ EguibarIT 36 | Get-FunctionDisplay ║ EguibarIT 37 | Write-Verbose ║ Microsoft.PowerShell.Utility 38 | Forest.GetCurrentForest ║ System.DirectoryServices.ActiveDirectory 39 | 40 | .NOTES 41 | Version: 1.1 42 | DateModified: 22/May/2025 43 | LastModifiedBy: Vicente Rodriguez Eguibar 44 | vicente@eguibar.com 45 | Eguibar IT 46 | http://www.eguibarit.com 47 | 48 | .LINK 49 | https://github.com/vreguibar/EguibarIT/blob/main/Public/Get-AdSite.ps1 50 | 51 | .COMPONENT 52 | Active Directory 53 | 54 | .ROLE 55 | Network Administration 56 | 57 | .FUNCTIONALITY 58 | Site Management 59 | #> 60 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] 61 | [OutputType([array])] 62 | 63 | Param () 64 | 65 | Begin { 66 | $txt = ($Variables.Header -f 67 | (Get-Date).ToString('dd/MMM/yyyy'), 68 | $MyInvocation.Mycommand, 69 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 70 | ) 71 | Write-Verbose -Message $txt 72 | 73 | ############################## 74 | # Module imports 75 | 76 | Import-MyModule -Name 'ServerManager' -SkipEditionCheck -Verbose:$false 77 | Import-MyModule -Name 'ActiveDirectory' -Verbose:$false 78 | 79 | ############################## 80 | # Variables Definition 81 | } #end Begin 82 | 83 | Process { 84 | Write-Verbose -Message "Get AD Site List `r" 85 | [array] $ADSites = [DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites 86 | } #end Process 87 | 88 | End { 89 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 90 | 'getting AD Sites.' 91 | ) 92 | Write-Verbose -Message $txt 93 | 94 | Return $ADSites 95 | } #end End 96 | } #end Function 97 | -------------------------------------------------------------------------------- /Docs/New-LocalLogonTask.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LocalLogonTask 9 | 10 | ## SYNOPSIS 11 | Generates a New Local Logon task 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LocalLogonTask [-name] [-Description] [-Author] [-Command] 17 | [[-CommandArguments] ] [-Hidden] [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Generates a New Local Logon task 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | New-LocalLogonTask -Name -Description -Author -Command -CommandArguments -Hiden 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -name 33 | Param1 help description 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: True (ByPropertyName, ByValue) 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -Description 48 | Param2 help description 49 | 50 | ```yaml 51 | Type: String 52 | Parameter Sets: (All) 53 | Aliases: 54 | 55 | Required: True 56 | Position: 2 57 | Default value: None 58 | Accept pipeline input: True (ByPropertyName, ByValue) 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -Author 63 | Param3 help description 64 | 65 | ```yaml 66 | Type: String 67 | Parameter Sets: (All) 68 | Aliases: 69 | 70 | Required: True 71 | Position: 3 72 | Default value: None 73 | Accept pipeline input: True (ByPropertyName, ByValue) 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -Command 78 | Param4 help description 79 | 80 | ```yaml 81 | Type: String 82 | Parameter Sets: (All) 83 | Aliases: 84 | 85 | Required: True 86 | Position: 4 87 | Default value: None 88 | Accept pipeline input: True (ByPropertyName, ByValue) 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### -CommandArguments 93 | Param5 help description 94 | 95 | ```yaml 96 | Type: String 97 | Parameter Sets: (All) 98 | Aliases: 99 | 100 | Required: False 101 | Position: 5 102 | Default value: None 103 | Accept pipeline input: True (ByPropertyName, ByValue) 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### -Hidden 108 | Param6 help description 109 | 110 | ```yaml 111 | Type: SwitchParameter 112 | Parameter Sets: (All) 113 | Aliases: 114 | 115 | Required: False 116 | Position: 6 117 | Default value: False 118 | Accept pipeline input: True (ByPropertyName, ByValue) 119 | Accept wildcard characters: False 120 | ``` 121 | 122 | ### -ProgressAction 123 | {{ Fill ProgressAction Description }} 124 | 125 | ```yaml 126 | Type: ActionPreference 127 | Parameter Sets: (All) 128 | Aliases: proga 129 | 130 | Required: False 131 | Position: Named 132 | Default value: None 133 | Accept pipeline input: False 134 | Accept wildcard characters: False 135 | ``` 136 | 137 | ### CommonParameters 138 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 139 | 140 | ## INPUTS 141 | 142 | ## OUTPUTS 143 | 144 | ## NOTES 145 | Version: 1.0 146 | DateModified: 31/Mar/2015 147 | LasModifiedBy: Vicente Rodriguez Eguibar 148 | vicente@eguibar.com 149 | Eguibar Information Technology S.L. 150 | http://www.eguibarit.com 151 | 152 | ## RELATED LINKS 153 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // A task runner that invokes Pester to run all Pester tests under the 2 | // current workspace folder. 3 | // NOTE: This Test task runner requires an updated version of Pester (>=4.0.3) 4 | // in order for the problemMatcher to find failed test information (message, line, file). 5 | // If you don't have that version, you can update Pester from the PowerShell Gallery 6 | // with this command: 7 | // 8 | // PS C:\> Update-Module Pester 9 | // 10 | // If that gives an error like: 11 | // "Module 'Pester' was not installed by using Install-Module, so it cannot be updated." 12 | // then execute: 13 | // 14 | // PS C:\> Install-Module Pester -Scope CurrentUser -Force 15 | // 16 | // NOTE: The Clean, Build and Publish tasks require PSake. PSake can be installed 17 | // from the PowerShell Gallery with this command: 18 | // 19 | // PS C:\> Install-Module PSake -Scope CurrentUser -Force 20 | // 21 | // Available variables which can be used inside of strings: 22 | // ${workspaceFolder} the path of the workspace folder that contains the tasks.json file 23 | // ${workspaceFolderBasename} the name of the workspace folder that contains the tasks.json file without any slashes (/) 24 | // ${file} the current opened file 25 | // ${relativeFile} the current opened file relative to the workspace folder containing the file 26 | // ${fileBasename} the current opened file's basename 27 | // ${fileBasenameNoExtension} the current opened file's basename without the extension 28 | // ${fileDirname} the current opened file's dirname 29 | // ${fileExtname} the current opened file's extension 30 | // ${cwd} the task runner's current working directory on startup 31 | // ${lineNumber} the current selected line number in the active file 32 | { 33 | "version": "2.0.0", 34 | "windows": { 35 | "options": { 36 | "shell": { 37 | "executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", 38 | "args": [ 39 | "-NoProfile", 40 | "-ExecutionPolicy", 41 | "Bypass", 42 | "-Command" 43 | ] 44 | } 45 | } 46 | }, 47 | "linux": { 48 | "options": { 49 | "shell": { 50 | "executable": "/usr/bin/pwsh", 51 | "args": [ 52 | "-NoProfile", 53 | "-Command" 54 | ] 55 | } 56 | } 57 | }, 58 | "osx": { 59 | "options": { 60 | "shell": { 61 | "executable": "/usr/local/bin/pwsh", 62 | "args": [ 63 | "-NoProfile", 64 | "-Command" 65 | ] 66 | } 67 | } 68 | }, 69 | "tasks": [ 70 | { 71 | "label": "Clean", 72 | "type": "shell", 73 | "command": "Invoke-PSake build.ps1 -taskList Clean" 74 | }, 75 | { 76 | "label": "Build", 77 | "type": "shell", 78 | "command": "Invoke-PSake build.ps1 -taskList Build", 79 | "group": { 80 | "kind": "build", 81 | "isDefault": true 82 | } 83 | }, 84 | { 85 | "label": "Test", 86 | "type": "shell", 87 | "command": "Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true}", 88 | "group": { 89 | "kind": "test", 90 | "isDefault": true 91 | }, 92 | "problemMatcher": [ 93 | "$pester" 94 | ] 95 | }, 96 | { 97 | "label": "Publish", 98 | "type": "shell", 99 | "command": "Invoke-PSake build.ps1 -taskList Publish" 100 | } 101 | ] 102 | } 103 | -------------------------------------------------------------------------------- /Docs/Set-AdAclDelegateComputerAdmin.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-AdAclDelegateComputerAdmin 9 | 10 | ## SYNOPSIS 11 | Wrapper for all rights used for Computer object container. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-AdAclDelegateComputerAdmin [-Group] [-LDAPpath] [-QuarantineDN] [-RemoveRule] 17 | [-ProgressAction ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The function will consolidate all rights used for Computer object container. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Set-AdAclDelegateComputerAdmin -Group "SG_SiteAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Set-AdAclDelegateComputerAdmin -Group "SG_SiteAdmins_XXXX" -LDAPPath "OU=Users,OU=XXXX,OU=Sites,DC=EguibarIT,DC=local" -RemoveRule 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -Group 38 | Delegated Group Name 39 | 40 | ```yaml 41 | Type: String 42 | Parameter Sets: (All) 43 | Aliases: 44 | 45 | Required: True 46 | Position: 1 47 | Default value: None 48 | Accept pipeline input: True (ByPropertyName, ByValue) 49 | Accept wildcard characters: False 50 | ``` 51 | 52 | ### -LDAPpath 53 | Distinguished Name of the OU where given group will fully manage a computer object. 54 | 55 | ```yaml 56 | Type: String 57 | Parameter Sets: (All) 58 | Aliases: 59 | 60 | Required: True 61 | Position: 2 62 | Default value: None 63 | Accept pipeline input: True (ByPropertyName, ByValue) 64 | Accept wildcard characters: False 65 | ``` 66 | 67 | ### -QuarantineDN 68 | PARAM3 Distinguished Name of the quarantine OU 69 | 70 | ```yaml 71 | Type: String 72 | Parameter Sets: (All) 73 | Aliases: 74 | 75 | Required: True 76 | Position: 3 77 | Default value: None 78 | Accept pipeline input: True (ByPropertyName, ByValue) 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -RemoveRule 83 | If present, the access rule will be removed 84 | 85 | ```yaml 86 | Type: SwitchParameter 87 | Parameter Sets: (All) 88 | Aliases: 89 | 90 | Required: False 91 | Position: 4 92 | Default value: False 93 | Accept pipeline input: True (ByPropertyName, ByValue) 94 | Accept wildcard characters: False 95 | ``` 96 | 97 | ### -WhatIf 98 | Shows what would happen if the cmdlet runs. 99 | The cmdlet is not run. 100 | 101 | ```yaml 102 | Type: SwitchParameter 103 | Parameter Sets: (All) 104 | Aliases: wi 105 | 106 | Required: False 107 | Position: Named 108 | Default value: None 109 | Accept pipeline input: False 110 | Accept wildcard characters: False 111 | ``` 112 | 113 | ### -Confirm 114 | Prompts you for confirmation before running the cmdlet. 115 | 116 | ```yaml 117 | Type: SwitchParameter 118 | Parameter Sets: (All) 119 | Aliases: cf 120 | 121 | Required: False 122 | Position: Named 123 | Default value: None 124 | Accept pipeline input: False 125 | Accept wildcard characters: False 126 | ``` 127 | 128 | ### -ProgressAction 129 | {{ Fill ProgressAction Description }} 130 | 131 | ```yaml 132 | Type: ActionPreference 133 | Parameter Sets: (All) 134 | Aliases: proga 135 | 136 | Required: False 137 | Position: Named 138 | Default value: None 139 | Accept pipeline input: False 140 | Accept wildcard characters: False 141 | ``` 142 | 143 | ### CommonParameters 144 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 145 | 146 | ## INPUTS 147 | 148 | ## OUTPUTS 149 | 150 | ## NOTES 151 | Version: 1.0 152 | DateModified: 19/Oct/2016 153 | LasModifiedBy: Vicente Rodriguez Eguibar 154 | vicente@eguibar.com 155 | Eguibar Information Technology S.L. 156 | http://www.eguibarit.com 157 | 158 | ## RELATED LINKS 159 | -------------------------------------------------------------------------------- /Private/Test-IsValidGUID.ps1: -------------------------------------------------------------------------------- 1 | function Test-IsValidGUID { 2 | <# 3 | .SYNOPSIS 4 | Validates if the input string is a valid Global Unique Identifier (GUID). 5 | 6 | .DESCRIPTION 7 | This cmdlet checks if the provided input string adheres to the structure of a valid GUID. 8 | It uses a RegEx pattern to validate the GUID format which must be in the format: 9 | "550e8400-e29b-41d4-a716-446655440000" 10 | 11 | .PARAMETER ObjectGUID 12 | The GUID string to validate. Must be in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 13 | where x represents hexadecimal digits (0-9, a-f, A-F). 14 | 15 | .INPUTS 16 | System.String 17 | You can pipe one or more GUID strings to this function. 18 | 19 | .OUTPUTS 20 | System.Boolean 21 | Returns $true if the input is a valid GUID, $false otherwise. 22 | 23 | .EXAMPLE 24 | Test-IsValidGUID -ObjectGUID '550e8400-e29b-41d4-a716-446655440000' 25 | 26 | Returns $true as this is a valid GUID format. 27 | 28 | .EXAMPLE 29 | '550e8400-e29b-41d4-a716-446655440000' | Test-IsValidGUID 30 | 31 | Shows pipeline input usage. Returns $true. 32 | 33 | .EXAMPLE 34 | Test-IsValidGUID -ObjectGUID 'invalid-guid' 35 | 36 | Returns $false as this is not a valid GUID format. 37 | 38 | .NOTES 39 | Used Functions: 40 | Name ║ Module/Namespace 41 | ═══════════════════════╬══════════════════════════════ 42 | Write-Verbose ║ Microsoft.PowerShell.Utility 43 | Write-Debug ║ Microsoft.PowerShell.Utility 44 | Write-Error ║ Microsoft.PowerShell.Utility 45 | 46 | .NOTES 47 | Version: 1.3 48 | DateModified: 22/May/2025 49 | LastModifiedBy: Vicente Rodriguez Eguibar 50 | vicente@eguibar.com 51 | Eguibar IT 52 | http://www.eguibarit.com 53 | 54 | .LINK 55 | https://github.com/vreguibar/EguibarIT/blob/main/Private/Test-IsValidGUID.ps1 56 | 57 | .COMPONENT 58 | Data Validation 59 | 60 | .ROLE 61 | Utility 62 | 63 | .FUNCTIONALITY 64 | GUID Validation 65 | #> 66 | 67 | [CmdletBinding(ConfirmImpact = 'Low', 68 | SupportsShouldProcess = $false)] 69 | [OutputType([bool])] 70 | 71 | param ( 72 | [Parameter(Mandatory = $true, 73 | ValueFromPipeline = $true, 74 | ValueFromPipelineByPropertyName = $true, 75 | ValueFromRemainingArguments = $false, 76 | HelpMessage = 'String to be validated as Global Unique Identifier (GUID)', 77 | Position = 0)] 78 | [ValidateNotNullOrEmpty()] 79 | [Alias('GUID', 'GlobalUniqueIdentifier', 'Id')] 80 | [string] 81 | $ObjectGUID 82 | ) 83 | 84 | Begin { 85 | 86 | Set-StrictMode -Version Latest 87 | 88 | ############################## 89 | # Module imports 90 | 91 | ############################## 92 | # Variables Definition 93 | 94 | [bool]$isValid = $false 95 | 96 | Write-Debug 'Begin block: Regex pattern for GUID validation initialized.' 97 | 98 | } #end Begin 99 | 100 | Process { 101 | 102 | Try { 103 | 104 | # Perform the actual validation 105 | #$isValid = $ObjectDN -match $distinguishedNameRegex 106 | $isValid = $ObjectGUID -match $Constants.GuidRegEx 107 | 108 | Write-Verbose -Message ('GUID validation result: {0}' -f $isValid) 109 | 110 | } catch { 111 | 112 | # Handle exceptions gracefully 113 | Write-Error -Message 'Error when validating GUID' 114 | 115 | } #end Try-Catch 116 | 117 | } #end Process 118 | 119 | end { 120 | return $isValid 121 | } #end End 122 | } #end Function Test-IsValidGUID 123 | -------------------------------------------------------------------------------- /Public/ConvertTo-IPv4MaskString.ps1: -------------------------------------------------------------------------------- 1 | function ConvertTo-IPv4MaskString { 2 | <# 3 | .SYNOPSIS 4 | Converts a CIDR bit count (0-32) to its equivalent subnet mask in dotted-decimal format. 5 | 6 | .DESCRIPTION 7 | This function converts a CIDR bit count (e.g., 24) to its equivalent subnet mask 8 | in dotted-decimal format (e.g., "255.255.255.0"). This is useful for network 9 | configurations that require subnet masks in the traditional format rather than CIDR notation. 10 | 11 | .PARAMETER MaskBits 12 | Specifies the number of bits in the subnet mask (0-32). 13 | Must be an integer between 0 and 32. 14 | 15 | .INPUTS 16 | System.Int32 17 | You can pipe an integer value representing CIDR bit count to this function. 18 | 19 | .OUTPUTS 20 | System.String 21 | Returns a string representing the subnet mask in dotted-decimal notation. 22 | 23 | .EXAMPLE 24 | ConvertTo-IPv4MaskString -MaskBits 24 25 | 26 | Returns "255.255.255.0", which is the subnet mask for a CIDR /24 network. 27 | 28 | .EXAMPLE 29 | ConvertTo-IPv4MaskString 16 30 | 31 | Returns "255.255.0.0", which is the subnet mask for a CIDR /16 network. 32 | 33 | .EXAMPLE 34 | 30 | ConvertTo-IPv4MaskString 35 | 36 | Returns "255.255.255.252", which is the subnet mask for a CIDR /30 network. 37 | 38 | .NOTES 39 | Used Functions: 40 | Name ║ Module/Namespace 41 | ═══════════════════════════════════════╬══════════════════════════════ 42 | Write-Verbose ║ Microsoft.PowerShell.Utility 43 | Get-FunctionDisplay ║ EguibarIT 44 | Math.Pow ║ System 45 | BitConverter.GetBytes ║ System 46 | 47 | .NOTES 48 | Version: 1.1 49 | DateModified: 22/May/2025 50 | LastModifiedBy: Vicente Rodriguez Eguibar 51 | vicente@eguibar.com 52 | Eguibar IT 53 | http://www.eguibarit.com 54 | 55 | .LINK 56 | https://github.com/vreguibar/EguibarIT/blob/main/Public/ConvertTo-IPv4MaskString.ps1 57 | 58 | .COMPONENT 59 | Networking 60 | 61 | .ROLE 62 | Utility 63 | 64 | .FUNCTIONALITY 65 | Subnet Mask Conversion 66 | #> 67 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] 68 | [OutputType([string])] 69 | 70 | Param 71 | ( 72 | [Parameter(Mandatory = $true, 73 | ValueFromPipeline = $true, 74 | ValueFromPipelineByPropertyName = $true, 75 | ValueFromRemainingArguments = $false, 76 | Position = 0)] 77 | [ValidateRange(0, 32)] 78 | [System.Int32] 79 | $MaskBits 80 | ) 81 | 82 | Begin { 83 | $txt = ($Variables.Header -f 84 | (Get-Date).ToString('dd/MMM/yyyy'), 85 | $MyInvocation.Mycommand, 86 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 87 | ) 88 | Write-Verbose -Message $txt 89 | 90 | ############################## 91 | # Module imports 92 | 93 | ############################## 94 | # Variables Definition 95 | 96 | } #end Begin 97 | 98 | Process { 99 | $mask = ([Math]::Pow(2, $MaskBits) - 1) * [Math]::Pow(2, (32 - $MaskBits)) 100 | $bytes = [BitConverter]::GetBytes([UInt32] $mask) 101 | (($bytes.Count - 1)..0 | ForEach-Object { [String] $bytes[$_] }) -join '.' 102 | } #end Process 103 | 104 | End { 105 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 106 | 'converting bits to a networkmask string.' 107 | ) 108 | Write-Verbose -Message $txt 109 | } #end End 110 | 111 | } #end Function 112 | -------------------------------------------------------------------------------- /Docs/Start-AdDelegateSite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Start-AdDelegateSite 9 | 10 | ## SYNOPSIS 11 | The function will create the corresponding Tier2 site 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Start-AdDelegateSite [-ConfigXMLFile] [-ouName] [-QuarantineDN] [-CreateExchange] 17 | [-ProgressAction ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | This function will create all needed objects and related delegations for the 22 | given site. 23 | This Tier2 site is intended to hold all related Tier2 objects, as Users, Computers, Groups, etc. 24 | and provide all delegated rights and permissions according to the delegation model. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | ``` 30 | Start-AdDelegateSite -ConfigXMLFile "C:\PsScripts\Config.xml" -ouName "GOOD" -QuarantineDN "Quarantine" -CreateExchange 31 | ``` 32 | 33 | ### EXAMPLE 2 34 | ``` 35 | $Splat = @{ 36 | ConfigXMLFile = "C:\PsScripts\Config.xml" 37 | ouName = "GOOD" 38 | QuarantineDN = "Quarantine" 39 | CreateExchange = $true 40 | } 41 | Start-AdDelegateSite @Splat 42 | ``` 43 | 44 | ## PARAMETERS 45 | 46 | ### -ConfigXMLFile 47 | Full path to the Configuration.XML file 48 | 49 | ```yaml 50 | Type: String 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: True 55 | Position: 1 56 | Default value: None 57 | Accept pipeline input: True (ByPropertyName, ByValue) 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -ouName 62 | Name of the Site OU 63 | 64 | ```yaml 65 | Type: String 66 | Parameter Sets: (All) 67 | Aliases: 68 | 69 | Required: True 70 | Position: 2 71 | Default value: None 72 | Accept pipeline input: True (ByPropertyName, ByValue) 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### -QuarantineDN 77 | Name new redirected OU for computers 78 | 79 | ```yaml 80 | Type: String 81 | Parameter Sets: (All) 82 | Aliases: 83 | 84 | Required: True 85 | Position: 3 86 | Default value: None 87 | Accept pipeline input: True (ByPropertyName, ByValue) 88 | Accept wildcard characters: False 89 | ``` 90 | 91 | ### -CreateExchange 92 | If present It will create all needed Exchange objects and containers. 93 | 94 | ```yaml 95 | Type: SwitchParameter 96 | Parameter Sets: (All) 97 | Aliases: 98 | 99 | Required: False 100 | Position: 4 101 | Default value: False 102 | Accept pipeline input: True (ByPropertyName, ByValue) 103 | Accept wildcard characters: False 104 | ``` 105 | 106 | ### -WhatIf 107 | Shows what would happen if the cmdlet runs. 108 | The cmdlet is not run. 109 | 110 | ```yaml 111 | Type: SwitchParameter 112 | Parameter Sets: (All) 113 | Aliases: wi 114 | 115 | Required: False 116 | Position: Named 117 | Default value: None 118 | Accept pipeline input: False 119 | Accept wildcard characters: False 120 | ``` 121 | 122 | ### -Confirm 123 | Prompts you for confirmation before running the cmdlet. 124 | 125 | ```yaml 126 | Type: SwitchParameter 127 | Parameter Sets: (All) 128 | Aliases: cf 129 | 130 | Required: False 131 | Position: Named 132 | Default value: None 133 | Accept pipeline input: False 134 | Accept wildcard characters: False 135 | ``` 136 | 137 | ### -ProgressAction 138 | {{ Fill ProgressAction Description }} 139 | 140 | ```yaml 141 | Type: ActionPreference 142 | Parameter Sets: (All) 143 | Aliases: proga 144 | 145 | Required: False 146 | Position: Named 147 | Default value: None 148 | Accept pipeline input: False 149 | Accept wildcard characters: False 150 | ``` 151 | 152 | ### CommonParameters 153 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 154 | 155 | ## INPUTS 156 | 157 | ## OUTPUTS 158 | 159 | ## NOTES 160 | Version: 1.3 161 | DateModified: 12/Feb/2019 162 | LasModifiedBy: Vicente Rodriguez Eguibar 163 | vicente@eguibar.com 164 | Eguibar Information Technology S.L. 165 | http://www.eguibarit.com 166 | 167 | ## RELATED LINKS 168 | -------------------------------------------------------------------------------- /Public/ConvertTo-IPv4MaskBit.ps1: -------------------------------------------------------------------------------- 1 | function ConvertTo-IPv4MaskBit { 2 | <# 3 | .SYNOPSIS 4 | Converts a subnet mask string to its CIDR bit count (0-32). 5 | 6 | .DESCRIPTION 7 | This function converts a subnet mask in dotted-decimal format (e.g., "255.255.255.0") 8 | to its equivalent CIDR notation bit count (e.g., 24). This is useful for network 9 | calculations and subnet operations where CIDR notation is required. 10 | 11 | .PARAMETER MaskString 12 | Specifies the IPv4 subnet mask in dotted-decimal format (e.g., "255.255.255.0"). 13 | Must be a valid subnet mask that passes the Test-IPv4MaskString validation. 14 | 15 | .INPUTS 16 | System.String 17 | You can pipe a string value representing a subnet mask to this function. 18 | 19 | .OUTPUTS 20 | System.Int32 21 | Returns an integer between 0 and 32 representing the CIDR bit count. 22 | 23 | .EXAMPLE 24 | ConvertTo-IPv4MaskBit -MaskString "255.255.255.0" 25 | 26 | Returns 24, which is the CIDR bit count for the subnet mask 255.255.255.0. 27 | 28 | .EXAMPLE 29 | ConvertTo-IPv4MaskBit "255.255.0.0" 30 | 31 | Returns 16, which is the CIDR bit count for the subnet mask 255.255.0.0. 32 | 33 | .EXAMPLE 34 | "255.255.255.252" | ConvertTo-IPv4MaskBit 35 | 36 | Returns 30, which is the CIDR bit count for the subnet mask 255.255.255.252. 37 | 38 | .NOTES 39 | Used Functions: 40 | Name ║ Module/Namespace 41 | ═══════════════════════════════════════╬══════════════════════════════ 42 | Test-IPv4MaskString ║ EguibarIT 43 | Write-Verbose ║ Microsoft.PowerShell.Utility 44 | Get-FunctionDisplay ║ EguibarIT 45 | IPAddress ║ System.Net 46 | 47 | .NOTES 48 | Version: 1.1 49 | DateModified: 22/May/2025 50 | LastModifiedBy: Vicente Rodriguez Eguibar 51 | vicente@eguibar.com 52 | Eguibar IT 53 | http://www.eguibarit.com 54 | 55 | .LINK 56 | https://github.com/vreguibar/EguibarIT/blob/main/Public/ConvertTo-IPv4MaskBit.ps1 57 | 58 | .COMPONENT 59 | Networking 60 | 61 | .ROLE 62 | Utility 63 | 64 | .FUNCTIONALITY 65 | Subnet Mask Conversion 66 | #> 67 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] 68 | [OutputType([System.Int32])] 69 | 70 | Param 71 | ( 72 | [Parameter(Mandatory = $true, 73 | ValueFromPipeline = $true, 74 | ValueFromPipelineByPropertyName = $true, 75 | ValueFromRemainingArguments = $false, 76 | Position = 0)] 77 | [ValidateScript({ Test-IPv4MaskString $_ })] 78 | [String] 79 | $MaskString 80 | ) 81 | 82 | Begin { 83 | $txt = ($Variables.Header -f 84 | (Get-Date).ToString('dd/MMM/yyyy'), 85 | $MyInvocation.Mycommand, 86 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 87 | ) 88 | Write-Verbose -Message $txt 89 | 90 | ############################## 91 | # Module imports 92 | 93 | ############################## 94 | # Variables Definition 95 | } #end Begin 96 | 97 | Process { 98 | $mask = ([IPAddress] $MaskString).Address 99 | for ( $bitCount = 0; $mask -ne 0; $bitCount++ ) { 100 | $mask = $mask -band ($mask - 1) 101 | } 102 | $bitCount 103 | } #end Process 104 | 105 | End { 106 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 107 | 'returning the bits in a bitmask IPv4.' 108 | ) 109 | Write-Verbose -Message $txt 110 | } #end End 111 | } #end Function 112 | -------------------------------------------------------------------------------- /Public/Get-AllAdSubnet.ps1: -------------------------------------------------------------------------------- 1 | function Get-AllAdSubnet { 2 | <# 3 | .SYNOPSIS 4 | Retrieves all Active Directory subnets defined in the current forest. 5 | 6 | .DESCRIPTION 7 | This function retrieves all Active Directory subnets defined in the current forest 8 | using LDAP queries. It returns an array of subnet objects with all properties 9 | including site association, description, and location. 10 | 11 | Subnets are critical for client site awareness and proper domain controller 12 | selection in distributed Active Directory environments. 13 | 14 | .INPUTS 15 | None 16 | This function does not accept pipeline input. 17 | 18 | .OUTPUTS 19 | System.Array 20 | Returns an array of Microsoft.ActiveDirectory.Management.ADObject objects 21 | representing subnets, with all properties populated. 22 | 23 | .EXAMPLE 24 | Get-AllAdSubnet 25 | 26 | Returns all AD subnets defined in the current forest. 27 | 28 | .EXAMPLE 29 | Get-AllAdSubnet | Where-Object { $_.siteObject -eq $null } 30 | 31 | Returns all subnets that are not associated with any site. 32 | 33 | .EXAMPLE 34 | Get-AllAdSubnet | Select-Object Name, @{N='Site';E={($_.siteObject -split ',')[0] -replace 'CN=',''}} 35 | 36 | Returns all subnets with their names and associated site names in a readable format. 37 | 38 | .NOTES 39 | Used Functions: 40 | Name ║ Module/Namespace 41 | ═══════════════════════════════════════╬══════════════════════════════ 42 | Import-MyModule ║ EguibarIT 43 | Get-ADObject ║ ActiveDirectory 44 | Get-FunctionDisplay ║ EguibarIT 45 | Write-Verbose ║ Microsoft.PowerShell.Utility 46 | ADSI ║ System.DirectoryServices 47 | 48 | .NOTES 49 | Version: 1.1 50 | DateModified: 22/May/2025 51 | LastModifiedBy: Vicente Rodriguez Eguibar 52 | vicente@eguibar.com 53 | Eguibar IT 54 | http://www.eguibarit.com 55 | 56 | .LINK 57 | https://github.com/vreguibar/EguibarIT/blob/main/Public/Get-AllAdSubnet.ps1 58 | 59 | .COMPONENT 60 | Active Directory 61 | 62 | .ROLE 63 | Network Administration 64 | 65 | .FUNCTIONALITY 66 | Site and Subnet Management 67 | #> 68 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] 69 | [OutputType([array])] 70 | 71 | Param () 72 | 73 | Begin { 74 | $txt = ($Variables.Header -f 75 | (Get-Date).ToString('dd/MMM/yyyy'), 76 | $MyInvocation.Mycommand, 77 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 78 | ) 79 | Write-Verbose -Message $txt 80 | 81 | ############################## 82 | # Module imports 83 | 84 | Import-MyModule -Name 'ServerManager' -SkipEditionCheck -Verbose:$false 85 | Import-MyModule -Name 'ActiveDirectory' -Verbose:$false 86 | 87 | ############################## 88 | # Variables Definition 89 | 90 | } #end Begin 91 | 92 | Process { 93 | #Get a reference to the RootDSE of the current domain 94 | $ADConfigurationNamingContext = ([ADSI]'LDAP://RootDSE').configurationNamingContext 95 | 96 | [array] $ADSubnets = Get-ADObject -Filter { 97 | objectclass -eq 'subnet' 98 | } -SearchBase $ADConfigurationNamingContext -Properties * 99 | } #end Process 100 | 101 | End { 102 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 103 | 'getting AD Subnets.' 104 | ) 105 | Write-Verbose -Message $txt 106 | 107 | Return $ADSubnets 108 | } #end End 109 | } #end Function 110 | -------------------------------------------------------------------------------- /Public/ConvertTo-IntegerIPv4.ps1: -------------------------------------------------------------------------------- 1 | function ConvertTo-IntegerIPv4 { 2 | <# 3 | .SYNOPSIS 4 | Converts an integer value to its IPv4 address representation. 5 | 6 | .DESCRIPTION 7 | This function converts a 32-bit unsigned integer to a standard dotted-decimal 8 | IPv4 address format. This is the reverse operation of ConvertTo-IPv4Integer and 9 | is useful for IP address calculations, range conversions, and subnet operations. 10 | 11 | .PARAMETER Integer 12 | Specifies the 32-bit unsigned integer representing the IPv4 address. 13 | For example, 3232235776 will convert to "192.168.1.0". 14 | 15 | .INPUTS 16 | System.UInt32 17 | You can pipe a 32-bit unsigned integer value to this function. 18 | 19 | .OUTPUTS 20 | System.Net.IPAddress 21 | Returns an IPv4 address object in dotted-decimal notation. 22 | 23 | .EXAMPLE 24 | ConvertTo-IntegerIPv4 -Integer 3232235776 25 | 26 | Converts the integer 3232235776 to the IP address 192.168.1.0. 27 | 28 | .EXAMPLE 29 | ConvertTo-IntegerIPv4 167772160 30 | 31 | Converts the integer 167772160 to the IP address 10.0.0.0. 32 | 33 | .EXAMPLE 34 | 3232235521 | ConvertTo-IntegerIPv4 35 | 36 | Converts the integer received from the pipeline to its IPv4 representation. 37 | 38 | .NOTES 39 | Used Functions: 40 | Name ║ Module/Namespace 41 | ═══════════════════════════════════════╬══════════════════════════════ 42 | Write-Verbose ║ Microsoft.PowerShell.Utility 43 | Write-Error ║ Microsoft.PowerShell.Utility 44 | Get-FunctionDisplay ║ EguibarIT 45 | BitConverter.GetBytes ║ System 46 | IPAddress ║ System.Net 47 | 48 | .NOTES 49 | Version: 1.1 50 | DateModified: 22/May/2025 51 | LastModifiedBy: Vicente Rodriguez Eguibar 52 | vicente@eguibar.com 53 | Eguibar IT 54 | http://www.eguibarit.com 55 | 56 | .LINK 57 | https://github.com/vreguibar/EguibarIT/blob/main/Public/ConvertTo-IntegerIPv4.ps1 58 | 59 | .COMPONENT 60 | Networking 61 | 62 | .ROLE 63 | Utility 64 | 65 | .FUNCTIONALITY 66 | IP Address Conversion 67 | #> 68 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] 69 | [OutputType([System.Net.IpAddress])] 70 | 71 | Param ( 72 | [Parameter(Mandatory = $true, 73 | ValueFromPipeline = $true, 74 | ValueFromPipelineByPropertyName = $true, 75 | ValueFromRemainingArguments = $false, 76 | Position = 0)] 77 | [uint32] 78 | $Integer 79 | ) 80 | 81 | Begin { 82 | $txt = ($Variables.Header -f 83 | (Get-Date).ToString('dd/MMM/yyyy'), 84 | $MyInvocation.Mycommand, 85 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 86 | ) 87 | Write-Verbose -Message $txt 88 | 89 | ############################## 90 | # Module imports 91 | 92 | ############################## 93 | # Variables Definition 94 | 95 | } #end Begin 96 | 97 | Process { 98 | Try { 99 | $bytes = [System.BitConverter]::GetBytes($Integer) 100 | 101 | [Array]::Reverse($bytes) 102 | 103 | ([IPAddress]($bytes)).ToString() 104 | 105 | } Catch { 106 | Write-Error -Message 'Error when converting Integer to IPv4' 107 | throw 108 | } 109 | } #end Process 110 | 111 | End { 112 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 113 | 'converting Integer to IPv4.' 114 | ) 115 | Write-Verbose -Message $txt 116 | } #end End 117 | 118 | } #end Function 119 | -------------------------------------------------------------------------------- /Public/Get-AllAdSiteLink.ps1: -------------------------------------------------------------------------------- 1 | function Get-AllAdSiteLink { 2 | <# 3 | .SYNOPSIS 4 | Retrieves all Active Directory site links from the current forest. 5 | 6 | .DESCRIPTION 7 | This function retrieves all Active Directory site links from the current forest 8 | using LDAP queries. It returns an array of site link objects with all properties, 9 | including replication schedules, cost, and connected sites. 10 | 11 | Site links are critical components of Active Directory replication topology 12 | and define how sites are interconnected for replication purposes. 13 | 14 | .INPUTS 15 | None 16 | This function does not accept pipeline input. 17 | 18 | .OUTPUTS 19 | System.Array 20 | Returns an array of Microsoft.ActiveDirectory.Management.ADObject objects 21 | representing site links, with all properties populated. 22 | 23 | .EXAMPLE 24 | Get-AllAdSiteLink 25 | 26 | Returns all AD site links in the current forest and displays the total count. 27 | 28 | .EXAMPLE 29 | Get-AllAdSiteLink | Select-Object Name, Cost, ReplicationInterval 30 | 31 | Returns all site links with their names, costs, and replication intervals. 32 | 33 | .NOTES 34 | Used Functions: 35 | Name ║ Module/Namespace 36 | ═══════════════════════════════════════╬══════════════════════════════ 37 | Import-MyModule ║ EguibarIT 38 | Get-ADObject ║ ActiveDirectory 39 | Get-FunctionDisplay ║ EguibarIT 40 | Write-Verbose ║ Microsoft.PowerShell.Utility 41 | Write-Output ║ Microsoft.PowerShell.Utility 42 | 43 | .NOTES 44 | Version: 1.1 45 | DateModified: 22/May/2025 46 | LastModifiedBy: Vicente Rodriguez Eguibar 47 | vicente@eguibar.com 48 | Eguibar IT 49 | http://www.eguibarit.com 50 | 51 | .LINK 52 | https://github.com/vreguibar/EguibarIT/blob/main/Public/Get-AllAdSiteLink.ps1 53 | 54 | .COMPONENT 55 | Active Directory 56 | 57 | .ROLE 58 | Network Administration 59 | 60 | .FUNCTIONALITY 61 | Site Replication Management 62 | #> 63 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] 64 | [OutputType([array])] 65 | 66 | Param () 67 | 68 | Begin { 69 | $txt = ($Variables.Header -f 70 | (Get-Date).ToString('dd/MMM/yyyy'), 71 | $MyInvocation.Mycommand, 72 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 73 | ) 74 | Write-Verbose -Message $txt 75 | 76 | ############################## 77 | # Module imports 78 | 79 | Import-MyModule -Name 'ServerManager' -SkipEditionCheck -Verbose:$false 80 | Import-MyModule -Name 'ActiveDirectory' -Verbose:$false 81 | 82 | ############################## 83 | # Variables Definition 84 | 85 | $ADSiteDN = 'CN=Sites,{0}' -f $Variables.configurationNamingContext 86 | #$SubnetsDN = 'CN=Subnets,{0}' -f $ADSiteDN 87 | #$ADSiteLinksDN = 'CN=IP,CN=Inter-Site Transports,{0}' -f $ADSiteDN 88 | } #end Begin 89 | 90 | Process { 91 | Write-Verbose -Message "Get List of AD Site Links `r" 92 | 93 | [array] $ADSiteLinks = Get-ADObject -Filter { ObjectClass -eq 'sitelink' } -SearchBase $ADSiteDN -Properties * 94 | 95 | $ADSiteLinksCount = $ADSiteLinks.Count 96 | 97 | Write-Output -InputObject ("There are {0} AD Site Links in {1} `r" -f $ADSiteLinksCount, $env:USERDNSDOMAIN) 98 | } #end Process 99 | 100 | End { 101 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 102 | 'getting SiteLinks.' 103 | ) 104 | Write-Verbose -Message $txt 105 | 106 | Return $ADSiteLinks 107 | } #end End 108 | } #end Function 109 | -------------------------------------------------------------------------------- /Public/ConvertTo-IPv4Integer.ps1: -------------------------------------------------------------------------------- 1 | function ConvertTo-IPv4Integer { 2 | <# 3 | .SYNOPSIS 4 | Converts an IPv4 address to its integer representation. 5 | 6 | .DESCRIPTION 7 | This function converts a standard dotted-decimal IPv4 address (e.g., 192.168.1.200) 8 | to its 32-bit unsigned integer equivalent. This conversion is useful for IP address 9 | calculations, range comparisons, and subnet operations. 10 | 11 | .PARAMETER Ipv4Address 12 | Specifies the IPv4 Address as a string (e.g., "192.168.1.200"). 13 | Must be a valid IPv4 address in dotted-decimal notation. 14 | 15 | .INPUTS 16 | System.String 17 | You can pipe a string value representing an IPv4 address to this function. 18 | 19 | .OUTPUTS 20 | System.UInt32 21 | Returns a 32-bit unsigned integer representation of the IPv4 address. 22 | 23 | .EXAMPLE 24 | ConvertTo-IPv4Integer -Ipv4Address "192.168.1.200" 25 | 26 | Converts the IP address 192.168.1.200 to its integer representation. 27 | 28 | .EXAMPLE 29 | ConvertTo-IPv4Integer "192.168.1.200" 30 | 31 | Converts the IP address using positional parameter. 32 | 33 | .EXAMPLE 34 | "10.0.0.1" | ConvertTo-IPv4Integer 35 | 36 | Converts the IP address received from the pipeline. 37 | 38 | .NOTES 39 | Used Functions: 40 | Name ║ Module/Namespace 41 | ═══════════════════════════════════════╬══════════════════════════════ 42 | Write-Verbose ║ Microsoft.PowerShell.Utility 43 | Write-Error ║ Microsoft.PowerShell.Utility 44 | Get-FunctionDisplay ║ EguibarIT 45 | IPAddress.Parse ║ System.Net 46 | BitConverter.ToUInt32 ║ System 47 | 48 | .NOTES 49 | Version: 1.1 50 | DateModified: 22/May/2025 51 | LastModifiedBy: Vicente Rodriguez Eguibar 52 | vicente@eguibar.com 53 | Eguibar IT 54 | http://www.eguibarit.com 55 | 56 | .LINK 57 | https://github.com/vreguibar/EguibarIT/blob/main/Public/ConvertTo-IPv4Integer.ps1 58 | 59 | .COMPONENT 60 | Networking 61 | 62 | .ROLE 63 | Utility 64 | 65 | .FUNCTIONALITY 66 | IP Address Conversion 67 | #> 68 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] 69 | [OutputType([System.UInt32])] 70 | 71 | Param 72 | ( 73 | [Parameter(Mandatory = $true, 74 | ValueFromPipeline = $true, 75 | ValueFromPipelineByPropertyName = $true, 76 | ValueFromRemainingArguments = $false, 77 | Position = 0)] 78 | [String] 79 | $Ipv4Address 80 | ) 81 | 82 | Begin { 83 | $txt = ($Variables.Header -f 84 | (Get-Date).ToString('dd/MMM/yyyy'), 85 | $MyInvocation.Mycommand, 86 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 87 | ) 88 | Write-Verbose -Message $txt 89 | 90 | ############################## 91 | # Module imports 92 | 93 | ############################## 94 | # Variables Definition 95 | } #end Begin 96 | 97 | Process { 98 | 99 | Try { 100 | $ipAddress = [IPAddress]::Parse($IPv4Address) 101 | 102 | $bytes = $ipAddress.GetAddressBytes() 103 | 104 | [Array]::Reverse($bytes) 105 | 106 | [System.BitConverter]::ToUInt32($bytes, 0) 107 | 108 | } Catch { 109 | Write-Error -Exception $_.Exception -Category $_.CategoryInfo.Category 110 | } #end Try-Catch 111 | 112 | } #end Process 113 | 114 | End { 115 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 116 | 'converting IPv4 to Integer.' 117 | ) 118 | Write-Verbose -Message $txt 119 | } #end End 120 | 121 | } #end Function 122 | -------------------------------------------------------------------------------- /Public/Test-RegistryValue.ps1: -------------------------------------------------------------------------------- 1 | function Test-RegistryValue { 2 | <# 3 | .SYNOPSIS 4 | Tests if a specific registry value exists. 5 | 6 | .DESCRIPTION 7 | This function tests whether a specified registry value exists in a given registry path. 8 | It provides a safe way to check registry values without throwing errors if the value 9 | doesn't exist. The function returns a boolean value indicating the existence of the 10 | specified registry value. 11 | 12 | .PARAMETER Path 13 | The registry path to check. Must be a valid registry path starting with one of the 14 | PowerShell registry drives (HKLM:, HKCU:, etc.). 15 | 16 | .PARAMETER Value 17 | The name of the registry value to test for existence. This is the specific value 18 | name within the specified registry key. 19 | 20 | .INPUTS 21 | System.String 22 | You can pipe registry paths and value names to this function. 23 | 24 | .OUTPUTS 25 | System.Boolean 26 | Returns $true if the registry value exists, $false otherwise. 27 | 28 | .EXAMPLE 29 | Test-RegistryValue -Path "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Value "AutoAdminLogon" 30 | 31 | Tests if the AutoAdminLogon value exists in the Windows NT Winlogon registry key. 32 | 33 | .EXAMPLE 34 | Test-RegistryValue "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "AutoAdminLogon" 35 | 36 | Shows using positional parameters to test the existence of the AutoAdminLogon value. 37 | 38 | .EXAMPLE 39 | "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" | Test-RegistryValue -Value "AutoAdminLogon" 40 | 41 | Shows how to pipe a registry path to the function. 42 | 43 | .NOTES 44 | Used Functions: 45 | Name ║ Module/Namespace 46 | ═══════════════════════════════════════════╬══════════════════════════════ 47 | Get-ItemProperty ║ Microsoft.PowerShell.Management 48 | Get-CurrentErrorToDisplay ║ EguibarIT 49 | Get-FunctionDisplay ║ EguibarIT 50 | 51 | .NOTES 52 | Version: 1.1 53 | DateModified: 22/May/2025 54 | LastModifiedBy: Vicente Rodriguez Eguibar 55 | vicente@eguibar.com 56 | Eguibar IT 57 | http://www.eguibarit.com 58 | 59 | .LINK 60 | https://github.com/vreguibar/EguibarIT/blob/main/Public/Test-RegistryValue.ps1 61 | 62 | .COMPONENT 63 | Windows Registry Management 64 | 65 | .ROLE 66 | System Administration 67 | 68 | .FUNCTIONALITY 69 | Registry Value Validation 70 | #> 71 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] 72 | [OutputType([Bool])] 73 | 74 | Param ( 75 | [parameter(Mandatory = $true, 76 | ValueFromPipeline = $true, 77 | ValueFromPipelineByPropertyName = $true, 78 | ValueFromRemainingArguments = $true, 79 | HelpMessage = 'Registry path to be tested', 80 | Position = 0)] 81 | [ValidateNotNullOrEmpty()] 82 | [string] 83 | $Path, 84 | 85 | [parameter(Mandatory = $true, 86 | ValueFromPipeline = $true, 87 | ValueFromPipelineByPropertyName = $true, 88 | ValueFromRemainingArguments = $true, 89 | HelpMessage = 'Registry value to be tested', 90 | Position = 1)] 91 | [ValidateNotNullOrEmpty()] 92 | [string] 93 | $Value 94 | ) 95 | 96 | Begin { 97 | 98 | ############################## 99 | # Module imports 100 | 101 | ############################## 102 | # Variables Definition 103 | 104 | } #end Begin 105 | 106 | Process { 107 | try { 108 | Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Value -ErrorAction Stop | Out-Null 109 | return $true 110 | } catch { 111 | return $false 112 | } 113 | } #end Process 114 | 115 | End { 116 | 117 | } #end End 118 | 119 | } #end Function 120 | -------------------------------------------------------------------------------- /Docs/New-AreaShareNTFS.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: EguibarIT-help.xml 3 | Module Name: EguibarIT 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-AreaShareNTFS 9 | 10 | ## SYNOPSIS 11 | Function to create a new Area folder share 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-AreaShareNTFS [-ShareName] [-readGroup] [-changeGroup] 17 | [-SG_SiteAdminsGroup] [-sitePath] [-ShareLocation] [-AreasName] 18 | [-ProgressAction ] [-WhatIf] [-Confirm] [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | Function to create a new Area folder share 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-AreaShareNTFS -ShareName 'Acounting' -ReadGroup 'SL_Accounting_Read' -ChangeGroup 'SL_Accounting_write' -SiteAdminGroup 'SG_Accounting_MNGT' -SitePath 'C:\Shares\Areas\Accounting' 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ShareName 34 | Param1 Sharename 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName, ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -readGroup 49 | Param2 Read group 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: True (ByPropertyName, ByValue) 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -changeGroup 64 | Param3 Change Group 65 | 66 | ```yaml 67 | Type: String 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: 3 73 | Default value: None 74 | Accept pipeline input: True (ByPropertyName, ByValue) 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -SG_SiteAdminsGroup 79 | Param4 All Site Admins group 80 | 81 | ```yaml 82 | Type: String 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: True 87 | Position: 4 88 | Default value: None 89 | Accept pipeline input: True (ByPropertyName, ByValue) 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -sitePath 94 | Param5 Path to the site 95 | 96 | ```yaml 97 | Type: String 98 | Parameter Sets: (All) 99 | Aliases: 100 | 101 | Required: True 102 | Position: 5 103 | Default value: None 104 | Accept pipeline input: True (ByPropertyName, ByValue) 105 | Accept wildcard characters: False 106 | ``` 107 | 108 | ### -ShareLocation 109 | Param6 110 | 111 | ```yaml 112 | Type: String 113 | Parameter Sets: (All) 114 | Aliases: 115 | 116 | Required: True 117 | Position: 6 118 | Default value: None 119 | Accept pipeline input: True (ByPropertyName, ByValue) 120 | Accept wildcard characters: False 121 | ``` 122 | 123 | ### -AreasName 124 | Param7 125 | 126 | ```yaml 127 | Type: String 128 | Parameter Sets: (All) 129 | Aliases: 130 | 131 | Required: True 132 | Position: 7 133 | Default value: None 134 | Accept pipeline input: True (ByPropertyName, ByValue) 135 | Accept wildcard characters: False 136 | ``` 137 | 138 | ### -WhatIf 139 | Shows what would happen if the cmdlet runs. 140 | The cmdlet is not run. 141 | 142 | ```yaml 143 | Type: SwitchParameter 144 | Parameter Sets: (All) 145 | Aliases: wi 146 | 147 | Required: False 148 | Position: Named 149 | Default value: None 150 | Accept pipeline input: False 151 | Accept wildcard characters: False 152 | ``` 153 | 154 | ### -Confirm 155 | Prompts you for confirmation before running the cmdlet. 156 | 157 | ```yaml 158 | Type: SwitchParameter 159 | Parameter Sets: (All) 160 | Aliases: cf 161 | 162 | Required: False 163 | Position: Named 164 | Default value: None 165 | Accept pipeline input: False 166 | Accept wildcard characters: False 167 | ``` 168 | 169 | ### -ProgressAction 170 | {{ Fill ProgressAction Description }} 171 | 172 | ```yaml 173 | Type: ActionPreference 174 | Parameter Sets: (All) 175 | Aliases: proga 176 | 177 | Required: False 178 | Position: Named 179 | Default value: None 180 | Accept pipeline input: False 181 | Accept wildcard characters: False 182 | ``` 183 | 184 | ### CommonParameters 185 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 186 | 187 | ## INPUTS 188 | 189 | ### Param1...: ShareName 190 | ### Param2...: ReadGroup 191 | ### Param3...: ChangeGroup 192 | ### Param4...: SiteAdminGroup 193 | ### Param5...: SitePath 194 | ## OUTPUTS 195 | 196 | ### System.String 197 | ## NOTES 198 | Version: 1.1 199 | DateModified: 03/Oct/2016 200 | LasModifiedBy: Vicente Rodriguez Eguibar 201 | vicente@eguibar.com 202 | Eguibar Information Technology S.L. 203 | http://www.eguibarit.com 204 | 205 | ## RELATED LINKS 206 | -------------------------------------------------------------------------------- /Private/Test-IsValidDN.ps1: -------------------------------------------------------------------------------- 1 | function Test-IsValidDN { 2 | <# 3 | .SYNOPSIS 4 | Validates if the input string is a valid distinguished name (DN). 5 | 6 | .DESCRIPTION 7 | This cmdlet checks if the provided input string adheres to the 8 | structure of a valid distinguished name in Active Directory. 9 | It uses regex pattern matching to validate the DN structure 10 | without making actual AD queries. 11 | 12 | The function is idempotent and can process multiple DNs 13 | through pipeline input efficiently. 14 | 15 | .PARAMETER ObjectDN 16 | The distinguished name to validate. This parameter accepts a 17 | string representing the DN of an Active Directory object. 18 | Multiple DNs can be processed through pipeline input. 19 | 20 | .INPUTS 21 | System.String 22 | You can pipe one or more distinguished name strings to this function. 23 | 24 | .OUTPUTS 25 | System.Boolean 26 | Returns $true if the string is a valid distinguished name, otherwise $false. 27 | 28 | .EXAMPLE 29 | Test-IsValidDN -ObjectDN 'CN=Darth Vader,OU=Users,DC=EguibarIT,DC=local' 30 | 31 | Returns $true as this is a valid DN format. 32 | 33 | .EXAMPLE 34 | 'CN=Test User,DC=domain,DC=com', 'Invalid DN' | Test-IsValidDN 35 | 36 | Processes multiple DNs through pipeline, returning boolean results for each. 37 | 38 | .EXAMPLE 39 | Test-IsValidDN -ObjectDN 'Invalid DN' -Verbose 40 | 41 | Returns $false and shows verbose output about the validation process. 42 | 43 | .NOTES 44 | Used Functions: 45 | Name ║ Module/Namespace 46 | ════════════════════════╬══════════════════════════════ 47 | Write-Verbose ║ Microsoft.PowerShell.Utility 48 | Write-Debug ║ Microsoft.PowerShell.Utility 49 | Write-Error ║ Microsoft.PowerShell.Utility 50 | 51 | .NOTES 52 | Version: 1.3 53 | DateModified: 22/May/2025 54 | LastModifiedBy: Vicente Rodriguez Eguibar 55 | vicente@eguibar.com 56 | Eguibar IT 57 | http://www.eguibarit.com 58 | 59 | .LINK 60 | https://pscustomobject.github.io/powershell/howto/identity%20management/PowerShell-Check-If-String-Is-A-DN/ 61 | 62 | .LINK 63 | https://github.com/vreguibar/EguibarIT/blob/main/Private/Test-IsValidDN.ps1 64 | 65 | .COMPONENT 66 | Active Directory 67 | 68 | .ROLE 69 | Identity Management 70 | 71 | .FUNCTIONALITY 72 | Distinguished Name Validation 73 | #> 74 | 75 | [CmdletBinding(ConfirmImpact = 'Low', 76 | SupportsShouldProcess = $false)] 77 | [OutputType([bool])] 78 | 79 | param 80 | ( 81 | [Parameter(Mandatory = $true, 82 | ValueFromPipeline = $true, 83 | ValueFromPipelineByPropertyName = $true, 84 | ValueFromRemainingArguments = $false, 85 | HelpMessage = 'Distinguished Name string to validate', 86 | Position = 0)] 87 | [ValidateNotNullOrEmpty()] 88 | [Alias('DN', 'DistinguishedName')] 89 | [string] 90 | $ObjectDN 91 | ) 92 | 93 | Begin { 94 | 95 | Set-StrictMode -Version Latest 96 | 97 | ############################## 98 | # Module imports 99 | 100 | ############################## 101 | # Variables Definition 102 | 103 | # Initialize a boolean variable to store validation result 104 | [bool]$isValid = $false 105 | 106 | Write-Debug -Message 'Begin block: Regex pattern for DN validation initialized.' 107 | 108 | } #end Begin 109 | 110 | Process { 111 | 112 | Try { 113 | 114 | # Perform the actual validation 115 | $isValid = $ObjectDN -match $Constants.DnRegEx 116 | 117 | # Provide verbose output 118 | if ($PSCmdlet.MyInvocation.BoundParameters['Verbose']) { 119 | Write-Verbose -Message ('DistinguishedName validation result: {0}' -f $isValid) 120 | } #end If 121 | 122 | } catch { 123 | 124 | # Handle any exceptions gracefully 125 | Write-Error -Message ('Error validating DN: {0}. Error: {1}' -f $ObjectDN, $_.Exception.Message) 126 | $isValid = $false 127 | 128 | } #end Try-Catch 129 | 130 | } #end Process 131 | 132 | end { 133 | return $isValid 134 | } #end End 135 | } #end Function Test-IsValidDN 136 | -------------------------------------------------------------------------------- /Public/New-EitAdSite.ps1: -------------------------------------------------------------------------------- 1 | function New-EitAdSite { 2 | <# 3 | .Synopsis 4 | Create new AD Site 5 | .DESCRIPTION 6 | Create new AD Site 7 | .EXAMPLE 8 | New-EitAdSite -NewSiteName $SiteName 9 | .INPUTS 10 | Param1 NewSiteName - Name for the new site. 11 | .NOTES 12 | Version: 1.0 13 | DateModified: 31/Mar/2015 14 | LasModifiedBy: Vicente Rodriguez Eguibar 15 | vicente@eguibar.com 16 | Eguibar Information Technology S.L. 17 | http://www.eguibarit.com 18 | #> 19 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] 20 | [OutputType([void])] 21 | 22 | Param 23 | ( 24 | # Param1 New Site name 25 | [Parameter(Mandatory = $true, 26 | ValueFromPipeline = $true, 27 | ValueFromPipelineByPropertyName = $true, 28 | ValueFromRemainingArguments = $false, 29 | HelpMessage = 'Add help message for user', 30 | Position = 0)] 31 | [ValidateNotNullOrEmpty()] 32 | [string] 33 | $NewSiteName 34 | ) 35 | 36 | Begin { 37 | $error.Clear() 38 | 39 | $txt = ($Variables.Header -f 40 | (Get-Date).ToString('dd/MMM/yyyy'), 41 | $MyInvocation.Mycommand, 42 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 43 | ) 44 | Write-Verbose -Message $txt 45 | 46 | ############################## 47 | # Module imports 48 | 49 | Import-MyModule -Name 'ServerManager' -SkipEditionCheck -Verbose:$false 50 | Import-MyModule -Name 'ActiveDirectory' -Verbose:$false 51 | 52 | ############################## 53 | # Variables Definition 54 | 55 | #Get a reference to the RootDSE of the current domain 56 | Write-Verbose -Message 'Get the Root DSE of the forest' 57 | $ADConfigurationNamingContext = ([ADSI]'LDAP://RootDSE').configurationNamingContext.ToString() 58 | 59 | # Get the Sites container 60 | $ADSiteDN = 'CN=Sites,{0}' -f $variables.configurationNamingContext 61 | 62 | Write-Verbose -Message "Set necessary site variables `r " 63 | $NewADSiteDN = 'CN={0},{1}' -f $PSBoundParameters['NewSiteName'], $ADSiteDN 64 | } #end Begin 65 | 66 | Process { 67 | If (Test-Path -Path AD:$NewADSiteDN) { 68 | Write-Warning -Message ('The site {0} already exist. Please review the name and try again' -f $PSBoundParameters['NewSiteName']) 69 | } else { 70 | Write-Verbose -Message 'Create New Site Object `r ' 71 | TRY { 72 | New-ADObject -Name $PSBoundParameters['NewSiteName'] -Path $ADSiteDN -Type Site 73 | } CATCH { 74 | Write-Error -Message ('An error occurred while attempting to create the new site {0} in the AD Site Path: {1} `r ' -f $PSBoundParameters['NewSiteName'], $ADSiteDN) 75 | ###Get-CurrentErrorToDisplay -CurrentError $error[0] 76 | throw 77 | } 78 | 79 | $SiteCreationCheck = Test-Path -Path AD:$NewADSiteDN 80 | 81 | IF ($SiteCreationCheck -eq $false) { 82 | Write-Warning -Message ('Failed to create the new site {0} `r ' -f $PSBoundParameters['NewSiteName']) 83 | } ELSE { 84 | ## OPEN ELSE Site Object created successfully 85 | Write-Verbose -Message 'Create New Site Object Child Objects (NTDS Site Settings & Servers Container) `r ' 86 | 87 | TRY { 88 | ## OPEN TRY Create New Site Object Child Objects (NTDS Site Settings & Servers Container) 89 | New-ADObject -Name 'NTDS Site Settings' -Path $NewADSiteDN -Type NTDSSiteSettings 90 | New-ADObject -Name 'Servers' -Path $NewADSiteDN -Type serversContainer 91 | 92 | Write-Verbose -Message 'Get New AD Site as variable `r ' 93 | $NewADSiteInfo = Get-ADObject $NewADSiteDN 94 | } ## CLOSE TRY Create New Site Object Child Objects (NTDS Site Settings & Servers Container) 95 | CATCH { 96 | Write-Warning -Message ('An error occurred while attempting to create site {0} child objects in the AD Site Path: {1} `r ' -f $PSBoundParameters['NewSiteName'], $NewADSiteDN) 97 | ###Get-CurrentErrorToDisplay -CurrentError $error[0] 98 | throw 99 | } 100 | }#end elseIf 101 | }#end elseIf 102 | } #end Process 103 | 104 | End { 105 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 106 | 'creating new AD Site.' 107 | ) 108 | Write-Verbose -Message $txt 109 | } #end End 110 | } #end Function 111 | -------------------------------------------------------------------------------- /Private/Get-RandomHex.ps1: -------------------------------------------------------------------------------- 1 | Function Get-RandomHex { 2 | <# 3 | .SYNOPSIS 4 | Generates a random hexadecimal string of specified length. 5 | 6 | .DESCRIPTION 7 | This function generates a cryptographically secure random hexadecimal string 8 | of the specified length using .NET methods for better performance. 9 | 10 | .PARAMETER Length 11 | The length of the hexadecimal string to generate. 12 | Must be a positive integer. 13 | Maximum value is 2147483647 (Int32.MaxValue). 14 | 15 | .INPUTS 16 | System.Int32 17 | You can pipe an integer representing the desired length to this function. 18 | 19 | .OUTPUTS 20 | System.String 21 | Returns a random hexadecimal string of specified length. 22 | 23 | .EXAMPLE 24 | Get-RandomHex -Length 8 25 | 26 | Generates an 8-character random hexadecimal string (e.g., "1A2B3C4D"). 27 | 28 | .EXAMPLE 29 | Get-RandomHex -Length 16 -Verbose 30 | 31 | Generates a 16-character random hexadecimal string with verbose output. 32 | 33 | .EXAMPLE 34 | 1..5 | ForEach-Object { Get-RandomHex -Length 4 } 35 | 36 | Generates five different 4-character random hexadecimal strings. 37 | 38 | .NOTES 39 | Used Functions: 40 | Name ║ Module/Namespace 41 | ═══════════════════════════════════════╬══════════════════════════════ 42 | Write-Verbose ║ Microsoft.PowerShell.Utility 43 | Write-Debug ║ Microsoft.PowerShell.Utility 44 | Write-Error ║ Microsoft.PowerShell.Utility 45 | Get-Random ║ Microsoft.PowerShell.Utility 46 | Get-FunctionDisplay ║ EguibarIT 47 | 48 | .NOTES 49 | Version: 2.1 50 | DateModified: 22/May/2025 51 | LastModifiedBy: Vicente Rodriguez Eguibar 52 | vicente@eguibar.com 53 | Eguibar IT 54 | http://www.eguibarit.com 55 | 56 | .LINK 57 | https://github.com/vreguibar/EguibarIT/blob/main/Private/Get-RandomHex.ps1 58 | 59 | .COMPONENT 60 | Security 61 | 62 | .ROLE 63 | Cryptography 64 | 65 | .FUNCTIONALITY 66 | Random Value Generation 67 | #> 68 | 69 | [CmdletBinding( 70 | SupportsShouldProcess = $false, 71 | ConfirmImpact = 'Low' 72 | )] 73 | [OutputType([string])] 74 | 75 | param ( 76 | [parameter(Mandatory = $true, 77 | Position = 0, 78 | ValueFromPipeline = $true, 79 | ValueFromPipelineByPropertyName = $true, 80 | HelpMessage = 'Specify the length of the hexadecimal string (1-2147483647).')] 81 | [ValidateRange(1, [int]::MaxValue)] 82 | [Alias('Size', 'Characters')] 83 | [int] 84 | $Length 85 | ) 86 | 87 | Begin { 88 | Set-StrictMode -Version Latest 89 | 90 | # Output header information 91 | if ($null -ne $Variables -and 92 | $null -ne $Variables.Header) { 93 | 94 | $txt = ($Variables.Header -f 95 | (Get-Date).ToString('dd/MMM/yyyy'), 96 | $MyInvocation.Mycommand, 97 | (Get-FunctionDisplay -HashTable $PsBoundParameters -Verbose:$False) 98 | ) 99 | Write-Verbose -Message $txt 100 | } #end if 101 | 102 | ############################## 103 | # Module imports 104 | 105 | ############################## 106 | # Variables Definition 107 | 108 | # Generating random hexadecimal string 109 | $Hex = '0123456789ABCDEF' 110 | [System.Text.StringBuilder]$StringBuilder = [System.Text.StringBuilder]::new($Length) 111 | 112 | } #end Begin 113 | 114 | Process { 115 | try { 116 | Write-Debug -Message ('Generating {0} character hex string' -f $Length) 117 | 118 | # Using StringBuilder for better performance with string concatenation 119 | for ($i = 1; $i -le $Length; $i++) { 120 | [void]$StringBuilder.Append($HexChars[(Get-Random -Minimum 0 -Maximum 16)]) 121 | } #end For 122 | 123 | $Result = $StringBuilder.ToString() 124 | Write-Verbose -Message ('Generated random hexadecimal string: {0}' -f $Result) 125 | 126 | } catch { 127 | 128 | Write-Error -Message ('Failed to generate hex string: {0}' -f $_.Exception.Message) 129 | throw 130 | } #end Try-Catch 131 | 132 | } #end Process 133 | 134 | End { 135 | if ($null -ne $Variables -and 136 | $null -ne $Variables.Footer) { 137 | $txt = ($Variables.Footer -f $MyInvocation.InvocationName, 138 | 'generating random hexadecimal string (Private Function).' 139 | ) 140 | Write-Verbose -Message $txt 141 | } #end if 142 | 143 | # Returning the generated string 144 | $Return 145 | } #end End 146 | 147 | } #end Function Get-RandomHex 148 | --------------------------------------------------------------------------------