full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Global-ErrorHandler.ps1 | Global-ErrorHandler.ps1 | $ErrorActionPreference="Stop"
$DebugPreference="Continue"
$emailTo="user@domain.com"
$emailCC="team@domain.com"
$From = "notification@domain.com"
$SmtpHost = "smtphost@domain.com"
trap
{
# Trap might not work if you dot sourcing this script.
# http://stackoverflow.com/questions/5077550/powershell-sin... |
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Send-Email.ps1 | Send-Email.ps1 | function Send-Email($to, $cc, $subject, $body)
{
$From = "you@domain.com"
$SmtpHost = "smtp.domain.com"
Send-MailMessage -From $From -Subject $subject -To $to -Cc $cc -Body $body -BodyAsHtml -SmtpServer $SmtpHost
}
$To = "user1@domain.com", "user2@domain.com"
$Cc="boss@domain.com"
$Subject = "Don'... |
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Get-HashTest.ps1 | Get-HashTest.ps1 | $md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
function Get-Hash($filePath, $retry=3)
{
$stream = [System.IO.File]::Open("$filePath",[System.IO.Filemode]::Open, [System.IO.FileAccess]::Read)
$h... |
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Retry-Sample.ps1 | Retry-Sample.ps1 | function Test-Retry ($retry=3)
{
if($retry -gt 0)
{
"Retry $retry ..."
$retry --
Test-Retry $retry
}
}
Test-Retry |
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Profile/Setup.ps1 | Setup.ps1 | # Will copy the profile script to local folder
# Example: C:\Users\Toby\Documents\WindowsPowerShell
$ps = "Microsoft.PowerShell_profile.ps1"
$ise = "Microsoft.PowerShellISE_profile.ps1"
function Copy-Profile ($file)
{
$from = Join-Path $PSScriptRoot $file
$to = Join-Path (Get-Item $profile).Directory... |
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Profile/Microsoft.PowerShell_profile.ps1 | Microsoft.PowerShell_profile.ps1 | if(Test-Path C:\Scripts) {Set-Location C:\Scripts} |
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Profile/Microsoft.PowerShellISE_profile.ps1 | Microsoft.PowerShellISE_profile.ps1 | if(Test-Path C:\Scripts) {Set-Location C:\Scripts}
Function Format-Document
{
Param([int]$space=4)
$tab = " " * $space
$numtab = 0
$text = $psISE.CurrentFile.editor.Text
foreach ($l in $text -split [environment]::newline)
{
$line = $l.Trim()
if ($line.StartsWith... |
PowerShellCorpus/Github/tobyqin_PowerScripts/PowerShell/Test-Module/test-module.ps1 | test-module.ps1 | trap {
"Script trap entered: $_"
# exit -1
continue
}
$dir = Split-Path -Parent $PSCommandPath
"Current directory: $dir"
Remove-Module -Force "Test-Module"
Import-Module $dir
test-function
|
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_D_Provision_2017_5_24_27_58_27/.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/MaximeLaunay_AzureAssets/Cours/scripts/AzureSQLDatabase.ps1 | AzureSQLDatabase.ps1 | Param(
[Parameter(Mandatory=$true)][String]$SubscriptionName,
[Parameter(Mandatory=$true)][String]$FirewallIP,
[Parameter(Mandatory=$true)][String]$PosteNumber,
[Parameter(Mandatory=$true)][String]$mail
)
$SubscriptionName = "Osiatis CIS - Azure 1"
$FirewallIP = "31.33.101.85"
$PosteNumber ... |
PowerShellCorpus/Github/MaximeLaunay_AzureAssets/Cours/scripts/testTemplateWithPSSscript.ps1 | testTemplateWithPSSscript.ps1 | cd "C:\Users\maxim\Documents\Git\AzureAssets\VSTSBuild\ARM_Template"
Login-AzureRmAccount
$SubscriptionName = "Osiatis CIS - Azure 1"
Select-AzureRmSubscription -Subscriptionid (Get-AzureRmSubscription -SubscriptionName $SubscriptionName).SubscriptionId
$template = ".\template.json"
$parameters = ".\parameters.jso... |
PowerShellCorpus/Github/MaximeLaunay_AzureAssets/Cours/scripts/DeployAndRemoveResourceGroups.ps1 | DeployAndRemoveResourceGroups.ps1 | Login-AzureRmAccount
$SubscriptionName = "Osiatis CIS - Formation Azure"
# Set Account and Subscription
$Subscription = Get-AzureRmSubscription |where {$_.SubscriptionName -eq $SubscriptionName}
Set-AzureRmContext -SubscriptionId $Subscription.SubscriptionId
$i = 0
for ($i = 1;$i -lt 8;$i++){
Remove-Az... |
PowerShellCorpus/Github/MaximeLaunay_AzureAssets/AzureContainerService/PSScripts/SWARMAzureContainerServiceViaARM.ps1 | SWARMAzureContainerServiceViaARM.ps1 | Param(
[Parameter(Mandatory=$true)][String]$SubscriptionName,
[Parameter(Mandatory=$true)][String]$rgname,
[Parameter(Mandatory=$true)][String]$location,
[Parameter(Mandatory=$true)][String]$sshKey
)
# Connect to Azure with your account
Login-AzureRmAccount;
# Select Subscription
Select-Azu... |
PowerShellCorpus/Github/MaximeLaunay_AzureAssets/AzureContainerService/PSScripts/DCOSAzureContainerServiceViaARM.ps1 | DCOSAzureContainerServiceViaARM.ps1 | Param(
[Parameter(Mandatory=$true)][String]$SubscriptionName,
[Parameter(Mandatory=$true)][String]$rgname,
[Parameter(Mandatory=$true)][String]$location
)
# Connect to Azure with your account
Login-AzureRmAccount;
# Select Subscription
Select-AzureRmSubscription -Subscriptionid (Get-AzureRmSubsc... |
PowerShellCorpus/Github/MaximeLaunay_AzureAssets/AzureContainerService/PSScripts/Set-AzureContainerService.ps1 | Set-AzureContainerService.ps1 | Param(
[Parameter(Mandatory=$true)][String]$SubscriptionName,
[Parameter(Mandatory=$true)][String]$rgname,
[Parameter(Mandatory=$true)][String]$location,
[Parameter(Mandatory=$true)][String]$vmSize,
[Parameter(Mandatory=$true)][String]$orchestratorType,
[Parameter(Mandatory=$true)][String]... |
PowerShellCorpus/Github/ederhf_jQuery-Fundamentals/jQuerySelectors/jQuerySelectors/packages/jQuery.1.9.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/ederhf_jQuery-Fundamentals/jQuerySelectors/jQuerySelectors/packages/jQuery.1.9.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
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/ederhf_jQuery-Fundamentals/jQuerySelectors/jQuerySelectors/packages/jQuery.1.9.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/ederhf_jQuery-Fundamentals/jQuerySelectors/packages/jQuery.1.9.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/ederhf_jQuery-Fundamentals/jQuerySelectors/packages/jQuery.1.9.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
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/ederhf_jQuery-Fundamentals/jQuerySelectors/packages/jQuery.1.9.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/stopthatastronaut_EC2MetaData/Modules/EC2MetaData/EC2MetaData.Tests.ps1 | EC2MetaData.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"
Describe "EC2MetaData" {
It "does something useful" {
$true | Should Be $false
}
}
|
PowerShellCorpus/Github/cavejay_Strippy/test.ps1 | test.ps1 | <#
.SYNOPSIS
Checks inputs and outputs to create a testing framework for strippy
.DESCRIPTION
Run a command and then do the thing and check the output
.EXAMPLE
// todo
.NOTES
Author: Michael Ball
Version: 170310
.LINK
https://github.com/cavejay/Strippy
#> |
PowerShellCorpus/Github/cavejay_Strippy/strippy.ps1 | strippy.ps1 | <#
.SYNOPSIS
Tool for sanitising log files based on configured "indicators"
.DESCRIPTION
Use this tool to automate the replacement of sensitive data in text files with generic strings.
While intended for use with log files this tool will work with text filesa as a whole.
In order to use this t... |
PowerShellCorpus/Github/ARMJ_SPL/AuthenticationAPI/packages/Newtonsoft.Json.9.0.1/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://www.newtonsoft.com/json/install?version=" + $package.Version
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindo... |
PowerShellCorpus/Github/ARMJ_SPL/AuthenticationAPI/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/ARMJ_SPL/AuthenticationAPI/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/ARMJ_SPL/AuthenticationAPI/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/ARMJ_SPL/AuthenticationAPI/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/JeremyTCD_Powershell.GithubUtils/JeremyTCD.Powershell.GithubUtils/GithubUtils.tests.ps1 | GithubUtils.tests.ps1 | # $PSCommandPath holds the path of the current file
# Split-Path $PSCommandPath returns the directory of the current file
# Set-Location is equivalent to cd in cmd.exe
Split-Path $PSCommandPath | Set-Location
Import-Module (".\" + (Split-Path -Leaf $PSCommandPath).Replace(".tests.ps1", ".psd1"))
Describe "Set-Gi... |
PowerShellCorpus/Github/JeremyTCD_Powershell.GithubUtils/JeremyTCD.Powershell.GithubUtils/GithubUtils.pre.ps1 | GithubUtils.pre.ps1 | # ensure that GitUtils is installed |
PowerShellCorpus/Github/v-peliao_E2E_Adhoc/.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/andreaswasita_new-AzureVM_with_VIPReservation/New-Azure VM with Static VIP.ps1 | New-Azure VM with Static VIP.ps1 | #==========================================================================
#
# NAME: Create New Azure VM using existing Reserved VIP
#
# AUTHOR: Andreas Wasita
# DATE : 24/06/2014
#
# COMMENT:
#
# VERSION: 0.1
#
# REVISION HISTORY:
# <date> <sign> <comments>
#
# 24/06/2014 AW Draft
#
#==... |
PowerShellCorpus/Github/Batz-10K_WOWsReplayTools/Get-Replays.ps1 | Get-Replays.ps1 | # Get Replay info for all replays in the current directory, and output PS objects of the json
#
# Paul Batchelor (paul.batchelor@gmail.com) , 3-Dec-2016
#
#
function GetReplayInfo( $replayfile )
{
if ( test-path $replayfile )
{
$enc = [System.Text.Encoding]::ASCII
... |
PowerShellCorpus/Github/Batz-10K_WOWsReplayTools/Sort-Replays.ps1 | Sort-Replays.ps1 | # Sort WOWs replays into their own folders by game version.
#
# Paul Batchelor (paul.batchelor@gmail.com) , 3-Dec-2016
#
#
$prefix = ".\" # Create version directories in current directory.
#
function GetReplayInfo( $replayfile )
{
# Extract the game information (a json object) from the replay file ... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Backup/C/USX_Automation/Scripts/USX_Manager_Setup_v1.ps1 | USX_Manager_Setup_v1.ps1 | cls
<#
.NOTES
File Name :<FileName of the Script>.ps1
Author : Bharath Nagaraj bharath@atlantiscomputing.com
Version : 1.0 alpha
Support : support@atlantiscomputing.com
Purpose - To deploy and setup the USX PowerShell modules
Pre-requisit... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/2.General_Input_File_Validation.ps1 | 2.General_Input_File_Validation.ps1 | <#
.NOTES
File Name :<FileName of the Script>.ps1
Author : Bharath Nagaraj bharath@atlantiscomputing.com
Version : 1.0 alpha
Support : support@atlantiscomputing.com
Purpose - To deploy and setup the USX PowerShell modules
Pre-requisite: Po... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/1.USX_PowerShell_Deploy_v1.ps1 | 1.USX_PowerShell_Deploy_v1.ps1 | <#
.NOTES
File Name :<FileName of the Script>.ps1
Author : Bharath Nagaraj bharath@atlantiscomputing.com
Version : 1.0 alpha
Support : support@atlantiscomputing.com
Purpose - To deploy and setup the USX PowerShell modules
Pre-requisite: Po... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/3.USX_Manager_Setup_v1.ps1 | 3.USX_Manager_Setup_v1.ps1 | cls
<#
.NOTES
File Name :<FileName of the Script>.ps1
Author : Bharath Nagaraj bharath@atlantiscomputing.com
Version : 1.0 alpha
Support : support@atlantiscomputing.com
Purpose - To deploy and setup the USX PowerShell modules
Pre-requisit... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/Environment-Clean-Scripts/USX_Clean_Script.ps1 | USX_Clean_Script.ps1 | cls
<#
.NOTES
File Name :<FileName of the Script>.ps1
Author : Bharath Nagaraj bharath@atlantiscomputing.com
Version : 1.0 alpha
Support : support@atlantiscomputing.com
Purpose - To deploy and setup the USX PowerShell modules
Pre-requisit... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/All_Flash/1.USX_All_Flash_VolumeSetup.ps1 | 1.USX_All_Flash_VolumeSetup.ps1 | cls
<#
.NOTES
File Name :<FileName of the Script>.ps1
Author : Bharath Nagaraj bharath@atlantiscomputing.com
Version : 1.0 alpha
Support : support@atlantiscomputing.com
Purpose - To deploy and setup the USX PowerShell modules
Pre-requisit... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/Debug-Scripts/Testjson.ps1 | Testjson.ps1 | $test = {1,2,3}
Write-Output $test
|
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/Debug-Scripts/TestFunctions.ps1 | TestFunctions.ps1 | $volservicelist= Get-USXVolume | select volumeservicename
$vollist = $volservicelist.GetEnumerator() | % { $_.volumeservicename }
if (!$vollist)
{
Write-Log "All VMs have HA Disabled"
break
}
else
{
foreach ($vol in $vollist)
{
Set-USXDisableHA -VolumeName $vol -ErrorAction:SilentlyContinue
... |
PowerShellCorpus/Github/bharath2885_USX-PowerShell-Automation/Scripts/Debug-Scripts/TestDeleteContainer.ps1 | TestDeleteContainer.ps1 | cls
Import-Module c:\Users\Administrator.VSIINFRA\Documents\WindowsPowerShell\Modules\Atlantis-USX\Atlantis-USX.PSM1 -Force
$connected = Connect-USX 10.30.10.5 admin poweruser
Remove-USXContainer |
PowerShellCorpus/Github/jimk818_ps_scripts/Check-Dropzone.ps1 | Check-Dropzone.ps1 | <#
.Synopsis
This script will check for new ZIP package in dropzone.
This can be added as the first step of deployment pipeline.
If no package is found, it will result in error as it should stop the deployment.
.DESCRIPTION
The script will check in the dropzone for the newest package and move any olde... |
PowerShellCorpus/Github/jimk818_ps_scripts/Grab-ReleasePackage.ps1 | Grab-ReleasePackage.ps1 | <#
.Synopsis
This script is to be run as the first step of deployment pipeline.
This will check dropzone for files, and if new drop exists, copy the package over to working directory.
As for copy, robocopy will be used for its extra functions.
.DESCRIPTION
Detailed information of each project will be ... |
PowerShellCorpus/Github/budostylz_Core-Solutions-of-Microsoft-SharePoint-Server-2013/Host-Based Configuration/Host-Based-Prototype.ps1 | Host-Based-Prototype.ps1 |
#STEP 1 (CREATE WEB APPLICATION IF NEEDED AND IISRESET)
New-SPWebApplication -Name 'Contoso Sites' -Port 19565 -ApplicationPool ContosoAppPool -ApplicationPoolAccount (Get-SPManagedAccount 'AD2012\SP_Farm') -AuthenticationProvider (New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication)
IISRESET /noforc... |
PowerShellCorpus/Github/petermarnef_merge-csv-files/MergeCSVFiles.ps1 | MergeCSVFiles.ps1 | # This script merges a bunch of files into one file and filters out duplicate lines
#
# If the output file does not exist, it will be created
# If the output file already exists, only new/unique lines will be added. So the script
# can be run multiple times with the same source files, and the output file will still... |
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_D_Provision_2017_4_24_14_58_23/.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/cpaton_MachineConfig/Init.ps1 | Init.ps1 | $scriptPath = $MyInvocation.MyCommand.Path
$scriptDirectory = Split-Path $scriptPath
$utilitiesPath = Join-Path $scriptDirectory "Utilities.ps1"
Invoke-Expression ( ". {0}" -f $utilitiesPath )
if ( -not ( Test-Admin ) ) {
Write-Host "Re-running this script as Admin"
RunScriptAsAdmin $scriptPath
r... |
PowerShellCorpus/Github/cpaton_MachineConfig/Boxstarter.Common.ps1 | Boxstarter.Common.ps1 | Enable-RemoteDesktop
Move-LibraryDirectory "Downloads" "C:\_cp\Downloads"
Enable-MicrosoftUpdate
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Update-Help -UICulture "en-us"
|
PowerShellCorpus/Github/cpaton_MachineConfig/Git-Clone.ps1 | Git-Clone.ps1 | $gitRoot = "C:\_cp\Git"
if ( -not ( Test-Path $gitRoot ) ) {
New-Item -Path $gitRoot -ItemType Directory | Out-Null
}
& 'C:\Program Files\Git\bin\git' clone git@github.com:cpaton/MachineConfig.git C:\_cp\Git\MachineConfig
& 'C:\Program Files\Git\bin\git' clone ssh://Craig@storage:60022/volume1/Data/Git/Rep... |
PowerShellCorpus/Github/cpaton_MachineConfig/Bootstrap.ps1 | Bootstrap.ps1 | #
# Used to bootstrap a new machine. Example script to copy all files
# needed onto the new machine to initialise it. This should be run
# from an admin powershell console
#
Set-ExecutionPolicy RemoteSigned -Force
if ( Test-Path C:\MachineConfig ) {
Remove-Item C:\MachineConfig -Recurse -Force
}
$p... |
PowerShellCorpus/Github/cpaton_MachineConfig/Git-GenerateKeys.ps1 | Git-GenerateKeys.ps1 | function GenerateSshKey() {
[CmdletBinding()]
param (
[Parameter(Position = 1, Mandatory = $true)]
[string] $SshKeyName,
[Parameter(Position = 2, Mandatory = $true)]
[string] $Comment
)
$sshKeyPath = Join-Path $env:USERPROFILE ( ".ssh\{0}" -f $SshKeyName )
... |
PowerShellCorpus/Github/cpaton_MachineConfig/Utilities.ps1 | Utilities.ps1 | function Test-Admin {
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object System.Security.Principal.WindowsPrincipal( $identity )
return $principal.IsInRole( [System.Security.Principal.WindowsBuiltInRole]::Administrator )
}
function RunScriptAsAdmin() {
... |
PowerShellCorpus/Github/fintalex_Angular-tests/AngularDevSuperPower/packages/jQuery.1.9.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/fintalex_Angular-tests/AngularDevSuperPower/packages/jQuery.1.9.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
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/fintalex_Angular-tests/AngularDevSuperPower/packages/jQuery.1.9.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/fintalex_Angular-tests/AngularDevSuperPower/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/fintalex_Angular-tests/AngularDevSuperPower/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/fintalex_Angular-tests/AngularDevSuperPower/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/fintalex_Angular-tests/AngularDevSuperPower/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/fintalex_Angular-tests/AngularDevSuperPower/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/fintalex_Angular-tests/AngularDevSuperPower/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/fintalex_Angular-tests/AngularDevSuperPower/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/fintalex_Angular-tests/AngularDevSuperPower/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/mani0070_apache-zookeeper/choco_repro.ps1 | choco_repro.ps1 | # Can I see my appveyor.yml?
gci *
# Install a package
cinst apache-zookeeper -y -f
clist -l
# Uninstall the package and it's dependencies
# Note the --force
cuninst apache-zookeeper -y -f -x
# This will fail with an error about not finding the meta package's nupkg file but the package is no longer in `cli... |
PowerShellCorpus/Github/mani0070_apache-zookeeper/tools/chocolateyuninstall.ps1 | chocolateyuninstall.ps1 | $ErrorActionPreference = 'Stop';
$packageName = 'apache-zookeeper'
$softwareName = 'apache-zookeeper*'
$optionsFile = (Join-Path $PSScriptRoot 'options.xml')
Remove-Item (Join-Path $options['unzipLocation'] '') -Recurse -Force |
PowerShellCorpus/Github/mani0070_apache-zookeeper/tools/chocolateyinstall.ps1 | chocolateyinstall.ps1 | $ErrorActionPreference = 'Stop';
$options = @{
unzipLocation = 'C:\tools\'
}
$packageParameters = @{
packageName = 'apache-zookeeper'
url = 'http://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz'
checksum = '0285717bf5ea87a7a36936bf37851d214a32bb99'
check... |
PowerShellCorpus/Github/kimmoxter_hme/src/hme/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/kimmoxter_hme/src/hme/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/rackerlabs_PoSh-Ohai/plugins/logonhistory.ps1 | logonhistory.ps1 | #requires -Version 2
$provides = 'logonhistory'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$logons = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$query = "*[System[(EventID=4624)]] and (*[EventData[Data[@Name='Lo... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/memory.ps1 | memory.ps1 | #requires -Version 1
$provides = 'memory'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$meminfo = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
try
{
$memory = Get-WmiObject -Class Win32_PerfRawD... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/windows_features.ps1 | windows_features.ps1 | #requires -Version 1
$provides = 'ServerFeatures', 'OptionalFeatures'
function Collect-Data
{
$ServerFeatures = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$OptionalFeatures = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$list_ServerFeatures = Ge... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/firewall_profiles.ps1 | firewall_profiles.ps1 | #requires -Version 1
$provides = 'firewall_profiles'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$firewall_profiles = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$find_rule = netsh.exe advfirewall show allpr... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/pending_reboot.ps1 | pending_reboot.ps1 | #requires -Version 2
$provides = 'pending_reboot'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$pending_reboot = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$PendFileRename, $Pending, $SCCM = $false, $false, $fal... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/platform.ps1 | platform.ps1 | #requires -Version 1
$provides = 'os', 'platform_family', 'platform', 'platform_version', 'platform_architecture', 'platform_servicepack_major', 'platform_servicepack_minor', 'powershell_version'
function Collect-Data
{
if(((Get-WmiObject -Class Win32_OperatingSystem).CreationClassName) -eq 'Win32_OperatingSys... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/softwares.ps1 | softwares.ps1 | #requires -Version 1
$provides = 'softwares'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$softwares = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$list_softwares = Get-ItemProperty -Path HKLM:\Software\Microsoft\W... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/services.ps1 | services.ps1 | #requires -Version 1
$provides = 'services'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$services = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$list_services = Get-WmiObject -Class Win32_Service | Select-Object -... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/processes.ps1 | processes.ps1 | #requires -Version 1
$provides = 'processes'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$processes = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$list_processes = Get-WmiObject -Class Win32_Process |
Select-... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/users.ps1 | users.ps1 | #requires -Version 1
$provides = 'users'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$users = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$list_users = (Get-WmiObject -Class Win32_UserAccount) | Select-Object -P... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/dot_net_version.ps1 | dot_net_version.ps1 | #requires -Version 1
$provides = 'dot_net_version'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$dot_net_version = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$list_versions = Get-ChildItem -Path 'HKLM:\SOFTWAR... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/filesystem.ps1 | filesystem.ps1 | #requires -Version 1
$provides = 'filesystem'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$fs = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$disks = Get-WmiObject -Class Win32_LogicalDisk
foreach ... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/windows_updates.ps1 | windows_updates.ps1 | #requires -Version 1
$provides = 'windows_updates'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$windows_updates = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$patchlist = Get-HotFix | Select-Object @{name='Artic... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/netstat.ps1 | netstat.ps1 | $provides = "netstat"
function Collect-Data {
$rawNetstat = netstat -ano | Select-String -Pattern '\s+(TCP|UDP)'
$psObjNetstat = @()
$Output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
ForEach($connection in $rawNetstat){
$item = $connection.line.s... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/certificates.ps1 | certificates.ps1 | $provides = "mycerts" #,"allcerts"
function Collect-Data {
$LMMyCerts = (Get-ChildItem -path Cert:\LocalMachine\My)
$mycerts = New-Object System.Collections.Specialized.OrderedDictionary
foreach ($cert in $LMMyCerts){
$certhash = $cert.Thumbprint
$mycerts[$certhash] = New... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/remote_services.ps1 | remote_services.ps1 | $provides = 'remote_services'
Function Collect-Data {
$dynamicStart = (netsh.exe int ipv4 show dynamicport tcp)
$ns = netstat -ano
$remoteServices = @()
if (($dynamicStart -eq $null) -or($ns -eq $null) ){
$remoteServices
}
else{
$dynamicStartTrim = [Int]($dynamicStar... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/time_zone.ps1 | time_zone.ps1 | #requires -Version 1
$provides = 'time_zone'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$timezone = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$timezone = Get-WmiObject -Class Win32_TimeZone
$output.A... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/loggedon_users.ps1 | loggedon_users.ps1 | #requires -Version 1
$provides = 'loggedon_users'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$loggedon_users = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$session_user = @{}
$regex_antecedent = '.+Domain=... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/iis.ps1 | iis.ps1 | #requires -Version 1
$provides = 'iis_pools', 'iis_apps'
function Collect-Data
{
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.Web.Administration')
$iis = New-Object -TypeName Microsoft.Web.Administration.ServerManager
$app_pool = New-Object -TypeName System.Collecti... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/startup_applications.ps1 | startup_applications.ps1 | #requires -Version 1
$provides = 'startup_applications'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$startup_applications = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$list_startup_applications = Get-WmiObject -... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/reboot_history.ps1 | reboot_history.ps1 | #requires -Version 2
$provides = 'reboot_history'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$reboot_history = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$event_1074 = Get-WinEvent -FilterHashtable @{
... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/network.ps1 | network.ps1 | #requires -Version 1
$provides = 'network'
function Collect-Data
{
$output = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$iface = New-Object -TypeName System.Collections.Specialized.OrderedDictionary
$iface_config = New-Object -TypeName System.Collections.Specialized.Order... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/cpu.ps1 | cpu.ps1 | $provides = 'cpu'
function Collect-Data {
$output = New-Object System.Collections.Specialized.OrderedDictionary
$cpuinfo = New-Object System.Collections.Specialized.OrderedDictionary
$cpuNumber = 0
$index = 0
foreach ($processor in Get-WmiObject Win32_Processor) {
$numberOfCores = $... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/plugins/uptime.ps1 | uptime.ps1 | #requires -Version 1
$provides = 'uptime', 'uptime_seconds'
function Collect-Data
{
$uptimeSeconds = (Get-WmiObject -Class Win32_PerfFormattedData_PerfOS_System).SystemUpTime
$TimeSpan = New-TimeSpan -Seconds $uptimeSeconds
$uptimeString = '{0} days {1} hours {2} minutes {3} seconds' -f $TimeSpan.D... |
PowerShellCorpus/Github/rackerlabs_PoSh-Ohai/deploy/deploy.ps1 | deploy.ps1 | #requires -Version 2
#region Variables
$PoshOhaiModuleVersionLatest = '1.4.2'
$TempDir = 'C:\rs-pkgs'
$ModuleDir = $env:PSModulePath.Split(';') | Where-Object -FilterScript {
$_.StartsWith($env:SystemRoot)
}
$PoshOhaiUrl = 'http://readonly.configdiscovery.rackspace.com/PoSh-Ohai-master.zip'
$PoshOhaiFil... |
PowerShellCorpus/Github/tdashroy_dev/install/posh-git.ps1 | posh-git.ps1 | if ((Get-ExecutionPolicy).value__ -gt [Microsoft.PowerShell.ExecutionPolicy]::RemoteSigned.value__)
{
Write-Host "Please set the execution policy to allow RemoteSigned scripts to be run."
Write-Host "To achieve this, you can run the following command from an admin PowerShell:"
Write-Host "Set-ExecutionP... |
PowerShellCorpus/Github/tdashroy_dev/install/gvim.ps1 | gvim.ps1 | # Download installer
$url = "ftp://ftp.vim.org/pub/vim/pc/gvim80-069.exe"
$filename = [System.IO.Path]::GetFileName($url)
$output = "$env:TEMP\$filename"
(New-Object System.Net.WebClient).DownloadFile($url, $output)
# Install via installer
# Note: this requires user input, need to find a way to do silent mode... |
PowerShellCorpus/Github/tdashroy_dev/install/psprofile.ps1 | psprofile.ps1 | $dot = Split-Path $MyInvocation.MyCommand.Path
$psprofile = [System.IO.Path]::GetFullPath((Join-Path $dot "..\powershell\profile.ps1"))
". $psprofile" | Out-File $profile.CurrentUserCurrentHost -Force
. $profile.CurrentUserCurrentHost |
PowerShellCorpus/Github/tdashroy_dev/install/vimprofile.ps1 | vimprofile.ps1 | $dotdir = Split-Path $MyInvocation.MyCommand.Path
# Using ASCII because otherwise vim gets confused.
$vimrc = [System.IO.Path]::GetFullPath((Join-Path $dotdir "..\vim\_vimrc"))
"execute 'source ' . fnameescape('$vimrc')" | Out-File ~\_vimrc -Encoding ASCII -Force
$gvimrc = [System.IO.Path]::GetFullPath((Join-Pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.