full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-LastProcessFailed.ps1
Assert-LastProcessFailed.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-NodeExists.ps1
Assert-NodeExists.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-Is.ps1
Assert-Is.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Test-NodeExists.ps1
Test-NodeExists.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-ContainsNotLike.ps1
Assert-ContainsNotLike.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-DirectoryDoesNotExist.ps1
Assert-DirectoryDoesNotExist.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-That.ps1
Assert-That.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-DirectoryExists.ps1
Assert-DirectoryExists.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/New-TempDirectory.ps1
New-TempDirectory.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-Empty.ps1
Assert-Empty.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/New-TempDirectoryTree.ps1
New-TempDirectoryTree.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-FileContains.ps1
Assert-FileContains.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-NotNull.ps1
Assert-NotNull.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-CEqual.ps1
Assert-CEqual.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-Match.ps1
Assert-Match.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-Error.ps1
Assert-Error.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-FileDoesNotContain.ps1
Assert-FileDoesNotContain.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-NotEqual.ps1
Assert-NotEqual.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-NoError.ps1
Assert-NoError.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-LessThan.ps1
Assert-LessThan.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-LastError.ps1
Assert-LastError.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-LastProcessSucceeded.ps1
Assert-LastProcessSucceeded.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-Like.ps1
Assert-Like.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Assert-True.ps1
Assert-True.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/Blade/0.15.0/Functions/Export-RunResultXml.ps1
Export-RunResultXml.ps1
# Copyright 2012 - 2015 Aaron Jensen # # 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 agr...
PowerShellCorpus/PowerShellGallery/xWordPress/1.1.0.0/DscResources/MSFT_xWordPressSite/xWordPressSite.ps1
xWordPressSite.ps1
# Sample script to create the template or update the Wordpress Resource # Resource Details # Friendly name of the resource: $friendlyName = "xWordPressSite" # Name of the resource: $resourceName = "MSFT_$friendlyName" # Class Version of the resource: $classVersion = "1.0.0" # Various Paths $diff = join-...
PowerShellCorpus/PowerShellGallery/xWordPress/1.1.0.0/samples/WordPressConfigurationTemplate.ps1
WordPressConfigurationTemplate.ps1
# Generate a WordPress configuration base on the supplied parameters # and returns it as a string. param ( [Parameter(Mandatory = $true)] [string] $WordPressDatabase, [Parameter(Mandatory = $true)] [string] $WordPressUserName, [Parameter(Mandatory = $true)] [...
PowerShellCorpus/PowerShellGallery/xWordPress/1.1.0.0/samples/InstallRequiredModules.ps1
InstallRequiredModules.ps1
# This Script installs the required modules for the WordPress Sample # It uses the PowerShell Resource Gallery, see https://msconfiggallery.cloudapp.net/ # This requires WMF 5. If you don't have WMF 5, Please install the modules manually. Write-Host "Installing required modules..." Install-Module xWebAdministrat...
PowerShellCorpus/PowerShellGallery/xWordPress/1.1.0.0/samples/SingleNodeEndToEndWordPress.ps1
SingleNodeEndToEndWordPress.ps1
# This configuration configures a Basic WordPress Site # It requires xPhp, xMySql, xWordPress, and xWebAdministration # Please review the note about the FQDN variable and # about the URLs, they may need to be updated. # ********* NOTE *********** # If you are not targetting the local machine, # or this does no...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/New-SAPSetupFolder.ps1
New-SAPSetupFolder.ps1
function Cleanup-Temp { if((Test-Path "patch.cab")) { Remove-Item "patch.cab" -Force } if((Test-Path "patch")) { Remove-Item "patch" -Force -Recurse } } function New-SAPSetupFolder { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Positi...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/GetSAPSetupPatchFile.ps1
GetSAPSetupPatchFile.ps1
function GetSAPSetupPatchFile { [CmdletBinding()] param ( [PSCredential] $Credential = $global:SAPCredential ) $credential = EnsureSAPSupportCredential $Credential $sapSetupPatches = Get-SAPPatchDownload 01200314690200016672 -OperatingSystem NT_I386 $latestPatch = $sapSetupPat...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Update-SAPSetupPatchMetadata.ps1
Update-SAPSetupPatchMetadata.ps1
function Update-SAPSetupPatchMetadata { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Position=1)] [string] $SAPSetupPath, [string] $PatchMetadataFilePath = $global:PatchMetadataFilePath, [string] $PackageCachePath = $global:SAPPackageCachePath, $ComponentMapping = $null, ...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/EnsurePatchMetadataFilePath.ps1
EnsurePatchMetadataFilePath.ps1
<# My Function #> function EnsurePatchMetadataFilePath { param( [Parameter(Position=1)] [string]$PatchMetadataFilePath = "" ) if([String]::IsNullOrWhiteSpace($PatchMetadataFilePath)) { $commonAppData = [System.Environment]::GetFolderPath([System.Environment+SpecialF...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Import-SAPSetupGUIPackage.ps1
Import-SAPSetupGUIPackage.ps1
function Import-SAPSetupGUIPackage { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Position=1)] [string] $SAPSetupPath, [PSCredential] $Credential = $global:SAPCredential, [string]$PackageCachePath = $global:SAPPackageCachePath, [string]$Temp = $env:TEMP, [swi...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Export-SAPInstallationFileMetadata.ps1
Export-SAPInstallationFileMetadata.ps1
function Export-SAPInstallationFileMetadata { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Position=1)] [string] $Path, [string]$Temp = $env:TEMP ) $7zip = Join-Path (get-module WAS.SAP.FrontendSetup.Management -ListAvailable | select ModuleBase).ModuleBase "7za.exe" ...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Get-SAPPatchFile.ps1
Get-SAPPatchFile.ps1
function Get-SAPPatchFile { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Position=1)] [string] $DownloadId, [PSCredential] $Credential = $global:SAPCredential, [int] $Last = 99 ) $credential = EnsureSAPSupportCredential $Credential (Get-SAPPatchDownload -Downl...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Export-SAPPatchFileMetadata.ps1
Export-SAPPatchFileMetadata.ps1
function Export-SAPPatchFileMetadata { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Position=1)] [string] $Path, [string]$Temp = $env:TEMP ) $7zip = Join-Path (get-module WAS.SAP.FrontendSetup.Management -ListAvailable | select ModuleBase).ModuleBase "7za.exe" ...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/EnsureSAPSupportCredential.ps1
EnsureSAPSupportCredential.ps1
<# My Function #> function EnsureSAPSupportCredential { param( [Parameter(Position=1)] [pscredential]$Credential = $null ) if($Credential -eq $null) { $registryPath = "HKCU:\Software\wagnerSolutions\PSSAPSupport" $password = (Get-ItemProperty $registryPath -Name "Pass...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/EnsureSAPPackageCachePath.ps1
EnsureSAPPackageCachePath.ps1
<# My Function #> function EnsureSAPPackageCachePath { param( [Parameter(Position=1)] [string]$SAPPackageCachePath = "" ) if([String]::IsNullOrWhiteSpace($SAPPackageCachePath)) { $commonAppData = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Test-IsAdmin.ps1
Test-IsAdmin.ps1
function Test-IsAdmin { ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") } # SIG # Begin signature block # MIIX5QYJKoZIhvcNAQcCoIIX1jCCF9ICAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEA...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Get-SAPInstallationFile.ps1
Get-SAPInstallationFile.ps1
function Get-SAPInstallationFile { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Position=1)] [string] $DownloadId, [PSCredential] $Credential = $global:SAPCredential ) $credential = EnsureSAPSupportCredential $Credential $installationInfo = (Get-SAPInstallationDownload...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/SAPSetupPatchMetdataHelpers.ps1
SAPSetupPatchMetdataHelpers.ps1
function CleanupTemp { if((Test-Path "patch.cab")) { Remove-Item "patch.cab" -Force } if((Test-Path "patch")) { Remove-Item "patch" -Force -Recurse } } function isFileLocked([string]$Path) { ### Make sure the path is good if ((Test-Path -Path $Path) -eq $fal...
PowerShellCorpus/PowerShellGallery/wagnersolutions.SAPSetupPatchManagement/0.0.3/Update-SAPSetupFolder.ps1
Update-SAPSetupFolder.ps1
function Update-SAPSetupFolder { [CmdletBinding()] param ( [Parameter(Mandatory=$True,Position=1)] [string] $SAPSetupPath, [string] $PatchMetadataFilePath = $global:PatchMetadataFilePath, [string] $PackageCachePath = $global:SAPPackageCachePath, [string]$Temp = $env:TEMP ) ...
PowerShellCorpus/PowerShellGallery/VMware.VimAutomation.HA/6.0.0.5314477/VMware.HAModule.ps1
VMware.HAModule.ps1
[VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory]::CoreService.OnImportModule( "VMware.VimAutomation.HA.Commands", (Split-Path $script:MyInvocation.MyCommand.Path)); # SIG # Begin signature block # MIIdVgYJKoZIhvcNAQcCoIIdRzCCHUMCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4w...
PowerShellCorpus/PowerShellGallery/Get-Quote/1.2/PublishPsGalleryModule.ps1
PublishPsGalleryModule.ps1
#requires -Modules PowerShellGet $ReleaseNotes =@' Get-Quote Chris Warwick, @cjwarwickps, January 2012. This version, November 2015. Read a Quote/Cookie/Fortune/MOTD from a file and display it. A list of quotes is included (in fortunes.dat) The fortunes file consists of thousands of random quotes. As a q...
PowerShellCorpus/PowerShellGallery/nScriptAnalyzerRules/0.1/Tests/nScriptAnalyzerRules.Tests.ps1
nScriptAnalyzerRules.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") . "$here\$sut" function Get-ScriptBlockAst { param( [string] $Path ) New-Variable Tokens New-Variable ParseErrors $Ast = [Management...
PowerShellCorpus/PowerShellGallery/nScriptAnalyzerRules/0.1/Tests/nScriptAnalyzerRules.ps1
nScriptAnalyzerRules.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path Import-Module PSScriptAnalyzer Import-Module "$here\..\nScriptAnalyzerRules.psm1" -Force
PowerShellCorpus/PowerShellGallery/PSAzureToolkit/1.0.1/Public/Get-AzureRmStorageContextFromAccountName.ps1
Get-AzureRmStorageContextFromAccountName.ps1
function Get-AzureRmStorageContextFromAccountName { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [ValidateNotNullOrEmpty()] [Alias("StorageAccount", "Name")] [string]$StorageAccountName, [Parameter(ValueFromPipelineByPropertyName)] ...
PowerShellCorpus/PowerShellGallery/PSAzureToolkit/1.0.1/Public/Add-AzureRmNetworkSecurityRuleConfigForRegionPublicIpSubnets.ps1
Add-AzureRmNetworkSecurityRuleConfigForRegionPublicIpSubnets.ps1
function Add-AzureRmNetworkSecurityRuleConfigForRegionPublicIpSubnets { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] [ValidateNotNull()] [Microsoft.Azure.Commands.Network.Models.PSNetworkSecurityGroup]$NetworkSecurityGroup, [Parameter(Mandatory)] ...
PowerShellCorpus/PowerShellGallery/PSAzureToolkit/1.0.1/Public/Get-AzureRmStorageGeoReplicationStats.ps1
Get-AzureRmStorageGeoReplicationStats.ps1
function Get-AzureRmStorageGeoReplicationStats { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [ValidateNotNullOrEmpty()] [Alias("StorageAccount", "Name")] [string]$StorageAccountName ) process { Write-Verbose "Getting seconar...
PowerShellCorpus/PowerShellGallery/PSAzureToolkit/1.0.1/Public/Get-AzureRegionPublicIpSubnets.ps1
Get-AzureRegionPublicIpSubnets.ps1
function Get-AzureRegionPublicIpSubnets { [CmdletBinding()] param ( [switch]$RefreshCache = $false ) $timeout = 10 $now = Get-Date $regionSubnetsCache = $global:regionSubnetsCache $regionSubnetsCacheTime = $global:regionSubnetsCacheTime Write-Verbose "Last cached result was cac...
PowerShellCorpus/PowerShellGallery/PSAzureToolkit/1.0.1/Public/Start-AzureRmVMSnapshotCopyDisks.ps1
Start-AzureRmVMSnapshotCopyDisks.ps1
function Start-AzureRmVMSnapshotCopyDisks { [CmdletBinding()] param ( [Parameter(ParameterSetName = "PSVirtualMachine", Mandatory, ValueFromPipeline)] [ValidateNotNull()] [Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine]$VM, [Parameter(ParameterSetName = "NamedVM", Man...
PowerShellCorpus/PowerShellGallery/PSVersionCompare/0.4/Functions/Compare-PSVersionCommand.ps1
Compare-PSVersionCommand.ps1
<# .SYNOPSIS A function to compare PowerShell commands between two computers. .DESCRIPTION Compare-PSVersionCommand have two parameter sets which makes it possible to compare based on either XML-files pre-gathered from systems, or data gathered directly via PowerShell remoting. .PARAMETER SourceVersion...
PowerShellCorpus/PowerShellGallery/PSVersionCompare/0.4/Functions/Get-PSVersionVariable.ps1
Get-PSVersionVariable.ps1
<# .SYNOPSIS A function to retrieve PowerShell default variables from a computer. Defaults to the local machine if -ComputerName is not specified. .DESCRIPTION If you run Get-PSVersionVariable without -Export, you will get all variables is returned. With the -Export parameter specified the results will be e...
PowerShellCorpus/PowerShellGallery/PSVersionCompare/0.4/Functions/Get-PSVersionCommand.ps1
Get-PSVersionCommand.ps1
<# .SYNOPSIS A function to retrieve PowerShell commands from a computer. Defaults to the local machine if -ComputerName is not specified. .DESCRIPTION If you run Get-PSVersionCommand without -Export, you will get all commands from system wide modules returned. With the -Export parameter specified the result...
PowerShellCorpus/PowerShellGallery/PSVersionCompare/0.4/Functions/Compare-PSVersionVariable.ps1
Compare-PSVersionVariable.ps1
<# .SYNOPSIS A function to compare PowerShell variables between two computers. .DESCRIPTION Compare-PSVersionVariable have two parameter sets which makes it possible to compare based on either XML-files pre-gathered from systems, or data gathered directly via PowerShell remoting. .PARAMETER SourceVersi...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Stop-WebDriver.ps1
Stop-WebDriver.ps1
<# .Synopsis Stops The Current WebDriver Session .DESCRIPTION Stops The Current WebDriver Session .EXAMPLE Stop-WebDriver .EXAMPLE Start-WebDriver -Browser Chrome | Stop-WebDriver #> function Stop-WebDriver { [CmdletBinding()] Param () if ($global:WebDriver -is [OpenQA.Selenium.IWebDriver])...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Get-HyperLink.ps1
Get-HyperLink.ps1
<# .Synopsis Retrieves a Hyperlink or links on the current webpage .DESCRIPTION By Default will return all hyperlinks on the current page. A String of the text can be passed in to limit the returns links. Wildcards are accepted. .PARAMETER Text The Text in the HyperLink you want wildcards accepted .E...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Start-WebDriver.ps1
Start-WebDriver.ps1
<# .Synopsis Starts a WebDriver for the specified browser .DESCRIPTION Using the browser specified when this function is called a WebDriver session is created and the specified browser is launched and ready for further processing. .PARAMETER Browser Suported browsers Chrome, Firefox, IE .EXAMPLE St...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Get-ElementByTagName.ps1
Get-ElementByTagName.ps1
<# .Synopsis returns elements from the current page by tag name .DESCRIPTION Takes the tag name and returns IWebElement objects .PARAMETER TagName The string of the Tag you want returned .EXAMPLE Start-WebDriver -Browser Chrome $Links = Get-ElementByTagName -TagName a .INPUTS String .OUTPUTS O...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Select-HyperLink.ps1
Select-HyperLink.ps1
<# .Synopsis Short description .DESCRIPTION Long description .EXAMPLE Example of how to use this cmdlet .EXAMPLE Another example of how to use this cmdlet .INPUTS Inputs to this cmdlet (if any) .OUTPUTS Output from this cmdlet (if any) .NOTES General notes .COMPONENT The component this cmdl...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Move-ToURL.ps1
Move-ToURL.ps1
<# .Synopsis Moves the WebDriver Page to the specified URL .DESCRIPTION Taking a URL. The command will move the connected browser to the specified URL. The URL must begin with http://, https://, or ftp:// .PARAMETER URL The fully qualified url string to move the connected browsers location .EXAMPL...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Get-PageHeader.ps1
Get-PageHeader.ps1
<# .Synopsis Retrieves Headers from the current page by size .DESCRIPTION By Default will return all headers of a specified size on the page. .PARAMETER Size The header size 1, 2, 3 .PARAMETER Text The text of the header you want, wildcards accepted .EXAMPLE $Links = Get-PageHeader -Size 1 .EXAMPLE ...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Get-WebPageTitle.ps1
Get-WebPageTitle.ps1
<# .Synopsis Returns current page title .DESCRIPTION Returns current page title .EXAMPLE $Title = Get-WebPageTitle .OUTPUTS string .COMPONENT WebDriver .FUNCTIONALITY WebTesting #> function Get-WebPageTitle { [CmdletBinding()] [OutputType([String])] Param () if ($Global:WebDrive...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Functions/Update-EnvPath.ps1
Update-EnvPath.ps1
<# .Synopsis Update the Environment Path Variable .DESCRIPTION Checks to see if the the path to add already exists and if not adds it otherwise just returns .PARAMETER Path Path to folder or exe to add to the Enviroment Path .EXAMPLE Update-EnvPath -Path C:\Path\to\add\to\Env\Path .INPUTS file pat...
PowerShellCorpus/PowerShellGallery/PSWebDriver/0.3.0.1/Tests/Start-WebDriver.Tests.ps1
Start-WebDriver.Tests.ps1
Get-Module WebDriver | Remove-Module Import-Module WebDriver -RequiredVersion 0.1.0.0 InModuleScope 'WebDriver' { Describe "Start-WebDriver" { Mock -CommandName Update-EnvPath -MockWith { Test-Path -Path $PSBoundParameters['Path'] } It "The Command Exists" { $( Get-Command -N...
PowerShellCorpus/PowerShellGallery/cWindowsErrorReporting/1.1/DSCResources/cWindowsErrorReporting/ResourceDesignerScripts/GeneratecWindowsErrorReporting.ps1
GeneratecWindowsErrorReporting.ps1
$State = New-xDscResourceProperty -Name 'State' -Type 'String' -Attribute Key -ValidateSet 'Enabled','Disabled' New-xDscResource -Name cWindowsErrorReporting -Property $State -ModuleName cWindowsErrorReporting -FriendlyName cWindowsErrorReporting -Path "C:\Git\DscModules\"
PowerShellCorpus/PowerShellGallery/cWindowsErrorReporting/1.1/Examples/Sample_cWindowsErrorReporting.ps1
Sample_cWindowsErrorReporting.ps1
$DevEnvironment = @{ AllNodes = @( @{ NodeName = "Localhost" } ) } Configuration DisableWER { param() Import-DscResource -ModuleName "cWindowsErrorReporting" Node $AllNodes.NodeName { cWindowsErrorReporting Disabled { State = "Disab...
PowerShellCorpus/PowerShellGallery/SCOrchDev-SQL/2.1.0/SCOrchDev-SQL.tests.ps1
SCOrchDev-SQL.tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $manifestPath = "$here\SCOrchDev-SQL.psd1" Import-Module SCOrchDev-SQL -Force Describe -Tags 'VersionChecks' 'SCOrchDev-SQL manifest' { $script:manifest = $null It 'has a valid manifest' { { $script:manifest = Test-ModuleMani...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Get-ClonedObject.ps1
Get-ClonedObject.ps1
# Idea from http://stackoverflow.com/questions/7468707/deep-copy-a-dictionary-hashtable-in-powershell # borrowed from http://stackoverflow.com/questions/8982782/does-anyone-have-a-dependency-graph-and-topological-sorting-code-snippet-for-pow function Get-ClonedObject { param($DeepCopyObject) $memStream = new-o...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Sort-PSDeployment.ps1
Sort-PSDeployment.ps1
function Sort-PSDeployment { [cmdletbinding()] param( [object[]]$Deployments ) $Order = @{} Foreach($Deployment in $Deployments) { if($Deployment.Dependencies.DeploymentName) { if(-not $Order.ContainsKey($Deployment.DeploymentName)) { ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Validate-DeploymentParameters.ps1
Validate-DeploymentParameters.ps1
function Validate-DeploymentParameters { [cmdletbinding()] param( [string[]]$Required, [string[]]$Parameters ) foreach($RequiredParam in $Required) { if($Parameters -notcontains $RequiredParam) { return $false } } $true }
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Get-TaggedDeployment.ps1
Get-TaggedDeployment.ps1
Function Get-TaggedDeployment { param( [object[]]$Deployment, [string[]]$Tags ) # Only return deployment with all specified tags foreach($Deploy in $Deployment) { $Include = $False foreach($Tag in @($Tags)) { if($Deploy.Tags -contains $Tag) ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Resolve-DeployScripts.ps1
Resolve-DeployScripts.ps1
# Borrowed from Pester and stripped down # This might be overkill function Resolve-DeployScripts { param ([object[]] $Path, [bool]$Recurse = $True) $resolvedScriptInfo = @( foreach ($object in $Path) { $unresolvedPath = [string] $object if ($unresolvedPath -notmatch '[\...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Add-ObjectDetail.ps1
Add-ObjectDetail.ps1
function Add-ObjectDetail { <# .SYNOPSIS Decorate an object with - A TypeName - New properties - Default parameters .DESCRIPTION Helper function to decorate an object with - A TypeName - New properties - Default paramet...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Get-PropertyOrder.ps1
Get-PropertyOrder.ps1
#function to extract properties Function Get-PropertyOrder { <# .SYNOPSIS Gets property order for specified object .DESCRIPTION Gets property order for specified object .PARAMETER InputObject A single object to convert to an array of property value pairs. .PARAMETER Member...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Test-TargetOnVM.ps1
Test-TargetOnVM.ps1
Function Test-Target { param( $Target, $Session ) Invoke-Command -Session $Session -ScriptBlock { Test-Path -Path $using:Target -PathType Container } }
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Sort-WithCustomList.ps1
Sort-WithCustomList.ps1
# Thanks to https://gallery.technet.microsoft.com/scriptcenter/Sort-With-Custom-List-07b1d93a Function Sort-ObjectWithCustomList { Param ( [parameter(ValueFromPipeline=$true)] [PSObject] $InputObject, [parameter(Position=1)] [String] $Property, [parameter()]...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Start-ConsoleProcess.ps1
Start-ConsoleProcess.ps1
<# .Synopsis Launch console process, pipe strings to its StandardInput and get resulting StandardOutput/StandardError streams and exit code. .Description This function will start console executable, pipe any user-specified strings to it and capture StandardOutput/StandardError streams and exit c...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/New-TargetOnVM.ps1
New-TargetOnVM.ps1
Function New-Target { param($Target, $Session) $null = Invoke-Command -Session $session -ScriptBlock { New-Item -Path $Using:Target -ItemType Directory -Force } }
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Get-Hash.ps1
Get-Hash.ps1
function Get-Hash { <# .SYNOPSIS Calculates the hash on a given file based on the seleced hash algorithm. .DESCRIPTION Calculates the hash on a given file based on the seleced hash algorithm. Multiple hashing algorithms can be used with this command. ....
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Get-ParameterName.ps1
Get-ParameterName.ps1
Function Get-ParameterName { #Get parameter names for a specific command [cmdletbinding()] param( [string]$command, [string]$parameterset = $null, [string[]]$excludeDefault = $( "Verbose", "Debug", "ErrorAction", ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Invoke-Robocopy.ps1
Invoke-Robocopy.ps1
<# .Synopsis Wrapper function for robocopy.exe .Parameter Path String. Source path. You can use relative path. .Parameter Destination Array of destination paths. You can use relative paths. .Parameter ArgumentList Array of additional arguments for robocopy.exe .Parameter Retry Integer. Number of...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/Get-TopologicalSort.ps1
Get-TopologicalSort.ps1
# Thanks to http://stackoverflow.com/questions/8982782/does-anyone-have-a-dependency-graph-and-topological-sorting-code-snippet-for-pow # Input is a hashtable of @{ID = @(Depended,On,IDs);...} function Get-TopologicalSort { param( [Parameter(Mandatory = $true, Position = 0)] [hashtable] $edgeList ) #...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/PSYaml/ConvertFrom-Yaml.ps1
ConvertFrom-Yaml.ps1
function ConvertFrom-Yaml { <# .SYNOPSIS Convert a yaml file or string into a PowerShell object .PARAMETER Path Path to a yaml document .PARAMETER Text Yaml string to be converted .EXAMPLE $Yaml = ConvertFrom-Yaml -path C:\GitHub\PSYaml\sample.yml $Ya...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/PSYaml/Private/Shadow-Copy.ps1
Shadow-Copy.ps1
function Shadow-Copy($file, $shadowPath = "$($env:TEMP)\poweryaml\shadow") { if (-not (Test-Path $shadowPath ) ) { New-Item $shadowPath -ItemType directory | Out-Null } try { Copy-Item $file $shadowPath -Force -ErrorAction SilentlyContinue } catch { "Attempted to write over loc...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/PSYaml/Private/YamlDotNet-Integration.ps1
YamlDotNet-Integration.ps1
function Load-YamlDotNetLibraries([string] $dllPath, $shadowPath = "$($env:TEMP)\poweryaml\shadow") { gci $dllPath | % { $shadow = Shadow-Copy -File $_.FullName -ShadowPath $shadowPath Add-Type -Path $Shadow } | Out-Null } #Get-YamlStream returned a document. Not sure why. Swapping code directl...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/PSYaml/Private/Casting.ps1
Casting.ps1
function Add-CastingFunctions($value) { if ($PSVersionTable.PSVersion -ge "3.0") { return $value } return Add-CastingFunctionsForPosh2($value) } function Add-CastingFunctionsForPosh2($value) { $parms = @{MemberType = 'ScriptMethod'; Passthru = $True; ErrorAction = 'SilentlyContinue'} Add-Member @p...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Private/PSYaml/Private/Validator-Functions.ps1
Validator-Functions.ps1
function Validate-yamlFile([string] $file) { Try { #Resolve relative paths... Thanks Oisin! http://stackoverflow.com/a/3040982/3067642 $file = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($file) } Catch { Write-Error "Could not resolve path for...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Tagged.ps1
Tagged.ps1
Function Tagged { <# .SYNOPSIS Specify tags for deployments in a 'By' block .DESCRIPTION Specify tags for deployments in a 'By' block This is not intended to be used anywhere but in a *.PSDeploy.ps1 file. It is included here for intellisense support .PARAMETER Tags One...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Deploy.ps1
Deploy.ps1
Function Deploy { <# .SYNOPSIS Specify deployment details in a PSDeploy.ps1 .DESCRIPTION Specify deployment details in a PSDeploy.ps1 You may specify multiple Deploy blocks in a single PSDeploy.ps1, as long as their names are unique. This is not intended to be used anywher...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Get-PSDeploymentScript.ps1
Get-PSDeploymentScript.ps1
Function Get-PSDeploymentScript { <# .SYNOPSIS Get deployment types and associated scripts .DESCRIPTION Get deployment types and associated scripts Checks PSDeploy.yml, verifies deployment scripts exist, returns a hashtable of these. .PARAMETER Path Pat...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Invoke-PSDeployment.ps1
Invoke-PSDeployment.ps1
Function Invoke-PSDeployment { <# .SYNOPSIS Invoke a deployment .DESCRIPTION Invoke a deployment Takes output from Get-PSDeployment, or a deployment yml path. Runs deployment scripts depending on each deployment's type. If a deployment is not found, we continue pr...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Initialize-PSDeployment.ps1
Initialize-PSDeployment.ps1
function Initialize-PSDeployment { <# .SYNOPSIS Creates a sample deployment config file, yaml or *.psdeploy.ps1 .DESCRIPTION Creates a sample deployment config file, yaml or *.psdeploy.ps1. Use this Function to put a sample file in a Directory. One can then edit the ps1 or ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Get-PSDeploymentType.ps1
Get-PSDeploymentType.ps1
Function Get-PSDeploymentType { <# .SYNOPSIS Get deployment types and related information .DESCRIPTION Get deployment types and related information Checks PSDeploy.yml for deployment types, verifies deployment scripts exist, gets help content for deployment scripts,...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Invoke-PSDeploy.ps1
Invoke-PSDeploy.ps1
Function Invoke-PSDeploy { <# .SYNOPSIS Invoke PSDeploy .DESCRIPTION Invoke PSDeploy Searches for .PSDeploy.ps1 files in the current and nested paths, and invokes their deployment See Get-Help about_PSDeploy for more information. .PARAMETER Path Path to a spec...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/To.ps1
To.ps1
Function To { <# .SYNOPSIS Specify targets in a 'By' block of a PSDeploy.ps1 .DESCRIPTION Specify targets in a 'By' block of a PSDeploy.ps1 This is not intended to be used anywhere but in a *.PSDeploy.ps1 file. It is included here for intellisense support .PARAMETER Targets ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/WithPreScript.ps1
WithPreScript.ps1
Function WithPreScript { <# .SYNOPSIS Specify a script to run before the deployment in a By block .DESCRIPTION Specify a script to run before the deployment in a By block Keep in mind: * This runs in the current scope using dot sourcing * A FromSource with multi...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/Get-PSDeployment.ps1
Get-PSDeployment.ps1
Function Get-PSDeployment { <# .SYNOPSIS Read a Deployment.yml file .DESCRIPTION Read a Deployment.yml file The resulting object contains these properties DeploymentSource = Path to the deployment.yml DeploymentName = Deployment name Deployme...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/By.ps1
By.ps1
Function By { <# .SYNOPSIS Specify details about the DeploymentType for deployments defined in a PSDeploy.ps1 .DESCRIPTION Specify details about the DeploymentType for deployments defined in a PSDeploy.ps1 This is not intended to be used anywhere but in a *.PSDeploy.ps1 file. It is...