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
$here = Split-Path -Parent $MyInvocation.MyCommand.Path | |
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace('.Tests.', '.') | |
. "$here\$sut" | |
Remove-EventLog -LogName Pester -ErrorAction SilentlyContinue | |
Describe 'Test-EventLogExists' { | |
Set-StrictMode -Version latest | |
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 Set-O365UserLicense | |
{ | |
<# | |
.SYNOPSIS | |
Sets licenses for Office 365 users. | |
.PARAMETER MsolUser | |
Specifies an Azure Active Directory user to set license entitlements for. Should be an object of type [Microsoft.Online.Administration.User] which is returned by the Get-MsolUser cmdlet found in the Azure Active Directory (MSOnline) module. | |
.PARAMETER LicenseTemplate |
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 Add-TaskbarItem | |
{ | |
<# | |
.SYNOPSIS | |
Adds or removes items from a user's taskbar | |
.DESCRIPTION | |
Adds or removes items from a user's taskbar. Supports pinning of multiple items using the pipeline. | |
.PARAMETER Action |
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
$list = @" | |
1 Partridge in a pear tree | |
2 Turtle Doves | |
3 French Hens | |
4 Calling Birds | |
5 Golden Rings | |
6 Geese a laying | |
7 Swans a swimming | |
8 Maids a milking | |
9 Ladies dancing |
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
Describe "Example" { | |
It "Performs short-circuit evaluation" { | |
Test-Path c:\NoDirHere | Should be $true | |
Get-ChildItem c:\NoDirHere -File | Should Not Be $null | |
} | |
} |
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-SvcHost | |
{ | |
<# | |
.SYNOPSIS | |
Returns information about the processes running under each instance of the service host process. | |
.DESCRIPTION | |
Returns information about the processes running under each instance of the service host process of local or remote computers. | |
Uses WMI as the source of this information. | |
.PARAMETER ComputerName | |
Specifies a remote computer to gather information about. Can be a fully-qualified domain name, NetBIOS name, or and IP address. |
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-IPAddress | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[ValidateSet('IPv4','IPv6','All')] | |
[string] | |
$AddressType = 'All', | |
[Parameter(ValueFromPipelineByPropertyName,ValueFromPipeline)] |
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
# A one-liner to return the desired output | |
Invoke-RestMethod -Uri 'telize.com/geoip' | Select-Object longitude, latitude, continent_code, timezone | |
# Wrapped with a function - simple but works | |
Function Get-GeoInformation | |
{ | |
[CmdletBinding()] | |
Param | |
( | |
[System.Net.IPAddress] |
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
gwmi CIM_operatingsystem|Select PSC*,*j*,v*,@{n='BIOSSerial';e={$_.SerialNumber}} |
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
# Add an enum with All constant | |
Add-Type -TypeDefinition @' | |
using System; | |
[Flags] | |
public enum O365Services | |
{ | |
AzureActiveDirectory, | |
Exchange, | |
Sharepoint, |