- User Specifies On Premises Distribution Lists to be nested
- Validate that the identifier(s) are correct and the objects exist
- Get the Distribution List Object(s)
- Exchange On Premises Distribution List Object
- Exchange Online Distribution List Object
- Store Distribution List objects/attributes for later use/reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Test-TCPConnection | |
| { | |
| <# | |
| .SYNOPSIS | |
| Tests a TCP Connection to each port specified for each ComputerName specified. | |
| .DESCRIPTION | |
| Tests a TCP Connection to each port specified for each ComputerName specified and, | |
| if specified, can return details for each requested ComputerName and port. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Register-ArgumentCompleter -CommandName @( | |
| 'Set-OneShellUserProfileSystem' | |
| 'Get-OneShellUserProfileSystem' | |
| ) -ParameterName 'Identity' -ScriptBlock { | |
| param($commandName, $parameterName, $WordToComplete, $commandAst, $fakeBoundParameter) | |
| $OrgProfilePath = if ($null -eq $fakeBoundParameter.OrgProfilePath) {$script:OneShellOrgProfilePath} else {$fakeBoundParameter.OrgProfilePath} | |
| $Path = if ($null -eq $fakeBoundParameter.Path) {$Script:OneShellUserProfilePath} else {$fakeBoundParameter.Path} | |
| $GetOneShellUserProfileSystemParams = @{ | |
| Path = $Path | |
| OrgProfilePath = $OrgProfilePath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Get the available Skus and Usage from the tenant | |
| Get-MsolAccountSku | Select-Object SkuPartNumber,ActiveUnits,ConsumedUnits,@{n='AvailableUnits';e={$_.ActiveUnits-$_.ConsumedUnits}} -OutVariable AllSkus | |
| #Specify which skus you want to specifically report on | |
| $SkusToReportOn = @('STANDARDPACK','ENTERPRISEPACK','ENTERPRISEPREMIUM') | |
| #Report on Users/Sku Usage | |
| $AllLicensedUsers = Get-MsolUser -all | ? IsLicensed -eq $true | Select DisplayName,UserPrincipalName,IsLicensed,@{n='Skus';e={@($_.Licenses.AccountSkuID)}} | |
| #Below expands licensed users so that for each Sku in SkusToReportOn there would be an entry for the user if the user has more than one of them assigned | |
| $ExpandedSkuUsers = @( | |
| foreach ($lu in $AllLicensedUsers) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #https://en.wikipedia.org/wiki/Collatz_conjecture | |
| function Test-CollatzConjecture | |
| { | |
| [cmdletbinding()] | |
| param | |
| ( | |
| [parameter(ParameterSetName = 'SpecifiedNumber')] | |
| [int32]$BeginningNumber | |
| , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Connect-RDP { | |
| param ( | |
| [Parameter(Mandatory=$true)] | |
| [string[]]$ComputerName, | |
| [System.Management.Automation.Credential()] | |
| $Credential | |
| ) | |
| #https://www.powershellmagazine.com/2014/04/18/automatic-remote-desktop-connection/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Import the required module | |
| $Module = Get-Module -ListAvailable -Name 'Microsoft.Online.SharePoint.PowerShell' -ErrorAction Stop | |
| if ($Null -eq $Module) {throw ("PowerShell Module Microsoft.Online.SharePoint.PowerShell was not found")} | |
| else { | |
| Import-Module -Name 'Microsoft.Online.SharePoint.PowerShell' -Force -Global -ErrorAction Stop -DisableNameChecking | |
| } | |
| #Get the administratiave credential | |
| #$AdminCredential = Get-Credential -Message "Please provide the SharePoint Online Admin Credential" -ErrorAction Stop | |
| #if ($null -eq $AdminCredential -or $AdminCredential.GetType().name -ne 'PSCredential') {throw ("SharePoint Online Admin Credential Required")} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Out-FileUtf8NoBom | |
| { | |
| #requires -version 3 | |
| <# | |
| .SYNOPSIS | |
| Outputs to a UTF-8-encoded file *without a BOM* (byte-order mark). | |
| .DESCRIPTION | |
| Mimics the most important aspects of Out-File: | |
| * Input objects are sent to Out-String first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") | |
| Describe "$CommandName Unit Tests" -Tag 'UnitTests' { | |
| Context "Validate parameters" { | |
| $defaultParamCount = 11 | |
| [object[]]$params = (Get-ChildItem "function:\$CommandName").Parameters.Keys | |
| $knownParameters = 'Start','Interval','Units','Limit','SkipStart' | |
| $paramCount = $knownParameters.Count | |
| It "Should contain specific parameters" { | |
| ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount |
OlderNewer