This file contains 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
$ModulePath = Split-Path -Parent $MyInvocation.MyCommand.Path | |
$ModuleName = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -Replace ".Tests.ps1" | |
$ManifestPath = "$ModulePath\$ModuleName.psd1" | |
# test the module manifest - exports the right functions, processes the right formats, and is generally correct | |
Describe "Manifest" { | |
$Manifest = $null | |
It "has a valid manifest" { | |
{ |
This file contains 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
#requires -Version 3 | |
function Test-KeyPress | |
{ | |
<# | |
.SYNOPSIS | |
Checks to see if a key or keys are currently pressed. | |
.DESCRIPTION | |
Checks to see if a key or keys are currently pressed. If all specified keys are pressed then will return true, but if | |
any of the specified keys are not pressed, false will be returned. |
This file contains 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
# save the license options in a variable | |
$Options = New-MsolLicenseOptions ` | |
-AccountSkuId whitehouse:ENTERPRISEPACK ` | |
-DisabledPlans SWAY, YAMMER_ENTERPRISE, SHAREPOINTWAC, MCOSTANDARD | |
# set the license using the saved options | |
Set-MsolUserLicense ` | |
-UserPrincipalName Ronald.Reagan@whitehouse.gov ` | |
-AddLicenses whitehouse:ENTERPRISEPACK ` | |
-LicenseOptions $Options |
This file contains 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
$User = Get-MsolUser -UserPrincipalName ronald.reagan@whitehouse.gov | |
$User.Licenses | | |
Select-Object -Property AccountSkuId, | |
@{ | |
n='ServicePlans' | |
e={ ($_.ServiceStatus | Where-Object ProvisioningStatus -eq 'success').ServicePlan.ServiceName } | |
} |
This file contains 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
$LicenseTemplate = @( | |
@{ | |
AccountSkuId = 'whitehouse:ENTERPRISEPACK' | |
EnabledPlans = 'EXCHANGE_S_STANDARD','SHAREPOINTENTERPRISE','SHAREPOINTWAC','MCOSTANDARD','YAMMER_ENTERPRISE' | |
}, | |
@{ | |
AccountSkuId = 'whitehouse:PROJECTONLINE' | |
EnabledPlans = 'SWAY' | |
} |
This file contains 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
It "gallery tags don't contain spaces" { | |
foreach ($Tag in $ManifestHash.PrivateData.Values.tags) | |
{ | |
$Tag | Should Not Match '\s' | |
} | |
} |
This file contains 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-PSCredential | |
{ | |
param | |
( | |
[PSCredential] | |
$Credential | |
) | |
$Credential | |
} |
This file contains 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
$ModulePath = Split-Path -Parent $MyInvocation.MyCommand.Path | |
$ModuleName = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -Replace ".Tests.ps1" | |
$ManifestPath = "$ModulePath\$ModuleName.psd1" | |
# test the module manifest - exports the right functions, processes the right formats, and is generally correct | |
Describe "Manifest" { | |
$Manifest = $null | |
It "has a valid manifest" { | |
{ |
This file contains 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 Get-O365UserLicenseReport | |
{ | |
<# | |
.SYNOPSIS | |
Generates a report of Office 365 license assignments | |
.DESCRIPTION | |
Generates a report of Office 365 license assignments by license sku, including individual service plan assignments. | |
This command requires that you have a global administrator account for an Office 365 tenant and can connect to Office 365 using | |
Windows PowerShell. Instructions for this can be found at http://powershell.office.com/. |
This file contains 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 New-CustomObject | |
{ | |
param | |
( | |
[Parameter(ValueFromPipeline)] | |
[Object] | |
$InputObject, | |
[Parameter()] | |
[hashtable] |