full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/chethaa_manug7cr/artifacts/windows-chocolatey/ChocolateyPackageInstaller.ps1 | ChocolateyPackageInstaller.ps1 | <##################################################################################################
Description
===========
- This script does the following -
- installs chocolatey
- installs specified chocolatey packages
- This script generates logs in the following folder -
- %ALLUSERSP... |
PowerShellCorpus/Github/furkansarmusak_RepositoryPatternApp/RepositoryPattern/packages/EntityFramework.6.1.3/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
if (Get-Module | ?{ $_.Name -eq 'EntityFramework' })
{
Remove-Module EntityFramework
}
Import-Module (Join-Path $toolsPath EntityFramework.psd1)
# SIG # Begin signature block
# MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQ... |
PowerShellCorpus/Github/furkansarmusak_RepositoryPatternApp/RepositoryPattern/packages/EntityFramework.6.1.3/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
Initialize-EFConfiguration $project
Add-EFProvider $project 'System.Data.SqlClient' 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
Write-Host
Write-Host "Type 'get-help EntityFramework' to see all available Entity Framework comma... |
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_NewRepo_2017_4_15_16_5_16/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstorageprod.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source url: ... |
PowerShellCorpus/Github/OPSTestPPE_E2E_D_NewRepo_2017_3_24_13_58_25/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source u... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/Modernizr.2.6.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/Modernizr.2.6.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $modernizrFileName... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/Modernizr.2.6.2/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/EntityFramework.5.0.0/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
$importedModule = Get-Module | ?{ $_.Name -eq 'EntityFramework' }
if ($PSVersionTable.PSVersion -ge (New-Object Version @( 3, 0 )))
{
$thisModuleManifest = 'EntityFramework.PS3.psd1'
}
else
{
$thisModuleManifest = 'EntityFramework.psd1'
}
$thisModule... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/EntityFramework.5.0.0/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
function Invoke-ConnectionFactoryConfigurator($assemblyPath, $project)
{
$appDomain = [AppDomain]::CreateDomain(
'EntityFramework.PowerShell',
$null,
(New-Object System.AppDomainSetup -Property @{ ShadowCopyFiles = 'true' }))
... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/jQuery.UI.Combined.1.8.24/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $juiFileNameRegEx |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/jQuery.UI.Combined.1.8.24/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $juiFileNameRegEx ... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/jQuery.UI.Combined.1.8.24/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/jQuery.1.8.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Determine the file paths
$projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName
$origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName
if (Test-Path $projectIntelliSense... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/jQuery.1.8.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# VS 11 and above supports the new intellisense JS files
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/zhangsai521314_Grunt/Grunt_1基础使用/packages/jQuery.1.8.2/Tools/common.ps1 | common.ps1 | function Get-Checksum($file) {
$cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"
$fileInfo = Get-Item $file
trap { ;
continue } $stream = $fileInfo.OpenRead()
if ($? -eq $false) {
# Couldn't open file for reading
return $null
}
$bytes = $... |
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_NewRepo_2017_4_15_18_5_18/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstorageprod.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source url: ... |
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_Provision_2017_4_25_11_25_11/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstorageprod.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source url: ... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Unity.NuGet/NuGetPackage.ps1 | NuGetPackage.ps1 | Param (
[switch]$Publish
)
$ErrorActionPreference = "Stop"
$global:ExitCode = 1
function Write-Log {
#region Parameters
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline=$true)]
[array] $Messages,
[Parameter()] [ValidateSet("Error", "Warn", "Info")]
[string] $Level = "Info",... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Unity.NuGet/NuGetSetup.ps1 | NuGetSetup.ps1 | Param (
[string]$Url,
[string]$Base64EncodedMessage
)
$ErrorActionPreference = "Stop"
$ExitCode = 1
function Write-Log {
#region Parameters
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline=$true)]
[array] $Messages,
[Parameter()] [ValidateSet("Error", "Warn", "Info")]
[st... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Unity.NuGet/tools/init.ps1 | init.ps1 | # Runs the first time a package is installed in a solution, and every time the solution is opened.
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is instal... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Unity.NuGet/tools/uninstall.ps1 | uninstall.ps1 | # Runs every time a package is uninstalled
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is installed.
# $package is a reference to the package object.
... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Unity.NuGet/tools/install.ps1 | install.ps1 | # Runs every time a package is installed in a project
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is installed.
# $package is a reference to the packag... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Core.NuGet/NuGetPackage.ps1 | NuGetPackage.ps1 | Param (
[switch]$Publish
)
$ErrorActionPreference = "Stop"
$global:ExitCode = 1
function Write-Log {
#region Parameters
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline=$true)]
[array] $Messages,
[Parameter()] [ValidateSet("Error", "Warn", "Info")]
[string] $Level = "Info",... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Core.NuGet/NuGetSetup.ps1 | NuGetSetup.ps1 | Param (
[string]$Url,
[string]$Base64EncodedMessage
)
$ErrorActionPreference = "Stop"
$ExitCode = 1
function Write-Log {
#region Parameters
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline=$true)]
[array] $Messages,
[Parameter()] [ValidateSet("Error", "Warn", "Info")]
[st... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Core.NuGet/tools/init.ps1 | init.ps1 | # Runs the first time a package is installed in a solution, and every time the solution is opened.
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is instal... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Core.NuGet/tools/uninstall.ps1 | uninstall.ps1 | # Runs every time a package is uninstalled
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is installed.
# $package is a reference to the package object.
... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Core.NuGet/tools/install.ps1 | install.ps1 | # Runs every time a package is installed in a project
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is installed.
# $package is a reference to the packag... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Ninject.NuGet/NuGetPackage.ps1 | NuGetPackage.ps1 | Param (
[switch]$Publish
)
$ErrorActionPreference = "Stop"
$global:ExitCode = 1
function Write-Log {
#region Parameters
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline=$true)]
[array] $Messages,
[Parameter()] [ValidateSet("Error", "Warn", "Info")]
[string] $Level = "Info",... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Ninject.NuGet/NuGetSetup.ps1 | NuGetSetup.ps1 | Param (
[string]$Url,
[string]$Base64EncodedMessage
)
$ErrorActionPreference = "Stop"
$ExitCode = 1
function Write-Log {
#region Parameters
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline=$true)]
[array] $Messages,
[Parameter()] [ValidateSet("Error", "Warn", "Info")]
[st... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Ninject.NuGet/tools/init.ps1 | init.ps1 | # Runs the first time a package is installed in a solution, and every time the solution is opened.
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is instal... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Ninject.NuGet/tools/uninstall.ps1 | uninstall.ps1 | # Runs every time a package is uninstalled
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is installed.
# $package is a reference to the package object.
... |
PowerShellCorpus/Github/Hallmanac_ServiceLocator/src/Hallmanac.ServiceLocator/Hallmanac.ServiceLocator.Ninject.NuGet/tools/install.ps1 | install.ps1 | # Runs every time a package is installed in a project
param($installPath, $toolsPath, $package, $project)
# $installPath is the path to the folder where the package is installed.
# $toolsPath is the path to the tools directory in the folder where the package is installed.
# $package is a reference to the packag... |
PowerShellCorpus/Github/ubergiek_hydracode/esiprotection/esi-protection.ps1 | esi-protection.ps1 | [CmdletBinding()]
param([parameter(Mandatory=$true)]$EsiConfig,[switch]$RemoveSnapshotsOnly,[switch]$NoImageAccess)
$script:ScriptVersion = '1.0.1109.15'
$debug = 1
if ($debug -eq 1) { $VerbosePreference = 'continue' } else { $VerbosePreference = 'SilentlyContinue' }
########################################... |
PowerShellCorpus/Github/ubergiek_hydracode/esiprotection/refresh-xtremioSnapshotSet.ps1 | refresh-xtremioSnapshotSet.ps1 | ######## Remove-PreviousSnapshots ###########################################################################
function Refresh-XtremIOSnapshots
{
#Define esiSnapshot suffix and protected XtremIO Consistency Group
$esiSnapshotSet = $null
$drArrayName = 'clt-dr-xio-bbt-xio-20TB'
$xtremioSnapshotSuff... |
PowerShellCorpus/Github/ubergiek_hydracode/esiprotection/xtremio/esiprotection.ps1 | esiprotection.ps1 | [CmdletBinding()]
param([parameter(Mandatory=$true)]$EsiConfig,[switch]$RemoveSnapshotsOnly,[switch]$NoImageAccess)
$script:ScriptVersion = '1.1.04.15.16'
$debug = 1
if ($debug -eq 1) { $VerbosePreference = 'continue' } else { $VerbosePreference = 'SilentlyContinue' }
#######################################... |
PowerShellCorpus/Github/ubergiek_hydracode/esiprotection/production/vnx/Run-EsiProtectionVnx.ps1 | Run-EsiProtectionVnx.ps1 | [CmdletBinding()]
param([parameter(Mandatory=$true)]$EsiConfig,[switch]$RemoveSnapshotsOnly,[switch]$NoImageAccess)
$script:ScriptVersion = '1.0.1109.15'
$debug = 1
if ($debug -eq 1) { $VerbosePreference = 'continue' } else { $VerbosePreference = 'SilentlyContinue' }
########################################... |
PowerShellCorpus/Github/ubergiek_hydracode/esiprotection/production/xio/Run-EsiProtectionXio.ps1 | Run-EsiProtectionXio.ps1 | [CmdletBinding()]
param([parameter(Mandatory=$true)]$EsiConfig,[switch]$RemoveSnapshotsOnly,[switch]$NoImageAccess,[switch]$CreateInitialSnapshotSet)
$script:ScriptVersion = '1.1.04.29.16'
$debug = 1
if ($debug -eq 1) { $VerbosePreference = 'continue' } else { $VerbosePreference = 'SilentlyContinue' }
#####... |
PowerShellCorpus/Github/edwcmiller3_Run-AvigilonApplianceSetup.ps1/Run-AvigilonApplianceSetup.ps1 | Run-AvigilonApplianceSetup.ps1 | <#
.SYNOPSIS
Run-AvigilonApplianceSetup: Script to automate video appliance configuration.
.DESCRIPTION
Automates the configuration of Avigilon HD video appliances.
WARNING: Has only been tested on Avigilon HDVAs.
.NOTES
Version: 3.0
Author: Edward C Miller III
Creati... |
PowerShellCorpus/Github/twttao_Git-credential-daily-cleaner/deploy.ps1 | deploy.ps1 | $action = New-ScheduledTaskAction -Execute 'Powershell.exe'`
-Argument '-NoProfile -WindowStyle Hidden -File "C:\CleanGitWincred.ps1"'
$trigger = New-ScheduledTaskTrigger -Daily -At 12am
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Clean Git Credential" -Description "" |
PowerShellCorpus/Github/twttao_Git-credential-daily-cleaner/CleanGitWincred.ps1 | CleanGitWincred.ps1 | $result = cmdkey /list | Out-String
$prefixIdx = $result.IndexOf("git:https://")
$suffixIdx = $result.IndexOf("@github.com")
if($prefixIdx -ne -1 -and $suffixIdx -ne -1) {
$userNameStartIdx = $result.IndexOf("git:https://") + 12
$userNameEndIdx = $result.IndexOf("@github.com") - 1
$userNameLength = $userNa... |
PowerShellCorpus/Github/elliot-labs_Spigot-Auto-Updater/Update-Spigot.ps1 | Update-Spigot.ps1 | param([string]$Verbosity="Normal", [string]$WindowName = "Spigot Server", [string]$ServerDir = "C:\Some\Path\", [string]$ServerStartScript = "Start Server.bat", [string]$BuildDir = "C:/Some/Other/Path/", [string]$BuildVersion = "latest", [string]$GitBashLocation = "C:\Program Files\Git\bin\bash.exe")
# Acceptable Ve... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-LBDeprovisionServer.ps1 | Tool-LBDeprovisionServer.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Config-SSH.ps1 | Config-SSH.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-LBDeprovisionSite.ps1 | Tool-LBDeprovisionSite.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-WindowsDeprovisionServer.ps1 | Tool-WindowsDeprovisionServer.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-LBCompileConfigAndReload.ps1 | Tool-LBCompileConfigAndReload.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-ProvisionSite.ps1 | Tool-ProvisionSite.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-WindowsProvisionServer.ps1 | Tool-WindowsProvisionServer.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-LBProvisionSite.ps1 | Tool-LBProvisionSite.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-DeprovisionAdditionalSite.ps1 | Tool-DeprovisionAdditionalSite.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-AutoScaleLocal.ps1 | Tool-AutoScaleLocal.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-ProvisionAdditionalSite.ps1 | Tool-ProvisionAdditionalSite.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-AutoScale.ps1 | Tool-AutoScale.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/MattMills_SimpleDotNetPaaS/Windows/Tool-LBProvisionServer.ps1 | Tool-LBProvisionServer.ps1 | # SimpleDotNetPaaS
#
# Copyright (C) 2014 Matt Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
PowerShellCorpus/Github/ghostsquad_PoshBox/TestCommon.ps1 | TestCommon.ps1 | $ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$ModuleName = [System.IO.Path]::GetFileName((Split-Path $MyInvocation.ScriptName -Parent)) -Replace '.Test',''
$private:modulePathRelative = (Join-Path (Split-Path $MyInvocation.MyCommand.Path -Parent) "$ModuleName\$ModuleName.psd1")
$private:modulePath... |
PowerShellCorpus/Github/ghostsquad_PoshBox/Run-Tests.ps1 | Run-Tests.ps1 | param (
[string]$TestName = "*",
[switch]$Debug,
[switch]$CurrentContext = $false
)
$ErrorActionPreference = "Stop"
if($Debug){
$DebugPreference = "Continue"
}
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
if($currentContext) {
Import-Module Pester
Invoke-Pester -Test... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Dev/Replace-TabsWithSpaces.ps1 | Replace-TabsWithSpaces.ps1 | function Replace-TabsWithSpaces {
[cmdletbinding()]
param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[string]$path
)
process {
$path = Resolve-Path $path
$lines = [Io.File]::ReadAllLines($path) | %{ $_ -replace "`t", ' ' }
[Io.File]::Writ... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Dev/Fix-SourceFiles.ps1 | Fix-SourceFiles.ps1 | function Fix-SourceFiles {
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,ValueFromPipeLine=$true)]
[System.Io.FileInfo]$fileInfo
)
process {
Write-Verbose "fixing up $($fileinfo.Fullname)"
Write-Verbose "Removing BOM"
Set-EncodingUtf8NoBom $fileInfo... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Dev/Remove-ExcessWhitespace.ps1 | Remove-ExcessWhitespace.ps1 | function Remove-ExcessWhitespace {
[cmdletbinding()]
param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[string]$path
)
process {
$path = Resolve-Path $path
$lines = [Io.File]::ReadAllLines($path) | % { $_.TrimEnd() }
[Io.File]::WriteAllLines(... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Dev/Set-EncodingUtf8NoBom.ps1 | Set-EncodingUtf8NoBom.ps1 | function Set-EncodingUtf8NoBom {
[cmdletbinding()]
param (
[parameter(Mandatory=$true,ValueFromPipeline=$true)]
[string]$path
)
process {
$MyFile = Get-Content $path
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($False)
[System.IO.File]::Writ... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Get-CurrentFunctionName.ps1 | Get-CurrentFunctionName.ps1 | function Get-CurrentFunctionName {
return (Get-Variable MyInvocation -Scope 1).Value.MyCommand.Name;
}
|
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/New-PSCredential.ps1 | New-PSCredential.ps1 | function New-PSCredential {
param (
[string]$UserName,
[string]$Password
)
Guard-ArgumentNotNullOrEmpty 'UserName' $UserName
Guard-ArgumentNotNullOrEmpty 'Password' $Password
$secpasswd = ConvertTo-SecureString $Password -AsPlainText -Force
return New-Object System.Ma... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/New-PSObject.ps1 | New-PSObject.ps1 | function New-PSObject {
param(
[System.Collections.Hashtable]$Property
)
return (New-Object PSObject -Property $Property)
} |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Guard-FileExists.ps1 | Guard-FileExists.ps1 | function Guard-FileExists {
param(
[string]$ArgumentName = $(throw 'parameter -ArgumentName is required.'),,
[string]$FileName
)
Guard-ArgumentNotNullOrEmpty $ArgumentName $FileName
Guard-ArgumentValid $ArgumentName ('File not found: {0}' -f $FileName) ([System.IO.File]::Exists($... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Add-TypeAccelerator.ps1 | Add-TypeAccelerator.ps1 | ##############################################################################
#.SYNOPSIS
# Add a type accelerator to the current session.
#
#.DESCRIPTION
# The Add-TypeAccelerator function allows you to add a simple type accelerator
# (like [regex]) for a longer type (like [System.Text.RegularExpressions.Regex])... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/ConvertTo-HashTable.ps1 | ConvertTo-HashTable.ps1 | function ConvertTo-HashTable {
param (
[parameter(ValueFromPipeline)]
[PSObject]$inputObject
)
process {
$hashtable = @{}
foreach($property in $inputObject.psobject.properties) {
[Void]$hashtable.Add($property.Name, $property.Value)
}
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Attach-PSNote.ps1 | Attach-PSNote.ps1 | function Attach-PSNote {
param (
[PSObject]$InputObject
, [string]$Name
, $Value
, [switch]$PassThru
)
Guard-ArgumentNotNull 'InputObject' $InputObject
Guard-ArgumentNotNull 'Name' $Name
if ($InputObject.psobject.members[$Name] -ne $null) {
throw... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Attach-PSProperty.ps1 | Attach-PSProperty.ps1 | function Attach-PSProperty {
param (
[PSObject]$InputObject
, [string]$Name
, [scriptblock]$Get
, [scriptblock]$Set
, [switch]$Override
, [switch]$PassThru
)
Guard-ArgumentNotNull 'InputObject' $InputObject
Guard-ArgumentNotNull 'Name' $Name
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Guard-ArgumentNotNull.ps1 | Guard-ArgumentNotNull.ps1 | function Guard-ArgumentNotNull {
param(
[string]$ArgumentName,
$ArgumentValue
)
if($ArgumentValue -eq $null) {
throw (New-Object System.ArgumentNullException($ArgumentName))
}
} |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Get-Delegate.ps1 | Get-Delegate.ps1 | # http://poshcode.org/3327
#requires -version 3
function Get-Delegate {
<#
.SYNOPSIS
Create an action[] or func[] delegate for a psmethod reference.
.DESCRIPTION
Create an action[] or func[] delegate for a psmethod reference.
.PARAMETER Method
A PSMethod reference to create a delegate for. This parameter acc... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/New-Lazy.ps1 | New-Lazy.ps1 | #Describe "Lazy" {
# $lazy = New-Lazy { return "test" }
#
# It "Should not have a value evaluated" {
# $lazy.IsValueCreated.Should.Be($false)
# }
#
# It "Should get lazy value" {
# $lazy.Value.Should.Be("test")
# $lazy.IsValueCreated.Should.Be($true)
# }
#}
function New... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/New-DynamicModuleBuilder.ps1 | New-DynamicModuleBuilder.ps1 | function New-DynamicModuleBuilder {
# .SYNOPSIS
# Creates a new assembly and a dynamic module within the current AppDomain.
# .DESCRIPTION
# Prepares a System.Reflection.Emit.ModuleBuilder class to allow construction of dynamic types.
# The ModuleBuilder is created to allow the creation o... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Guard-ArgumentValid.ps1 | Guard-ArgumentValid.ps1 | function Guard-ArgumentValid {
param(
[string]$ArgumentName = $(throw 'parameter -ArgumentName is required.'),
[string]$Message = "Argument Failed Validation",
[bool]$Test
)
if(-not $Test) {
throw (New-Object System.ArgumentException($Message, $ArgumentName))
}
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Guard-ArgumentNotNullOrEmpty.ps1 | Guard-ArgumentNotNullOrEmpty.ps1 | function Guard-ArgumentNotNullOrEmpty {
param(
[string]$ArgumentName,
$ArgumentValue
)
Guard-ArgumentNotNull $ArgumentName $ArgumentValue
if($ArgumentValue -is [System.Collections.IEnumerable]) {
if (!$ArgumentValue.GetEnumerator().MoveNext()) {
throw (New... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Invoke-Using.ps1 | Invoke-Using.ps1 | # http://support-hq.blogspot.com/2011/07/using-clause-for-powershell.html
function Invoke-Using {
param (
[System.IDisposable]$InputObject = $(throw "The parameter -inputObject is required."),
[ScriptBlock]$ScriptBlock = $(throw "The parameter -scriptBlock is required.")
)
Try {
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Attach-PSScriptMethod.ps1 | Attach-PSScriptMethod.ps1 | function Attach-PSScriptMethod {
param (
[PSObject]$InputObject
, [string]$Name
, [scriptblock]$ScriptBlock
, [switch]$Override
, [switch]$PassThru
)
Guard-ArgumentNotNull 'InputObject' $InputObject
Guard-ArgumentNotNull 'Name' $Name
Guard-Argument... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Create-DirectoryIfNotExists.ps1 | Create-DirectoryIfNotExists.ps1 | function Create-DirectoryIfNotExists {
param (
[string]$Path
)
[Void][System.IO.Directory]::CreateDirectory($Path)
} |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/New-GenericObject.ps1 | New-GenericObject.ps1 | #http://www.leeholmes.com/blog/2006/08/18/creating-generic-types-in-powershell/
function New-GenericObject {
## New-GenericObject.ps1
## Creates an object of a generic type:
##
## Usage:
##
## # Simple generic collection
## $list = New-GenericObject System.Collections.ObjectModel... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Assert-ScriptBlockParametersEqual.ps1 | Assert-ScriptBlockParametersEqual.ps1 | function Assert-ScriptBlockParametersEqual {
param (
[ScriptBlock]$x,
[ScriptBlock]$y,
[Switch]$AssertNamesMatch
)
if($x -eq $null -or $y -eq $null) {
throw (New-Object ParametersNotEquivalentException('X or Y is Null'))
}
$xParams = @(?: {$x.Ast.ParamBlo... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Invoke-Generic.ps1 | Invoke-Generic.ps1 | function Invoke-Generic {
#.Synopsis
# Invoke Generic method definitions via reflection:
[CmdletBinding()]
param(
[Parameter(Position=0,ValueFromPipelineByPropertyName=$true)]
[Alias('On','Type')]
$InputObject,
[Parameter(Position=1,ValueFromPipelineByPropertyName=... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/New-Enum.ps1 | New-Enum.ps1 | function New-Enum {
# .SYNOPSIS
# Creates a new enum (System.Enum) from a hashtable using an existing dynamic module.
# .DESCRIPTION
# New-Enum dynamically creates an enum with the specified name (and namespace).
#
# A hashtable is used to populate the enum. All values passed in via ... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Guard-DirectoryExists.ps1 | Guard-DirectoryExists.ps1 | function Guard-DirectoryExists {
param(
[string]$ArgumentName = $(throw 'parameter -ArgumentName is required.'),
[string]$DirectoryName
)
Guard-ArgumentNotNullOrEmpty $ArgumentName $DirectoryName
Guard-ArgumentValid $ArgumentName ('Directory not found: {0}' -f $DirectoryName) ([S... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/PSCustomObjectExtensions.ps1 | PSCustomObjectExtensions.ps1 | # Usage
# $p.PSAddMember("q1","Value1")
# $p.PSAddMember("q3",{"*"* $this.Threads.Count},"ScriptProperty")
# $hash = @{q3=4; q4="Q4"; q5=(gsv alg)}
# $p.PSAddMember($hash)
Update-TypeData -TypeName System.Object `
-MemberType ScriptMethod `
-MemberName PSAddNoteProperty `
-Value {
switch ... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/New-Closure.ps1 | New-Closure.ps1 | function New-Closure {
#.SYNOPSIS
# A more fine grained approach to capturing variables than GetNewClosure
#.EXAMPLE
# $acc = New-Closure @{t = 0} {param($v = 1) $t += $v; $t} ; & $acc 10 ; & $acc
# 10
# 11
[OutputType([scriptblock])]
[CmdletBinding()]
param(
[System.Collections.IDictionary]$Variable... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core/Get-DelegateType.ps1 | Get-DelegateType.ps1 | #http://www.exploit-monday.com/2012/05/accessing-native-windows-api-in.html
# Create a delegate type with CalcFunction function signature
# $CalcFunctionDelegateType = Get-DelegateType @([Int32], [Int32]) ([Int32])
# This scriptblock will serve as the callback function
# $Action = {
# # Define params in place ... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.CredentialManagement/Set-ManagedCredential.ps1 | Set-ManagedCredential.ps1 | function Set-ManagedCredential {
[cmdletbinding(DefaultParameterSetName="Manual")]
param (
[Parameter(ParameterSetName="Manual")]
[Parameter(ParameterSetName="PSCredential")]
[string]$Target = $(throw "missing parameter -Target"),
[Parameter(ParameterSetName="Manual")]
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.CredentialManagement/Get-ManagedCredential.ps1 | Get-ManagedCredential.ps1 | function Get-ManagedCredential {
param (
[string]$Target
)
$managedCredential = new-object CredentialManagement.Credential
$managedCredential.Target = $Target
if($managedCredential.Load()) {
return (New-PSCredential $managedCredential.Username $managedCredential.Password)
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.CredentialManagement/Remove-ManagedCredential.ps1 | Remove-ManagedCredential.ps1 | function Remove-ManagedCredential {
param (
[string]$Target = $(throw "missing parameter -Target")
)
$managedCredential = new-object CredentialManagement.Credential
$managedCredential.Target = $Target
Invoke-Using $managedCredential {
if(-not $managedCredential.Exists())
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.CredentialManagement.Test/Remove-ManagedCredential.Tests.ps1 | Remove-ManagedCredential.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
# here : /branch/tests/Poshbox.Test
. "$here\..\TestCommon.ps1"
Describe "Remove-ManagedCredential" {
It "Removes a credential from Windows Credential Manager if it exists" {
$target = [Guid]::NewGuid().ToString()
$actualCreds = new-obj... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.CredentialManagement.Test/Get-ManagedCredential.Tests.ps1 | Get-ManagedCredential.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
# here : /branch/tests/Poshbox.Test
. "$here\..\TestCommon.ps1"
Describe "Get-ManagedCredential" {
It "Gets credentials from Windows Credential Manager" {
$expectedUserName = "testuser"
$expectedPassword = "pass123"
$target = [... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.CredentialManagement.Test/Set-ManagedCredential.Tests.ps1 | Set-ManagedCredential.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
# here : /branch/tests/Poshbox.Test
. "$here\..\TestCommon.ps1"
Describe "Set-ManagedCredential" {
It "Add credential to Windows Credential Manager if it does not exist" {
$expectedUserName = "testuser"
$expectedPassword = "pass123"
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.PSClass.Test/New-PSClass.Tests.ps1 | New-PSClass.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
# here : /branch/tests/Poshbox.Test
. "$here\..\TestCommon.ps1"
function IAmOutside {
return "I Am Outside"
}
Describe "New-PSClass" {
Context "GivenStaticMethod" {
It "runs provided script block" {
$testClass = New-PSClass... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.PSClass.Test/New-PSClassMock.Tests.ps1 | New-PSClassMock.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\..\TestCommon.ps1"
Describe "New-PSClassMock" {
Context "Method Mocking" {
BeforeEach {
$testClass = New-PSClass "testClass" {
method "foo" {
throw "not implemented"
}
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.PSClass/New-PSClassMock.ps1 | New-PSClassMock.ps1 | function New-PSClassMock {
param (
[PSObject]$Class = $( Throw "parameter -Class is required." )
, [Switch]$Strict
)
Guard-ArgumentNotNull 'Class' $Class
$mock = New-PSObject
Attach-PSNote $mock '_strict' ([bool]$Strict)
Attach-PSNote $mock '_originalClass' $Class
... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.PSClass/New-PSClass.ps1 | New-PSClass.ps1 | function New-PSClass {
param (
[string]$ClassName
, [scriptblock]$Definition
, [psobject]$Inherit
)
Guard-ArgumentNotNullOrEmpty 'ClassName' $ClassName
Guard-ArgumentNotNull 'Definition' $Definition
#region Class Definition Functions
#============================... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging/Log-Info.ps1 | Log-Info.ps1 | function Log-Info{
param(
[Parameter(Mandatory=$false,Position=1)]
[object]$object,
[Parameter(Mandatory=$false,Position=2)]
[Exception]$exception,
[Parameter(Mandatory=$false,ValueFromPipeline=$true,Position=3)]
[log4net.ILog]$logger
)
if($logger -... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging/Log-Debug.ps1 | Log-Debug.ps1 | function Log-Debug {
param(
[Parameter(Mandatory=$false,Position=1)]
[object]$object,
[Parameter(Mandatory=$false,Position=2)]
[Exception]$exception,
[Parameter(Mandatory=$false,ValueFromPipeline=$true,Position=3)]
[log4net.ILog]$logger
)
if($logger... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging/Add-FileLogAppender.ps1 | Add-FileLogAppender.ps1 | function Add-FileLogAppender{
[CmdletBinding()]
param (
[log4net.Core.Level]$logLevelThreshold = [log4net.Core.Level]::Info,
[string]$logPattern = "%date{ISO8601} [%thread] %-5level [%ndc] - %message%newline",
[string]$logPath = (Join-Path $PSScriptRoot "logs"),
[string]$lo... |
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging/Log-Error.ps1 | Log-Error.ps1 | function Log-Error {
param(
[Parameter(Mandatory=$false,Position=1)]
[object]$object,
[Parameter(Mandatory=$false,Position=2)]
[Exception]$exception,
[Parameter(Mandatory=$false,ValueFromPipeline=$true,Position=3)]
[log4net.ILog]$logger
)
if($logger... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.