full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/Twilio/0.9/Get-TwilioCall.ps1
Get-TwilioCall.ps1
function Get-PhoneCall { <# .Synopsis Gets information about phone calls .Description Gets information about phone calls sent to or from any Twilio Number .Example Get-PhoneCall #> param( [Parameter(ValueFromPipelineByPropertyName=$true)] [Alias('Si...
PowerShellCorpus/PowerShellGallery/Twilio/0.9/Get-TwilioAccount.ps1
Get-TwilioAccount.ps1
function Get-TwilioAccount { param( [Parameter(ValueFromPipelineByPropertyName=$true)] [Management.Automation.PSCredential] $Credential, [Parameter(ValueFromPipelineByPropertyName=$true)] [string[]] $Setting = @("TwilioAccountKey", "TwilioAccountSecret") ) ...
PowerShellCorpus/PowerShellGallery/Twilio/0.9/Get-TwilioRecording.ps1
Get-TwilioRecording.ps1
function Get-TwilioRecording { <# .Synopsis Gets Twilio call recordings .Description Get recordings from Twilio calls .Example Get-TwilioRecording .Link Twilio.com .Link Get-PhoneCall #> param( # The credential used to get...
PowerShellCorpus/PowerShellGallery/ISHRemote/0.4/Scripts/Private/New-IshAuxCompletionResult.ps1
New-IshAuxCompletionResult.ps1
# # Hat tip to # * https://github.com/thinkbeforecoding/PSCompletion # * http://www.powershellmagazine.com/2012/11/29/using-custom-argument-completers-in-powershell-3-0/ # function New-IshAuxCompletionResult { <# .SYNOPSIS Creates a new System.Management.Automation.CompletionResult object t...
PowerShellCorpus/PowerShellGallery/ISHRemote/0.4/Scripts/Private/Get-IshAuxParameterCompleter.ps1
Get-IshAuxParameterCompleter.ps1
# # Hat tip to # * https://github.com/thinkbeforecoding/PSCompletion # * http://www.powershellmagazine.com/2012/11/29/using-custom-argument-completers-in-powershell-3-0/ # function Get-IshAuxParameterCompleter { <# .SYNOPSIS Gets registered parameter completion scripts. .DESCRIPTION...
PowerShellCorpus/PowerShellGallery/ISHRemote/0.4/Scripts/Private/Register-IshAuxParameterCompleter.ps1
Register-IshAuxParameterCompleter.ps1
# # Hat tip to # * https://github.com/thinkbeforecoding/PSCompletion # * http://www.powershellmagazine.com/2012/11/29/using-custom-argument-completers-in-powershell-3-0/ # function Register-IshAuxParameterCompleter { <# .SYNOPSIS Registers a custom argument completer. .DESCRIPTION ...
PowerShellCorpus/PowerShellGallery/ISHRemote/0.4/Scripts/Public/Expand-ISHParameter.ps1
Expand-ISHParameter.ps1
# # Hat tip to # * https://github.com/thinkbeforecoding/PSCompletion # * http://www.powershellmagazine.com/2012/11/29/using-custom-argument-completers-in-powershell-3-0/ # * http://www.powertheshell.com/dynamicargumentcompletion/ # # Relies on # Get-IshAuxParameterCompleter.ps1 # New-IshAuxCompletionResult....
PowerShellCorpus/PowerShellGallery/cdpath/2.0.1/init.ps1
init.ps1
if (Test-Path alias:cd) { Remove-Item alias:cd } # SIG # Begin signature block # MIINLAYJKoZIhvcNAQcCoIINHTCCDRkCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUYYwn38SB60490aEg3EGYG+Gl # T8egggpuMIIFMDCCBBigAwIBAgIQB...
PowerShellCorpus/PowerShellGallery/powerlogger/1.8.5/Build/Build.ps1
Build.ps1
param( $Task = 'Default' ) Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null # Install PS Depend if(-not (Get-Module -ListAvailable PSDepend)) { & (Resolve-Path "$PSScriptRoot\helpers\Install-PSDepend.ps1") } Import-Module PSDepend $null = Invoke-PSDepend -Path "$PSScriptRoot\build.requirements.psd1...
PowerShellCorpus/PowerShellGallery/powerlogger/1.8.5/Build/psake.ps1
psake.ps1
# PSake makes variables declared here available in other scriptblocks # Init some things Properties { # Find the build folder based on build system $ProjectRoot = $ENV:BHProjectPath if(-not $ProjectRoot) { $ProjectRoot = Resolve-Path "$PSScriptRoot\.." } $Timestamp =...
PowerShellCorpus/PowerShellGallery/powerlogger/1.8.5/Build/deploy.psdeploy.ps1
deploy.psdeploy.ps1
# Generic module deployment. # # ASSUMPTIONS: # # * folder structure either like: # # - RepoFolder # - This PSDeploy file # - ModuleName # - ModuleName.psd1 # # OR the less preferable: # - RepoFolder # - RepoFolder.psd1 # # * Nuget key in $ENV:NugetApiKey # # * Set-BuildEnvironment from BuildHel...
PowerShellCorpus/PowerShellGallery/powerlogger/1.8.5/Build/helpers/Install-PSDepend.ps1
Install-PSDepend.ps1
<# .SYNOPSIS Bootstrap PSDepend .DESCRIPTION Bootstrap PSDepend Why? No reliance on PowerShellGallery * Downloads nuget to your ~\ home directory * Creates $Path (and full path to it) * Downloads module to $Path\PSDepend * Moves nuget.exe to...
PowerShellCorpus/PowerShellGallery/EditModule/2.1.7/ModuleMembers.ps1
ModuleMembers.ps1
function Get-ModuleMembers { <# .SYNOPSIS Finds all functions and aliases defined within a function. Intended to make it easier for defining / updating Export-ModuleMember paramters .DESCRIPTION Uses Get-Module and Select-String to find the functions and aliases defined within the various s...
PowerShellCorpus/PowerShellGallery/NetDebug/1.6/Notes.ps1
Notes.ps1
Import-Module C:\OneDrive\HobbyTimeCode\NetDebug\Checkpoint-NetIPsecMainModeSA.psm1 Checkpoint-NetIPsecMainModeSA [System.Net.IPAddress]'2001:0:9d38:90d7:3838:7ec8:2fca:966a' $x = "2001:0:9d38:90d7:3838:7ec8:2fca:966a" [System.Net.IPAddress]::Parse($x)
PowerShellCorpus/PowerShellGallery/nPSDesiredStateConfiguration/1.1/Generator/Generator.ps1
Generator.ps1
# Set this to the path where you want the module to # be generated. This has been set to a temporary # location to prevent overriding the existing code # during the demo #$Script:PathToModule = 'D:\Nana\Official\git' $Script:PathToModule = "$($env:TEMP)\Modules" $Properties = @{} $Properties += @{ 'Name'...
PowerShellCorpus/PowerShellGallery/nPSDesiredStateConfiguration/1.1/Tests/nService.Tests.ps1
nService.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace('.Tests.', '.') . "$here\$sut" $script:TestService = 'w3svc' if ((Get-CimInstance win32_operatingsystem).ProductType -eq 1) { $script:TestService = 'HomeGroupListener' } Describe -Name 'n...
PowerShellCorpus/PowerShellGallery/nPSDesiredStateConfiguration/1.1/Tests/nService.ps1
nService.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path Import-Module "$here\..\DscResources\Nana_nService\Nana_nService.psm1" -Force
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Examples/pssession.examples.ps1
pssession.examples.ps1
<# .SYNOPSIS Demo script for opening admin PSSessions to AWS EC2 instances .NOTES Please set parameters explicitly, otherwise the demo will default to the first random EC2 instance based on your AWSPowershell module defaults. #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSA...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Examples/rdp.examples.ps1
rdp.examples.ps1
<# .SYNOPSIS Demo script for opening RDP sessions to AWS EC2 instances .NOTES Please set parameters explicitly, otherwise the demo will default to the first random EC2 instance based on your AWSPowershell module defaults. #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoid...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/Expand-Object.ps1
Expand-Object.ps1
<# .SYNOPSIS Enriches the inputobject, by expanding properties to the top level. .DESCRIPTION Expands the InputObject with the -ExpandProperty and merges its content to the top level. .PARAMETER InputObject Mandatory - InputObject to be expanded .PARAMETER Force Optional - Switch to to override...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/Common.ps1
Common.ps1
# Common Aliases New-Alias -Name ssm -Value Invoke-SSMCommand -Force New-Alias -Name rdp -Value Enter-RdpSession -Force New-Alias -Name ec2rdp -Value Enter-EC2RdpSession -Force New-Alias -Name ec2sn -Value Enter-EC2PSSession -Force $script:DefaultEc2PemFile=$null $Script:DefaultSSMOutputS3BucketName=$null $Script:De...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/Enter-RdpSession.ps1
Enter-RdpSession.ps1
<# .SYNOPSIS Opens an RDP Session to a target machine .DESCRIPTION Opens mstsc.exe with the passed -ComputerName parameter. If -Credential is set, it will use cmdkey.exe to save the credential for passthrough. .PARAMETER ComputerName Mandatory - ComputerName, IpAddress or fqdn of the target machin...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/Get-EC2Credential.ps1
Get-EC2Credential.ps1
<# .SYNOPSIS Returns Administrator credentials for an EC2 Instance .DESCRIPTION The cmdlet accepts pipeline input of EC2 instances and requires a private-key file to decrypt and logon with the administrator credentials. .PARAMETER InstanceObject Accepts an EC2 Reservation pipeline input from Get-Ec2Ins...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/Get-EC2InstanceAddress.ps1
Get-EC2InstanceAddress.ps1
<# .SYNOPSIS Returns all or a prefered address from an EC2 Instance .DESCRIPTION The cmdlet accepts pipeline input of EC2 instances. If -AddressProperty is defined, it returns only that, otherwise it returns all. The valid addresses are: - PrivateIpAddress - PublicIpAddress - PrivateDnsN...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/New-EC2PSSession.ps1
New-EC2PSSession.ps1
<# .SYNOPSIS Opens a PSSession to an Ec2 instance with Administrator credentials .DESCRIPTION The cmdlet accepts pipeline input of EC2 instances and requires a private-key file to decrypt and logon with the administrator credentials. .PARAMETER InstanceId Mandatory - EC2 Instance Id for the target mach...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/Enter-EC2PSSession.ps1
Enter-EC2PSSession.ps1
<# .SYNOPSIS Opens a PSSession to an Ec2 instance with Administrator credentials .DESCRIPTION The cmdlet accepts pipeline input of EC2 instances and requires a private-key file to decrypt and logon with the administrator credentials. .PARAMETER InstanceId Mandatory - EC2 Instance Id for the target mach...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/Enter-EC2RdpSession.ps1
Enter-EC2RdpSession.ps1
<# .SYNOPSIS Opens an RDP session to an Ec2 instance with Administrator credentials .DESCRIPTION The cmdlet accepts pipeline input of EC2 instances and requires a private-key file to decrypt and logon with the administrator credentials. Th cmdlet uses cmdkey.exe in the background to enable credential p...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/SSM/Set-DefaultSSMOutput.ps1
Set-DefaultSSMOutput.ps1
<# .SYNOPSIS Sets the default SSM Output S3 bucket and prefix .DESCRIPTION The cmdlet sets the default S3 bucket and prefix for capturing SSM outputs. .PARAMETER PemFile Mandatory - Path to the PrivateKey file to be used by default .EXAMPLE Set-DefaultSSMOutput #> function Set-DefaultSSMOutput { ...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/SSM/Invoke-SSMCommand.ps1
Invoke-SSMCommand.ps1
<# .SYNOPSIS Invokes an AWS SSM Command against EC2 instances .DESCRIPTION This command is an extension for AWS PowerShell module to execute script on EC2 Instances similarly as Invoke-Command does on regular PSSessions. It takes direct EC2 instances or AWS reservation objects from pipeline an...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/SSM/Get-SSMCommandResult.ps1
Get-SSMCommandResult.ps1
function Get-SSMCommandResult { param( [Parameter(Mandatory=$true)] [string]$CommandId, [Parameter()] [string]$InstanceId, [Parameter()] [string]$Region=$(Get-DefaultAWSRegion | Select-Object -ExpandProperty Region), [Parameter()] [switch]$EnableCl...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/SSM/Clear-DefaultSSMOutput.ps1
Clear-DefaultSSMOutput.ps1
<# .SYNOPSIS Clears the default S3 output settings for SSM .DESCRIPTION The cmdlet clears a previously set Default S3 Output setting for SSM .EXAMPLE Clear-DefaultSSMOutput #> function Clear-DefaultSSMOutput { Write-Verbose "Clearing SSM S3 Output settings.." $Script:DefaultSSMOutputS3BucketNam...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/PemFile/Clear-DefaultEC2PemFile.ps1
Clear-DefaultEC2PemFile.ps1
<# .SYNOPSIS Clears the default EC2 PemFile for this module .DESCRIPTION The cmdlet clears a previously set Default EC2 PemFile for this module cmdlets .EXAMPLE Clear-DefaultEC2PemFile #> function Clear-DefaultEC2PemFile { Write-Verbose "Clearing `$script:DefaultEc2PemFile" $script:DefaultEc2Pe...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/PemFile/Test-EC2PemFile.ps1
Test-EC2PemFile.ps1
<# .SYNOPSIS Validates the default EC2 pemfile .DESCRIPTION This cmdlet is used for a vague validation of the PemFile .PARAMETER PemFile Mandatory - Path to the PrivateKey file to be used by default .EXAMPLE Test-EC2PemFile '~/ssh/ec2-dev.pem' #> function Test-EC2PemFile { [CmdletBinding()] [Ou...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/PemFile/Set-DefaultEC2PemFile.ps1
Set-DefaultEC2PemFile.ps1
<# .SYNOPSIS Sets the default EC2 PemFile for this module .DESCRIPTION The cmdlet sets the default EC2 PemFile for all CloudRemoting functions, so the user doesn't have to specify it all the time .PARAMETER PemFile Mandatory - Path to the PrivateKey file to be used by default .EXAMPLE Set-DefaultE...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Functions/AWS/PemFile/Get-DefaultEC2PemFile.ps1
Get-DefaultEC2PemFile.ps1
<# .SYNOPSIS Returns the default EC2 PemFile set for this module .DESCRIPTION The cmdlet returns previously set Default EC2 PemFile for this module. If it was never set or cleared, the function returns $null .EXAMPLE Get-DefaultEC2PemFile #> function Get-DefaultEC2PemFile { $script:Default...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Tests/TestCommon.ps1
TestCommon.ps1
# Load module from the local filesystem, instead from the ModulePath Remove-Module CloudRemoting -Force -ErrorAction SilentlyContinue Import-Module (Split-Path $PSScriptRoot -Parent) $Script:ModuleName = 'CloudRemoting' $script:FunctionPath = Resolve-Path (Join-Path $PSScriptRoot '../Functions')
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Tests/Module/ScriptAnalyzer.tests.ps1
ScriptAnalyzer.tests.ps1
. (Join-Path $PSScriptRoot '../TestCommon.ps1') $scriptSources = Get-ChildItem -Path $script:FunctionPath -Filter '*.ps1' -Recurse $scriptAnalyzer = Get-Module PSScriptAnalyzer -ListAvailable $excludeRuleList = @( 'PSUseShouldProcessForStateChangingFunctions' ) if (-Not $scriptAnalyzer) { Write-Warning "PSSc...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Tests/Module/Module.tests.ps1
Module.tests.ps1
. (Join-Path $PSScriptRoot '../TestCommon.ps1') $exportedCommands = (Get-Command -Module $Script:ModuleName) $expectedCommands = Import-Csv -Path (Join-Path $PSScriptRoot 'expected_commands.csv') Describe "$($Script:ModuleName) Module" { It "ModuleName Should be set" { $Script:ModuleName | Should Not BeNu...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Tests/PemFile/PemFile.tests.ps1
PemFile.tests.ps1
. (Join-Path $PSScriptRoot '../TestCommon.ps1') Describe "Validation - No Default EC2 PemFile" { $fakeInstance = 'i-123456' $fakeRegion = 'us-east-1' $emptyFile = Resolve-Path(Join-Path $PSScriptRoot '../PemFile/empty.txt') function Test-PemFileValidation([string]$FunctionName) { Context $...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Tests/PemFile/Set-DefaultEC2PemFile.tests.ps1
Set-DefaultEC2PemFile.tests.ps1
. (Join-Path $PSScriptRoot '../TestCommon.ps1') Describe "Set-DefaultEC2PemFile" { $emptyFile = Join-Path $PSScriptRoot '../PemFile/empty.txt' $notEmptyFile = Resolve-Path (Join-Path $PSScriptRoot '../PemFile/notempty.txt') | Select-Object -ExpandProperty Path Context "Valid input" { it "should no...
PowerShellCorpus/PowerShellGallery/CloudRemoting/0.6.1.0/Tests/PemFile/Test-EC2PemFile.tests.ps1
Test-EC2PemFile.tests.ps1
. (Join-Path $PSScriptRoot '../TestCommon.ps1') Describe "Test-EC2PemFile validation" { $emptyFile = Join-Path $PSScriptRoot '../PemFile/empty.txt' $notEmptyFile = Join-Path $PSScriptRoot '../PemFile/notempty.txt' it "should return false if not specified" { Test-EC2PemFile -ErrorAction 0 | Should ...
PowerShellCorpus/PowerShellGallery/PowerShellPushOver/2.0.1/functions/Send-Pushover.ps1
Send-Pushover.ps1
#requires -Version 3 function Send-Pushover { <# .SYNOPSIS Sends a push notification alert to a specific user using PushOver.net .DESCRIPTION Use this function to send push notification alerts using the PushOver.net API. .EXAMPLE ...
PowerShellCorpus/PowerShellGallery/PowerShellPushOver/2.0.1/functions/Test-Pushover.ps1
Test-Pushover.ps1
#requires -Version 3 function Test-PushOver { <# .SYNOPSIS Tests if the API, User, Group or Device Tokens are Valid .DESCRIPTION As an optional step in collecting user keys for users of your application, you may verify those keys to ensure that a user has co...
PowerShellCorpus/PowerShellGallery/PowerShellPushOver/2.0.1/functions/Get-PushoverReceipt.ps1
Get-PushoverReceipt.ps1
#requires -Version 3 function Get-PushoverReceipt { <# .SYNOPSIS Get's Pushover Receipt information in regards to an Emergency notification. .DESCRIPTION Applications sending emergency-priority notifications will receive a receipt parameter from our API when ...
PowerShellCorpus/PowerShellGallery/PSDiskPart/1.0/Invoke-DiskPartScript.ps1
Invoke-DiskPartScript.ps1
Function Invoke-DiskPartScript { <# .SYNOPSIS Run a DiskPart script on one or more remote systems .FUNCTIONALITY Computers .DESCRIPTION Run a DiskPart script on one or more remote systems. Results and errors sent to text files on that system, returned by this function, and ...
PowerShellCorpus/PowerShellGallery/PSDiskPart/1.0/Get-DiskPartVDisk.ps1
Get-DiskPartVDisk.ps1
Function Get-DiskPartVDisk { <# .SYNOPSIS Run a LIST VDISK and parse the output into objects, from one or more remote systems .FUNCTIONALITY Computers .DESCRIPTION Run a LIST VDISK and parse the output into objects, from one or more remote systems. Get-Help Invok...
PowerShellCorpus/PowerShellGallery/PSDiskPart/1.0/Get-DiskPartVolume.ps1
Get-DiskPartVolume.ps1
Function Get-DiskPartVolume { <# .SYNOPSIS Run a LIST VOLUME and parse the output into objects, from one or more remote systems .FUNCTIONALITY Computers .DESCRIPTION Run a LIST VOLUME and parse the output into objects, from one or more remote systems. Get-Help In...
PowerShellCorpus/PowerShellGallery/PSDiskPart/1.0/Get-DiskPartDisk.ps1
Get-DiskPartDisk.ps1
Function Get-DiskPartDisk { <# .SYNOPSIS Run a LIST DISK and parse the output into objects, from one or more remote systems .FUNCTIONALITY Computers .DESCRIPTION Run a LIST DISK and parse the output into objects, from one or more remote systems. Get-Help Invoke-D...
PowerShellCorpus/PowerShellGallery/gibbels-algorithms/1.0.4/scripts/luhn/Test-LuhnValidation.Tests.ps1
Test-LuhnValidation.Tests.ps1
Import-Module $([System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSCommandPath, '..\..\..\gibbels-algorithms.psd1'))); Describe "Test-LuhnValidation" { Context "Given a Visa credit card (4024007106418766)" { $result = Test-LuhnValidation -Number 4024007106418766 It "Should pass validation" {...
PowerShellCorpus/PowerShellGallery/gibbels-algorithms/1.0.4/scripts/luhn/Test-LuhnValidation.ps1
Test-LuhnValidation.ps1
<# .SYNOPSIS Checks whether a given number was generated using the Luhn algorithm. .PARAMETER Number The number you want to validate. .EXAMPLE Test-LuhnValidation -Number "79927398712" #> function Test-LuhnValidation { param ( [Parameter(Mandatory=$True)] [string]$Number ...
PowerShellCorpus/PowerShellGallery/gibbels-algorithms/1.0.4/scripts/levenshtein/Test-LevenshteinDistance.Tests.ps1
Test-LevenshteinDistance.Tests.ps1
Import-Module $([System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSCommandPath, '..\..\..\gibbels-algorithms.psd1'))); Describe "Test-LevenshteinDistance" { Context "Given a source of 'Taylor Gibb' and target of 'Taylor'" { $source = 'Taylor Gibb' $target = 'Taylor' $result = Test-Lev...
PowerShellCorpus/PowerShellGallery/gibbels-algorithms/1.0.4/scripts/levenshtein/Test-LevenshteinDistance.ps1
Test-LevenshteinDistance.ps1
<# .SYNOPSIS Checks the Levenshtein Distance (also known as Edit Distance) between two strings. .PARAMETER Source The source string you want to test. .PARAMETER Target The target string you want to test against. #> function Test-LevenshteinDistance { param( [Parameter(Position=0...
PowerShellCorpus/PowerShellGallery/CType/1.0/CType.ps1
CType.ps1
# CODEWORK Need better parameter validation [Hashtable]$CType_AddedTypes = @{} Write-Verbose 'CType.ps1: adding CType base types' Add-Type -ReferencedAssemblies System.Data -TypeDefinition @' namespace CType { public class TypeElement { } public class Property : TypeElement { ...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Join-Config.ps1
Join-Config.ps1
function Join-Config { <# .Synopsis Joins several DSC configurations .Description Joins several DSC configurations into a single DSC configuration .Link Split-Config .Example { configuration InstallWebServer_IIS { node localhost { WindowsFeature IIS...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Out-Config.ps1
Out-Config.ps1
function Out-Config { <# .Synopsis Generates a configuration from any input object .Description Generates a PowerShell DSC configuration based off of a series of input objects or hashtables. The properties Node, ResourceName, and SetttingName are used to define...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Register-DSCTrigger.ps1
Register-DSCTrigger.ps1
function Register-DSCTrigger { <# .Synopsis Registers a trigger to run a Powershell configuration .Description Registers a WMI event trigger that, when the event occurs, will run a PowerShell configuration .Link Get-DSCTrigger .Link UnRegister-DSCTri...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Split-Config.ps1
Split-Config.ps1
function Split-Config { <# .Synopsis Splits a DSC configuration .Description Splits a single DSC configuration into multiple DSC configurations .Link Join-Config .Example { configuration InstallWebServer { node localhost { WindowsFeature IIS { ...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Reset-DSCResource.ps1
Reset-DSCResource.ps1
function Reset-DSCResource { <# .Synopsis Removes automatically generated DSC resources .Description Removes resources that were generated based off of .resource.ps1 files. .Link Initialize-DSCResource .Example Reset-DSCResource $env:ProgramFiles\WindowsPowe...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Use-Config.ps1
Use-Config.ps1
function Use-Config { <# .Synopsis Applies a saved configuration .Description Applies a saved DSC configuration to the local machine, a remote machine, or an azure virtual machine .Example Use-Config MySavedConfig .Example Use-Config MySavedConfig -AzureVirt...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Initialize-DSCResource.ps1
Initialize-DSCResource.ps1
function Initialize-DSCResource { <# .Synopsis Initializes DSC resources within a module .Description Initializes DSC resources within a module, based off of scripts named *.version.resource.ps1 (i.e. foo.1.0.resource.ps1) .Link Reset-DSCResource .Example ...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Get-DSCData.ps1
Get-DSCData.ps1
function Get-DSCData { <# .Synopsis Gets data generated by a DSC resource .Description Gets data that was generated by a DSC resource. .Example Get-DSCData .Example Get-DSCData -ResourceName "MonitorDiskSpace" .Link Clear-DSCData #> [...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Clear-DSCData.ps1
Clear-DSCData.ps1
function Clear-DSCData { <# .Synopsis Clears data stored in DSC .Description Clears data stored in DSC resource instances .Example Clear-DSCData # Clear all DSC Data .Example Clear-DSCData -ResourceName "MonitorDiskSpace" # Clear all data from the DSC resou...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Write-DSCResource.ps1
Write-DSCResource.ps1
function Write-DSCResource { <# .Synopsis Automatically generates the tedious code required to implement a DSC resource .Description Automatically generates the source code for a DSC resource. The DSC resource can be generated with a simple hashtable and a set of scriptblo...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Unregister-DSCTrigger.ps1
Unregister-DSCTrigger.ps1
function Unregister-DSCTrigger { <# .Synopsis Unregisters a trigger to run a Powershell configuration .Description Unregisters a WMI event trigger that would start a PowerShell configuration .Link Register-DSCTrigger .Link Get-DSCTrigger .Exampl...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Get-DSCTrigger.ps1
Get-DSCTrigger.ps1
function Get-DSCTrigger { <# .Synopsis Gets DSC triggers .Description Gets WMI event subscriptions that will trigger a DSC resource .Link Register-DSCTrigger .Link Unregister-DSCTrigger .Example Get-DSCTrigger #> [OutputType([PSObject...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Save-Config.ps1
Save-Config.ps1
function Save-Config { <# .Synopsis Saves a configuration .Description Saves a DSC configuration .Example Save-Config -Name MyConfig .Link Get-Config .Link Use-Config #> [CmdletBinding(DefaultParameterSetName='Name')] [OutputT...
PowerShellCorpus/PowerShellGallery/cFg/0.3/cFg.EzFormat.ps1
cFg.EzFormat.ps1
$ModuleRoot = $MyInvocation.MyCommand.Source | Split-Path $formatting = @() $formatting += Write-FormatView -TypeName cFg.DSC.SavedConfigurationMetadata -Property Name, Notes -Wrap -AutoSize $formatting += Write-FormatView -TypeName cFg.DSC.SavedConfiguration -Property Name, Notes, ScriptBlock -AsList $form...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Remove-Config.ps1
Remove-Config.ps1
function Remove-Config { <# .Synopsis Gets stored configurations .Description Gets stored DSC configurations. .Example Remove-Config "MySavedConfig" .Link Get-Config .Link Save-Config .Link Use-Config #> [OutputType([Nul...
PowerShellCorpus/PowerShellGallery/cFg/0.3/Get-Config.ps1
Get-Config.ps1
function Get-Config { <# .Synopsis Gets stored configurations .Description Gets stored DSC configurations. .Example Get-Config .Link Save-Config .Link Use-Config #> [OutputType([PSObject], [Management.Automation.ExternalScript...
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cClearDSCTrigger.0.1.Resource.ps1
cClearDSCTrigger.0.1.Resource.ps1
(Write-DSCResource -KeyProperty Name -Test { ((Get-DSCTrigger | Where-Object { $_.Name -like $Name }) -as [bool]) } -Set { Get-DSCTrigger | Where-Object { $_.Name -like $Name } | Unregister-DSCTrigger -Confirm:$false } -Property @{ Name = 'A wildcard pattern describing the name of the DSC triggers to r...
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cWmiIntervalTimer.1.0.Resource.ps1
cWmiIntervalTimer.1.0.Resource.ps1
Write-DSCResource -Property @{ TimerId = 'An identifier for the timer' IntervalBetweenEvents = 'The number of milliseconds between each event', [Uint64] SkipIfPassed = 'Indicates if the event should fire after the event has passed', [bool] } -Test { $existingTimer = Get-WmiObject -Namespace root\ci...
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cMonitorPerformanceCounter.0.1.resource.ps1
cMonitorPerformanceCounter.0.1.resource.ps1
Write-DSCResource <#-ResourceName cMonitorPerformanceCounter -ModuleRoot $sysModules\cFg #>-Property @{ CounterPath = 'The path to the performance counter' Value = 'The value of the performance counter', [Double] Timestamp = 'The timestamp', [DateTime] CounterType = 'The type of performance coun...
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cUnregisterDSCTrigger.0.1.Resource.ps1
cUnregisterDSCTrigger.0.1.Resource.ps1
(Write-DSCResource -SetCommand ($ExecutionContext.SessionState.InvokeCommand.GetCommand('Unregister-DSCTrigger', 'Function')) -KeyProperty Name -SetDefaultParameter @{ Confirm = $false } -Test { (Get-DSCTrigger | Where-Object { $_.Name -eq $Name }) -as [bool] })
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cBinPlace.1.0.resource.ps1
cBinPlace.1.0.resource.ps1
Write-DSCResource <#-ResourceName cBinPlace -ModuleRoot $sysModules\cFg #>-Property @{ OutputPath = "The output path" Base64Content = "The file contents, in base64" } -Test { if (-not [IO.File]::Exists($OutputPath)) { return $false } $b64 = [Convert]::FromBase64String($Base64Content) ...
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cRegisterDSCTrigger.0.1.Resource.ps1
cRegisterDSCTrigger.0.1.Resource.ps1
(Write-DSCResource -SetCommand ($ExecutionContext.SessionState.InvokeCommand.GetCommand('Register-DSCTrigger', 'Function')) -KeyProperty Name -SetDefaultParameter @{ Force = $true } -Test { -not ((Get-DSCTrigger | Where-Object { $_.Name -eq $Name }) -as [bool]) })
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cWmiAbsoluteTimer.1.0.Resource.ps1
cWmiAbsoluteTimer.1.0.Resource.ps1
Write-DSCResource -Property @{ TimerId = 'An identifier for the timer' EventDateTime = 'The datetime of the event', [DateTime] SkipIfPassed = 'Indicates if the event should fire after the event has passed', [bool] } -Test { $existingTimer = Get-WmiObject -Namespace root\cimv2 -Class __AbsoluteTimer...
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cMonitorDiskSpace.0.3.Resource.ps1
cMonitorDiskSpace.0.3.Resource.ps1
Write-DSCResource <#-ResourceName cMonitorDiskSpace -ModuleRoot $sysModules\cFg #>-Property @{ FreeSpace = 'The amount of free space on the disk, in bytes', [Uint64] Size = 'The size of the disk, in bytes', [Uint64] VolumeName = 'The name of the volume' Timestamp = 'The timestamp', [DateTime] ...
PowerShellCorpus/PowerShellGallery/cFg/0.3/DSCResources/src/cRobocopyMirror.0.1.Resource.ps1
cRobocopyMirror.0.1.Resource.ps1
Write-DSCResource <#-ResourceName cRoboCopyMirror -ModuleRoot $sysModules\cFg #> -Property @{ Source = 'The source directory' Destination = 'The destination directory' } -Set { robocopy $Source $Destination /MIR } -KeyProperty Source, Destination
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Register-PSSnapin.ps1
Register-PSSnapin.ps1
None
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Import-Module.ps1
Import-Module.ps1
None
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Get-DoBlock.ps1
Get-DoBlock.ps1
function Get-DoBlock { param ( [scriptblock] $ScriptBlock = $null, [Object] $BoundParameters = $null ) $blocks = @() $block = $ScriptBlock.ToString().Trim() if ($block) { $commands = $ScriptBlock.AST.EndBlock.Statements fo...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/ConvertTo-CidneyScriptBlock.ps1
ConvertTo-CidneyScriptBlock.ps1
function ConvertTo-CidneyScriptBlock { param ( [scriptblock] $ScriptBlock = $null, [Object] $BoundParameters = $null, [hashtable] $Context = $null ) $OFS = "`r`n" $block = $ScriptBlock.ToString().Trim() if ($block) { ...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Invoke-CidneyBlock.ps1
Invoke-CidneyBlock.ps1
function Invoke-CidneyBlock { [CmdletBinding()] param ( [Parameter(Mandatory)] [scriptblock] $ScriptBlock = $null, [Parameter(Mandatory)] [hashtable] $Context = $null ) $localVariables = @{} $variables = @{} $localVariable...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Get-CidneyPipelineParams.ps1
Get-CidneyPipelineParams.ps1
function Get-CidneyPipelineParams { param ( [string] $functionName, [System.Collections.Generic.List`1[System.Object]] $DynamicParams ) # When Invoking a cidney pipeline in a Do: block (new runspace) we need to Find the Function in the Global namespace. #...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Get-CommonParameter.ps1
Get-CommonParameter.ps1
function Get-CommonParameter { param ( [Object] $BoundParameters = $null ) $commonParams = '' if ($BoundParameters) { if ($BoundParameters['Verbose'] -and $($BoundParameters['Verbose'].ToString() -eq 'True')) { $commonParams +=...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/New-CidneyContext.ps1
New-CidneyContext.ps1
function New-CidneyContext { $CidneyContext = @{} $CidneyContext.Add('Modules', (Get-Module)) $CidneyContext.Add('CredentialStore', @{}) $CidneyContext.Add('CurrentPath', (Get-Location)) $CidneyContext.Add('Jobs', @()) $CidneyContext.Add('RemoteSessions', @{}) return $CidneyCon...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Get-ThrottleLimit.ps1
Get-ThrottleLimit.ps1
function Get-ThrottleLimit { $property = 'numberOfCores', 'NumberOfLogicalProcessors' $cpuInfo = Get-CimInstance -class win32_processor -Property $property | Select-Object -Property $property $suggestedThreads = ($cpuInfo.numberOfLogicalProcessors * $cpuInfo.NumberOfCores) $throttle = [int32]$sugge...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Get-CidneyStatement.ps1
Get-CidneyStatement.ps1
function Get-CidneyStatement { param ( [scriptblock] $ScriptBlock = $null, [Object] $BoundParameters = $null ) $statementblocks = @() $blocks = @() $OFS = "`n`r" $block = $ScriptBlock.ToString().Trim() if ($block) { $statem...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Private/Start-CidneyJob.ps1
Start-CidneyJob.ps1
function Start-CidneyJob() { param ( [scriptblock] $Script, [string] $ComputerName, [switch] $UseSSL, [int] $MaxThreads = 16, [int] $SleepTimer = 100, [int] $TimeOut = 1800, # Default TimeOut is 30 min...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Public/Get-CidneyPipeline.ps1
Get-CidneyPipeline.ps1
function Get-CidneyPipeline { <# .SYNOPSIS Get-CidneyPipeline will return a list of all Cidney Pipelines compiled from Pipeline: configurations. .DESCRIPTION When you first create a Cidney Pipeline: configuration you are actually creating a definition or a configuration of a pipel...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Public/Write-CidneyLog.ps1
Write-CidneyLog.ps1
function Write-CidneyLog { param ( [parameter(ValueFromPipeline)] [string] $Message = $null ) $indentLevel = $CidneyPipelineCount-1 if($indentLevel -lt 0) { $indentLevel = 0 } $Date = "[$(Get-Date -Format 'MM/dd/yy h:mm:ss.fff tt')]" $i...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Public/Send-Event.ps1
Send-Event.ps1
function Send-Event { param ( [Parameter(Mandatory)] [string] $Name = $null ) $null = New-Event $Name -Sender 'Cidney' }
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Public/Remove-CidneyPipeline.ps1
Remove-CidneyPipeline.ps1
function Remove-CidneyPipeline { <# .SYNOPSIS Remove-CidneyPipeline will remove the specified Cidney Pipelines compiled from Pipeline: configurations. .DESCRIPTION When you first create a Cidney Pipeline: configuration you are actually creating a definition or a configuration of a ...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Public/Wait-CidneyJob.ps1
Wait-CidneyJob.ps1
function Wait-CidneyJob { [CmdletBinding()] param ( [Parameter(ValueFromPipelineByPropertyName, ValueFromPipeline)] [hashtable] $Context = $null ) $count = 0 $date = Get-Date $jobCount = $Context.Jobs.Count $showprogress = $Context.ShowProgress ...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Public/Invoke-Cidney.ps1
Invoke-Cidney.ps1
function Invoke-Cidney { <# .SYNOPSIS Invoke-Cidney will start a Cidney Pipeline. .DESCRIPTION To start a Pipeline you use the cmdlet Invoke-Cidney. You can specify a name or a list of one or more Pipelines returned from the cmdlet Get-CidneyPipeline. ...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Samples/HelloWorld.ps1
HelloWorld.ps1
$ErrorActionPreference = 'stop' $var = 'ABC' Pipeline: HelloWorld { $Test = 'ONE' Stage: One { Write-Output "Hello World! from [Stage $Stagename] [$Test] [$var]" } Stage: Two { $var = 'def' $test = 'TWO' Invoke-Cidney HelloWorld2 # on: $env:COMPUTER...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Samples/DCKissTest.ps1
DCKissTest.ps1
Import-Module Cidney -Force Pipeline: DCKiss { Import-Module Cidney.Commands -Force Stage: Build { Do: { Build -Path '$/Development/DealerCenter/Integration/Apps/QuickBooks/DCQBConnector' -LocalPath d:\Prj\DCQBConnector -SolutionName DCQBConnector.sln } Do: { Build -Path '$/Developm...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Samples/EventTest.ps1
EventTest.ps1
function Create-FileWatcher { param ( [object] $Path ) $properties = @{ Path = $Path NotifyFilter = [IO.NotifyFilters]'FileName' IncludeSubdirectories = $False } $eventObject = New-Object System.IO.FileSystemWatcher -Property $properties...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Samples/HelloWorld2.ps1
HelloWorld2.ps1
$ErrorActionPreference = 'stop' $var = 'ABC.2' Pipeline: HelloWorld2 { $Test = 'ONE.2' Stage: 'One.2' { Write-Output "Hello World2! (Stage One.2) from [Stage $Stagename] [$Test] [$var]" } Stage: 'Two.2' { $var = 'def.2' $test = 'TWO.2' #Invoke-Cidney HelloW...
PowerShellCorpus/PowerShellGallery/Cidney/1.0.0.7/Samples/DeployFeedbackTest.ps1
DeployFeedbackTest.ps1
$tfsServer = 'http://tfs.nowcom.com:8080/tfs/nowcom' $cred = Get-Credential hic\rkozak Pipeline: FeedBack { Stage: Build { GetSource -Name $TfsServer -Credential $Cred -WorkspaceName 'Workspace' ` -Path '$/Development/Feedback/Integration' -LocalPath D:\Prj RestorePackages -Pa...