full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging/Log-Warning.ps1
Log-Warning.ps1
function Log-Warning { 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($logg...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging/Log-Fatal.ps1
Log-Fatal.ps1
function Log-Fatal { 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/AddConsoleLogAppender.ps1
AddConsoleLogAppender.ps1
function AddConsoleLogAppender { param( [log4net.Core.Level]$logLevelThreshold = [log4net.Core.Level]::Debug, [string]$logPattern = "%date{ISO8601} [%thread] %-5level [%ndc] - %message%newline" ) function AddMapping { [cmdletbinding()] param( [Parameter(...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging/Get-Logger.ps1
Get-Logger.ps1
function Get-Logger { [cmdletbinding()] param( [string]$loggerName, [int]$callStackStart = 1 ) function TryGetLogger([log4net.ILog[]]$loggers, [string]$loggerName, [ref]$logger){ foreach($ilog in $loggers){ if($ilog.Logger.Name -eq $loggerName){ ...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.UI/New-ConsoleTable.ps1
New-ConsoleTable.ps1
function New-ConsoleTable { param( [int]$columns = 0, [int]$rows = 0, [int]$defaultCellWidth = 10, [int]$defaultCellVerticalPadding = 0, [switch]$NoSave = $false, [switch]$NoBorders = $false, [switch]$NoHeader = $false ...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Log-Debug.Tests.ps1
Log-Debug.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $testFileName = $MyInvocation.MyCommand.Path $testBasePath = "$here\LogTestBase.ps1" . "$here\..\TestCommon.ps1" . $testBasePath Describe 'Log-Debug' { $action = { Log-Debug "test msg" } $logger = Get-Logger WithAddedFileAppender "Debug" "t...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Log-Info.Tests.ps1
Log-Info.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $testFileName = $MyInvocation.MyCommand.Path $testBasePath = "$here\LogTestBase.ps1" . "$here\..\TestCommon.ps1" . $testBasePath Describe 'Log-Info' { $logger = Get-Logger $action = { Log-Info "test msg" } WithAddedFileAppender "Info" "test...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/ConsoleAppender.Tests.ps1
ConsoleAppender.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "AddConsoleAppender" { It "adds console appender to root logger on load of PoshBox" { $appenders = @([log4net.LogManager]::GetAllRepositories()[0].Root.Appenders) ...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Get-Logger.Tests.ps1
Get-Logger.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $testFileNameWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension((Split-Path -Leaf $MyInvocation.MyCommand.Path)) $testFileName = $MyInvocation.MyCommand.Path $fakeFunctionFilePath = "$here\Fakes\FakeFunctionFile.ps1" . $fakeFunctionFilePath . "$...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Log-Error.Tests.ps1
Log-Error.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $testFileName = $MyInvocation.MyCommand.Path $testBasePath = "$here\LogTestBase.ps1" . "$here\..\TestCommon.ps1" . $testBasePath Describe 'Log-Error' { $logger = Get-Logger $action = { Log-Error "test msg" } WithAddedFileAppender "Error" "t...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Add-FileLogAppender.Tests.ps1
Add-FileLogAppender.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Add-FileLogAppender" { $logger = Get-Logger $logPath = (Convert-Path "TestDrive:\") Context "No parameters" { It "Adds file appender" { $appenders...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/LogTestBase.ps1
LogTestBase.ps1
function WithAddedFileAppender { param( [string]$logType, [string]$expectedMessage, [scriptblock]$action, [log4net.ILog]$logger ) Context 'With added file appender' { $logPath = (Convert-Path "TestDrive:\") $logFileName = [System.IO.Path]::GetFileNa...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Log-Fatal.Tests.ps1
Log-Fatal.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $testFileName = $MyInvocation.MyCommand.Path $testBasePath = "$here\LogTestBase.ps1" . "$here\..\TestCommon.ps1" . $testBasePath Describe 'Log-Fatal' { $logger = Get-Logger $action = { Log-Fatal "test msg" } WithAddedFileAppender "Fatal" "t...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Log-Warning.Tests.ps1
Log-Warning.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $testFileName = $MyInvocation.MyCommand.Path $testBasePath = "$here\LogTestBase.ps1" . "$here\..\TestCommon.ps1" . $testBasePath Describe 'Log-Warning' { $logger = Get-Logger $action = { Log-Warning "test msg" } WithAddedFileAppender "Warn"...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Logging.Test/Fakes/FakeFunctionFile.ps1
FakeFunctionFile.ps1
function MyFakeFunctionGetLogger { Write-Output (Get-Logger) }
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core.Test/Attach-PSNote.Tests.ps1
Attach-PSNote.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Attach-PSNote" { Context "Given Name, Value" { It "Adds name/value as note property" { $expectedName = "foo" $expectedValue = "bar" ...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core.Test/Get-Delegate.Tests.ps1
Get-Delegate.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe 'Get-Delegate Static Methods' { Context '[string]::format | get-delegate -delegate ''func[string,object,string]''' { It 'formats a string' { $delegate = [strin...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core.Test/PSCustomObjectExtensions.Tests.ps1
PSCustomObjectExtensions.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" function _AddNoteProperties1Arg { param ( [object]$object = (New-PSObject) ) $hash = @{p1=4; p2="Q4"; p3=(New-PSObject)} $object = New-PSObject $object.PSAddMe...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core.Test/Attach-PSScriptMethod.Tests.ps1
Attach-PSScriptMethod.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Attach-PSScriptMethod" { BeforeEach { $expectedMethodName = "foo" $expectedScript = {return "bar"} } Context "Given Name, Script" { It "Attac...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core.Test/Add-TypeAccelerator.Tests.ps1
Add-TypeAccelerator.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Add-TypeAccelerator" { It "Can add type accelerator" { Add-TypeAccelerator List "System.Collections.Generic.List``1" $MyList = New-Object List[String] $M...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core.Test/New-PSObject.Tests.ps1
New-PSObject.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "New-PSObject" { It "creates a new PSCustomObject" { $actualObject = New-PSObject $actualObject.GetType() | Should Be ([System.Management.Automation.PSCustomObject...
PowerShellCorpus/Github/ghostsquad_PoshBox/PoshBox.Core.Test/Attach-PSProperty.Tests.ps1
Attach-PSProperty.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Attach-PSProperty" { BeforeEach { $expectedPropertyName = "foo" $expectedGetterScript = {return "bar"} $expectedSetterScript = {return} } Con...
PowerShellCorpus/Github/chrisreed87_quickbind/quickbind.ps1
quickbind.ps1
Clear-Host Write-Host "The purpose of this script is to quickly bind/unbind to the PRIMARY NIC `nthe PANIC option removes EVERY IP that is not the source/primary" Write-Host `n Write-Host "PROCEED WITH CAUTION & CHOOSE WISELY!" Write-Host `n #-----------User Prompt----------------------------# $Selection = Re...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/jQuery.1.10.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/anawatj_Northwind_net/Northwind/packages/jQuery.1.10.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/anawatj_Northwind_net/Northwind/packages/jQuery.1.10.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/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.Core.1.0.0/tools/init.ps1
init.ps1
param($rootPath, $toolsPath, $package, $project) # Don't support old NuGet versions as it's impractical to handle all their different sets of sematics if ([NuGet.PackageManager].Assembly.GetName().Version -lt 1.4) { throw "T4Scaffolding requires NuGet (Package Manager Console) 1.4 or later" } function GetL...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.Core.1.0.0/tools/uninstall.ps1
uninstall.ps1
param($rootPath, $toolsPath, $package, $project) # Bail out if Set-IsCheckedOut is disabled (probably because you're running an incompatible version of NuGet) if (-not (Get-Command Set-IsCheckedOut -ErrorAction SilentlyContinue)) { return } # Try to delete the solution-level config file, if there is one if ($p...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.Core.1.0.0/tools/install.ps1
install.ps1
param($rootPath, $toolsPath, $package, $project) # Try to delete InstallationDummyFile.txt if ($project) { $project.ProjectItems | ?{ $_.Name -eq "InstallationDummyFile.txt" } | %{ $_.Delete() } }
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.Core.1.0.0/tools/CustomTemplate/T4Scaffolding.CustomTemplate.ps1
T4Scaffolding.CustomTemplate.ps1
[T4Scaffolding.Scaffolder(Description = "Allows you to modify the T4 template rendered by a scaffolder")][CmdletBinding()] param( [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$ScaffolderName, [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.Core.1.0.0/tools/CustomScaffolder/T4Scaffolding.CustomScaffolder.ps1
T4Scaffolding.CustomScaffolder.ps1
[T4Scaffolding.Scaffolder(Description = "Creates an entirely new scaffolder with a PS1 script and a T4 template")][CmdletBinding()] param( [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$CustomScaffolderName, [string]$Project, [string]$CodeLanguage, [string[]]$Temp...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/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/anawatj_Northwind_net/Northwind/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/anawatj_Northwind_net/Northwind/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/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.1.0.8/tools/init.ps1
init.ps1
param($rootPath, $toolsPath, $package, $project) # Bail out if scaffolding is disabled (probably because you're running an incompatible version of T4Scaffolding.dll) if (-not (Get-Module T4Scaffolding)) { return } Set-DefaultScaffolder -Name DbContext -Scaffolder T4Scaffolding.EFDbContext -SolutionWide -DoNotOve...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.1.0.8/tools/install.ps1
install.ps1
param($rootPath, $toolsPath, $package, $project) # Try to delete InstallationDummyFile.txt if ($project) { $project.ProjectItems | ?{ $_.Name -eq "InstallationDummyFile.txt" } | %{ $_.Delete() } }
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.1.0.8/tools/EFDbContext/T4Scaffolding.EFDbContext.ps1
T4Scaffolding.EFDbContext.ps1
[T4Scaffolding.Scaffolder(Description = "Makes an EF DbContext able to persist models of a given type, creating the DbContext first if necessary")][CmdletBinding()] param( [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$ModelType, [parameter(Mandatory = $true, ValueFromPipel...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/T4Scaffolding.1.0.8/tools/EFRepository/T4Scaffolding.EFRepository.ps1
T4Scaffolding.EFRepository.ps1
[T4Scaffolding.Scaffolder(Description = "Creates a repository")][CmdletBinding()] param( [parameter(Position = 0, Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$ModelType, [string]$DbContextType, [string]$Area, [string]$Project, [string]$CodeLanguage, [switch]$NoCh...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/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/anawatj_Northwind_net/Northwind/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/anawatj_Northwind_net/Northwind/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/init.ps1
init.ps1
param($installPath, $toolsPath, $package, $project) $compilerPackageName = 'Microsoft.Net.Compilers' $roslynSubFolder = 'roslyn' if ($project -eq $null) { $project = Get-Project } $libDirectory = Join-Path $installPath 'lib\net45' $packageDirectory = Split-Path $installPath $compilerPackage = Get-Chil...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) $roslynSubFolder = 'roslyn' if ($project -eq $null) { $project = Get-Project } $projectRoot = $project.Properties.Item('FullPath').Value $binDirectory = Join-Path $projectRoot 'bin' $targetDirectory = Join-Path $binDirectory $roslynSubFolder if (Te...
PowerShellCorpus/Github/anawatj_Northwind_net/Northwind/packages/Newtonsoft.Json.6.0.4/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) # open json.net splash page on package install # don't open if json.net is installed as a dependency try { $url = "http://james.newtonking.com/json" $dte2 = Get-Interface $dte ([EnvDTE80.DTE2]) if ($dte2.ActiveWindow.Caption -eq "Package Manager Con...
PowerShellCorpus/Github/1RedOne_WinRM_CertMgmt/Certificate Enrollment.ps1
Certificate Enrollment.ps1
#Requires -version 4 <# agree on a convention for error codes # thoughts # 0 - success # 1 - invalid cert (expired / name mismatch) # 3 - no cert available to enable https # 4 - some other error v 2.0 - add logic to renew a cert #> #region setup logging function Write-Log { param( [...
PowerShellCorpus/Github/slavizh_s2d-oms-mgmt-solution/project/s2d-oms-mgmt-solution/Deploy-AzureResourceGroup.ps1
Deploy-AzureResourceGroup.ps1
#Requires -Version 3.0 #Requires -Module AzureRM.Resources #Requires -Module Azure.Storage Param( [string] [Parameter(Mandatory=$true)] $ResourceGroupLocation, [string] $ResourceGroupName = 's2d-oms-mgmt-solution', [switch] $UploadArtifacts, [string] $StorageAccountName, [string] $StorageC...
PowerShellCorpus/Github/slavizh_s2d-oms-mgmt-solution/project/s2d-oms-mgmt-solution/s2dmon/s2dmon.ps1
s2dmon.ps1
############################################################################### # # # File name PSService.ps1 # # ...
PowerShellCorpus/Github/slavizh_s2d-oms-mgmt-solution/s2dmon/s2dmon.ps1
s2dmon.ps1
############################################################################### # # # File name PSService.ps1 # # ...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/BaseServer/dsc/manifests/MyServer.ps1
MyServer.ps1
Configuration MyServer { param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$MachineName ) Import-DscResource -ModuleName 'PSDesiredStateConfiguration' Import-DscResource -Module 'xWebAdministration' Import-DscResource -Module 'xNetworking' Write-Host "MyServer D...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/win-updates.ps1
win-updates.ps1
param($global:RestartRequired=0, $global:MoreUpdates=0, $global:MaxCycles=5) function Check-ContinueRestartOrEnd() { $RegistryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" $RegistryEntry = "InstallWindowsUpdates" switch ($global:RestartRequired) { 0 { ...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/provision-agent.ps1
provision-agent.ps1
# Allows us to build without VS # Note: you will need to copy \ package the reference assemblies (we have created an internal Nuget chocolatey package to distribute) # see http://nickberardi.com/a-net-build-server-without-visual-studio/ for details choco install microsoft-build-tools -y choco install vs2013agents ...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/cleanup2.ps1
cleanup2.ps1
# NOTE: Pause for a few minutes before running this script as the system seems to take itself down after rebooting. # Disk Cleanup - doesn't get rid of anything at this early stage # Write-Host "cleaning disk..." # C:\Windows\System32\cleanmgr.exe /d c: /verylowdisk # Remove unnecessary features @('Desktop-Ex...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/provision-dev.ps1
provision-dev.ps1
choco install vs2013remotetools -Pre -y # Update 3: -Version 12.0.30723.5 -Pre # For local dev iterations #choco uninstall seek-dsc-webadministration -y -force #choco install seek-dsc-webadministration -Version 1.0.0.79 --allow-downgrade -y
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/disable-password-complexity.ps1
disable-password-complexity.ps1
# works on Microsoft Windows Server 2008 #carriage return secedit /export /cfg c:\new.cfg #carriage return #start-sleep -s 5 #carriage return ((get-content c:\new.cfg) -replace ('PasswordComplexity = 1', 'PasswordComplexity = 0')) | Out-File c:\new.cfg #carriage return secedit /configure /db $env:windir\security\ne...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/provision-ruby.ps1
provision-ruby.ps1
# Update SSL Certs: https://github.com/rubygems/rubygems/issues/1050 ruby -e 'path=File.dirname(`gem which rubygems`).to_str + \"/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem\"; open(path, \"wb\").write %(-----BEGIN CERTIFICATE-----\nMIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU\nMBIGA1UEChMLQ...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/parallels-guest-tools.ps1
parallels-guest-tools.ps1
cp C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp -Force & "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels C:\Windows\Temp\parallels\Autorun.exe /S Start-Sleep -s 60
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/openssh.ps1
openssh.ps1
param ( [switch]$AutoStart = $false ) # Vagrant SSH Keys Mkdir -Force c:\Users\vagrant\.ssh (New-Object System.Net.WebClient).DownloadFile('https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagrant\.ssh\authorized_keys') Write-Output "AutoStart: $AutoStart" $is_64bit =...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/cleanup.ps1
cleanup.ps1
# Let's cleanup! # # See http://www.hurryupandwait.io/blog/in-search-of-a-light-weight-windows-vagrant-box # for details! # Reduce PageFile size $System = GWMI Win32_ComputerSystem -EnableAllPrivileges $System.AutomaticManagedPagefile = $False $System.Put() $CurrentPageFile = gwmi -query "select * from Win3...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/provision-mongodb.ps1
provision-mongodb.ps1
# Create mongodb and data directory md $env:temp\mongo\data # Go to mongodb dir Push-Location $env:temp\mongo # Download zipped mongodb binaries to mongodbdir Invoke-WebRequest https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.5.zip -OutFile mongodb.zip # Extract mongodb zip cmd /c 7za e -...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/virtualbox-guest-tools.ps1
virtualbox-guest-tools.ps1
# There needs to be Oracle CA (Certificate Authority) certificates installed in order # to prevent user intervention popups which will undermine a silent installation. cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer # Remove if dodgey previous version already exists rm "C:\Windows\Temp\VBoxGues...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/aws/bake-admin-password.ps1
bake-admin-password.ps1
# DO NOT USE AS PART OF PACKER PIPELINE # It appears that packer needs to know the admin password throughout the entire build pipeline # I.e. even baking the admin password as the last step will cause the pipeline to fail $EC2SettingsFile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Settings\\Config.xml" $xml = ...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/aws/ec2-config-instance.ps1
ec2-config-instance.ps1
# https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/UsingConfig_WinAMI.html # BundleConfig.xml $EC2SettingsFile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Settings\\BundleConfig.xml" $xml = [xml](get-content $EC2SettingsFile) $xmlElement = $xml.get_DocumentElement() $xmlElementToModify = $xmlElement.Plug...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/aws/ec2-config-ami.ps1
ec2-config-ami.ps1
# https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/UsingConfig_WinAMI.html # BundleConfig.xml $EC2SettingsFile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Settings\\BundleConfig.xml" $xml = [xml](get-content $EC2SettingsFile) $xmlElement = $xml.get_DocumentElement() $xmlElementToModify = $xmlElement.Plug...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/common/provision-core.ps1
provision-core.ps1
# Install Chocolatey (iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')))>$null 2>&1 # Reload profile . $profile # Disable Windows Updates cmd /c reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 1 /f...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/common/provision-build-user.ps1
provision-build-user.ps1
net user /add "$env:BUILD_USER" "$env:BUILD_USER_PASSWORD" net localgroup administrators packer /add
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/common/provision-dsc.ps1
provision-dsc.ps1
# Install NuGet Write-Host "Installing NuGet" Get-PackageProvider -Name NuGet -ForceBootstrap # Trust the Microsoft PowerShell Gallery Set-PSRepository -Name PSGallery -InstallationPolicy Trusted # Install DSC modules Write-Host "Installing Third-Party DSC modules" # https://github.com/PowerShell/xWebAdminis...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/common/remove-build-user.ps1
remove-build-user.ps1
net user /delete "$env:BUILD_USER"
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/common/provision-powershell.ps1
provision-powershell.ps1
# install PowerShell 5 and Windows Management Framework # NOTE this WILL NOT WORK over Powershell remoting (winrm) Write-Host "Installing PowerShell" choco install powershell -y
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/common/provision-boxstarter.ps1
provision-boxstarter.ps1
# Read this link to understand why this looks the way it does! # https://github.com/mwrock/boxstarter/issues/121 Import-Module Boxstarter.Chocolatey Import-Module "$($Boxstarter.BaseDir)\Boxstarter.Common\boxstarter.common.psd1" $secpasswd = ConvertTo-SecureString "$env:BUILD_USER_PASSWORD" -AsPlainText -Force ...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/packer-pipeline/scripts/common/boxstarter.ps1
boxstarter.ps1
# Boxstarter WinConfig features to customize the Windows experience # http://boxstarter.org/WinConfig Disable-MicrosoftUpdate Disable-InternetExplorerESC Disable-BingSearch Enable-RemoteDesktop Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -En...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/MyProject/install/ChocolateyInstall.ps1
ChocolateyInstall.ps1
# This is a workaround to deal with the fact that # 1) New Chocolatey now sets the UI Culture to invariant # 2) DSC Tries to Import-LocalizedData (line 57 of C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1) # which uses implicit UI Culture, but of co...
PowerShellCorpus/Github/deluxebrain_play-packer-aws-provisioning/MyProject/dsc/manifests/MyProject.ps1
MyProject.ps1
Configuration MyProject { param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$MachineName, [string]$SourcePath ) Import-DscResource -ModuleName 'PSDesiredStateConfiguration' Import-DscResource -Module 'MyProjectApp' Import-DscResource -Module 'xWebAdministration'...
PowerShellCorpus/Github/AspenForester_DSC-FSRM/FSRMFileScreen-DSC.ps1
FSRMFileScreen-DSC.ps1
Configuration TestFileGroupAndTemplate { Import-DscResource -ModuleName FSRMDsc # I should provide an attribution for this $Filters = @((Invoke-WebRequest -Uri "https://fsrm.experiant.ca/api/v1/combined" -UseBasicParsing).content ` | convertfrom-json ` | ForEach-Object...
PowerShellCorpus/Github/dgacias_Others/comparador.ps1
comparador.ps1
#lo primero guardamos la hora en el log: $ruta=$pwd.path $hora=get-date set-Content "$ruta\log.txt" "$hora" #hacemos la lista de los que hemos descargado de su FTP y excluimos los que terminan en extension *._ o *.algo_ , ademas solo queremos los ficheros y no los directorios $listaficheros = get-childitem -na...
PowerShellCorpus/Github/chgeuer_Sitecore-ARM/ARM/Sitecore-ARM/Scripts/Deploy-AzureResourceGroup.ps1
Deploy-AzureResourceGroup.ps1
#Requires -Version 3.0 Param( [string] [Parameter(Mandatory=$true)] $ResourceGroupLocation, [string] $ResourceGroupName = 'polopoly-on-azure', [switch] $UploadArtifacts, [string] $StorageAccountName, [string] $StorageAccountResourceGroupName, [string] $StorageContainerName = $ResourceGroupName.T...
PowerShellCorpus/Github/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/NeogovDemo.DDD.WEB/packages/Microsoft.AspNet.Providers.LocalDb.1.1/tools/Install.ps1
Install.ps1
param($installPath, $toolsPath, $package, $project) try { # Set up variables $timestamp = (Get-Date).ToString('yyyyMMddHHmmss') $projectName = [IO.Path]::GetFileName($project.ProjectName.Trim([IO.PATH]::DirectorySeparatorChar, [IO.PATH]::AltDirectorySeparatorChar)) $catalogName = "aspnet-$project...
PowerShellCorpus/Github/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/NeogovDemo.DDD.WEB/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/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/NeogovDemo.DDD.WEB/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/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/packages/Microsoft.AspNet.Providers.LocalDB.1.1/tools/Install.ps1
Install.ps1
param($installPath, $toolsPath, $package, $project) try { # Set up variables $timestamp = (Get-Date).ToString('yyyyMMddHHmmss') $projectName = [IO.Path]::GetFileName($project.ProjectName.Trim([IO.PATH]::DirectorySeparatorChar, [IO.PATH]::AltDirectorySeparatorChar)) $catalogName = "aspnet-$project...
PowerShellCorpus/Github/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/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/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/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/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/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/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/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/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/packages/Microsoft.Bcl.Build.1.0.14/tools/Install.ps1
Install.ps1
param($installPath, $toolsPath, $package, $project) # This is the MSBuild targets file to add $targetsFile = [System.IO.Path]::Combine($toolsPath, $package.Id + '.targets') # Need to load MSBuild assembly if it's not loaded yet. Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=ne...
PowerShellCorpus/Github/KhatoPito_NeogovDemo.DDD/NeogovDemo.DDD-master/packages/Microsoft.Bcl.Build.1.0.14/tools/Uninstall.ps1
Uninstall.ps1
param($installPath, $toolsPath, $package, $project) # Need to load MSBuild assembly if it's not loaded yet. Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' # Grab the loaded MSBuild project for the project # Normalize project path before calli...
PowerShellCorpus/Github/GoFetchAD_GoFetch/Invoke-PsExec.ps1
Invoke-PsExec.ps1
function Invoke-PsExec { <# .SYNOPSIS This function is a rough port of Metasploit's psexec functionality. It utilizes Windows API calls to open up the service manager on a remote machine, creates/run a service with an associated binary path or command, and then cleans everyth...
PowerShellCorpus/Github/GoFetchAD_GoFetch/Invoke-GoFetch.ps1
Invoke-GoFetch.ps1
<# .SYNOPSIS File: Invoke-GoFetch.ps1 Version: 1.0 Author: Tal Maor, Twitter: @TalThemaor Co-Author: Itai Grady, Twitter: @ItaiGrady License: MIT License Depends on BloodHound Graphs realse 1.2.1 - https://github.com/BloodHoundAD/BloodHound/releases Required Dependencies: Invoke-Mimikatz htt...
PowerShellCorpus/Github/GoFetchAD_GoFetch/Invoke-Mimikatz.ps1
Invoke-Mimikatz.ps1
function Invoke-Mimikatz { <# .SYNOPSIS This script leverages Mimikatz 2.0 and Invoke-ReflectivePEInjection to reflectively load Mimikatz completely in memory. This allows you to do things such as dump credentials without ever writing the mimikatz binary to disk. The script has a ComputerName parameter which a...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/default.ps1
default.ps1
Framework "4.0" properties { $version = "0.1.0" $version = $version + "." + (get-date -format "MMdd") $projectName = "Woliver13.CmdLine" $unitTestAssembly = "$projectName.UnitTests.dll" $integrationTestAssembly = "$projectName.IntegrationTests.dll" $projectConfig="Release" $base_dir = Resolve-Pa...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/init.ps1
init.ps1
param($installPath, $toolsPath, $package) $psakeModule = Join-Path $toolsPath psake.psm1 import-module $psakeModule @" ======================== psake - Automated builds with powershell ======================== "@ | Write-Host
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/psake-config.ps1
psake-config.ps1
<# ------------------------------------------------------------------- Defaults ------------------------------------------------------------------- $config.buildFileName="default.ps1" $config.framework = "4.0" $config.taskNameFormat="Executing {0}" $config.verboseError=$false $config.coloredOutput = $true $con...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/psake-buildTester.ps1
psake-buildTester.ps1
function Main() { write-host "Running psake build tests" -ForeGroundColor GREEN remove-module psake -ea SilentlyContinue import-module .\psake.psm1 $psake.run_by_psake_build_tester = $true $results = runBuilds remove-module psake "" $results | Sort 'Name' | % { if ($_.Result -eq "Passed") { write-hos...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/chocolateyInstall.ps1
chocolateyInstall.ps1
try { $nugetPath = $env:ChocolateyInstall $nugetExePath = Join-Path $nuGetPath 'bin' $packageBatchFileName = Join-Path $nugetExePath "psake.bat" $psakeDir = (Split-Path -parent $MyInvocation.MyCommand.Definition) #$path = ($psakeDir | Split-Path | Join-Path -ChildPath 'psake.cmd') $path = Join-Pat...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/psake.ps1
psake.ps1
# Helper script for those who want to run psake without importing the module. # Example: # .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0" # Must match parameter definitions for psake.psm1/invoke-psake # otherwise named parameter binding fails param( [Parameter(Position=0,Mandatory=0)] [string]$buil...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/tabexpansion/PsakeTabExpansion.ps1
PsakeTabExpansion.ps1
$global:psakeSwitches = @('-docs', '-task', '-properties', '-parameters') function script:psakeSwitches($filter) { $psakeSwitches | where { $_ -like "$filter*" } } function script:psakeDocs($filter, $file) { if ($file -eq $null -or $file -eq '') { $file = 'default.ps1' } psake $file -docs | out-string...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/specs/simple_properties_and_tasks_should_pass.ps1
simple_properties_and_tasks_should_pass.ps1
properties { $testMessage = 'Executed Test!' $compileMessage = 'Executed Compile!' $cleanMessage = 'Executed Clean!' } task default -depends Test task Test -depends Compile, Clean { $testMessage } task Compile -depends Clean { $compileMessage } task Clean { $cleanMessage }
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/specs/using_initialization_block_should_pass.ps1
using_initialization_block_should_pass.ps1
properties { $container = @{} $container.foo = "foo" $container.bar = $null $foo = 1 $bar = 1 } task default -depends TestInit task TestInit { # values are: # 1: original # 2: overide # 3: new Assert ($container.foo -eq "foo") "$container.foo should be foo" Assert ($container.bar ...
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/specs/using_precondition_should_pass.ps1
using_precondition_should_pass.ps1
task default -depends A,B,C task A { "TaskA" } task B -precondition { return $false } { "TaskB" } task C -precondition { return $true } { "TaskC" }
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/specs/duplicate_alias_should_fail.ps1
duplicate_alias_should_fail.ps1
task default task A -alias a {} task B -alias b {} task C -alias a {}
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/specs/using_postcondition_should_pass.ps1
using_postcondition_should_pass.ps1
task default -depends A,B,C task A { "TaskA" } task B -postcondition { return $true } { "TaskB" } task C { "TaskC" }
PowerShellCorpus/Github/woliver13_Woliver13.CmdLine/src/packages/psake.4.2.0.1/tools/specs/calling_invoke-task_should_pass.ps1
calling_invoke-task_should_pass.ps1
task default -depends A,B task A { } task B { "inside task B before calling task C" invoke-task C "inside task B after calling task C" } task C { }