full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/PackageManagementSource/OneGetSource.Get.Set.Test.Tests.ps1
OneGetSource.Get.Set.Test.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/PackageManagement/PackageManagement.Get.Tests.ps1
PackageManagement.Get.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/PackageManagement/PackageManagement.Set.Tests.ps1
PackageManagement.Set.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/PackageManagement/PackageManagement.Test.Tests.ps1
PackageManagement.Test.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/NugetPackage/NugetPackage.Set.Tests.ps1
NugetPackage.Set.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/NugetPackage/NugetPackage.IntegrationTest.Tests.ps1
NugetPackage.IntegrationTest.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/NugetPackage/NugetPackage.Get.Tests.ps1
NugetPackage.Get.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/NugetPackage/NugetPackage.Test.Tests.ps1
NugetPackage.Test.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Examples/Sample_Install_Package_Using_NuGet.ps1
Sample_Install_Package_Using_NuGet.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Examples/Sample_PSModule.ps1
Sample_PSModule.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Examples/Sample_Install_Package.ps1
Sample_Install_Package.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Examples/Sample_Install_Pester.ps1
Sample_Install_Pester.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Examples/Sample_NuGet_InstallPackage.ps1
Sample_NuGet_InstallPackage.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/posh-vsdev/0.1.1/VisualStudio-scripts.ps1
VisualStudio-scripts.ps1
# constants $script:VSDEVCMD_PATH = "Common7\Tools\VsDevCmd.bat"; $script:VS_INSTANCES_DIR = "$env:ProgramData\Microsoft\VisualStudio\Packages\_Instances"; $script:CONFIG_DIR = "$env:USERPROFILE\.posh-vsdev"; $script:CACHE_PATH = "$script:CONFIG_DIR\instances.json"; $script:VisualStudioVersions = $null; # In-mem...
PowerShellCorpus/PowerShellGallery/GitHubRepository/1.2.0/GitHubRepository.Tests.ps1
GitHubRepository.Tests.ps1
#requires -RunAsAdministrator #requires -Version 4 $moduleName = 'GitHubRepository'; if (!$PSScriptRoot) { # $PSScriptRoot is not defined in 2.0 $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) } $repoRoot = (Resolve-Path $PSScriptRoot).Path; Import-Module (Join-Path -Path...
PowerShellCorpus/PowerShellGallery/GitHubRepository/1.2.0/GitHubRepository.ps1
GitHubRepository.ps1
$localized = data { ConvertFrom-StringData @' ResolvedDestinationPath = Resolved destination path '{0}'. ResolvedSourcePath = Resolved source path '{0}'. ExpandingZipArchive = Expanding Zip archive '{0}'. CreatingDirectory = Creating target directory '{0}'. Extra...
PowerShellCorpus/PowerShellGallery/cMDT/1.0.0.7/Examples/Azure-MDTServer.ps1
Azure-MDTServer.ps1
Function Get-ConfigurationDataAsObject { [CmdletBinding()] [OutputType([hashtable])] Param ( [Parameter(Mandatory)] [Microsoft.PowerShell.DesiredStateConfiguration.ArgumentToConfigurationDataTransformation()] [hashtable] $ConfigurationData ) return $Configuration...
PowerShellCorpus/PowerShellGallery/cMDT/1.0.0.7/Examples/OnPremise-Deploy_MDT_Server.ps1
OnPremise-Deploy_MDT_Server.ps1
<# $Modules = @( @{ Name = "xSmbShare" RequiredVersion = "1.1.0.0" }, @{ Name = "cNtfsAccessControl" RequiredVersion = "1.3.0" } ) ForEach ($Module in $Modules) { If (-not((Get-DscResource -Module $Module.Name -Verbose:$False).Versi...
PowerShellCorpus/PowerShellGallery/cDtc/1.0/DSCResources/cDtcNetworkSetting/ResourceDesignerScripts/GeneratecDtcNetworkSettingSchema.ps1
GeneratecDtcNetworkSettingSchema.ps1
$DtcName = New-xDscResourceProperty -Name DtcName -Type String -Attribute Key $RemoteClientAccessEnabled = New-xDscResourceProperty -Name RemoteClientAccessEnabled -Type Boolean -Attribute Required $RemoteAdministrationAccessEnabled = New-xDscResourceProperty -Name RemoteAdministrationAccessEnabled -Type Boolean -Att...
PowerShellCorpus/PowerShellGallery/cDtc/1.0/Examples/Sample_cDtcNetworkSetting.ps1
Sample_cDtcNetworkSetting.ps1
$DevEnvironment = @{ AllNodes = @( @{ NodeName = "Localhost" } ) } Configuration EnableDtcSettings { param() Import-DscResource -ModuleName "cDtc" Node $AllNodes.NodeName { cDtcNetworkSetting Local { DtcName = "Lo...
PowerShellCorpus/PowerShellGallery/cDtc/1.0/Tests/Unit/cDtcNetworkSetting.Tests.ps1
cDtcNetworkSetting.Tests.ps1
$Global:DSCResourceName = 'cDtcNetworkSetting' Import-Module "$($PSScriptRoot)\..\..\DSCResources\cDtcNetworkSetting\cDtcNetworkSetting.psm1" $GetParams = @{ DtcName="Local" RemoteClientAccessEnabled=$True RemoteAdministrationAccessEnabled=$True InboundTransactionsEnabled=$True OutboundTran...
PowerShellCorpus/PowerShellGallery/PSOpenFiles/1.0.3/Set-OpenFiles.ps1
Set-OpenFiles.ps1
function Set-OpenFiles { <# .SYNOPSIS Close files on a remote computer by ID number. .DESCRIPTION Use Get-OpenFiles to pipe IDs to Set-OpenFiles and close them. .PARAMETER ComputerName Remote computer hostname that you want to close files. .PARAMETER IDs List of IDs that can only come fro...
PowerShellCorpus/PowerShellGallery/PSOpenFiles/1.0.3/Get-OpenFiles.ps1
Get-OpenFiles.ps1
function Get-OpenFiles { <# .SYNOPSIS List open files on a remote computer. .DESCRIPTION Connects to a remote computer and list open files. You can also filter the list with a keyword. Wildcard is %. .PARAMETER ComputerName Remote computer hostname that you want to close files. .PARAM...
PowerShellCorpus/PowerShellGallery/xDSCFirewall/1.6.21/Tests/xDSCFirewall.Tests.ps1
xDSCFirewall.Tests.ps1
#requires -Version 1.0 Import-Module -Name .\DSCResources\xDSCFirewall\xDSCFirewall.psm1 $Global:DSCModuleName = 'xDSCFirewall' $Global:DSCResourceName = 'xDSCFirewall' InModuleScope -ModuleName XDSCFirewall -ScriptBlock { $Firewall = New-Object -TypeName PSObject -Property @{ Enabled = $t...
PowerShellCorpus/PowerShellGallery/PasswordsGenerator/1.0.0.0/New-Password.ps1
New-Password.ps1
Function New-Password { <# .SYNOPSIS Passwords generator .DESCRIPTION The New-Password cmdlet allow to generate pools of random passwords. .PARAMETER Pool Specifies pool length. Default is 10 random password. .PARAMETER CharsLengthArray Specifies array of chars used in pas...
PowerShellCorpus/PowerShellGallery/Debug/1.0.4/Tests/Debug.Test.ps1
Debug.Test.ps1
using module Debug using module ColoredText using module ..\Src\Rules\TreeViewRules.psm1 $object = New-Object ColoredText $hash = @{ digit = 4353534 array = (1, 3, 4) hash = @{ hello = 'World' } round = 'String=(1.2,3)' square = '[String]' color = [ConsoleColor]::Gray } $arra...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Get-ReferencedCommand.ps1
Get-ReferencedCommand.ps1
function Get-ReferencedCommand { <# .Synopsis Gets the commands referred to from within a function or external script .Description Uses the Tokenizer to get the commands referred to from within a function or external script .Example Get-Command New-Button | Get-Refere...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Get-Type.ps1
Get-Type.ps1
function Get-Type { <# .Synopsis Gets the types that are currenty loaded in .NET, or gets information about a specific type .Description Gets all of the loaded types, or gets the possible values for an enumerated type or value. .Example # Gets all load...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-PInvoke.ps1
Write-PInvoke.ps1
function Write-PInvoke { <# .Synopsis Creates C# code to access a C function .Description Creates P/Invoke C# code to access a C function .Example Write-PInvoke -Library User32.dll -Signature GetSystemMetrics(uint Metric) .Link http://www.pinvoke.net/ #...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-ScriptCmdlet.ps1
Write-ScriptCmdlet.ps1
function Write-ScriptCmdlet { <# .Synopsis Creates a new script cmdlet .Description Creates a new script cmdlet automatically .Example Write-ScriptCmdlet New-FooBar .Example Write-ScriptCmdlet -Name Start-ProcessAsAdministrator -FromCommand (Get-Comm...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-Enum.ps1
Write-Enum.ps1
function Write-Enum { <# .Synopsis Creates a New enumerated type .Description Creates a new enumerated type from a list of strings or a dictionary of values .Example Write-Enum "Foo" "a","b","c" .Example Write-Enum "Foo" @{"a" = 1;"b" = 2;"c" = 4} -Namespac...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-Program.ps1
Write-Program.ps1
#requires -version 2.0 function Write-Program { <# .Synopsis Creates an application to run a PowerShell command. .Description Creates an application to run a PowerShell command. The application will wrap any cmdlet and any function stored in a module and create a ...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-RemoteDataCollector.ps1
Write-RemoteDataCollector.ps1
function Write-RemoteDataCollector { <# .Synopsis Writes a function that collects information from several machines using fan-out remoting .Description Writes a function that collects information from several machines using fan-out remoting .Example Write-RemoteDataCollec...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-CommandOverload.ps1
Write-CommandOverload.ps1
function Write-CommandOverload { <# .Synopsis Writes a command overload. .Description This creates a command that runs another command. It can optionally drop some parameters, or create new ones. .Example #> param( [Parameter(Mandatory=$true,Parame...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Get-FunctionFromScript.ps1
Get-FunctionFromScript.ps1
function Get-FunctionFromScript { <# .Synopsis Gets the functions declared within a script block or a file .Description Gets the functions exactly as they are written within a script or file .Example Get-FunctionFromScript { function foo() { ...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-MarkupWriter.ps1
Write-MarkupWriter.ps1
function Write-MarkupWriter { <# .Synopsis Write-MarkupWriter produces PowerShell commands that create markup .Description Write-MarkupWriter will create a single PowerShell function to create a single XML element, with as rich parameter binding and defaults as you w...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-WMICommand.ps1
Write-WMICommand.ps1
function Write-WmiCommand { <# .Synopsis Writes a WMI command .Description Generates the code for a new WMI function to get a class .Example # Create a function to get to Win32_Process Write-WmiCommand Win32_Process .Example # Create a function to ...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-Interface.ps1
Write-Interface.ps1
function Write-Interface { <# .Synopsis Creates an interface implementation that is backed by a PSObject .Description Creates an interface implementation backed by a PSObject. All operations on the interface go straight to the PSObject, which lets you do two powerful things: ...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-Parameter.ps1
Write-Parameter.ps1
function Write-Parameter { <# .Synopsis Writes a parameter attribute. .Description Writes a PowerShell parameter attribute. .Example Write-Parameter 'MyParameter' -Mandatory #> param( #The name of the parameter [Parameter(ValueFromPipelineByPropertyName...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/Write-Hashtable.ps1
Write-Hashtable.ps1
function Write-Hashtable { <# .Synopsis Takes an existing Hashtable and creates the script you would need to embed to recreate the hashtable .Description Allows you to take a hashtable and create a hashtable you would embed into a script. Handles nested hashtables and automatic...
PowerShellCorpus/PowerShellGallery/CodeCraft/1.0/ConvertTo-CodeSnippet.ps1
ConvertTo-CodeSnippet.ps1
function ConvertTo-CodeSnippet { <# .Synopsis Turns PowerShell functions Visual Studio code snippets .Description Converts simple PowerShell functions into Visual Studio code snippets. Only functions that start with a string statement which contains all of ...
PowerShellCorpus/PowerShellGallery/VMware.VimAutomation.Vds/6.5.1.5374428/VMware.VimAutomation.Vds.ps1
VMware.VimAutomation.Vds.ps1
[VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory]::CoreService.OnImportModule( "VMware.VimAutomation.Vds.Commands", (Split-Path $script:MyInvocation.MyCommand.Path)); # SIG # Begin signature block # MIIdVgYJKoZIhvcNAQcCoIIdRzCCHUMCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJg...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/Initialize-ForgeContext.ps1
Initialize-ForgeContext.ps1
$Script:ForgeContexts = @{} function Initialize-ForgeContext { <# .SYNOPSIS Initializes the context in which all generation fonctions will work. .DESCRIPTION Sets up the context for other Forge functions to reuse. .EXAMPLE Initialize-ForgeContext -SourceRoot (Join-Path $PSScri...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/Get-ForgeContext.ps1
Get-ForgeContext.ps1
function Get-ForgeContext { <# .SYNOPSIS Get-ForgeContext synopsis. .DESCRIPTION Get-ForgeContext description. .EXAMPLE Get-FogeContext #... #> [CmdletBinding()] Param( [String]$ContextName = $(Get-CallerModuleName) ) $Context = $Script:ForgeCon...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/Copy-ForgeFile.ps1
Copy-ForgeFile.ps1
function Copy-ForgeFile { <# .SYNOPSIS Generates a new file based on the source. .DESCRIPTION Generates a new file based on the source file. The source file comes from the template directory and is handled as an EPS template. .EXAMPLE Copy-ForgeFile -Source "README.md" ...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/Set-ForgeBinding.ps1
Set-ForgeBinding.ps1
function Set-ForgeBinding { <# .SYNOPSIS Set-ForgeBinding synopsis. .DESCRIPTION Set-ForgeBinding description. .EXAMPLE Set-ForgeBinding #... #> [CmdletBinding()] Param( [Hashtable]$Binding, [String]$ContextName = $(Get-CallerModuleName) ) ...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/New-ForgeDirectory.ps1
New-ForgeDirectory.ps1
function New-ForgeDirectory { <# .SYNOPSIS Generates a directory. .DESCRIPTION New-ForgeDirectory creates a directory where the code is being generated. .EXAMPLE New-ForgeDirectory -Destination "Tests" Generates a Tests directory. .PARAMETER Destination ...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/New-ForgeScript.ps1
New-ForgeScript.ps1
<# Copyright 2016 Dominique Broeglin 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/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/Get-CallerModuleName.ps1
Get-CallerModuleName.ps1
function Get-CallerModuleName { <# .SYNOPSIS Returns the caller's module name. .DESCRIPTION Gets the caller's module name by retrieving it from the CallStack invokation information. .EXAMPLE Get-CallerModuleName #> [CmdletBinding()] Param( ) (Get-PS...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/Get-ValueOrGitOrDefault.ps1
Get-ValueOrGitOrDefault.ps1
$ErrorActionPreference = "Stop" function Get-ValueOrGitOrDefault { Param( [String]$Value, [String]$GitConfigKey, [String]$Default, [String]$GitCommand = "git" ) if ([string]::IsNullOrWhitespace($Value)) { if (-not (Get-Command $GitCommand -ErrorAction SilentlyContinue) -or ...
PowerShellCorpus/PowerShellGallery/Forge/0.4.4/Get-ForgeBinding.ps1
Get-ForgeBinding.ps1
function Get-ForgeBinding { <# .SYNOPSIS Returns the forge binding. .DESCRIPTION Returns the forge binding associated with the current caller's module name or the given context name. .EXAMPLE Return the forge binding associated with the caller's module name. Ge...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SCSMA-SingleServer-TP.ps1
SCSMA-SingleServer-TP.ps1
#requires -Version 5 # Suppression of this PSSA rule allowed in examples [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param() Configuration SMA { Import-DscResource -Module xSQLServer Import-DscResource -Module xSCSMA # Set role and ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SmaCredentials.ps1
SmaCredentials.ps1
param( [parameter(mandatory = $true)] [PSCredential] $cred ) Configuration SmaCredential { Import-DscResource -ModuleName 'xSCSMA' Node "localhost" { xSmaCredential Example { Name = $cred.UserName credential = $cred W...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SCSMA-SeperateSQL-TP.ps1
SCSMA-SeperateSQL-TP.ps1
#requires -Version 5 # Suppression of this PSSA rule allowed in examples [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param() Configuration SMA { Import-DscResource -Module xSQLServer Import-DscResource -Module xSCSMA # Set role and ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SCSMA-SeperateSQL.ps1
SCSMA-SeperateSQL.ps1
#requires -Version 5 # Suppression of this PSSA rule allowed in examples [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param() Configuration SMA { Import-DscResource -Module xSQLServer Import-DscResource -Module xSCSMA # Set role and ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SmaVariable.ps1
SmaVariable.ps1
Configuration RunbookDirectory { Param ( $NodeName ) Import-DscResource -ModuleName 'xSCSMA' Node $NodeName { SmaVariable Example { Name = "Variable" Value = 'Value' WebServiceEndpoint = 'https:\\localhost...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SCSMA-MultiInstance.ps1
SCSMA-MultiInstance.ps1
#requires -Version 5 # Suppression of this PSSA rule allowed in examples [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param() Configuration SMA { Import-DscResource -Module xSQLServer Import-DscResource -Module xSCSMA # Set role and ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SCSMA-SingleServer.ps1
SCSMA-SingleServer.ps1
#requires -Version 5 # Suppression of this PSSA rule allowed in examples [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param() Configuration SMA { Import-DscResource -Module xSQLServer Import-DscResource -Module xSCSMA # Set role and ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/RunbookDirectory.ps1
RunbookDirectory.ps1
Configuration RunbookDirectory { Param ( $NodeName ) Import-DscResource -ModuleName 'xSCSMA' Node $NodeName { RunbookDirectory Example { RunbookPath = 'C:\Source\Runbooks\Start-*' WebServiceEndpoint = 'https:\\localhost' ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/RemoveSampleRunbooks.ps1
RemoveSampleRunbooks.ps1
Configuration RunbookDirectory { Param ( $NodeName ) Import-DscResource -ModuleName 'xSCSMA' Node $NodeName { RunbookDirectory Example { RunbookPath = 'C:\Program Files\Microsoft System Center 2012 R2\Orchestrator\Web Service\SampleRunbooks\*' ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Examples/SCSMA-MultiInstance-TP.ps1
SCSMA-MultiInstance-TP.ps1
#requires -Version 5 # Suppression of this PSSA rule allowed in examples [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param() Configuration SMA { Import-DscResource -Module xSQLServer Import-DscResource -Module xSCSMA # Set role and ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Tests/Unit/MSFT_xRunbookDirectory.Tests.ps1
MSFT_xRunbookDirectory.Tests.ps1
<# .Synopsis Unit test for xRunbookDirectory DSC Resource #> $Global:DSCModuleName = 'xSCSMA' $Global:DSCResourceName = 'MSFT_xRunbookDirectory' #region HEADER if ( (-not (Test-Path -Path '.\DSCResource.Tests\')) -or ` (-not (Test-Path -Path '.\DSCResource.Tests\TestHelper.psm1')) ) { ...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Tests/Unit/MSFT_xSmaCredential.Tests.ps1
MSFT_xSmaCredential.Tests.ps1
<# .Synopsis MSFT_xSmaCredential unit test. #> # Suppression of this PSSA rule allowed in tests. [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] Param() $script:DSCModuleName = 'xSCSMA' $script:DSCResourceName = 'MSFT_xSmaCredential' #...
PowerShellCorpus/PowerShellGallery/xSCSMA/1.5.0.0/Tests/Unit/MSFT_xSmaVariable.Tests.ps1
MSFT_xSmaVariable.Tests.ps1
<# .Synopsis Unit test for xSmaVariable DSC Resource #> $Global:DSCModuleName = 'xSCSMA' $Global:DSCResourceName = 'MSFT_xSmaVariable' #region HEADER if ( (-not (Test-Path -Path '.\DSCResource.Tests\')) -or ` (-not (Test-Path -Path '.\DSCResource.Tests\TestHelper.psm1')) ) { & git @('...
PowerShellCorpus/PowerShellGallery/Posh-ChocoBear/0.1.3/Set-ChocolateyAccept.ps1
Set-ChocolateyAccept.ps1
$ChocolateyAccept = $false; function Set-ChocolateyAccept() { [cmdletbinding()] Param( [bool] $Accept ) $ChocolateyAccept = $Accept; } function Get-ChocolateyAccept() { [cmdletbinding()] Param() return $ChocolateyAccept; }
PowerShellCorpus/PowerShellGallery/Posh-ChocoBear/0.1.3/New-ChocoBearInstallConfig.ps1
New-ChocoBearInstallConfig.ps1
function New-ChocobearInstallConfig() { Param( [string] $Path = $null ) $json ="{ `"path`": null, `"toolsDirectory`": null, `"feeds`": { `"choco-bear`": `"https://www.myget.org/F/choco-bear/api/v2`", `"chocolatey`": `"http://chocolatey.org/api/v2`" } }" ...
PowerShellCorpus/PowerShellGallery/Posh-ChocoBear/0.1.3/Install-ChocoBear.ps1
Install-ChocoBear.ps1
function Install-Chocobear() { [cmdletbinding()] Param( [string] $Path = $null, [string] $ToolsDirectory = $null, [switch] $Force = $false, [HashTable] $Feeds, [String] $ConfigPath = $null ) if($Feeds -eq $null) { $Feeds = @{"choco-bear" = "htt...
PowerShellCorpus/PowerShellGallery/Posh-ChocoBear/0.1.3/Install-ChocolateyPackage.ps1
Install-ChocolateyPackage.ps1
function Install-ChocolateyPackage() { [cmdletbinding(SupportsShouldProcess=$True)] Param( [Parameter(ValueFromPipeline = $true, Position = 0)] [string[]] $Packages, [Alias("f")] [switch] $Force, [Alias("y")] [switch] $Accept, [switch] $Pre, ...
PowerShellCorpus/PowerShellGallery/Posh-ChocoBear/0.1.3/Test-ChocolateyPackagePath.ps1
Test-ChocolateyPackagePath.ps1
function Test-ChocolateyPackagePath() { Param( [string] $PackageName, [switch] $Multiple ) if(Test-Path "$Env:ChocolateyInstall\lib\$packageName") { return $true; } $folders = gci "$Env:ChocolateyInstall\lib\$packageName.*" if($folders -eq $null -or $folder...
PowerShellCorpus/PowerShellGallery/Posh-ChocoBear/0.1.3/Remove-ChocolateyPackage.ps1
Remove-ChocolateyPackage.ps1
function Remove-ChocolateyPackage() { [cmdletbinding(SupportsShouldProcess=$True)] Param( [Parameter(ValueFromPipeline = $true, Position = 0)] [string[]] $Packages, [Alias("f")] [switch] $Force, [Alias("y")] [switch] $Accept, [switch] $Pre, ...
PowerShellCorpus/PowerShellGallery/Posh-ChocoBear/0.1.3/Install-Chocolatey.ps1
Install-Chocolatey.ps1
function Install-Chocolatey() { [cmdletbinding()] Param( [string] $Path = $null, [string] $ToolsDirectory = $null, [switch] $Force = $false, [HashTable] $Feeds, [String] $ConfigPath ) $setupFile = $null; if(![string]::IsNullOrWhiteSpace(...
PowerShellCorpus/PowerShellGallery/Change-IP/1.3/Change-IP.tests.ps1
Change-IP.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 "Change-IP" { Context "Function Exists" { It "Should Return" { } } }
PowerShellCorpus/PowerShellGallery/CimSession/1.1.0.2/New-CimSessionDown.ps1
New-CimSessionDown.ps1
<# .SYNOPSIS Opens a CIM session to a computer, with a fallback from WSMAN to DCOM for older operating systems. .DESCRIPTION CIM is the preferred method of interacting with WMI on a computer. It can reuse a single session instead of creaing a new session for each interaction. It can timeout which the built-in WMI...
PowerShellCorpus/PowerShellGallery/xFirefox/1.2.0.0/Example/Sample_xFirefox.ps1
Sample_xFirefox.ps1
#Installs the specified version of Firefox in the specified language. Configuration Sample_InstallFirefoxBrowser { param ( [Parameter(Mandatory)] $VersionNumber, [Parameter(Mandatory)] $Language, [Parameter(Mandatory)] $OS, [Pa...
PowerShellCorpus/PowerShellGallery/xChrome/1.1.0.0/Example/Sample_xChrome.ps1
Sample_xChrome.ps1
#Installs the latest version of Chrome in the language specified in the parameter Language. Configuration Sample_InstallChromeBrowser { param ( [Parameter(Mandatory)] $Language, [Parameter(Mandatory)] $LocalPath ) Import-DscResource -module xChrome ...
PowerShellCorpus/PowerShellGallery/AttunixMSPTools/1.0/public/Start-AzureDSCCompilation.ps1
Start-AzureDSCCompilation.ps1
function Start-AzureDSCCompilation { [cmdletbinding()] Param ( [string]$ResourceGroupName, [string]$AutomationAccountName, [string]$ConfigurationName ) Begin {} Process { Try { $CompilationJob = Start-AzureRmAuto...
PowerShellCorpus/PowerShellGallery/OperationValidation/1.0.1/Test/OperationValidation.Tests.ps1
OperationValidation.Tests.ps1
$MyDir = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition) $moduleDir = (resolve-path "$myDir/../..").path Describe "OperationValidation Module Tests" { BeforeAll { $SavedModulePath = $env:PSModulePath if ( $env:psmodulepath.split(";") -notcontains $moduleDir ) {...
PowerShellCorpus/PowerShellGallery/OperationValidation/1.0.1/Diagnostics/Comprehensive/PSGallery.Comprehensive.Tests.ps1
PSGallery.Comprehensive.Tests.ps1
Describe "E2E validation of PSGallery" { BeforeAll { $Repository = "InternalPSGallery" $ModuleName = "FormatTools" $Version = "0.5.0" import-module PowerShellGet -Force if ( Get-Module -list ${ModuleName} ) { # the module is already installed ...
PowerShellCorpus/PowerShellGallery/OperationValidation/1.0.1/Diagnostics/Simple/PSGallery.Simple.Tests.ps1
PSGallery.Simple.Tests.ps1
Describe "Simple Validation of PSGallery" { It "The PowerShell Gallery should be responsive" { $request = [System.Net.WebRequest]::Create("http://psget/psgallery") $response = $Request.GetResponse() $response.StatusCode | Should be OK } }
PowerShellCorpus/PowerShellGallery/Psst/0.3.0/GetNamingConventions.ps1
GetNamingConventions.ps1
<# .SYNOPSIS Converts an upper camel case name (Pascal case) into a hash table of other naming conventions. .PARAMETER Name The name of convert to other naming conventions. This should be specified as upper camel case (Pascal case). .PARAMETER PluralName This is an optional parameter that can b...
PowerShellCorpus/PowerShellGallery/Psst/0.3.0/ExpandTemplateDirectory.ps1
ExpandTemplateDirectory.ps1
function Expand-TemplateDirectory { [CmdletBinding()] param ( [string] $InputPath, [string] $OutputPath = $PWD, [string[]] $Exclude, [hashtable] $Model ) $Model.Psst = Import-PowerShellDataFile "$PSScriptRoot\Psst.psd1" # Check to see if the Inp...
PowerShellCorpus/PowerShellGallery/Psst/0.3.0/ConvertToKebabCase.ps1
ConvertToKebabCase.ps1
<# .SYNOPSIS This function converts the provided Pascal cased name to its kebab case equivalent. (e.g. ItemList is converted to item-list) #> function ConvertTo-KebabCase { param ( [string]$Name ) if ($Name -eq $null) { return $null } $parts = @() $part = "" for ($i = 0; $i -lt $Name.L...
PowerShellCorpus/PowerShellGallery/Psst/0.3.0/ExpandTemplate.ps1
ExpandTemplate.ps1
<# .SYNOPSIS Expands a template string with dynamically defined arguments. .DESCRIPTION The Expand-Template function uses PowerShell's built in string expansion functionality to populate the values of a parameterized string. This can be a string literal that is passed to the function, or the contents of ...
PowerShellCorpus/PowerShellGallery/Psst/0.3.0/NewPsstGeneratorModule.ps1
NewPsstGeneratorModule.ps1
function New-PsstGeneratorModule { <# .SYNOPSIS Scaffolds the code files needed to create a PsstGeneratorModule generator. .DESCRIPTION This function scaffolds out a new Psst Generator project. .PARAMETER OutputPath The optional output directory where the new PsstGeneratorModule generat...
PowerShellCorpus/PowerShellGallery/Psst/0.3.0/NewPsstGenerator.ps1
NewPsstGenerator.ps1
function New-PsstGenerator { <# .SYNOPSIS Scaffolds the code files needed to create a Psst generator. .DESCRIPTION .PARAMETER Name The name of a brand new Psst generator. .PARAMETER OutputPath The output directory where the new Psst generator will be located. #> [CmdletBindi...
PowerShellCorpus/PowerShellGallery/PSEncryptedData/1.0/Functions/ConvertFrom-PSEncryptedData.ps1
ConvertFrom-PSEncryptedData.ps1
function ConvertFrom-PSEncryptedData { [OutputType([string])] [CmdletBinding()] param ( [Parameter(Mandatory,ValueFromPipeline,Position=0)] [string] $InputObject, [switch] $AsSecureString = $false ) process { $Data = [Convert]::FromBase64Strin...
PowerShellCorpus/PowerShellGallery/PSEncryptedData/1.0/Functions/New-PSEncryptedDataCertificate.ps1
New-PSEncryptedDataCertificate.ps1
function New-PSEncryptedDataCertificate { [OutputType([string])] [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Name, [Parameter()] [ValidateSet('CurrentUser','LocalMachine')] [string] $CertStore = 'Curre...
PowerShellCorpus/PowerShellGallery/PSEncryptedData/1.0/Functions/Import-PSEncryptedData.ps1
Import-PSEncryptedData.ps1
function Import-PSEncryptedData { [OutputType([string])] [CmdletBinding()] param ( [Parameter(Mandatory,Position=0,ValueFromPipeline)] [ValidateNotNullOrEmpty()] [string] $Path, [ValidateSet('ASCII','BigEndianUnicode','Unicode','UTF7','UTF8','UTF32')] ...
PowerShellCorpus/PowerShellGallery/PSEncryptedData/1.0/Functions/ConvertTo-PSEncryptedData.ps1
ConvertTo-PSEncryptedData.ps1
function ConvertTo-PSEncryptedData { [OutputType([string])] [CmdletBinding(DefaultParameterSetName='Path')] param ( [Parameter(Mandatory,ValueFromPipeline,Position=0,ParameterSetName='Path')] [Parameter(Mandatory,ValueFromPipeline,Position=0,ParameterSetName='Thumbprint')] ...
PowerShellCorpus/PowerShellGallery/PSEncryptedData/1.0/Functions/Export-PSEncryptedData.ps1
Export-PSEncryptedData.ps1
function Export-PSEncryptedData { [OutputType([void])] [CmdletBinding()] param ( [Parameter(Mandatory,ValueFromPipeline,ParameterSetName='Path')] [Parameter(Mandatory,ValueFromPipeline,ParameterSetName='Thumbprint')] [Parameter(Mandatory,ValueFromPipeline,ParameterSetName='Cert...
PowerShellCorpus/PowerShellGallery/PSEncryptedData/1.0/Functions/Import-PSEncryptedDataCredential.ps1
Import-PSEncryptedDataCredential.ps1
function Import-PSEncryptedCredential { [OutputType([PSCredential])] [CmdletBinding()] param ( [Parameter(Mandatory,Position=0,ValueFromPipeline)] [ValidateNotNullOrEmpty()] [string] $Path ) process { Import-PSEncryptedData -Path $Path | ConvertF...
PowerShellCorpus/PowerShellGallery/PSEncryptedData/1.0/Functions/Export-PSEncryptedCredential.ps1
Export-PSEncryptedCredential.ps1
function Export-PSEncryptedCredential { [OutputType([void])] [CmdletBinding()] param ( [Parameter(Mandatory,ParameterSetName='Path')] [Parameter(Mandatory,ParameterSetName='Thumbprint')] [Parameter(Mandatory,ParameterSetName='Certificate')] [System.Management.Automatio...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Get-Flashcard.ps1
Get-Flashcard.ps1
function Get-Flashcard { <# .Synopsis Gets flashcards .Description Generates flashcards for a given grade level #> param( # The grade level for the flashcard #|Default 3rd [Parameter(Mandatory=$true,Position=0, ValueFromPipeline=$true)] [ValidateSet("1st",...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Measure-Velocity.ps1
Measure-Velocity.ps1
function Measure-Velocity { <# .Synopsis Measures velocity .Description Calculates velocity, using several well-known formula. Velocity can be determined with: * Initial Velocity (u), Acceleration (a), and Time (t) (v = u + a * t ) * Initial Velocity (u...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Get-CircleArea.ps1
Get-CircleArea.ps1
function Get-CircleArea { <# .Synopsis Gets the area of a circle .Description Gets the area of a circle, using the simple equation Area = Pi * Radius^2 #> [CmdletBinding(DefaultParameterSetName='Radius')] param( # The radius [Paramete...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Get-TrianglePerimeter.ps1
Get-TrianglePerimeter.ps1
function Get-TrianglePerimeter { <# .Synopsis Gets the perimeter of a triangle .Description Gets the perimeter of a triangle, using the simple equation: P = a + b + c #> param( # The Length of Side A [Parameter(Mandatory=$true)] [Double] ...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Get-RectanglePerimeter.ps1
Get-RectanglePerimeter.ps1
function Get-RectanglePerimeter { <# .Synopsis Gets the perimeter of a rectangle .Description Gets the perimeter of a rectangle, using the simple equation Permieter = 2a + 2b #> [CmdletBinding(DefaultParameterSetName='ASideBSide')] param( # The L...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Measure-Tip.ps1
Measure-Tip.ps1
function Measure-Tip { <# .Synopsis .Description Calculates tips. Select service quality to determine the tip percent: * OK (15%) * Good (20%) * Awesome (25%) Then choose if you want to round up #> param( ...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Get-SquarePerimeter.ps1
Get-SquarePerimeter.ps1
function Get-SquarePerimeter { <# .Synopsis Gets the Perimeter of a square .Description Gets the Perimeter of a square, using the simple equation Perimeter = side*4 #> [CmdletBinding(DefaultParameterSetName='LengthOfEachSide')] param( # The Length...
PowerShellCorpus/PowerShellGallery/Formulaic/0.2.1.0/Get-RectangleArea.ps1
Get-RectangleArea.ps1
function Get-RectangleArea { <# .Synopsis Gets the area of a rectangle .Description Gets the area of a rectangle, using the simple equation Area = ab #> [CmdletBinding(DefaultParameterSetName='ASideBSide')] param( # The Length of Side A [Par...