├── LICENSE.MD ├── Modules ├── Check-HaveIBeenPwndStatus │ ├── Check-HaveIBeenPwndStatus.basic.tests.ps1 │ ├── Check-HaveIBeenPwndStatus.bespoke.tests.ps1 │ ├── Check-HaveIBeenPwndStatus.psd1 │ ├── Check-HaveIBeenPwndStatus.psm1 │ ├── Check-HaveIBeenPwndStatus.tests.ps1 │ ├── LICENSE │ └── README.md ├── Connect-EXOSession │ ├── Connect-EXOSession.basic.tests.ps1 │ ├── Connect-EXOSession.bespoke.tests.ps1 │ ├── Connect-EXOSession.psd1 │ ├── Connect-EXOSession.psm1 │ ├── Connect-EXOSession.tests.ps1 │ ├── LICENSE │ └── README.md ├── Eventbrite │ ├── Eventbrite.basic.tests.ps1 │ ├── Eventbrite.bespoke.tests.ps1 │ ├── Eventbrite.psd1 │ ├── Eventbrite.psm1 │ ├── Eventbrite.tests.ps1 │ ├── LICENSE │ └── README.md ├── Get-ExchangedCurrency │ ├── Get-ExchangedCurrency.basic.tests.ps1 │ ├── Get-ExchangedCurrency.bespoke.tests.ps1 │ ├── Get-ExchangedCurrency.psd1 │ ├── Get-ExchangedCurrency.psm1 │ ├── Get-ExchangedCurrency.tests.ps1 │ ├── LICENSE │ └── README.md ├── LICENSE ├── Modules.basic.tests.ps1 ├── Modules.bespoke.tests.ps1 ├── Modules.psd1 ├── New-GitHubEmailStuff │ ├── LICENSE │ ├── New-GitHubEmailStuff.basic.tests.ps1 │ ├── New-GitHubEmailStuff.bespoke.tests.ps1 │ ├── New-GitHubEmailStuff.psd1 │ ├── New-GitHubEmailStuff.psm1 │ ├── New-GitHubEmailStuff.tests.ps1 │ └── README.md └── README.md ├── README.md ├── Scripts ├── Check-TrainInternetConnectivity.ps1 ├── Get-ExchangedCurrency.ps1 ├── Install-OfficeDevPnPPowerShell.ps1 ├── Install-OfficeDevPnPPowerShellHelperModule.ps1 ├── Install-PowerShellPackageMangement.ps1 ├── Install-WMF5.ps1 ├── Install-Win10RSATTools.ps1 ├── LICENSE ├── README.md ├── Scripts.basic.tests.ps1 ├── Scripts.bespoke.tests.ps1 └── Scripts.psd1 └── StandardTests ├── LICENSE ├── PoshFunctionsStandard.tests.ps1 ├── README.md ├── StandardTests.basic.tests.ps1 ├── StandardTests.bespoke.tests.ps1 └── StandardTests.psd1 /LICENSE.MD: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ryan Yates 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. 22 | -------------------------------------------------------------------------------- /Modules/Check-HaveIBeenPwndStatus/Check-HaveIBeenPwndStatus.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /Modules/Check-HaveIBeenPwndStatus/Check-HaveIBeenPwndStatus.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Check-HaveIBeenPwndStatus/Check-HaveIBeenPwndStatus.bespoke.tests.ps1 -------------------------------------------------------------------------------- /Modules/Check-HaveIBeenPwndStatus/Check-HaveIBeenPwndStatus.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Check-HaveIBeenPwndStatus/Check-HaveIBeenPwndStatus.psd1 -------------------------------------------------------------------------------- /Modules/Check-HaveIBeenPwndStatus/Check-HaveIBeenPwndStatus.psm1: -------------------------------------------------------------------------------- 1 | Function Check-HaveIBeenPwndStatus { 2 | <# 3 | .Synopsis 4 | This Function will Check and see if your Email Account has recently been marked as being at risk of any breaches as detailed on https://haveibeenpwned.com/ 5 | .DESCRIPTION 6 | This uses Invoke-RestMethod to check if the account passed to it has been breached 7 | .EXAMPLE 8 | Check-HaveIBeenPwndStatus -Account me@abc.co.uk 9 | #> 10 | [CmdletBinding()] 11 | param 12 | ( 13 | [Parameter(Mandatory=$true, Position=1)] 14 | [string] $Account 15 | ) 16 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 17 | 18 | Try 19 | {$output = Invoke-RestMethod -Method get -Uri "https://haveibeenpwned.com/api/v2/breachedaccount/$account"} 20 | Catch 21 | {$error1 = $error} 22 | 23 | if ($error1 -eq $null) 24 | { Write-Warning "We have your account $account marked as having been pwnd on the following sites $($output.Title) - Please Check and change your passwords across other sites as soon as you can!"} 25 | else 26 | { Write-Output "Although $account has not been found in this database of PwndSites we advise that you change passwords regularly for any other accounts that may be linked to $account for your own protection"} 27 | } -------------------------------------------------------------------------------- /Modules/Check-HaveIBeenPwndStatus/Check-HaveIBeenPwndStatus.tests.ps1: -------------------------------------------------------------------------------- 1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | 3 | $module_name = Split-Path -Leaf $here 4 | 5 | Describe "Tests the module framework for $module_name" { 6 | It "Has a root module file ($module_name.psm1)" { 7 | 8 | "$here\$module_name.psm1" | Should Exist 9 | } 10 | 11 | It "Is valid PowerShell" { 12 | 13 | $contents = Get-Content -Path "$here\$module_name.psm1" -ErrorAction Stop 14 | $errors = $null 15 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 16 | $errors.Count | Should Be 0 17 | } 18 | 19 | It 'passes the PSScriptAnalyzer without Errors' { 20 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Error).Count | Should Be 0 21 | } 22 | 23 | It 'passes the PSScriptAnalyzer with less than 10 Warnings' { 24 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Warning).Count | Should BeLessThan 10 25 | } 26 | 27 | It "Has a manifest file ($module_name.psd1)" { 28 | 29 | "$here\$module_name.psd1" | Should Exist 30 | } 31 | 32 | It "Contains a root module path in the manifest" { 33 | 34 | "$here\$module_name.psd1" | Should Contain "$module_name.psm1" 35 | } 36 | 37 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 38 | 39 | "$here\$module_name.psd1" | Should Contain "Author = *" 40 | } 41 | } 42 | 43 | Describe "Tests the modules to be be correctly formatted" { 44 | 45 | $scripts = Get-ChildItem "$here\*.psm1" | Where-Object {$_.name -NotMatch "Tests.ps1"} 46 | 47 | foreach($script in $scripts) 48 | { 49 | Import-Module $script.FullName 50 | It "Is valid Powershell (Has no script errors)" { 51 | 52 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 53 | $errors = $null 54 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 55 | $errors.Count | Should Be 0 56 | } 57 | } 58 | } 59 | 60 | Describe "Tests the Functions to ensure that they are correctly formatted" { 61 | $functions = Get-Command -FullyQualifiedModule $module_name 62 | foreach($modulefunction in $functions) 63 | { 64 | 65 | Context "Function $($modulefunction.Name)" { 66 | It "Function $($modulefunction.Name) Has show-help comment block" { 67 | 68 | $modulefunction.Definition.Contains('<#') | should be 'True' 69 | $modulefunction.Definition.Contains('#>') | should be 'True' 70 | } 71 | 72 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 73 | 74 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 75 | 76 | 77 | } 78 | 79 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 80 | 81 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 82 | } 83 | 84 | It "Function $($modulefunction.Name) Is an advanced function" { 85 | 86 | $modulefunction.CmdletBinding | should be 'True' 87 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Modules/Check-HaveIBeenPwndStatus/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Check-HaveIBeenPwndStatus/LICENSE -------------------------------------------------------------------------------- /Modules/Check-HaveIBeenPwndStatus/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for Check-HaveIBeenPwndStatus -------------------------------------------------------------------------------- /Modules/Connect-EXOSession/Connect-EXOSession.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /Modules/Connect-EXOSession/Connect-EXOSession.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Connect-EXOSession/Connect-EXOSession.bespoke.tests.ps1 -------------------------------------------------------------------------------- /Modules/Connect-EXOSession/Connect-EXOSession.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Connect-EXOSession/Connect-EXOSession.psd1 -------------------------------------------------------------------------------- /Modules/Connect-EXOSession/Connect-EXOSession.psm1: -------------------------------------------------------------------------------- 1 | #Connect-EXOSession# 2 | Function Connect-EXOSession { 3 | <# 4 | .Synopsis 5 | Short description 6 | .DESCRIPTION 7 | Long description 8 | .EXAMPLE 9 | Example of how to use this cmdlet 10 | .EXAMPLE 11 | Another example of how to use this cmdlet 12 | #> 13 | param ( 14 | [Parameter(Mandatory=$true)][PSCredential]$EXOCredential 15 | 16 | ) 17 | $Global:Session = New-PSSession -ConfigurationName Microsoft.Exchange ` 18 | -ConnectionUri https://ps.outlook.com/powershell/ ` 19 | -Credential $EXOCredential -Authentication Basic ` 20 | -AllowRedirection -Name EXOSession -WarningAction SilentlyContinue 21 | Import-Module (Import-PSSession -Session $Global:Session -Verbose:$false -DisableNameChecking -AllowClobber) -Global -DisableNameChecking 22 | } 23 | -------------------------------------------------------------------------------- /Modules/Connect-EXOSession/Connect-EXOSession.tests.ps1: -------------------------------------------------------------------------------- 1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | 3 | $module_name = Split-Path -Leaf $here 4 | 5 | Describe "Tests the module framework for $module_name" { 6 | It "Has a root module file ($module_name.psm1)" { 7 | 8 | "$here\$module_name.psm1" | Should Exist 9 | } 10 | 11 | It "Is valid PowerShell" { 12 | 13 | $contents = Get-Content -Path "$here\$module_name.psm1" -ErrorAction Stop 14 | $errors = $null 15 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 16 | $errors.Count | Should Be 0 17 | } 18 | 19 | It 'passes the PSScriptAnalyzer without Errors' { 20 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Error).Count | Should Be 0 21 | } 22 | 23 | It 'passes the PSScriptAnalyzer with less than 10 Warnings' { 24 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Warning).Count | Should BeLessThan 10 25 | } 26 | 27 | It "Has a manifest file ($module_name.psd1)" { 28 | 29 | "$here\$module_name.psd1" | Should Exist 30 | } 31 | 32 | It "Contains a root module path in the manifest" { 33 | 34 | "$here\$module_name.psd1" | Should Contain "$module_name.psm1" 35 | } 36 | 37 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 38 | 39 | "$here\$module_name.psd1" | Should Contain "Author = *" 40 | } 41 | } 42 | 43 | Describe "Tests the modules to be be correctly formatted" { 44 | 45 | $scripts = Get-ChildItem "$here\*.psm1" | Where-Object {$_.name -NotMatch "Tests.ps1"} 46 | 47 | foreach($script in $scripts) 48 | { 49 | Import-Module $script.FullName 50 | It "Is valid Powershell (Has no script errors)" { 51 | 52 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 53 | $errors = $null 54 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 55 | $errors.Count | Should Be 0 56 | } 57 | } 58 | } 59 | 60 | Describe "Tests the Functions to ensure that they are correctly formatted" { 61 | $functions = Get-Command -FullyQualifiedModule $module_name 62 | foreach($modulefunction in $functions) 63 | { 64 | 65 | Context "Function $($modulefunction.Name)" { 66 | It "Function $($modulefunction.Name) Has show-help comment block" { 67 | 68 | $modulefunction.Definition.Contains('<#') | should be 'True' 69 | $modulefunction.Definition.Contains('#>') | should be 'True' 70 | } 71 | 72 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 73 | 74 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 75 | 76 | 77 | } 78 | 79 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 80 | 81 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 82 | } 83 | 84 | It "Function $($modulefunction.Name) Is an advanced function" { 85 | 86 | $modulefunction.CmdletBinding | should be 'True' 87 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Modules/Connect-EXOSession/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Connect-EXOSession/LICENSE -------------------------------------------------------------------------------- /Modules/Connect-EXOSession/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for Connect-EXOSession -------------------------------------------------------------------------------- /Modules/Eventbrite/Eventbrite.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /Modules/Eventbrite/Eventbrite.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Eventbrite/Eventbrite.bespoke.tests.ps1 -------------------------------------------------------------------------------- /Modules/Eventbrite/Eventbrite.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Eventbrite/Eventbrite.psd1 -------------------------------------------------------------------------------- /Modules/Eventbrite/Eventbrite.psm1: -------------------------------------------------------------------------------- 1 | function Set-EVGroupDistributionList { 2 | <# 3 | .Synopsis 4 | This Function will Set users in a Distribution Group in Exchange Online based on the Orders placed in Eventbrite 5 | .DESCRIPTION 6 | To be completed 7 | .EXAMPLE 8 | Set-EVGroupDistributionList -ExistingXML C:\xml\EVGroup.xml -EventbrightToken $env:EventBriteToken -DistributionList MyEventBriteList -EXOCredential $MyEXOCredential 9 | #> 10 | [cmdletbinding()] 11 | param ( 12 | [Parameter(Mandatory=$true)][string]$ExistingXML, 13 | [Parameter(Mandatory=$true)][string]$EventbriteToken, 14 | [Parameter(Mandatory=$true)][string]$distributionList, 15 | [Parameter(Mandatory=$true)][PSCredential]$EXOcredential 16 | ) 17 | 18 | Get-EventbriteEvents -EventbrightToken $EventbriteToken 19 | $iemail = Import-Clixml -Path $existingXML 20 | Connect-EXOSession -EXOCredential $EXOcredential # Custom Function for Connecting to EXO PSSession 21 | 22 | $emails = New-Object System.Collections.Arraylist 23 | foreach ($event in $events.events) 24 | { 25 | $eventid = $event.id 26 | 27 | $Attendees = Invoke-RestMethod -Uri https://www.eventbriteapi.com/v3/events/$eventID/attendees/?token=$EventbriteToken 28 | $Orders = Invoke-RestMethod -Uri https://www.eventbriteapi.com/v3/events/$eventID/orders/?token=$EventbriteToken 29 | 30 | 31 | $pscustom = [PSCustomObject]@{Attendees = $Attendees.attendees ; Orders = $Orders.orders} 32 | 33 | foreach ($attendee in $pscustom.Attendees) 34 | { 35 | if($attendee.status -eq 'Attending') 36 | { 37 | if ($attendee.answers.answer.Contains("Please include me in email updates")) 38 | { 39 | if ($pscustom.Orders.Id -contains $attendee.order_id) 40 | { 41 | $details = $pscustom.Orders | Where-Object {$_.Id -eq $attendee.order_id} | Select-Object name,first_name,last_name,email 42 | $emails.add($details) 43 | } 44 | 45 | } 46 | } 47 | } 48 | } 49 | foreach ($email in $emails) 50 | { 51 | If (!$iemail.Name.Contains($email.name)) 52 | { 53 | New-MailContact -LastName $email.Last_name ` 54 | -DisplayName $email.name ` 55 | -Name $email.name ` 56 | -ExternalEmailAddress $email.email ` 57 | -FirstName $email.first_name ; Add-DistributionGroupMember -Identity $distributionList -Member $email.email 58 | } 59 | } 60 | Export-Clixml -InputObject $emails -Path $ExistingXML 61 | Remove-PSSession -Name EXOSession 62 | } 63 | 64 | function Get-EventbriteEvents { 65 | <# 66 | .Synopsis 67 | This Function will Get all EventBrite Events 68 | .DESCRIPTION 69 | To be completed 70 | .EXAMPLE 71 | Get-EventbriteEvents -EventbrightToken $env:EventBriteToken 72 | #> 73 | [cmdletbinding()] 74 | param ( 75 | [Parameter(Mandatory=$true)][string]$EventbriteToken 76 | 77 | ) 78 | $Global:Events = Invoke-RestMethod https://www.eventbriteapi.com/v3/users/me/owned_events/?token=$EventbriteToken 79 | 80 | Foreach ($event in $events.events ) 81 | { 82 | $event.Name = $event.Name.Text 83 | $event.start = (([DateTime]($event.start.local)).ToUniversalTime()) 84 | $event.end = (([DateTime]($event.end.local)).ToUniversalTime()) 85 | Add-Member -Name Year -InputObject $event -MemberType NoteProperty -Value $event.start.Year 86 | } 87 | } 88 | 89 | function Get-EventAttendees { 90 | [cmdletbinding()] 91 | param ( 92 | [Parameter(Mandatory=$true)][string]$EventbriteToken, 93 | [Parameter(Mandatory=$true)][ValidateSet('Manchester','London','Bristol','Derby','Leeds','Birmingham','Cambridge')][String]$location, 94 | [Parameter(Mandatory=$true)][ValidateSet('January','February','March','April','May','June','July','August','September','October','November','December')][String]$month, 95 | [Parameter(Mandatory=$true)][ValidateSet('2016','2015','2017','2018','2019','2020')][String]$year 96 | ) 97 | 98 | Get-EventbriteEvents -EventbriteToken $EventbriteToken 99 | 100 | $event = $($events.events.Where({$_.Name.contains($location)}).where({$_.name.contains($month)}).where({$_.Year -eq $year})) 101 | $emails = New-Object System.Collections.Arraylist 102 | 103 | $eventid = $event.id 104 | 105 | $Attendees = Invoke-RestMethod -Uri https://www.eventbriteapi.com/v3/events/$eventID/attendees/?token=$EventbriteToken 106 | $Orders = Invoke-RestMethod -Uri https://www.eventbriteapi.com/v3/events/$eventID/orders/?token=$EventbriteToken 107 | 108 | 109 | $pscustom = [PSCustomObject]@{Attendees = $Attendees.attendees ; Orders = $Orders.orders} 110 | 111 | foreach ($attendee in $pscustom.Attendees) 112 | { 113 | if($attendee.status -eq 'Attending') 114 | { 115 | if ($pscustom.Orders.Id -contains $attendee.order_id) 116 | { 117 | $details = $pscustom.Orders | Where-Object {$_.Id -eq $attendee.order_id} | Select-Object name,first_name,last_name,email 118 | $emails.add($details) | Out-Null 119 | } 120 | } 121 | } 122 | $emails 123 | } 124 | 125 | function Get-EventbriteOrders { 126 | <# 127 | .Synopsis 128 | This Function will Get all EventBrite Orders 129 | .DESCRIPTION 130 | To be completed 131 | .EXAMPLE 132 | Get-EventbriteOrders -EventbrightToken $env:EventBriteToken 133 | #> 134 | [cmdletbinding()] 135 | param ( 136 | [Parameter(Mandatory=$true)][string]$EventbriteToken 137 | 138 | ) 139 | $global:orders = Invoke-RestMethod https://www.eventbriteapi.com/v3/users/me/orders/?token=$EventbriteToken 140 | $global:Myevents =@() 141 | 142 | foreach ($order in $orders.orders) { 143 | Get-EventbriteEvent -EventbriteToken $EventbriteToken -EventID $order.event_id 144 | } 145 | 146 | } 147 | 148 | 149 | function Get-EventbriteEvent { 150 | <# 151 | .Synopsis 152 | This Function will Get a specific EventBrite Event 153 | .DESCRIPTION 154 | To be completed 155 | .EXAMPLE 156 | Get-EventbriteEvent -EventbrightToken $env:EventBriteToken -EventID 1234376727438 157 | #> 158 | [cmdletbinding()] 159 | param ( 160 | [Parameter(Mandatory=$true)][string]$EventbriteToken, 161 | [Parameter(Mandatory=$true)][string]$EventID 162 | ) 163 | $Global:Event = Invoke-RestMethod https://www.eventbriteapi.com/v3/events/$eventid/?token=$EventbriteToken 164 | $event.Name = $event.Name.Text 165 | $event.start = (([DateTime]($event.start.local)).ToUniversalTime()) 166 | $event.end = (([DateTime]($event.end.local)).ToUniversalTime()) 167 | 168 | $global:myevents += $event 169 | } 170 | 171 | function Get-EventbriteEventQuestions { 172 | <# 173 | .Synopsis 174 | This Function will Get all Questions from a specificed EventBrite Event 175 | .DESCRIPTION 176 | To be completed 177 | .EXAMPLE 178 | Get-EventbriteEventQuestions -EventbrightToken $env:EventBriteToken -EventID 1232786423 179 | #> 180 | [cmdletbinding()] 181 | param ( 182 | [Parameter(Mandatory=$true)][string]$EventbriteToken, 183 | [Parameter(Mandatory=$true)][string]$EventID 184 | ) 185 | $Global:questions = (Invoke-RestMethod https://www.eventbriteapi.com/v3/events/$eventid/questions/?token=$EventbriteToken ).questions 186 | 187 | } 188 | 189 | function Get-EventAttendees { 190 | [cmdletbinding()] 191 | param ( 192 | [Parameter(Mandatory=$true)][string]$EventbriteToken, 193 | [Parameter(Mandatory=$true)][ValidateSet('Manchester','London','Bristol','Derby','Leeds','Birmingham','Cambridge')][String]$location, 194 | [Parameter(Mandatory=$true)][ValidateSet('January','February','March','April','May','June','July','August','September','October','November','December')][String]$month 195 | ) 196 | 197 | Get-EventbriteEvents -EventbriteToken $EventbriteToken 198 | 199 | $event = $($events.events.Where({$_.Name.contains($location)}).where({$_.name.contains($month)})) 200 | $emails = New-Object System.Collections.Arraylist 201 | 202 | $eventid = $event.id 203 | 204 | $Attendees = Invoke-RestMethod -Uri https://www.eventbriteapi.com/v3/events/$eventID/attendees/?token=$EventbriteToken 205 | $Orders = Invoke-RestMethod -Uri https://www.eventbriteapi.com/v3/events/$eventID/orders/?token=$EventbriteToken 206 | 207 | 208 | $pscustom = [PSCustomObject]@{Attendees = $Attendees.attendees ; Orders = $Orders.orders} 209 | 210 | foreach ($attendee in $pscustom.Attendees) 211 | { 212 | if($attendee.status -eq 'Attending') 213 | { 214 | if ($pscustom.Orders.Id -contains $attendee.order_id) 215 | { 216 | $details = $pscustom.Orders | Where-Object {$_.Id -eq $attendee.order_id} | Select-Object name,first_name,last_name,email 217 | $emails.add($details) | Out-Null 218 | } 219 | } 220 | } 221 | $emails 222 | } 223 | 224 | function Get-EventbriteVenue { 225 | <# 226 | .Synopsis 227 | This Function will Get all EventBrite Orders 228 | .DESCRIPTION 229 | To be completed 230 | .EXAMPLE 231 | Get-EventbriteOrders -EventbrightToken $env:EventBriteToken 232 | #> 233 | [cmdletbinding()] 234 | param ( 235 | [Parameter(Mandatory=$true)][string]$EventbriteToken, 236 | [Parameter(Mandatory=$true)][string]$VenueID 237 | 238 | ) 239 | $global:Venue = Invoke-RestMethod https://www.eventbriteapi.com/v3/venues/$VenueID/?token=$EventbriteToken 240 | } 241 | -------------------------------------------------------------------------------- /Modules/Eventbrite/Eventbrite.tests.ps1: -------------------------------------------------------------------------------- 1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | 3 | $module_name = Split-Path -Leaf $here 4 | 5 | Describe "Tests the module framework for $module_name" { 6 | It "Has a root module file ($module_name.psm1)" { 7 | 8 | "$here\$module_name.psm1" | Should Exist 9 | } 10 | 11 | It "Is valid PowerShell" { 12 | 13 | $contents = Get-Content -Path "$here\$module_name.psm1" -ErrorAction Stop 14 | $errors = $null 15 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 16 | $errors.Count | Should Be 0 17 | } 18 | 19 | It 'passes the PSScriptAnalyzer without Errors' { 20 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Error).Count | Should Be 0 21 | } 22 | 23 | It 'passes the PSScriptAnalyzer with less than 10 Warnings' { 24 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Warning).Count | Should BeLessThan 10 25 | } 26 | 27 | It "Has a manifest file ($module_name.psd1)" { 28 | 29 | "$here\$module_name.psd1" | Should Exist 30 | } 31 | 32 | It "Contains a root module path in the manifest" { 33 | 34 | "$here\$module_name.psd1" | Should Contain "$module_name.psm1" 35 | } 36 | 37 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 38 | 39 | "$here\$module_name.psd1" | Should Contain "Author = *" 40 | } 41 | } 42 | 43 | Describe "Tests the modules to be be correctly formatted" { 44 | 45 | $scripts = Get-ChildItem "$here\*.psm1" | Where-Object {$_.name -NotMatch "Tests.ps1"} 46 | 47 | foreach($script in $scripts) 48 | { 49 | Import-Module $script.FullName 50 | It "Is valid Powershell (Has no script errors)" { 51 | 52 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 53 | $errors = $null 54 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 55 | $errors.Count | Should Be 0 56 | } 57 | } 58 | } 59 | 60 | Describe "Tests the Functions to ensure that they are correctly formatted" { 61 | $functions = Get-Command -FullyQualifiedModule $module_name 62 | foreach($modulefunction in $functions) 63 | { 64 | 65 | Context "Function $($modulefunction.Name)" { 66 | It "Function $($modulefunction.Name) Has show-help comment block" { 67 | 68 | $modulefunction.Definition.Contains('<#') | should be 'True' 69 | $modulefunction.Definition.Contains('#>') | should be 'True' 70 | } 71 | 72 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 73 | 74 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 75 | 76 | 77 | } 78 | 79 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 80 | 81 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 82 | } 83 | 84 | It "Function $($modulefunction.Name) Is an advanced function" { 85 | 86 | $modulefunction.CmdletBinding | should be 'True' 87 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Modules/Eventbrite/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Eventbrite/LICENSE -------------------------------------------------------------------------------- /Modules/Eventbrite/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for Eventbrite -------------------------------------------------------------------------------- /Modules/Get-ExchangedCurrency/Get-ExchangedCurrency.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /Modules/Get-ExchangedCurrency/Get-ExchangedCurrency.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Get-ExchangedCurrency/Get-ExchangedCurrency.bespoke.tests.ps1 -------------------------------------------------------------------------------- /Modules/Get-ExchangedCurrency/Get-ExchangedCurrency.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Get-ExchangedCurrency/Get-ExchangedCurrency.psd1 -------------------------------------------------------------------------------- /Modules/Get-ExchangedCurrency/Get-ExchangedCurrency.psm1: -------------------------------------------------------------------------------- 1 | function Get-ExchangedCurrency{ 2 | <# 3 | .SYNOPSIS 4 | This function will get back a rough estimate on how much that item will cost you in GBP 5 | .DESCRIPTION 6 | This will check if the List Name already exists (as there cannot be 2 lists or libraries with the same name) 7 | and will create a new List/library based on the passed parameters 8 | .PARAMETER curCode 9 | curCode is used for the exchanging from currency 10 | .PARAMETER toGBP 11 | By default this is set to true as likely you are looking at items in USD or EUR (or SGD in my case) and you 12 | want to get the rough costing in £ 13 | .PARAMETER Amount 14 | Is it 1, 145, 450 etc 15 | .EXAMPLE 16 | Get-ExchangedCurrency -curCode USD -amount 7 17 | 18 | Returns the GBP amount for $7 19 | .EXAMPLE 20 | Get-ExchangedCurrency -curCode USD -amount 7 -toGBP $false 21 | 22 | Returns the $USD amount for £7 23 | #> 24 | [cmdletbinding()] 25 | param ( 26 | [Parameter(Mandatory=$true)] 27 | [ValidateSet('AUD','BGN','BRL','CAD','CHF','CNY','CZK','DKK','HKD','HRK','HUF','IDR','ILS','INR','JPY','KRW','MXN','MYR','NOK','NZD','PHP','PLN','RON','RUB','SEK','SGD','THB','TRY','USD','ZAR','EUR')] 28 | [string] $curCode, 29 | 30 | [Parameter(Mandatory=$false)] 31 | [Bool] $toGBP = $true, 32 | 33 | [Parameter(Mandatory=$true)] 34 | [int]$amount 35 | ) 36 | 37 | $rst = Invoke-RestMethod -Method Get -Uri http://api.fixer.io/latest?base=GBP 38 | 39 | if ($toGBP -eq $true) 40 | { 41 | $rtn = $amount / $rst.rates."$curcode" 42 | } 43 | else 44 | { 45 | $rtn =$amount * $rst.rates."$curcode" 46 | } 47 | 48 | [math]::round($rtn,2) 49 | } 50 | -------------------------------------------------------------------------------- /Modules/Get-ExchangedCurrency/Get-ExchangedCurrency.tests.ps1: -------------------------------------------------------------------------------- 1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | 3 | $module_name = Split-Path -Leaf $here 4 | 5 | Describe "Tests the module framework for $module_name" { 6 | It "Has a root module file ($module_name.psm1)" { 7 | 8 | "$here\$module_name.psm1" | Should Exist 9 | } 10 | 11 | It "Is valid PowerShell" { 12 | 13 | $contents = Get-Content -Path "$here\$module_name.psm1" -ErrorAction Stop 14 | $errors = $null 15 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 16 | $errors.Count | Should Be 0 17 | } 18 | 19 | It 'passes the PSScriptAnalyzer without Errors' { 20 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Error).Count | Should Be 0 21 | } 22 | 23 | It 'passes the PSScriptAnalyzer with less than 10 Warnings' { 24 | (Invoke-ScriptAnalyzer -Path $here -Recurse -Severity Warning).Count | Should BeLessThan 10 25 | } 26 | 27 | It "Has a manifest file ($module_name.psd1)" { 28 | 29 | "$here\$module_name.psd1" | Should Exist 30 | } 31 | 32 | It "Contains a root module path in the manifest" { 33 | 34 | "$here\$module_name.psd1" | Should Contain "$module_name.psm1" 35 | } 36 | 37 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 38 | 39 | "$here\$module_name.psd1" | Should Contain "Author = *" 40 | } 41 | } 42 | 43 | Describe "Tests the modules to be be correctly formatted" { 44 | 45 | $scripts = Get-ChildItem "$here\*.psm1" | Where-Object {$_.name -NotMatch "Tests.ps1"} 46 | 47 | foreach($script in $scripts) 48 | { 49 | Import-Module $script.FullName 50 | It "Is valid Powershell (Has no script errors)" { 51 | 52 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 53 | $errors = $null 54 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 55 | $errors.Count | Should Be 0 56 | } 57 | } 58 | } 59 | 60 | Describe "Tests the Functions to ensure that they are correctly formatted" { 61 | $functions = Get-Command -FullyQualifiedModule $module_name 62 | foreach($modulefunction in $functions) 63 | { 64 | 65 | Context "Function $($modulefunction.Name)" { 66 | It "Function $($modulefunction.Name) Has show-help comment block" { 67 | 68 | $modulefunction.Definition.Contains('<#') | should be 'True' 69 | $modulefunction.Definition.Contains('#>') | should be 'True' 70 | } 71 | 72 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 73 | 74 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 75 | 76 | 77 | } 78 | 79 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 80 | 81 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 82 | } 83 | 84 | It "Function $($modulefunction.Name) Is an advanced function" { 85 | 86 | $modulefunction.CmdletBinding | should be 'True' 87 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Modules/Get-ExchangedCurrency/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Get-ExchangedCurrency/LICENSE -------------------------------------------------------------------------------- /Modules/Get-ExchangedCurrency/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for Get-ExchangedCurrency -------------------------------------------------------------------------------- /Modules/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/LICENSE -------------------------------------------------------------------------------- /Modules/Modules.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /Modules/Modules.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Modules.bespoke.tests.ps1 -------------------------------------------------------------------------------- /Modules/Modules.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/Modules.psd1 -------------------------------------------------------------------------------- /Modules/New-GitHubEmailStuff/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/New-GitHubEmailStuff/LICENSE -------------------------------------------------------------------------------- /Modules/New-GitHubEmailStuff/New-GitHubEmailStuff.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /Modules/New-GitHubEmailStuff/New-GitHubEmailStuff.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/New-GitHubEmailStuff/New-GitHubEmailStuff.bespoke.tests.ps1 -------------------------------------------------------------------------------- /Modules/New-GitHubEmailStuff/New-GitHubEmailStuff.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Modules/New-GitHubEmailStuff/New-GitHubEmailStuff.psd1 -------------------------------------------------------------------------------- /Modules/New-GitHubEmailStuff/New-GitHubEmailStuff.psm1: -------------------------------------------------------------------------------- 1 | #Module#New-GitHubEmailStuff# 2 | function New-GithubEmailStuffs { 3 | <# 4 | .SYNOPSIS 5 | Creates New Folders and Rules in EXO Mailbox for the Github User & Exchange Mailbox User (Could be run by Exchange Admins in a company) 6 | .DESCRIPTION 7 | Really saves time with nonsense for GitHub Issues tracking using the Open GitHub API for watched Public Repositories. 8 | .EXAMPLE 9 | New-GithubEmailStuffs -githubUser 'kilasuit' -MailboxFolderParent 'ryan.yates:\Inbox\GitHub Stuff' -EXOCredential $MYO365cred 10 | 11 | This will connect to Github API for the GitHub User kilasuit and then will connect to Exchange Online using the Required Connect-EXOSession Module with the Credentials 12 | passed to the EXOCredential Parameter and then will use the MailboxFolderParent Parameter for checking/adding the new folders and rules. 13 | .NOTES 14 | TO-DO 15 | Parameter help 16 | Include private repo searching via OAuth tokens and additional Parameter 17 | Ideally Clean up the multiple replaces that are used to set up the Last Link variable. 18 | Quicken the execution of this function as it is quite slow at the moment. 19 | Adapt and release a version that doesnt require use of Exchange functionality and can be used with Outlook using the Outlook COM model. 20 | LICENSE 21 | MIT 22 | AUTHOR 23 | Ryan Yates - Ryan.yates@kilasuit.org 24 | REQUIRES Modules Connect-EXOSession,GithubConnect 25 | #> 26 | [CmdletBinding()] 27 | Param ( 28 | [Parameter(Mandatory=$true,Position=0)] 29 | [string]$MailboxFolderParent, 30 | [Parameter(Mandatory=$true,Position=0)] 31 | [PSCredential]$EXOCredential, 32 | [Parameter(Mandatory=$true,Position=0)] 33 | [string]$PersonalGithubOauthToken 34 | ) 35 | $repos =@() 36 | Connect-Github -PersonalOAuthToken $PersonalGithubOauthToken | Out-Null 37 | $web = Invoke-WebRequest -Uri "https://api.github.com/user/subscriptions" -Method Get -Headers @{"Authorization"="token $GithubPersonalOAuthToken"} 38 | $page1 = Invoke-RestMethod -Uri "https://api.github.com/user/subscriptions" -Method Get -Headers @{"Authorization"="token $GithubPersonalOAuthToken"} 39 | $page1 | ForEach-Object { $repos += $_.name } 40 | if ($web.Headers.Keys.Contains('Link')) 41 | { 42 | $LastLink = $web.Headers.Link.Split(',')[1].replace('<','').replace('>','').replace(' ','').replace('rel="last"','').replace(';','') 43 | [int]$last = $($lastlink[($lastlink.ToCharArray().count -1)]).tostring() 44 | $pages = 2..$last 45 | foreach ($page in $pages) 46 | { 47 | Invoke-RestMethod -Uri "https://api.github.com/user/subscriptions?page=$page" -Method Get -Headers @{"Authorization"="token $GithubPersonalOAuthToken"} | ForEach-Object { $repos += $_.name } 48 | } 49 | } 50 | $repos = $repos | Sort-Object -Unique 51 | Connect-EXOSession -EXOCredential $EXOCredential 52 | $folders = Get-MailboxFolder $MailboxFolderParent -GetChildren | Select-Object -ExpandProperty Name 53 | foreach ($repo in $repos) { 54 | if($folders -notcontains $repo) { 55 | New-MailboxFolder -Parent $MailboxFolderParent -Name $repo | Out-Null 56 | New-InboxRule -SubjectContainsWords "[$repo]" -MoveToFolder $MailboxFolderParent\$repo -Name "[$repo]" -Force | Out-Null 57 | Write-Output "Folder & rule for $repo have been created" 58 | } 59 | } 60 | Remove-PSSession -Name EXOSession 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Modules/New-GitHubEmailStuff/New-GitHubEmailStuff.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | ($modulefunction.CmdletBinding | should be 'True') -and ($modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True') 77 | } 78 | } 79 | } 80 | } 81 | } 82 | } 83 | 84 | if ($scripts.count -gt 0) { 85 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 86 | 87 | foreach($Script in $Scripts) 88 | { 89 | 90 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 91 | 92 | It "Is valid Powershell (Has no script errors)" { 93 | 94 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 95 | $errors = $null 96 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 97 | $errors.Count | Should Be 0 98 | } 99 | 100 | It 'passes the PSScriptAnalyzer without Errors' { 101 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 102 | } 103 | 104 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 105 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 106 | } 107 | 108 | It "Has show-help comment block" { 109 | 110 | $script.FullName | should contain '<#' 111 | $script.FullName | should contain '#>' 112 | } 113 | 114 | It "Has show-help comment block has a synopsis" { 115 | 116 | $script.FullName | should contain '\.SYNOPSIS' 117 | } 118 | 119 | It "Has show-help comment block has an example" { 120 | 121 | $script.FullName | should contain '\.EXAMPLE' 122 | } 123 | 124 | It "Is an advanced function" { 125 | 126 | $script.FullName | should contain 'function' 127 | $script.FullName | should contain 'cmdletbinding' 128 | $script.FullName | should contain 'param' 129 | } 130 | } 131 | 132 | } 133 | } 134 | } 135 | 136 | -------------------------------------------------------------------------------- /Modules/New-GitHubEmailStuff/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for New-GitHubEmailStuff -------------------------------------------------------------------------------- /Modules/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for Modules -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PoshFunctions 2 | A repo for PowerShell Functions and Scripts that I am Working on - plan to link to sub repos for the modules and functions and have this as a landing repo 3 | 4 | [![Stories in Ready](https://badge.waffle.io/kilasuit/PoshFunctions.png?label=ready&title=Ready)](http://waffle.io/kilasuit/PoshFunctions) 5 | 6 | 7 | [![Stories in progress](https://badge.waffle.io/kilasuit/PoshFunctions.png?label=In%20Progress&title=In%20Progress)](https://waffle.io/kilasuit/PoshFunctions) 8 | 9 | 10 | 11 | [![Stories in backlog](https://badge.waffle.io/kilasuit/PoshFunctions.png?label=BackLog&title=BackLog)](https://waffle.io/kilasuit/PoshFunctions) 12 | 13 | Throughput Graph 14 | 15 | [![Throughput Graph](https://graphs.waffle.io/kilasuit/PoshFunctions/throughput.svg)](https://waffle.io/kilasuit/PoshFunctions/metrics) 16 | -------------------------------------------------------------------------------- /Scripts/Check-TrainInternetConnectivity.ps1: -------------------------------------------------------------------------------- 1 | Function Get-ExternalIpOnTrain { 2 | <# 3 | .Synopsis 4 | This function is just for getting external IP address and Wi-fi Speed 5 | .EXAMPLE 6 | Get-ExternalIPOnTrain 7 | 8 | #> 9 | [cmdletbinding()] 10 | param() 11 | try{ 12 | $wc=New-Object net.webclient 13 | $ip = $wc.downloadstring("http://checkip.dyndns.com") -replace "[^\d\.]" 14 | } 15 | catch 16 | { 17 | $currenterror = $_.Exception.HResult 18 | } 19 | if ($currenterror -eq '-2146233087') 20 | { 21 | Add-Content -Value "Not Connected ; to the internet at $(Get-Date)" -Path C:\TextFile\VirginInternet.log 22 | } 23 | Else 24 | { 25 | $speed = "{0:N2} Mbit/sec" -f ((10/(Measure-Command {Invoke-WebRequest 'http://cachefly.cachefly.net/1mb.test' | Out-null}).TotalSeconds)*8) 26 | $data = ping 8.8.8.8 27 | Add-Content -Value "Connected ; to the internet with an external IP of $ip at $(Get-date) and a Download speed of $speed with Ping data of $($data[10].Trim())" -Path C:\TextFile\VirginInternet.log 28 | } 29 | 30 | } 31 | $end = (Get-Date).AddMinutes(150) 32 | do{ 33 | Get-ExternalIpOnTrain 34 | Start-Sleep -Seconds 60 35 | } 36 | until($(Get-Date) -gt $end) 37 | 38 | 39 | -------------------------------------------------------------------------------- /Scripts/Get-ExchangedCurrency.ps1: -------------------------------------------------------------------------------- 1 | function Get-ExchangedCurrency{ 2 | <# 3 | .Synopsis 4 | This function will get back a rough estimate on how much that item will cost you in GBP 5 | .DESCRIPTION 6 | This will check if the List Name already exists (as there cannot be 2 lists or libraries with the same name) 7 | and will create a new List/library based on the passed parameters 8 | .PARAMETER curCode 9 | curCode is used for the exchanging from currency 10 | .PARAMETER toGBP 11 | By default this is set to true as likely you are looking at items in USD or EUR (or SGD in my case) and you 12 | want to get the rough costing in £ 13 | .PARAMETER Amount 14 | Is it 1, 145, 450 etc 15 | .EXAMPLE 16 | Get-ExchangedCurrency -curCode USD -amount 7 17 | 18 | Returns the GBP amount for $7 19 | .EXAMPLE 20 | Get-ExchangedCurrency -curCode USD -amount 7 -toGBP $false 21 | 22 | Returns the $USD amount for £7 23 | #> 24 | [cmdletbinding()] 25 | param ( 26 | [Parameter(Mandatory=$true)] 27 | [ValidateSet("SGD","EUR", "USD")] 28 | [string] $curCode, 29 | 30 | [Parameter(Mandatory=$false)] 31 | [Bool] $toGBP = $true, 32 | 33 | [Parameter(Mandatory=$true)] 34 | [int]$amount 35 | ) 36 | 37 | $rst = Invoke-RestMethod -Method Get -Uri http://api.fixer.io/latest?base=GBP 38 | 39 | if ($toGBP -eq $true) 40 | { 41 | $rtn = $amount / $rst.rates."$curcode" 42 | } 43 | else 44 | { 45 | $rtn =$amount * $rst.rates."$curcode" 46 | } 47 | 48 | [math]::round($rtn,2) 49 | } 50 | -------------------------------------------------------------------------------- /Scripts/Install-OfficeDevPnPPowerShell.ps1: -------------------------------------------------------------------------------- 1 | function Install-OfficeDevPnPPowerShell { 2 | <# 3 | .Synopsis 4 | This Function will Check and see if PowerShellGet (aka PowerShellPackageManagement) is installed on your system and then will install the Office Dev PnP PowerShell Cmdlets 5 | from the PowerShell Gallery 6 | .DESCRIPTION 7 | This uses Invoke-Expression which should be used with care in any case and if you are not happy to proceed from here then please run the scripts referenced individually 8 | .EXAMPLE 9 | Install-OfficeDevPnPPowerShell 10 | #> 11 | 12 | #Requires -Version 3.0 13 | [Cmdletbinding()] 14 | param() 15 | 16 | Invoke-Expression (New-Object Net.WebClient).DownloadString('http://bit.ly/PSPackManInstall') # We use this to install the PowerShell Package Manager for the PowerShell Gallery 17 | Invoke-Expression (New-Object Net.WebClient).DownloadString('http://bit.ly/ODevPnPPowerShellHelper1') 18 | } 19 | Install-OfficeDevPnPPowerShell -------------------------------------------------------------------------------- /Scripts/Install-OfficeDevPnPPowerShellHelperModule.ps1: -------------------------------------------------------------------------------- 1 | Function Install-Office365DevPNPModules { 2 | <# 3 | .Synopsis 4 | This Function will Check and see if the Office365DevPNP PowerShellModules are installed on your system and if not will use PowerShell Package Management to install them 5 | .DESCRIPTION 6 | This uses System.Net.WebRequest & System.Net.WebClient to download the specific version of PowerShellPackageManager for your OS version (x64/x86) and then uses 7 | msiexec to install it. 8 | .EXAMPLE 9 | Install-Office365DevPNPPowerShellModule -ModuleToInstall v15 10 | #> 11 | #Requires -Version 3.0 12 | #Requires -Modules PowerShellGet 13 | [Cmdletbinding()] 14 | param ( 15 | [Parameter(Mandatory=$true,HelpMessage='v15 is for SharePoint On-Premises, v16 is for SharePoint Online')] 16 | [ValidateSet('v15','v16')] 17 | [string] $ModuleToInstall 18 | ) 19 | 20 | if (!(Get-command -Module OfficeDevPnP.PowerShell.$ModuleToInstall.Commands).count -gt 0) 21 | { 22 | Install-Module OfficeDevPnP.PowerShell.$ModuleToInstall.Commands -Force 23 | } 24 | switch ($ModuleToInstall) 25 | { 26 | 'v15' { $moduleVersion = 'SharePoint On-Premises'} 27 | 'v16' { $moduleVersion = 'SharePoint Online'} 28 | } 29 | Write-Output "The modules for $moduleVersion have been installed and can now be used" 30 | Write-Output 'On the next release you can just run Update-Module -force to update this and other installed modules' 31 | } 32 | 33 | function Request-SPOOrOnPremises 34 | { 35 | [string]$title="Confirm" 36 | [string]$message="Which version of the Modules do you want to install?" 37 | 38 | $SPO = New-Object System.Management.Automation.Host.ChoiceDescription "SPO", "SharePoint Online" 39 | $OnPrem = New-Object System.Management.Automation.Host.ChoiceDescription "OnPrem", "SharePoint On-Premises" 40 | $options = [System.Management.Automation.Host.ChoiceDescription[]]($SPO, $OnPrem) 41 | 42 | $result = $host.ui.PromptForChoice($title, $message, $options, 0) 43 | 44 | switch ($result) 45 | { 46 | 1 { Return 'v15' } 47 | 0 { Return 'v16' } 48 | } 49 | } 50 | 51 | 52 | if ((Get-command -Module PowerShellGet).count -gt 0) 53 | { 54 | Write-Output 'PowerShellPackageManagement now installed we will now run the next command in 10 Seconds' 55 | Start-Sleep -Seconds 10 56 | Install-Office365DevPNPModules -ModuleToInstall (Request-SPOOrOnPremises) 57 | } 58 | else 59 | { 60 | Write-Output "PowerShellPackageManagement is not installed on this Machine - Please run the below to install - you will need to Copy and Paste it as i'm not doing everything for you ;-)" 61 | Write-Output "Invoke-Expression (New-Object Net.WebClient).DownloadString('http://bit.ly/PSPackManInstall')" 62 | } -------------------------------------------------------------------------------- /Scripts/Install-PowerShellPackageMangement.ps1: -------------------------------------------------------------------------------- 1 | function Install-PowerShellPackageManagement { 2 | <# 3 | .Synopsis 4 | This Function will Check and see if PowerShellGet (aka PowerShellPackageManagement) is installed on your system 5 | .DESCRIPTION 6 | This uses System.Net.WebRequest & System.Net.WebClient to download the specific version of PowerShellPackageManager for your OS version (x64/x86) and then uses 7 | msiexec to install it. 8 | .EXAMPLE 9 | Install-PowerShellPackageManagement -Latest -Verbose 10 | #> 11 | 12 | #Requires -Version 3.0 13 | [Cmdletbinding()] 14 | param( 15 | [Switch]$Latest 16 | 17 | ) 18 | 19 | if (!(Get-command -Module PowerShellGet).count -gt 0) 20 | { 21 | if ($Latest) { 22 | $x86 = 'https://download.microsoft.com/download/C/4/1/C41378D4-7F41-4BBE-9D0D-0E4F98585C61/PackageManagement_x86.msi' 23 | $x64 = 'https://download.microsoft.com/download/C/4/1/C41378D4-7F41-4BBE-9D0D-0E4F98585C61/PackageManagement_x64.msi' 24 | Write-Verbose "Using the March 2016 Version of the MSI installer" 25 | } 26 | Else{ 27 | $x86 = 'https://download.microsoft.com/download/4/1/A/41A369FA-AA36-4EE9-845B-20BCC1691FC5/PackageManagement_x86.msi' 28 | $x64 = 'https://download.microsoft.com/download/4/1/A/41A369FA-AA36-4EE9-845B-20BCC1691FC5/PackageManagement_x64.msi' 29 | Write-Verbose "Using the Pre-March 2016 Version of the MSI installer" 30 | } 31 | switch ($env:PROCESSOR_ARCHITECTURE) 32 | { 33 | 'x86' {$version = $x86} 34 | 'AMD64' {$version = $x64} 35 | } 36 | Write-Verbose "You are on a $version based OS and we are starting the Download of the MSI for your OS Version" 37 | $Request = [System.Net.WebRequest]::Create($version) 38 | $Request.Timeout = "100000000" 39 | $URL = $Request.GetResponse() 40 | $Filename = $URL.ResponseUri.OriginalString.Split("/")[-1] 41 | $url.close() 42 | $WC = New-Object System.Net.WebClient 43 | $WC.DownloadFile($version,"$env:TEMP\$Filename") 44 | $WC.Dispose() 45 | Write-Verbose "MSI Downloaded - Now executing the MSI to add the PackageManagement functionality to your Machine" 46 | msiexec.exe /package "$env:TEMP\$Filename" 47 | 48 | Start-Sleep 80 49 | Write-Verbose "MSI installed now removing the temporary file from your machine" 50 | Remove-Item "$env:TEMP\$Filename" 51 | } 52 | } 53 | 54 | Install-PowerShellPackageManagement -Latest -Verbose -------------------------------------------------------------------------------- /Scripts/Install-WMF5.ps1: -------------------------------------------------------------------------------- 1 | function Install-WMF5 { 2 | <# 3 | .Synopsis 4 | This Function will Install WMF5 on your system 5 | .DESCRIPTION 6 | This uses System.Net.WebRequest & System.Net.WebClient to download the specific version of PowerShellPackageManager for your OS version (x64/x86) and then uses 7 | msiexec to install it. 8 | .EXAMPLE 9 | Install-WMF5 -Verbose 10 | #> 11 | [CmdletBinding()] 12 | param() 13 | $versionNumber = (Get-WmiObject -class Win32_OperatingSystem | Select-Object -ExpandProperty version) 14 | $versionarray = @() 15 | $versionNumber.Split('.') | ForEach-Object { $versionArray += [int]$_} 16 | $SimpleVersionNumber = "$($versionArray[0]).$($versionArray[1])" 17 | $caption = (Get-WmiObject -class Win32_OperatingSystem | Select-Object -ExpandProperty Caption) 18 | $architecture = Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty OSArchitecture 19 | Write-Verbose 'We have Identified your OS and are now determining the Correct package to Download' 20 | If ($SimpleVersionNumber -ge 7) { 21 | Write-Warning 'WMF 5 is not installable via this method as you are already running Windows10 or Server 2016'} 22 | else { 23 | switch ($SimpleVersionNumber) 24 | { 25 | 6.3 {$version = "Windows 2012R2/Win8.1"} 26 | 6.2 {$version = "Windows 2012/Win8"} 27 | 6.1 {$version = "Windows 2008R2/Win7"} 28 | } 29 | } 30 | if ($version -eq "Windows 2008R2/Win7") { 31 | if ($caption.contains('Windows 7')) { 32 | switch ($architecture) 33 | { 34 | '64-bit' {$version = "Windows 7 64Bit"} 35 | '32-bit' {$version = "Windows 7 32Bit"} 36 | } 37 | } else { $version = "Windows 2008R2"} 38 | } 39 | elseif($version -eq "Windows 2012R2/Win8.1") { 40 | if ($caption.contains('Windows 8.1')) { 41 | switch ($architecture) 42 | { 43 | '64-bit' {$version = "Windows 8.1 64Bit"} 44 | '32-bit' {$version = "Windows 8.1 32Bit"} 45 | } 46 | } 47 | else { $version = "Windows 2012R2"} 48 | } 49 | elseif($version -eq "Windows 2012/Win8") { 50 | if ($caption.contains('Windows 8')) { Write-Warning 'Windows 8 is not supported for WMF5 - Sorry about that!' } 51 | else { $version = "Windows 2012"} 52 | 53 | } 54 | 55 | switch ($Version) 56 | { 57 | "Windows 2012R2" {$link = "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu"} 58 | "Windows 2012" {$link = "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/W2K12-KB3134759-x64.msu"} 59 | #"Windows 2008R2" {$link = "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win7AndW2K8R2-KB3134760-x64.msu"} 60 | "Windows 8.1 64Bit" {$link = "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu"} 61 | "Windows 8.1 32Bit" {$link = "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1-KB3134758-x86.msu"} 62 | #"Windows 7 64Bit" {$link = "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win7AndW2K8R2-KB3134760-x64.msu"} 63 | #"Windows 7 32Bit" {$link = "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win7-KB3134760-x86.msu"} 64 | } 65 | 66 | Write-Verbose 'We are now downloading the correct version of WMF5 for your System' 67 | Write-Verbose "System has been Identified as $version" 68 | $Request = [System.Net.WebRequest]::Create($link) 69 | $Request.Timeout = "100000000" 70 | $URL = $Request.GetResponse() 71 | $Filename = $URL.ResponseUri.OriginalString.Split("/")[-1] 72 | $url.close() 73 | $WC = New-Object System.Net.WebClient 74 | $WC.DownloadFile($link,"$env:TEMP\$Filename") 75 | $WC.Dispose() 76 | Write-Verbose 'We are Installing WMF5 silently for you' 77 | Set-Location $env:Temp 78 | & .\$Filename /quiet 79 | 80 | Start-Sleep 80 81 | Remove-Item "$env:TEMP\$Filename" 82 | if(Test-path $env:TEMP\WMF4Installed.txt) {Remove-Item $env:Temp\installedWMF4.txt} 83 | Write-Verbose 'We need to Reboot after install of WMF4 - you can now proceed to install WMF5' 84 | Start-Sleep 5 85 | shutdown /r /t 1 86 | } 87 | 88 | 89 | Install-WMF5 -Verbose -------------------------------------------------------------------------------- /Scripts/Install-Win10RSATTools.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | 3 | .VERSION 1.1.0 4 | 5 | .GUID 0b6b6733-a339-401a-b804-d107534bca0e 6 | 7 | .AUTHOR Ryan Yates 8 | 9 | .COMPANYNAME Re-Digitise 10 | 11 | .COPYRIGHT Re-Digitise Limited 12 | 13 | .TAGS RSAT, Win10 14 | 15 | .LICENSEURI https://github.com/kilasuit/poshfunctions/License 16 | 17 | .PROJECTURI https://github.com/kilasuit/poshfunctions/ 18 | 19 | .ICONURI 20 | 21 | .EXTERNALMODULEDEPENDENCIES 22 | 23 | .REQUIREDSCRIPTS 24 | 25 | .EXTERNALSCRIPTDEPENDENCIES 26 | 27 | .RELEASENOTES Released to PowerShell Gallery and updated with the latest Win10 RSAT Update 28 | 29 | 30 | #> 31 | 32 | <# 33 | 34 | .DESCRIPTION 35 | Installs RSAT Tools for Windows 10 36 | 37 | #> 38 | #Requires -Version 5.0 -RunAsAdministrator 39 | [Cmdletbinding()] 40 | param() 41 | $VerbosePreference = 'Continue' 42 | $x86 = 'https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS2016-x86.msu' 43 | $x64 = 'https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS2016-x64.msu' 44 | switch ($env:PROCESSOR_ARCHITECTURE) 45 | { 46 | 'x86' {$version = $x86} 47 | 'AMD64' {$version = $x64} 48 | } 49 | Write-Verbose -Message "OS Version is $env:PROCESSOR_ARCHITECTURE" 50 | Write-Verbose -Message "Now Downloading RSAT Tools installer" 51 | $Filename = $version.Split('/')[-1] 52 | $OutputFile = "$env:TEMP\$Filename" 53 | $WebClient = New-Object System.Net.WebClient 54 | $WebClient.DownloadFile($version, $OutputFile) 55 | Write-Verbose -Message "Starting the Windows Update Service to install the RSAT Tools" 56 | Start-Process -FilePath wusa.exe -ArgumentList "$OutputFile /quiet" -Wait -Verbose 57 | Write-Verbose -Message "RSAT Tools are now be installed" 58 | Remove-Item $OutputFile -Verbose 59 | Write-Verbose -Message "Script Cleanup complete" -------------------------------------------------------------------------------- /Scripts/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Scripts/LICENSE -------------------------------------------------------------------------------- /Scripts/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for Scripts -------------------------------------------------------------------------------- /Scripts/Scripts.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /Scripts/Scripts.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Scripts/Scripts.bespoke.tests.ps1 -------------------------------------------------------------------------------- /Scripts/Scripts.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/Scripts/Scripts.psd1 -------------------------------------------------------------------------------- /StandardTests/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/StandardTests/LICENSE -------------------------------------------------------------------------------- /StandardTests/PoshFunctionsStandard.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$RootLocation\Scripts\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$RootLocation\Modules\" -Filter '*.psm1' -Recurse 7 | 8 | 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | It "Function $($modulefunction.Name) Has show-help comment block" { 56 | 57 | $modulefunction.Definition.Contains('<#') | should be 'True' 58 | $modulefunction.Definition.Contains('#>') | should be 'True' 59 | } 60 | 61 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 62 | 63 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 64 | 65 | 66 | } 67 | 68 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 69 | 70 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 71 | } 72 | 73 | It "Function $($modulefunction.Name) Is an advanced function" { 74 | 75 | $modulefunction.CmdletBinding | should be 'True' 76 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 77 | } 78 | 79 | } 80 | } 81 | } 82 | } 83 | 84 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 85 | 86 | foreach($Script in $Scripts) 87 | { 88 | 89 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 90 | 91 | It "Is valid Powershell (Has no script errors)" { 92 | 93 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 94 | $errors = $null 95 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 96 | $errors.Count | Should Be 0 97 | } 98 | 99 | It 'passes the PSScriptAnalyzer without Errors' { 100 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 101 | } 102 | 103 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 104 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 105 | } 106 | 107 | It "Has show-help comment block" { 108 | 109 | $script.FullName | should contain '<#' 110 | $script.FullName | should contain '#>' 111 | } 112 | 113 | It "Has show-help comment block has a synopsis" { 114 | 115 | $script.FullName | should contain '\.SYNOPSIS' 116 | } 117 | 118 | It "Has show-help comment block has an example" { 119 | 120 | $script.FullName | should contain '\.EXAMPLE' 121 | } 122 | 123 | It "Is an advanced function" { 124 | 125 | $script.FullName | should contain 'function' 126 | $script.FullName | should contain 'cmdletbinding' 127 | $script.FullName | should contain 'param' 128 | } 129 | } 130 | 131 | } 132 | } 133 | 134 | 135 | -------------------------------------------------------------------------------- /StandardTests/README.md: -------------------------------------------------------------------------------- 1 | This is a Readme file for StandardTests -------------------------------------------------------------------------------- /StandardTests/StandardTests.basic.tests.ps1: -------------------------------------------------------------------------------- 1 | $Here = Split-Path -Parent $MyInvocation.MyCommand.Path 2 | $RootLocation = Split-Path -Parent $here 3 | 4 | 5 | $Scripts = Get-ChildItem "$here\" -Filter '*.ps1' -Recurse | Where-Object {$_.name -NotMatch "Tests.ps1"} 6 | $Modules = Get-ChildItem "$here\" -Filter '*.psm1' -Recurse 7 | 8 | if ($Modules.count -gt 0) { 9 | Describe "Testing all Modules in this Repo to be be correctly formatted" { 10 | 11 | foreach($module in $modules) 12 | { 13 | 14 | Context "Testing Module - $($module.BaseName) for Standard Processing" { 15 | Import-Module $module.FullName 16 | It "Is valid Powershell (Has no script errors)" { 17 | 18 | $contents = Get-Content -Path $module.FullName -ErrorAction Stop 19 | $errors = $null 20 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 21 | $errors.Count | Should Be 0 22 | } 23 | It "Has a root module file ($module_name.psm1)" { 24 | 25 | $module.FullName.Replace('psm1','psd1') | Should Exist 26 | } 27 | 28 | It "Has a manifest file ($($module.BaseName).psd1)" { 29 | 30 | $module.FullName.Replace('psm1','psd1') | Should Exist 31 | } 32 | 33 | It "Contains a root module path in the manifest" { 34 | 35 | $module.FullName.Replace('psm1','psd1') | Should Contain "$module_name.psm1" 36 | } 37 | 38 | It "Contains all needed properties in the Manifest for PSGallery Uploads" { 39 | 40 | $module.FullName.Replace('psm1','psd1') | Should Contain "Author = *" 41 | } 42 | 43 | It 'passes the PSScriptAnalyzer without Errors' { 44 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Error).Count | Should Be 0 45 | } 46 | 47 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 48 | (Invoke-ScriptAnalyzer -Path $module.Directory -Recurse -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions,PSUseSingularNouns).Count | Should BeLessThan 10 49 | } 50 | } 51 | $functions = Get-Command -FullyQualifiedModule $module.BaseName 52 | foreach($modulefunction in $functions) 53 | { 54 | 55 | Context "Testing that the function - $($modulefunction.Name) - is compliant" { 56 | It "Function $($modulefunction.Name) Has show-help comment block" { 57 | 58 | $modulefunction.Definition.Contains('<#') | should be 'True' 59 | $modulefunction.Definition.Contains('#>') | should be 'True' 60 | } 61 | 62 | It "Function $($modulefunction.Name) Has show-help comment block has a.SYNOPSIS" { 63 | 64 | $modulefunction.Definition.Contains('.SYNOPSIS') -or $modulefunction.Definition.Contains('.Synopsis') | should be 'True' 65 | 66 | 67 | } 68 | 69 | It "Function $($modulefunction.Name) Has show-help comment block has an example" { 70 | 71 | $modulefunction.Definition.Contains('.EXAMPLE') | should be 'True' 72 | } 73 | 74 | It "Function $($modulefunction.Name) Is an advanced function" { 75 | 76 | $modulefunction.CmdletBinding | should be 'True' 77 | $modulefunction.Definition.Contains('param') -or $modulefunction.Definition.Contains('Param') | should be 'True' 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if ($scripts.count -gt 0) { 86 | Describe "Testing all Scripts in this Repo to be be correctly formatted" { 87 | 88 | foreach($Script in $Scripts) 89 | { 90 | 91 | Context "Testing Script - $($Script.BaseName) for Standard Processing" { 92 | 93 | It "Is valid Powershell (Has no script errors)" { 94 | 95 | $contents = Get-Content -Path $script.FullName -ErrorAction Stop 96 | $errors = $null 97 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 98 | $errors.Count | Should Be 0 99 | } 100 | 101 | It 'passes the PSScriptAnalyzer without Errors' { 102 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Error).Count | Should Be 0 103 | } 104 | 105 | It 'passes the PSScriptAnalyzer with less than 10 Warnings excluding PSUseShouldProcessForStateChangingFunctions Rule as it is currently Pants!' { 106 | (Invoke-ScriptAnalyzer -Path $script.FullName -Severity Warning -ExcludeRule PSUseShouldProcessForStateChangingFunctions).Count | Should BeLessThan 10 107 | } 108 | 109 | It "Has show-help comment block" { 110 | 111 | $script.FullName | should contain '<#' 112 | $script.FullName | should contain '#>' 113 | } 114 | 115 | It "Has show-help comment block has a synopsis" { 116 | 117 | $script.FullName | should contain '\.SYNOPSIS' 118 | } 119 | 120 | It "Has show-help comment block has an example" { 121 | 122 | $script.FullName | should contain '\.EXAMPLE' 123 | } 124 | 125 | It "Is an advanced function" { 126 | 127 | $script.FullName | should contain 'function' 128 | $script.FullName | should contain 'cmdletbinding' 129 | $script.FullName | should contain 'param' 130 | } 131 | } 132 | 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /StandardTests/StandardTests.bespoke.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/StandardTests/StandardTests.bespoke.tests.ps1 -------------------------------------------------------------------------------- /StandardTests/StandardTests.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kilasuit/PoshFunctions/8ded86500e771378c6a436f3099c31f989c3a128/StandardTests/StandardTests.psd1 --------------------------------------------------------------------------------