full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/bielawb_PSConfEU17-Hell/02_VMware.ps1
02_VMware.ps1
# Connection $root = Get-Credential -UserName root Connect-VIServer -Server esxi.monad.net -Credential $root Set-PowerCLIConfiguration -InvalidCertificateAction Ignore # Reading data Get-VMHost Get-VMHostDisk Get-VirtualSwitch Get-VM Get-View -ViewType VirtualMachine -Filter @{...
PowerShellCorpus/Github/bielawb_PSConfEU17-Hell/Start-Demo.ps1
Start-Demo.ps1
## Start-Demo.ps1 ################################################################################################## ## This is an overhaul of Jeffrey Snover's original Start-Demo script by Joel "Jaykul" Bennett ## ## I've switched it to using ReadKey instead of ReadLine (you don't have to hit Enter each time) ## ...
PowerShellCorpus/Github/bielawb_PSConfEU17-Hell/profile.ps1
profile.ps1
function Get-LinuxUser { <# .Synopsis Get information about the selected user(s) on current machine. #> param ( # Name of the user. Wildcards are supported. [SupportsWildcards()] [String]$Name = '*' ) Import-Csv -Delimiter : -LiteralPath /etc/passwd ...
PowerShellCorpus/Github/bielawb_PSConfEU17-Hell/03_GitHub.ps1
03_GitHub.ps1
# Issue Start-Process opera https://github.com/PowerShell/PowerShell/issues/3416 $uri = 'https://api.github.com/repos/PowerShell/PowerShell/issues' Invoke-RestMethod -Uri $uri | ForEach-Object { $_ } | Format-Table -Property Title, Number, Created_At # Fixed! Get-Process -Name code | Sel...
PowerShellCorpus/Github/bielawb_PSConfEU17-Hell/Microsoft.VSCode_profile.ps1
Microsoft.VSCode_profile.ps1
Import-Module -Name posh-git function Set-ZoomLevel { param ( [Int]$Level = 0, [ValidateSet( 'Workspace', 'User' )] [String]$Scope = 'Workspace', [ValidateSet( 'Merge', 'Overwrite' )] [String]$Mode =...
PowerShellCorpus/Github/bielawb_PSConfEU17-Hell/01_Basics.ps1
01_Basics.ps1
# Basics Set-ZoomLevel -Level 2 $xpath = "//service[port[@port < 1024 and @protocol = 'tcp']]" Select-Xml -Path /usr/lib/firewalld/services/*.xml -XPath $xpath | ForEach-Object { $_.Node } | Select-Object -Property short -ExpandProperty port Get-LinuxUser -Name Get-Command ...
PowerShellCorpus/Github/larsro_PowerShell/Get-OU.ps1
Get-OU.ps1
[CmdletBinding()] #requires -version 3 param( [parameter(ParameterSetName = "ComputerName", Mandatory = $true, ValueFromPipeline = $true, Position = 0)] $ComputerName, [parameter(ParameterSetName = "ThisComputer")] [switch]$ThisComputer, [switch]$ValueOnly ) begin { $roo...
PowerShellCorpus/Github/larsro_PowerShell/RobocopyProgress.ps1
RobocopyProgress.ps1
# Copyright (c) 2015 Lars Romshřj # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, di...
PowerShellCorpus/Github/larsro_PowerShell/Configure-Git.ps1
Configure-Git.ps1
git config --global core.editor "'C:/Program Files/Notepad2/Notepad2.exe'" git config --global user.name "larsro" git config --global user.email "larsro@live.dk"
PowerShellCorpus/Github/larsro_PowerShell/Install-Tools.ps1
Install-Tools.ps1
choco install 7zip choco install DotNet4.0 choco install git choco install git-credential-winstore choco install sourcetree choco install ilspy choco install notepad2 choco install poshgit choco install putty choco install svn choco install sysinternals
PowerShellCorpus/Github/larsro_PowerShell/install.ps1
install.ps1
$ErrorActionPreference = "STOP" iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) choco install git -y $Env:Path+=";${env:ProgramFiles(x86)}\git\bin" $psdir = [System.IO.PAth]::GetFullPAth("$PROFILE\..") $filecount=(gci $psdir -Recurse).Count if (Test-Path $psdir) { Write...
PowerShellCorpus/Github/larsro_PowerShell/Configure-Choco.ps1
Configure-Choco.ps1
choco feature enable -n allowGlobalConfirmation
PowerShellCorpus/Github/larsro_PowerShell/Microsoft.PowerShell_profile.ps1
Microsoft.PowerShell_profile.ps1
function Get-ParentProcessChain ([System.Diagnostics.Process]$Process = [System.Diagnostics.Process]::GetCurrentProcess()) { $ParentProcessId = (gwmi win32_process -Filter "processid='$($Process.Id)'" -ErrorAction SilentlyContinue).parentprocessid if ($ParentProcessId) { $ParentProcess = Ge...
PowerShellCorpus/Github/larsro_PowerShell/ProfileWithPoshGitAndVS.ps1
ProfileWithPoshGitAndVS.ps1
Function Invoke-Environment ( [Parameter(Mandatory=$true)] [string] # Any cmd shell command, normally a configuration batch file. $Command ) { cmd /c """$Command"" > nul 2>&1 && set" | .{process{ if ($_ -match '^([^=]+)=(.*)') { [System.Environment]::SetEnvironmentVariable($matc...
PowerShellCorpus/Github/larsro_PowerShell/Microsoft.PowerShellISE_profile.ps1
Microsoft.PowerShellISE_profile.ps1
$NormalProfile = resolve-Path "$profile.CurrentUserCurrentHost\..\Microsoft.PowerShell_profile.ps1" . $NormalProfile
PowerShellCorpus/Github/larsro_PowerShell/copystuff.ps1
copystuff.ps1
import-module .\Utilities.psm1 -Force $ErrorActionPreference = "Stop" function Assert-AreEquals($Expected, $Actual, $Message = "Expected $Expected found $Actual") { if ($Expected -ne $Actual) { throw $message } } #Format-Size 10304500 #Copy-ItemsRobustly -Source '\\larsro-dev1\d$\builds'...
PowerShellCorpus/Github/larsro_PowerShell/lib/copystuff.ps1
copystuff.ps1
import-module .\Utilities.psm1 -Force $ErrorActionPreference = "Stop" function Assert-AreEquals($Expected, $Actual, $Message = "Expected $Expected found $Actual") { if ($Expected -ne $Actual) { throw $message } } #Format-Size 10304500 #Copy-ItemsRobustly -Source '\\larsro-dev1\d$\builds'...
PowerShellCorpus/Github/kfwls_psProfile/Microsoft.PowerShell_profile.ps1
Microsoft.PowerShell_profile.ps1
Function elevate-process { $file, [string]$arguments = $args; $psi = new-object System.Diagnostics.ProcessStartInfo $file; $psi.Arguments = $arguments; $psi.Verb = "runas"; $psi.WorkingDirectory = get-location; [System.Diagnostics.Process]::Start($psi); } function kill-command { para...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/TortoiseGit.ps1
TortoiseGit.ps1
# TortoiseGit function private:Get-TortoiseGitPath { if ((Test-Path "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe") -eq $true) { # TortoiseGit 1.8.0 renamed TortoiseProc to TortoiseGitProc. return "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" } return "C:\Program Files\Tortoise...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/CheckVersion.ps1
CheckVersion.ps1
$Global:GitMissing = $false if (!(Get-Command git -TotalCount 1 -ErrorAction SilentlyContinue)) { Write-Warning "git command could not be found. Please create an alias or add it to your PATH." $Global:GitMissing = $true return } $requiredVersion = [Version]'1.7.2' if ((git --version 2> $null) -ma...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/Utils.ps1
Utils.ps1
# General Utility Functions function Invoke-NullCoalescing { $result = $null foreach($arg in $args) { if ($arg -is [ScriptBlock]) { $result = & $arg } else { $result = $arg } if ($result) { break } } $result } Set-Alias ?? Invoke-N...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/GitPrompt.ps1
GitPrompt.ps1
# Inspired by Mark Embling # http://www.markembling.info/view/my-ideal-powershell-prompt-with-git-integration $global:GitPromptSettings = New-Object PSObject -Property @{ DefaultForegroundColor = $Host.UI.RawUI.ForegroundColor BeforeText = ' [' BeforeForegroundColor = [Console...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/GitUtils.ps1
GitUtils.ps1
# Inspired by Mark Embling # http://www.markembling.info/view/my-ideal-powershell-prompt-with-git-integration function Get-GitDirectory { if ($Env:GIT_DIR) { $Env:GIT_DIR } else { Get-LocalOrParentPath .git } } function Get-GitBranch($gitDir = $(Get-GitDirectory), [Diagnostics.S...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/profile.example.ps1
profile.example.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) # Load posh-git module from current directory Import-Module .\posh-git # If module is installed in a default location ($env:PSModulePath), # use this instead (see about_Modules for more information): # Import-Module posh-git # Set...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/install.ps1
install.ps1
param([switch]$WhatIf = $false) if($PSVersionTable.PSVersion.Major -lt 2) { Write-Warning "posh-git requires PowerShell 2.0 or better; you have version $($Host.Version)." return } if(!(Test-Path $PROFILE)) { Write-Host "Creating PowerShell profile...`n$PROFILE" New-Item $PROFILE -Force -Type ...
PowerShellCorpus/Github/kfwls_psProfile/Modules/posh-git/GitTabExpansion.ps1
GitTabExpansion.ps1
# Initial implementation by Jeremy Skinner # http://www.jeremyskinner.co.uk/2010/03/07/using-git-with-windows-powershell/ $Global:GitTabSettings = New-Object PSObject -Property @{ AllCommands = $false } $subcommands = @{ bisect = 'start bad good skip reset visualize replay log run' notes = 'edit ...
PowerShellCorpus/Github/kfwls_psProfile/Modules/PowerLS/test.ps1
test.ps1
trap #trap exceptions and force failure { write-output $_ exit 1 } Import-Module Pester Set-StrictMode -Version Latest Import-Module agent-api -ErrorAction SilentlyContinue $Results = Invoke-Pester -PassThru .\Tests if (Get-Command "Add-AppveyorTest" -ErrorAction SilentlyContinue) { $failures ...
PowerShellCorpus/Github/kfwls_psProfile/Modules/PowerLS/Tests/Acceptance.Tests.ps1
Acceptance.Tests.ps1
$ROOT = Split-Path -Parent $MyInvocation.MyCommand.Path Describe "Importing" { Context "When importing the module" { It "Should have no warnings" { $warn = $false $out = (powershell -noprofile "Import-Module $ROOT\..\PowerLS.psm1") $out | % { $warn = $warn -or ($_...
PowerShellCorpus/Github/kfwls_psProfile/Modules/MyZsh/zstheme.ps1
zstheme.ps1
# vim:ft=zsh ts=2 sw=2 sts=2 # # agnoster's Theme - https://gist.github.com/3712874 # A Powerline-inspired theme for ZSH # # # README # # In order for this theme to render correctly, you will need a # [Powerline-patched font](https://gist.github.com/1595572). # # In addition, I recommend the # [Solarized the...
PowerShellCorpus/Github/egirdhar_HelloGitWorld/build.ps1
build.ps1
[cmdletbinding()] param( [string[]] $Task = 'default', [string] $Server = 'localhost', [string] $Repo = '\\Server\DSCRepo' ) $webRequest = [net.WebRequest]::Create("http://localhost:9090") (($webRequest.GetResponse()).Statuscode) -as [int] $webrequest.GetResponse() ...
PowerShellCorpus/Github/Stijnc_AzureRateCard/Tests/AzureRateCard.Tests.ps1
AzureRateCard.Tests.ps1
#Requires -Modules Pester <# .SYNOPSIS Tests the AzureRateCard module .EXAMPLE Invoke-Pester .NOTES This file contains only module specific test. For general tests, refer to https://github.com/Stijnc/PowerShellModule.Tests #> $here = Split-Path -Parent $MyInvocation.MyCommand.Path $parent ...
PowerShellCorpus/Github/toddrob_tdrTest/Artifacts/Windows-DomainJoin/domainjoin.ps1
domainjoin.ps1
param ( [Parameter(Mandatory=$True)] $LocalUser, [Parameter(Mandatory=$True)] $LocalPassword, [Parameter(Mandatory=$True)] $DomainUser, [Parameter(Mandatory=$True)] $DomainPassword, [Parameter(Mandatory=$True)] $Domain, [Parameter(Mandatory=$True)] ...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced10/Advanced10v2_Get-PerfData.ps1
Advanced10v2_Get-PerfData.ps1
<# GetPerfData 1. Use Get-Counter cmdlet to both get the list of Processor set counters, and then gather 10 samples at 2 second interval. 2. Use Export-Counter to output the gathered perf data to a CSV file under the Documents folder. #> (Get-Counter -List Processor).PathsWithInstances...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced10/Advanced10_Get-PerfData.ps1
Advanced10_Get-PerfData.ps1
((Get-Counter -List Processor).PathsWithInstances | Get-Counter -MaxSamples 10 -SampleInterval 2).CounterSamples | select Timestamp,Path,CookedValue (Get-Counter -List Processor).PathsWithInstances | Get-Counter -MaxSamples 10 -SampleInterval 2 | Select-Object -ExpandProperty CounterSamples |...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced09/Advanced09_Get-XmlSystemReport.ps1
Advanced09_Get-XmlSystemReport.ps1
function Get-XmlSystemReport { <# .Synopsis Writes XML based report of several important system values. .DESCRIPTION The Get-XmlSystemReport by default writes an xml file containing a number of important system values to the file system. If the values cannot be retrieved then 'N/A' is returned as v...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced06/Advanced06_Get-UptimeReport.ps1
Advanced06_Get-UptimeReport.ps1
function Get-UptimeReport { <# .Synopsis Reports on uptime of computer systems .DESCRIPTION The Get-UptimeReport cmdlet reports, outputing csv by default, reports on the uptime of systems from a standard time (8am by default). Systems with a boot time between the 8am base time and report execution ...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced01/Advanced01_Watch-Process.ps1
Advanced01_Watch-Process.ps1
Function Watch-Process { <# .SYNOPSIS Gets information about a process for a specified period of time. .DESCRIPTION The Watch-Process cmdlet monitors a selected process for a period of time. The monitored process name is specified as a parameter to the cmdlet. The default is to monitor the selected process...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced07/Advanced07_Get-NewestErrorEvents.ps1
Advanced07_Get-NewestErrorEvents.ps1
<# GetNewestErrorEvents - one liner 1. Uses Get-WinEvent to list logs, filtered by enabled and non-zero quantity events 2. Create empty array to contain found newest errors 3. For each of the found logs, run Get-WinEvent again and filter on LogName, Errors, and sort and select the newest error. ...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced05/Advanced05v2_Get-ErrorEventReport.ps1
Advanced05v2_Get-ErrorEventReport.ps1
Function Get-ErrorEventReport { <# .SYNOPSIS Report on error events from the various available event logs. .DESCRIPTION The Get-ErrorEventReport cmdlet inspects the various available event logs on one or more computer system, groups the sources of error events on the system and ranks them fro...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced05/Advanced05_Get-ErrorReport.ps1
Advanced05_Get-ErrorReport.ps1
Function Get-ErrorReport { <# .Synopsis Short description .DESCRIPTION Long description .EXAMPLE Example of how to use this cmdlet .EXAMPLE Another example of how to use this cmdlet #> [CmdletBinding()] Param ( [Parameter()] [string[]]$ComputerName = @("$env:computername") ) Begi...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced08/Advanced08_Switch-NetworkAdapter.ps1
Advanced08_Switch-NetworkAdapter.ps1
function Switch-NetworkAdapter { <# .Synopsis Swap enabled network interfaces to prevent bridging. .DESCRIPTION The Switch-NetworkAdapter cmdlet has no parameters and simply enables one interface and disables the other interface. Preventing the bridging of networks from wireless to wired or vice-v...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced04/Advanced04v2_Get-DirectorySize.ps1
Advanced04v2_Get-DirectorySize.ps1
function Get-DirectorySize { <# .Synopsis Get size of directory specified. .DESCRIPTION Get-DirectorySize is a cmdlet that returns the size of the directory specificed by parameter. By default it will recursively report the size of all sub-directories as well. The path to a directory must be speci...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced04/Advanced04_Get-DirectorySize.ps1
Advanced04_Get-DirectorySize.ps1
function Get-DirectorySize { <# .Synopsis Get size of directory specified. .DESCRIPTION Get-DirectorySize is a cmdlet that returns the size of the directory specificed by parameter. By default it will recursively report the size of all sub-directories as well. The path to a directory must be speci...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced02/Advanced02_Get-ServiceStateReport.ps1
Advanced02_Get-ServiceStateReport.ps1
Function Get-ServiceStateReport { <# .SYNOPSIS Gets report of computer(s) service state. .DESCRIPTION The Get-ServiceStateReport cmdlet reports on the service state on local or remote computer systems. The default is to report on the local computer services state. Remote computers (or a multiple of comput...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced03/Advanced03v2_Get-StatusReport.ps1
Advanced03v2_Get-StatusReport.ps1
[CmdletBinding(DefaultParametersetName='FileBased')] Param( [Parameter(ParameterSetName='FileBased')] [String]$Path = "$env:systemdrive\logonlog\logonstatus.txt", [Parameter(ParameterSetName='ObjectBased')] [Switch]$PassThru ) # Acquire various environment variable and WMI properties and methods for re...
PowerShellCorpus/Github/jlrd_PowerShell/ScriptingGames/2012/Advanced03/Advanced03_Get-StatusReport.ps1
Advanced03_Get-StatusReport.ps1
#This script supports either no parameters (report to file), or Path (alt file location), # or PassThru (object output). It also can be directly invoked or dot sourced. [CmdletBinding(DefaultParametersetName='FileBased')] Param( [Parameter(ParameterSetName='FileBased')] [String]$Path, [Parameter(Parameter...
PowerShellCorpus/Github/jlrd_PowerShell/Liners/Get-RandomPassword.ps1
Get-RandomPassword.ps1
function Get-JLRDRandomPassword{ [CmdletBinding()] param ( [parameter()] [int]$Length = 32, [parameter()] [int]$CharRepeatMax = 3, [parameter()] [int]$Generate = 1 ) For($i=0; $i -lt $Generate; $i++) { New-Object PSObject -Property @{ Password = $( ( $([char[]]@(48..57) * (Get-Random -Mi...
PowerShellCorpus/Github/Rajeswari4526_NewBMS/BugManagementSystem/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/Rajeswari4526_NewBMS/BugManagementSystem/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/Rajeswari4526_NewBMS/BugManagementSystem/packages/jQuery.1.7.1.1/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/Rajeswari4526_NewBMS/BugManagementSystem/packages/jQuery.1.7.1.1/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 $supportsJsIntelliSenseFile = [System.Version]::Parse($dte.Version).Major -ge 11 if (-not $supportsJsIntelliSenseFile) { Write-Host "IntelliSense JS files are n...
PowerShellCorpus/Github/Rajeswari4526_NewBMS/BugManagementSystem/packages/jQuery.1.7.1.1/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/packages/Microsoft.ApplicationInsights.WindowsServer.2.2.0/Tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) if ([System.IO.File]::Exists($project.FullName)) { function MarkItemASCopyToOutput($item) { Try { #mark it to copy if newer $item.Properties.Item("CopyToOutputDirectory").Value = 2 } Catch { write-host $_.Exception.ToString() }...
PowerShellCorpus/Github/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/Doova_CalcTest/CalcTest/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/svendepreter_XLSX-To-CSV/xls2csv.ps1
xls2csv.ps1
# Written by Sven De Preter # Convert XLS to CSV - PowerShell Version Function ExcelToCSV($file){ # Input : $file, a full path filename # Output : files with the same path and name as $file, with the worksheet name and .csv appended # Create new Excel Application object $ExcelObject = N...
PowerShellCorpus/Github/red-gate_RedGate.Build/build.ps1
build.ps1
<# .SYNOPSIS Pack, test and publish RedGate.Build .DESCRIPTION 1. nuget pack RedGate.Build.nuspec 2. If Nuget Feed Url and Api key are passed in, publish the RedGate.Build package .PARAMETER Version The version of the nuget package. .PARAMETER IsDefaultBranch True when building from master. If ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/Get-CallerPreference.ps1
Get-CallerPreference.ps1
#requires -Version 2.0 ################################################################################ # https://gallery.technet.microsoft.com/scriptcenter/Inherit-Preference-82343b9d ################################################################################ function Get-CallerPreference { <# ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/SmartAssembly.ps1
SmartAssembly.ps1
function Get-SmartAssemblyComPath { [CmdletBinding()] param( # The version of the nuget package containing the Smart Assembly executables [string] $SmartAssemblyVersion = $DefaultSmartAssemblyVersion ) Write-Verbose "Using Smart Assembly version $SmartAssemblyVersion" $SAFolder = Install-Smar...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/Utils.ps1
Utils.ps1
[CmdletBinding()] param() function Execute-Command { [CmdletBinding(DefaultParameterSetName='ScriptBlock')] param( [Parameter(Mandatory=$true,ParameterSetName='Command')] [string] $Command, [Parameter(Mandatory=$true,ParameterSetName='Command')] [string[]] $Arguments, [Param...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/DotCover.ps1
DotCover.ps1
function Get-DotCoverExePath { [CmdletBinding()] param( # The version of the nuget package containing DotCover.exe (JetBrains.dotCover.CommandLineTools) [string] $DotCoverVersion = $DefaultDotCoverVersion ) Write-Verbose "Using DotCover version $DotCoverVersion" $DotCoverFolder = Install-DotC...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/Zip.ps1
Zip.ps1
function Get-7ZipExePath { [CmdletBinding()] param() $7ZipFolder = Install-Package -Name '7-Zip.CommandLine' -Version '9.20.0' "$7ZipFolder\tools\7za.exe" | Resolve-Path }
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/_Init.ps1
_Init.ps1
# _Init.ps1 is a script that can be used to initialise stuff when RedGate.Build is imported for the first time. # (Like variables available within the module only.) # Create the packages folder where nuget packages used by this module will be installed. $PackagesDir = New-Item -Path "$PSScriptRoot\..\packages" -It...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/NUnit/Publish-ResultsAndLogsToTeamcity.ps1
Publish-ResultsAndLogsToTeamcity.ps1
function Publish-ResultsAndLogsToTeamcity { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [String] $AssemblyPath, [String] $TestResultFilenamePattern = 'TestResult', [bool] $ImportResultsToTeamcity ) if($ImportResultsToTeamcity) { TeamCity-ImportN...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/NUnit/2/Build-NUnitCommandLineArguments.ps1
Build-NUnitCommandLineArguments.ps1
function Build-NUnitCommandLineArguments { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] $AssemblyPath, [string] $FrameworkVersion, [string[]] $ExcludedCategories = @(), [string[]] $IncludedCategories = @(), [string] $TestResultFilenamePat...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/NUnit/2/Get-NUnitConsoleExePath.ps1
Get-NUnitConsoleExePath.ps1
function Get-NUnitConsoleExePath { [CmdletBinding()] param( # The version of the nuget package containing the NUnit executables (NUnit.Runners) [string] $NUnitVersion = $DefaultNUnitVersion, #If set, return path to nunit-console-x86.exe. #By default, use nunit-console.exe...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/NUnit/3/Get-NUnit3ConsoleExePath.ps1
Get-NUnit3ConsoleExePath.ps1
function Get-NUnit3ConsoleExePath { [CmdletBinding()] param( # The version of the nuget package containing the NUnit executables (NUnit.Console) [string] $NUnitVersion ) if(!$NunitVersion.StartsWith('3.')) { throw "Unexpected NUnit version '$NUnitVersion'. This function ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/NUnit/3/Build-NUnit3CommandLineArguments.ps1
Build-NUnit3CommandLineArguments.ps1
function Build-NUnit3CommandLineArguments { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] $AssemblyPath, [bool] $x86, [string] $FrameworkVersion, [string] $Where, [string] $TestResultFilenamePattern = 'TestResult' ) $params = $...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/Nuget/Get-DependencyVersionRange.ps1
Get-DependencyVersionRange.ps1
<# .SYNOPSIS Takes a dependency version number and return a valid dependency version range for use in a nuspec file. .DESCRIPTION Takes a version of the form a.b.c[.d][-branchName], returns the version range to set in the nuspec [a.b.c[.d][-branchName], a+1.0.0) .EXAMPLE Get-DependencyVersionRange #> ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/VisualStudio/Extract-NugetPackageFromHintPath.ps1
Extract-NugetPackageFromHintPath.ps1
# # Private function to parse the nuget package info from the value of a VS project 'HintPath' # # '..\..\packages\mypackage.1.2.3.4\lib\my.dll' | Extract-NugetPackageFromHintPath # will return a pscustomobject with properties: # Id = mypackage # Version = 1.2.3.4 # function Extract-NugetPackageFromHin...
PowerShellCorpus/Github/red-gate_RedGate.Build/Private/VisualStudio/LoadProjectFile.ps1
LoadProjectFile.ps1
function LoadProjectFile { [CmdletBinding()] param( # The path to a .csproj or .vbproj file. (msbuild format) [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $ProjectFile ) # Crude parameter checking $ProjectFile = Resolve-Path $ProjectFile ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/New-ZipArchive.ps1
New-ZipArchive.ps1
<# .SYNOPSIS Zip a list of files into a .zip archive .DESCRIPTION Uses 7zip to create a zip file containing files matching filename patterns passed in as $Files .EXAMPLE New-ZipArchive -OutputFile .\Build\Build.zip -BasePath .\Build -Files ".\Build\Release\*.exe", ".\Build\Release\*.dll" Packages al...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Invoke-SigningService.ps1
Invoke-SigningService.ps1
<# .SYNOPSIS Signs a .NET assembly, jar file, VSIX installer or ClickOnce application. .DESCRIPTION Signs a .NET assembly, jar file, VSIX installer or ClickOnce application using the Redgate signing service. .OUTPUTS The FilePath parameter, to enable call chaining. .EXAMPLE $AssemblyPath = "$SourceDir\B...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Update-AssemblyVersion.ps1
Update-AssemblyVersion.ps1
<# .SYNOPSIS Updates the AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion attributes in a source file. .DESCRIPTION Updates the AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion attributes in a source file, typically AssemblyInfo.cs. This cmdlet should be used on the Ass...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Remove-IgnoredTests.ps1
Remove-IgnoredTests.ps1
<# .SYNOPSIS Remove ignored tests from a NUnit test results xml file. .DESCRIPTION 1. Load the NUnit tests results file 2. Find any ignored tests (optional: matching a reason from -ReasonsIgnored) and remove them 3. Save back to xml. .EXAMPLE Remove-IgnoredTests -TestResultsPath 'D:\TestResults.xml' ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Expand-ZipArchive.ps1
Expand-ZipArchive.ps1
<# .SYNOPSIS Unzip a .zip archive to a directory .DESCRIPTION Extracts a zip file to the specified destination directory .EXAMPLE Expand-ZipArchive -Archive .\Build\MyZip.zip -Destination .\Build\MyZip Extracts all files in the archive at .\Build\MyZip.zip to the path .\Build\MyZip .NOTES Will call...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Invoke-NUnitForAssembly.ps1
Invoke-NUnitForAssembly.ps1
<# .SYNOPSIS Execute NUnit tests from a single assembly .DESCRIPTION 1. Install required Nuget Packages to get nunit-console.exe and dotcover.exe 2. Use nunit-console.exe and dotcover.exe to execute NUnit tests with dotcover coverage .EXAMPLE Invoke-NUnitForAssembly -AssemblyPath .\bin\debug\test.dll -NU...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Invoke-SmartAssembly.ps1
Invoke-SmartAssembly.ps1
<# .SYNOPSIS Call Smart Assembly .DESCRIPTION 1. Install required Smart Assembly nuget Package to get SmartAssembly.exe and SmartAssembly.com 2. Call smartassembly.com .EXAMPLE Invoke-SmartAssembly -ProjectPath D:\myproject.{sa}proj -SmartAssemblyVersion 6.9.0 Restore the SmartAssembly nuget package...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/New-TempDir.ps1
New-TempDir.ps1
<# .SYNOPSIS Creates a new empty temp directory. .DESCRIPTION Creates a new empty temp directory. .OUTPUTS The path of the newly created temporary directory. #> function New-TempDir { $Path = "$TempFolderPath\$([System.IO.Path]::GetRandomFileName())" Write-Verbose "Creating temp dir: $Path" ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Invoke-DotCoverForExecutable.ps1
Invoke-DotCoverForExecutable.ps1
<# .SYNOPSIS Performs coverage analysis of a .NET application. .DESCRIPTION Use 'dotcover.exe' to perform coverage analysis of the specified .NET executable. .PARAMETER TargetExecutable The path of the target executable. .PARAMETER TargetArguments The arguments to pass to the target executable. .PARAME...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Invoke-NUnit3ForAssembly.ps1
Invoke-NUnit3ForAssembly.ps1
<# .SYNOPSIS Execute NUnit tests from a single assembly using NUnit 3 .DESCRIPTION 1. Install required Nuget Packages to get nunit3-console.exe and dotcover.exe 2. Use nunit3-console.exe and dotcover.exe to execute NUnit tests with dotcover coverage .EXAMPLE Invoke-NUnit3ForAssembly -AssemblyPath .\bin\d...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Update-RedgateNugetPackages.ps1
Update-RedgateNugetPackages.ps1
<# .SYNOPSIS Updates all the packages in a solution whose ID starts with `Redgate.` and creates a PR .DESCRIPTION Updates all the packages in a solution whose ID starts with `Redgate.` and creates a PR #> Function Update-RedgateNugetPackages { [CmdletBinding()] [OutputType([Nullable])] ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Select-ReleaseNotes.ps1
Select-ReleaseNotes.ps1
function CreateRelease([version] $version) { # https://learn-powershell.net/2013/08/03/quick-hits-set-the-default-property-display-in-powershell-on-custom-objects/ # Set up the default display set and create the member set object for use later on # Configure a default display set $defaultDisplaySet...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Merge-CoverageReports.ps1
Merge-CoverageReports.ps1
<# .SYNOPSIS Merge multiple dotcover coverage reports into a single report. .DESCRIPTION Find all the *.coverage.snap in a folder and merge them together using 1 dotcover merge 2 dotcover zip If running within Teamcity, let Teamcity know where the merged coverage snapshot is. If outside of teamc...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/ConvertTo-ShellEscaped.ps1
ConvertTo-ShellEscaped.ps1
<# .SYNOPSIS Shell-escapes one or more strings for use in a command-line when starting a process. .DESCRIPTION Given one or more argument strings, for each argument, this function will escape double-quote characters and some backslash characters, and surround the string with double-quotes if necessary. The resu...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Read-ReleaseNotes.ps1
Read-ReleaseNotes.ps1
<# .SYNOPSIS Retrieves version information and release notes from a RELEASENOTES.md file .DESCRIPTION 1. Scans $ReleaseNotesPath for the first line matching ^#+\s*(?<version>[0-9]+\.[0-9]+(\.[0-9]+)?)$ 2. That line and all subsequent lines are appended 3. Return object contains Content and Version propert...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Format-WarningsAndErrors.ps1
Format-WarningsAndErrors.ps1
<# .SYNOPSIS Convert msbuild errors and warnings to powershell ones. .DESCRIPTION Parse input and look for * : warning *:* to detect warnings * : error *:* to detect errors And convert them using Write-Warning and Write-Error #> function Format-WarningsAndErrors { [CmdletBinding()] ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Nuget/New-SemanticNuGetPackageVersion.ps1
New-SemanticNuGetPackageVersion.ps1
#requires -Version 2 <# .SYNOPSIS Obtains a semantic NuGet package version based on the build version number and branch name. .DESCRIPTION Obtains a semantic NuGet package version based on a 3 or 4-digit build version number, the branch name and whether or not the branch is the default branch. .OUTPUTS A...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Nuget/Install-SmartAssemblyPackage.ps1
Install-SmartAssemblyPackage.ps1
<# .SYNOPSIS Install SmartAssembly to RedGate.Build\packages .DESCRIPTION Install a nuget package containing SmartAssembly.com to RedGate.Build\packages #> function Install-SmartAssemblyPackage { [CmdletBinding()] param( # The version of the nuget package containing the Smart Assembly executables ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Nuget/Get-NugetPackagesFromConfigFiles.ps1
Get-NugetPackagesFromConfigFiles.ps1
#requires -Version 4.0 <# .SYNOPSIS Returns all the nuget packages listed in a list of packages.config .DESCRIPTION Read all the packages.config files and return a list of Nuget packages .EXAMPLE Get-NugetPackagesFromConfigFiles -PackagesConfigPaths 'project1\packages.config', 'project2\packages.config' ...
PowerShellCorpus/Github/red-gate_RedGate.Build/Public/Nuget/Install-Package.ps1
Install-Package.ps1
<# .SYNOPSIS Install a Nuget Package to the RedGate.Build\packages\ folder. .DESCRIPTION Install a Nuget Package to the RedGate.Build\packages folder and return a DirectoryInfo object for the full path of the folder where the package was extracted to. .PARA...