full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Get-RepositoryStatus.ps1
Get-RepositoryStatus.ps1
function Get-RepositoryStatus { <# .Synopsis Gets the working tree status. .Description Gets paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Build.ps1
Build.ps1
vs2017 $SolutionDir = Get-Location msbuild ObjectiveGit.pssproj /m /p:SolutionDir=$SolutionDir /p:Tags=Git%2cSvn /p:LicenseUri=https%3a%2f%2fgithub.com%2fSamuelEnglard%2fObjectiveGit%2fblob%2fmaster%2fLICENSE.txt /p:ProjectUri=https%3a%2f%2fgithub.com%2fSamuelEnglard%2fObjectiveGit /p:ReleaseNotes=Added%20Get-Branch%...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Restore-Changes.ps1
Restore-Changes.ps1
function Restore-Changes { <# .Synopsis Restore the changes to a working directory. .Description Remove a single stashed state from the stash list and apply it on top of the current working tree state. .Parameter Repository Path to the git repository. Can be relative or absolute. If not specifi...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/ObjectiveGit.tests.ps1
ObjectiveGit.tests.ps1
# # This is a PowerShell Unit Test file. # You need a unit test framework such as Pester to run PowerShell Unit tests. # You can download Pester from http://go.microsoft.com/fwlink/?LinkID=534084 # Describe "Get-Function" { Context "Function Exists" { It "Should Return" { } } }
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Import-SvnRepository.ps1
Import-SvnRepository.ps1
function Import-SvnRepository { <# .Synopsis This fetches revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it. .Description This works similarly to svn update or git pull except that it preserves linear history with git rebase instead of git me...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Get-Branch.ps1
Get-Branch.ps1
function Get-Branch { <# .Synopsis List branches. .Description Gets the local and remote branches for the repository. .Parameter Repository Path to the git repository. Can be relative or absolute. If not specified defaults to the current directory .Link https://git-scm.com/docs/git-bran...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Export-SvnRepository.ps1
Export-SvnRepository.ps1
function Export-SvnRepository { [CmdletBinding()] param( [Parameter(Mandatory=$False,Position=1,ValueFromPipeline=$True)] [string]$Repository = ".\" ) process { $Repository = Resolve-Path -Path $Repository Write-Verbose -Message "Committing SVN $Repository" $ErrorCount = $Error.Count $Outpu...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Update-SvnRepository.ps1
Update-SvnRepository.ps1
function Update-SvnRepository { <# .Synopsis This fetches revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it. .Description This works similarly to svn update or git pull except that it preserves linear history with git rebase instead of git me...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Backup-Changes.ps1
Backup-Changes.ps1
function Backup-Changes { <# .Synopsis Stash the changes in a dirty working directory away .Description Save your local modifications to a new stash and roll them back to HEAD (in the working tree and in the index) .Parameter Repository Path to the git repository. Can be relative or absolute. I...
PowerShellCorpus/PowerShellGallery/ObjectiveGit/1.7/Restore-Items.ps1
Restore-Items.ps1
function Restore-Items { <# .Synopsis Restore working tree files .Description Updates files in the working tree to match the version in the specified tree. .Parameter Files Working files to restore. .Parameter Repository Path to the git repository. Can be relative or absolute. If not sp...
PowerShellCorpus/PowerShellGallery/PFDockerCore/0.1.2/PFDockerCore-Infra.ps1
PFDockerCore-Infra.ps1
#TODO: Test for requisite tools, e.g. docker command function Update-DockerInfraNetworks { param( [Parameter(Position=0)] $Cfg = $(throw "The parameter -Cfg is required.") ) $dockerNetworksTxt=$(docker network ls) $dockerNetworks = Convert-TextColumnsToObject $dockerNetworksTxt $cfg...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-SeperateSQL-TP.ps1
SCOM-SeperateSQL-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-SeperateSQL.ps1
SCOM-SeperateSQL.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-SeperateSQLInstances-TP.ps1
SCOM-SeperateSQLInstances-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-MultiInstance-TP.ps1
SCOM-MultiInstance-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-SingleServer-TP.ps1
SCOM-SingleServer-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-MultiInstance.ps1
SCOM-MultiInstance.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-SeperateSQLInstances.ps1
SCOM-SeperateSQLInstances.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xSCOM/1.3.3.0/Examples/SCOM-SingleServer.ps1
SCOM-SingleServer.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/xWindowsEventForwarding/1.0.0.0/Resources/xDSCResourceDesigner_NewModuleScript.ps1
xDSCResourceDesigner_NewModuleScript.ps1
$Exists = test-path 'C:\Program Files\WindowsPowerShell\Modules\xWindowsEventForwarding\' if (!$Exists) { mkdir 'C:\Program Files\WindowsPowerShell\Modules\xWindowsEventForwarding\' New-ModuleManifest -Path 'C:\Program Files\WindowsPowerShell\Modules\xWindowsEventForwarding\xWindowsEventForwarding.psd1' -Gui...
PowerShellCorpus/PowerShellGallery/xWindowsEventForwarding/1.0.0.0/Resources/ExampleConfiguration.ps1
ExampleConfiguration.ps1
configuration SetupCollector { Import-DscResource -ModuleName xWindowsEventForwarding xWEFCollector Enabled { Ensure = "Present" Name = "Enabled" } xWEFSubscription TestSub { SubscriptionID = "TestSub" Ensure = "Present" SubscriptionType = 'C...
PowerShellCorpus/PowerShellGallery/EZLog/1.6.0/EZLog.Tests.ps1
EZLog.Tests.ps1
Import-Module -Force (Join-Path $PSScriptRoot EZLog.psd1) InModuleScope "EZLog" { Describe "EZLog Module" { Context "WriteEZLog with ',' separator" { $logfile = Join-Path $TestDrive pester.log It "Creates a log file with a header in it." { Write-EZLog -Header -Log...
PowerShellCorpus/PowerShellGallery/AzureRM.Compute/3.1.0/AzureRmProfileStartup.ps1
AzureRmProfileStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Compute/3.1.0/AzureRmNetworkStartup.ps1
AzureRmNetworkStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Compute/3.1.0/ResourceManagerStartup.ps1
ResourceManagerStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Compute/2.9.0/AzureRmProfileStartup.ps1
AzureRmProfileStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Compute/2.9.0/AzureRmNetworkStartup.ps1
AzureRmNetworkStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Compute/2.9.0/ResourceManagerStartup.ps1
ResourceManagerStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/private/Invoke-LodPxWebMethod.ps1
Invoke-LodPxWebMethod.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/private/ConvertFrom-UnixEpochTime.ps1
ConvertFrom-UnixEpochTime.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/public/Start-LodPxLabSession.ps1
Start-LodPxLabSession.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/public/New-LodPxLabReport.ps1
New-LodPxLabReport.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/public/Get-LodPxLabSessionDetail.ps1
Get-LodPxLabSessionDetail.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/public/Stop-LodPxLabSession.ps1
Stop-LodPxLabSession.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/public/Show-LodPxLabSession.ps1
Show-LodPxLabSession.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/LodPx/1.0.6.8/public/Set-LodPxConnectOption.ps1
Set-LodPxConnectOption.ps1
<############################################################################# TBD Copyright 2015-2017 Kirk Munro Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org...
PowerShellCorpus/PowerShellGallery/Ravello/1.1.3.1/Examples/Ravello-Framework.ps1
Ravello-Framework.ps1
# Framework to work with the Ravello module #region Start $workDomain = 'work.domain' $workProxy = 'http://proxy.work.domain:8080' $workCredentials = "$($env:USERPROFILE)\workRavelloCreds.csv" $homeCredentials = "$($env:USERPROFILE)\homeRavelloCreds.csv" # Work if($env:USERDOMAIN -match $workDomain){ $obj...
PowerShellCorpus/PowerShellGallery/Ravello/1.1.3.1/Examples/Check-Maintenance.ps1
Check-Maintenance.ps1
# Check if VMs with Public IP in affected regions $maintInfo = @" Cloud,Region Google Cloud,us-central1 Amazon,Oregon "@ Write-Output "`r==> Checking affected public IPs" foreach($app in Get-RavelloApplication){ foreach($cloud in ($maintInfo | ConvertFrom-Csv)){ if($cloud.Cloud -eq $app.deploymen...
PowerShellCorpus/PowerShellGallery/Ravello/1.1.3.1/Examples/Ravello-Import-vSphere-VM.ps1
Ravello-Import-vSphere-VM.ps1
#requires -Version 3 -module Ravello # Script will import a VM from a vSphere environment # into your Ravello Image library # param( [Parameter(Mandatory=$true)] [string]$VmName, [Parameter(Mandatory=$true)] [string]$VMHost, [Parameter(Mandatory=$true)] [string]$EsxUser, [Par...
PowerShellCorpus/PowerShellGallery/Ravello/1.1.3.1/Examples/Test-VNC-RDP.ps1
Test-VNC-RDP.ps1
#requires -Version 3 -module Ravello # Script will check the status of the VNC and RDP connection to a VM running # in a Ravello application # param( [Parameter(Mandatory=$true)] [string]$ApplicationName, [Parameter(Mandatory=$true)] [string[]]$VmNames, [DateTime]$Finish = (Get-Date).Add...
PowerShellCorpus/PowerShellGallery/Format-Pester/1.4.2/Public/Format-Pester.ps1
Format-Pester.ps1
Function Format-Pester { <# .SYNOPSIS Document Pester's tests results into the selected format (HTML, Word, Text). .DESCRIPTION Create documents in formats: HTML, Word, Text using PScribo PowerShell module. Documents are preformated to be human friendly. Local Word installation is not needed...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterContent.ps1
PlasterContent.ps1
$Content = @( @{ ContentType = 'newModuleManifest' Destination = '${PLASTER_PARAM_ModuleName}.psd1' moduleVersion = '${PLASTER_PARAM_ModuleVersion}' rootModule = '${PLASTER_PARAM_ModuleName}.psm1' copyright = '(c) ${PLASTER_Year} ${PLASTER_PARAM_ModuleAuthor}. All right...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterParams.ps1
PlasterParams.ps1
# Our plaster parameters $Parameters = @( @{ ParameterName = "ModuleName" ParameterType = "text" ParameterPrompt = "Enter the name of the module. No space, underscores, or special characters are allowed" }, @{ ParameterName = "ModuleDescription" ParameterType...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/make.ps1
make.ps1
<# Make the plaster template manifest file for this project. #> $ModuleBuildPath = '.\ModuleBuild\plasterManifest.xml' Write-Output 'Creating the plaster manifest file for this project...' # First ensure that our custom version of Plaster is loaded Remove-Module Plaster -ErrorAction:SilentlyContinue tr...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/Install.ps1
Install.ps1
# Run this in an administrative PowerShell prompt to install the <%=$PLASTER_PARAM_ModuleName%> PowerShell module: # # iex (New-Object Net.WebClient).DownloadString("<%=$PLASTER_PARAM_ModuleWebsite%>/raw/master/Install.ps1") # Some general variables $ModuleName = '<%=$PLASTER_PARAM_ModuleName%>' $DownloadURL = ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/Build.ps1
Build.ps1
#Requires -Version 5 [CmdletBinding(DefaultParameterSetName = 'Build')] param ( [parameter(Position = 0, ParameterSetName = 'Build')] [switch]$BuildModule, [parameter(Position = 1, ParameterSetName = 'Build')] [switch]$UpdateRelease, [parameter(Position = 2, ParameterSetName = 'Build')] ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/modulename.build.ps1
modulename.build.ps1
param ( [parameter(Position = 0)] [string]$BuildFile = (Join-Path $BuildRoot 'build\<%=$PLASTER_PARAM_ModuleName%>.buildenvironment.ps1'), [parameter(Position = 1)] [version]$NewVersion = $null, [parameter(Position = 2)] [string]$ReleaseNotes, [parameter(Position = 3)] [switch]$F...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/private/Get-CallerPreference.ps1
Get-CallerPreference.ps1
function Get-CallerPreference { <# .Synopsis Fetches "Preference" variable values from the caller's scope. .DESCRIPTION Script module functions do not automatically inherit their caller's variables, but they can be obtained through the $PSCmdlet variable in Advanced Functions. Th...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/FunctionCBH.Tests.ps1
FunctionCBH.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the module's public functions all have proper comment based help required for building documentation via PlatyPS. Example: PS> Invoke-Pester -Script @{Path = '.\src\tests\FuncitonCBH.Tests.ps1'; Parameters = @{ ModuleName = MyModule}} #> [Cmdl...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/ModuleManifest.Tests.ps1
ModuleManifest.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the PowerShell module manifest file has valid content that will be required to upload to the PowerShell Gallary. .EXAMPLE PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = 'C:\Users\z...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/SensitiveTermScan.Tests.ps1
SensitiveTermScan.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the files in the specified path do not contain sensitive information. Example: Invoke-Pester -Script @{Path = '.\src\tests\SensitiveTermScan.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Terms = @('mydo...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/ScriptAnalyzer.Tests.ps1
ScriptAnalyzer.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the files in the specified path do not contain sensitive information. Example: Invoke-Pester -Script @{Path = '.\src\tests\ScriptAnalyzer.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD' }} #> [CmdletBi...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/meta/FileContent.Tests.ps1
FileContent.Tests.ps1
<# This meta tests verify, if the PowerShell module core project file have a valid content. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName Remove-Module -Name $ModuleName -...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/meta/FileEncoding.Tests.ps1
FileEncoding.Tests.ps1
<# Check if the encoding of all text files in the PowerShell module is valid, this means no Unicode or UTF-8 with BOM files. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/meta/FileFormatting.Tests.ps1
FileFormatting.Tests.ps1
<# Verify that the file content if formatted property. It will verify the following criterias: Use spaces instead of tabs for indentation, no trailing spaces for lines and should end with a new line. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/meta/ScriptAnalyzer.Tests.ps1
ScriptAnalyzer.Tests.ps1
# Requires -Modules Pester <# Check all scripts files in the sources folder against all script analyzer rules. It should comply with all rules. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandP...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/meta/ProjectStructure.Tests.ps1
ProjectStructure.Tests.ps1
<# This meta tests verify, if the PowerShell module project structure is adhered to the best practices. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName Remove-Module -Name $...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/tests/meta/Autoload.Tests.ps1
Autoload.Tests.ps1
<# Use this tests to verify, if the latest meta tests are available in this repository, compared to the claudiospizzi/PowerShellModuleBase repository. #> Describe 'Meta Autoload' { $baseApi = 'https://api.github.com/repos/claudiospizzi/PowerShellModuleBase/contents/Tests/Meta' $files = Invoke-RestMe...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/other/PreLoad.ps1
PreLoad.ps1
<# Put all code that must be run prior to function dot sourcing here. This is a good place for module variables as well. The only rule is that no variable should rely upon any of the functions in your module as they will not have been loaded yet. Also, this file cannot be completely empty. Even leaving th...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/src/other/PostLoad.ps1
PostLoad.ps1
# Use this variable for any path-sepecific actions (like loading dlls and such) to ensure it will work in testing and after being built $MyModulePath = $( Function Get-ScriptPath { $Invocation = (Get-Variable MyInvocation -Scope 1).Value if($Invocation.PSScriptRoot) { $Invocation....
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/FunctionCBH.Tests.ps1
FunctionCBH.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the module's public functions all have proper comment based help required for building documentation via PlatyPS. Example: PS> Invoke-Pester -Script @{Path = '.\src\tests\FuncitonCBH.Tests.ps1'; Parameters = @{ ModuleName = MyModule}} #> [Cmdl...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/ModuleManifest.Tests.ps1
ModuleManifest.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the PowerShell module manifest file has valid content that will be required to upload to the PowerShell Gallary. .EXAMPLE PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = 'C:\Users\z...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/SensitiveTermScan.Tests.ps1
SensitiveTermScan.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the files in the specified path do not contain sensitive information. Example: Invoke-Pester -Script @{Path = '.\src\tests\SensitiveTermScan.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Terms = @('mydo...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/ScriptAnalyzer.Tests.ps1
ScriptAnalyzer.Tests.ps1
#Requires -Modules Pester <# This pester test verifies the files in the specified path do not contain sensitive information. Example: Invoke-Pester -Script @{Path = '.\src\tests\ScriptAnalyzer.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD' }} #> [CmdletBi...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/meta/FileContent.Tests.ps1
FileContent.Tests.ps1
<# This meta tests verify, if the PowerShell module core project file have a valid content. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName Remove-Module -Name $ModuleName -...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/meta/FileEncoding.Tests.ps1
FileEncoding.Tests.ps1
<# Check if the encoding of all text files in the PowerShell module is valid, this means no Unicode or UTF-8 with BOM files. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/meta/FileFormatting.Tests.ps1
FileFormatting.Tests.ps1
<# Verify that the file content if formatted property. It will verify the following criterias: Use spaces instead of tabs for indentation, no trailing spaces for lines and should end with a new line. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/meta/ScriptAnalyzer.Tests.ps1
ScriptAnalyzer.Tests.ps1
# Requires -Modules Pester <# Check all scripts files in the sources folder against all script analyzer rules. It should comply with all rules. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandP...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/meta/ProjectStructure.Tests.ps1
ProjectStructure.Tests.ps1
<# This meta tests verify, if the PowerShell module project structure is adhered to the best practices. #> $ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path $ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName Remove-Module -Name $...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/tests/meta/Autoload.Tests.ps1
Autoload.Tests.ps1
<# Use this tests to verify, if the latest meta tests are available in this repository, compared to the claudiospizzi/PowerShellModuleBase repository. #> Describe 'Meta Autoload' { $baseApi = 'https://api.github.com/repos/claudiospizzi/PowerShellModuleBase/contents/Tests/Meta' $files = Invoke-RestMe...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/modulename.buildenvironment.ps1
modulename.buildenvironment.ps1
param ( [Parameter(HelpMessage = 'If you are initializing this file or want to force overwrite the persistent export data use this flag.')] [switch]$ForcePersist ) <# Update $Script:BuildEnv to suit your PowerShell module build. These variables get dot sourced into the build at every run and are exporte...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/tools/New-DynamicParameter.ps1
New-DynamicParameter.ps1
function New-DynamicParameter { <# .SYNOPSIS Helper function to simplify creating dynamic parameters .DESCRIPTION Helper function to simplify creating dynamic parameters. Example use cases: Include parameters only if your environment dictates it Include parameters dep...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/tools/Get-BuildEnvironment.ps1
Get-BuildEnvironment.ps1
function Get-BuildEnvironment { <# .SYNOPSIS Retrieves all the stored settings in a buildenvironment.json file. .DESCRIPTION Retrieves all the stored settings in a buildenvironment.json file. .PARAMETER Path Specifies the path to a buildenvironment.json file. .LINK htt...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/tools/Set-BuildEnvironment.ps1
Set-BuildEnvironment.ps1
. .\Get-BuildEnvironment.ps1 . .\New-DynamicParameter.ps1 function Set-BuildEnvironment { <# .SYNOPSIS Sets a stored setting in a buildenvironment.json file. .DESCRIPTION Sets the stored setting in a buildenvironment.json file. .PARAMETER Path Specifies the path to a build...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Out-ZipFromFile.ps1
Out-ZipFromFile.ps1
function Script:Out-ZipFromFile { [cmdletbinding()] param ( [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] [string[]]$Files, [Parameter(Position=1, Mandatory=$true)] [string]$ZipFile, [Parameter(Position=2)] [switch]$overwrite ) ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/New-PSGalleryProjectProfile.ps1
New-PSGalleryProjectProfile.ps1
#Requires -version 5 function Script:New-PSGalleryProjectProfile { <# .SYNOPSIS Create a powershell Gallery module upload profile .DESCRIPTION Create a powershell Gallery module upload profile. Some items (like Name) are inferred from the module manifest and are left ou...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Out-Zip.ps1
Out-Zip.ps1
function Script:Out-Zip { param ( [Parameter(Position=0, Mandatory=$true)] [string] $Directory, [Parameter(Position=1, Mandatory=$true)] [string] $FileName, [Parameter(Position=2)] [switch] $overwrite ) Add-Type -Assembly System.IO.Compression.FileSys...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/New-DynamicParameter.ps1
New-DynamicParameter.ps1
function Script:New-DynamicParameter { <# .SYNOPSIS Helper function to simplify creating dynamic parameters .DESCRIPTION Helper function to simplify creating dynamic parameters. Example use cases: Include parameters only if your environment dictates it Include paramet...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Get-BuildEnvironment.ps1
Get-BuildEnvironment.ps1
function Script:Get-BuildEnvironment { <# .SYNOPSIS Retrieves all the stored settings in a buildenvironment.json file. .DESCRIPTION Retrieves all the stored settings in a buildenvironment.json file. .PARAMETER Path Specifies the path to a buildenvironment.json file. .LINK ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Upload-ProjectToPSGallery.ps1
Upload-ProjectToPSGallery.ps1
#Requires -version 5 function Script:Upload-ProjectToPSGallery { <# .SYNOPSIS Upload module project to Powershell Gallery .DESCRIPTION Upload module project to Powershell Gallery .PARAMETER Name Path to module to upload. .PARAMETER Reposit...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Get-ErrorDetail.ps1
Get-ErrorDetail.ps1
function Get-ErrorDetail { param ( [Parameter(Mandatory,ValueFromPipeline)] $e ) process { if ($e -is [Management.Automation.ErrorRecord]) { [PSCustomObject]@{ Reason = $e.CategoryInfo.Reason Exception = $e.Exception.Message Target = $e.Categor...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/New-CommentBasedHelp.ps1
New-CommentBasedHelp.ps1
function Script:New-CommentBasedHelp { <# .SYNOPSIS Create comment based help for a function. .DESCRIPTION Create comment based help for a function. .PARAMETER Code Multi-line or piped lines of code to process. .PARAMETER ScriptParameters Process the script p...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Set-BuildEnvironment.ps1
Set-BuildEnvironment.ps1
function Script:Set-BuildEnvironment { <# .SYNOPSIS Sets a stored setting in a buildenvironment.json file. .DESCRIPTION Sets the stored setting in a buildenvironment.json file. .PARAMETER Path Specifies the path to a buildenvironment.json file. .LINK https://github.c...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Prompt-ForBuildBreak.ps1
Prompt-ForBuildBreak.ps1
Function Script:Prompt-ForBuildBreak { param ( [Parameter(Position=0)] [System.Object]$LastError, [Parameter(Position=1)] $CustomError = $null ) $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "End the build." $no = New-Object System....
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Convert-ArrayToString.ps1
Convert-ArrayToString.ps1
function Script:Convert-ArrayToString { [cmdletbinding()] Param ( [Parameter(Mandatory=$true,Position=0)] [AllowEmptyCollection()] [Array]$Array, [Parameter(Mandatory=$False)] [switch]$Flatten ) Begin{ If ($Flatten) { $...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Convert-HashToString.ps1
Convert-HashToString.ps1
function Script:Convert-HashToString { [cmdletbinding()] Param ( [Parameter(Mandatory=$true,Position=0)] [Hashtable]$Hashtable, [Parameter(Mandatory=$False)] [switch]$Flatten ) Begin{ If($Flatten -or $Hashtable.Keys.Count -eq 0) ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Replace-FileString.ps1
Replace-FileString.ps1
function Script:Replace-FileString { <# .SYNOPSIS Replaces strings in files using a regular expression. .DESCRIPTION Replaces strings in files using a regular expression. Supports multi-line searching and replacing. .PARAMETER Pattern Specifies the regular expression pattern....
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/ModuleBuild/scaffold/build/dotSource/Remove-Signature.ps1
Remove-Signature.ps1
#requires -Version 2 function Script:Remove-Signature { <# .SYNOPSIS Finds all signed ps1 and psm1 files recursively from the current or defined path and removes any digital signatures attached to them. .DESCRIPTION Finds all signed ps1 and psm1 files recursively from the current or defined...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/GetModuleExtension.ps1
GetModuleExtension.ps1
function Get-ModuleExtension { [CmdletBinding()] param( [string] $ModuleName, [Version] $ModuleVersion ) $modules = Get-Module -ListAvailable Write-Verbose "`nFound $($modules.Length) installed modules to scan for extensions." function ParseVersion...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/InvokePlaster.ps1
InvokePlaster.ps1
## DEVELOPERS NOTES & CONVENTIONS ## ## 1. All text displayed to the user except for Write-Debug (or $PSCmdlet.WriteDebug()) text must be added to the ## string tables in: ## en-US\Plaster.psd1 ## Plaster.psm1 ## 2. If a new manifest element is added, it must be added to the Schema\PlasterMa...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/NewPlasterManifest.ps1
NewPlasterManifest.ps1
function New-PlasterManifest { [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter()] [ValidateNotNullOrEmpty()] [string] $Path = "$pwd\plasterManifest.xml", [Parameter(Mandatory=$true)] [ValidatePattern('^[0-9a-zA-Z_-]+$')] [string] ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/TestPlasterManifest.ps1
TestPlasterManifest.ps1
function Test-PlasterManifest { [CmdletBinding()] [OutputType([System.Xml.XmlDocument])] param( [Parameter(Position=0, ParameterSetName="Path", ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, HelpMess...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/WritePlasterManifestContent.ps1
WritePlasterManifestContent.ps1
<# .SYNOPSIS A simple helper function to create a plaster message xml block .DESCRIPTION A simple helper function to create a plaster message xml block .PARAMETER Message The message to display .PARAMETER Condition The condition to match to display the message .PARAMETER NoNewLine The message will not include...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/GetPlasterTemplate.ps1
GetPlasterTemplate.ps1
. $PSScriptRoot\GetModuleExtension.ps1 function Get-PlasterTemplate { [CmdletBinding()] param( [Parameter(Position=0, ParameterSetName="Path", HelpMessage="Specifies a path to a folder containing a Plaster template or multiple template folders. Can also be ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/WritePlasterParameter.ps1
WritePlasterParameter.ps1
<# .SYNOPSIS A simple helper function to create a parameter xml block for plaster .DESCRIPTION A simple helper function to create a parameter xml block for plaster. This function is best used with an array of hashtables for rapid creation of a Plaster parameter block. .PARAMETER Name The plaster element name ...
PowerShellCorpus/PowerShellGallery/ModuleBuild/0.0.2/plaster/PlasterModule/Templates/NewPowerShellScriptModule/test/Module.T.ps1
Module.T.ps1
$ModuleManifestName = '<%=$PLASTER_PARAM_ModuleName%>.psd1' $ModuleManifestPath = "$PSScriptRoot\..\$ModuleManifestName" Describe 'Module Manifest Tests' { It 'Passes Test-ModuleManifest' { Test-ModuleManifest -Path $ModuleManifestPath | Should Not BeNullOrEmpty $? | Should Be $true } }...
PowerShellCorpus/PowerShellGallery/O365ServiceCommunications/1.4/O365ServiceCommunicationsSample.ps1
O365ServiceCommunicationsSample.ps1
<# .DESCRIPTION This sample script demonstrates using the O365ServiceCommunications module to alert on incidents posted in the Office 365 Message Center. It gathers information from the Service Communications API and builds custom HTML tables which are then added to an email message body. This script ...
PowerShellCorpus/PowerShellGallery/O365ServiceCommunications/1.4/helpers/New-CustomObject.ps1
New-CustomObject.ps1
function New-CustomObject { param ( [Parameter(ValueFromPipeline)] [Object] $InputObject, [Parameter()] [hashtable] $ExtraProperties, [Parameter()] [System.String[]] $ExcludedProperties, [Parameter()] [System.String] $TypeName ) PROCESS { $Properties = @{} foreach ($Property in $Inp...
PowerShellCorpus/PowerShellGallery/O365ServiceCommunications/1.4/helpers/Config.ps1
Config.ps1
$ServiceUrl = 'https://api.admin.microsoftonline.com/shdtenantcommunications.svc' $SessionTypeName = 'O365ServiceCommunications.Session' $EventTypeName = 'O365ServiceCommunications.Event' $TenantEventTypeName = 'O365ServiceCommunications.TenantEvent' $TenantServiceInfoTypeName = 'O365ServiceCommunications.TenantServ...
PowerShellCorpus/PowerShellGallery/O365ServiceCommunications/1.4/functions/Get-SCTenantEvent.ps1
Get-SCTenantEvent.ps1
function Get-SCTenantEvent { [CmdletBinding()] param ( [Parameter(Mandatory)] [PSTypeName('O365ServiceCommunications.Session')] $SCSession, [Parameter(Mandatory=$false)] [ValidateSet('Incident','Maintenance','Message')] [string[]] $EventTypes = 'Incident', ...