full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/Get-AutomationAsset.ps1
Get-AutomationAsset.ps1
workflow Get-AutomationAsset { param( [Parameter(Mandatory=$True)] [ValidateSet('Variable','Certificate','PSCredential', 'Connection')] [string] $Type, [Parameter(Mandatory=$True)] [string]$Name ) $Val = $null # Get asset if($Type -eq "Variable...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/Posh-SSH/PortForward.ps1
PortForward.ps1
############################################################################################## # SSH Port Forwarding <# .Synopsis Redirects traffic from a local port to a remote host and port via a SSH Session. .DESCRIPTION Redirects TCP traffic from a local port to a remote host and port via a SSH Sess...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/Posh-SSH/Sftp.ps1
Sftp.ps1
######################################################################################## # SFTP Functions # .ExternalHelp Posh-SSH.psm1-Help.xml function Get-SFTPSession { param( [Parameter(Mandatory=$false, Position=0)] [Alias('Index')] [Int32[]] ...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/Posh-SSH/Trust.ps1
Trust.ps1
# .ExternalHelp Posh-SSH.psm1-Help.xml function Get-SSHTrustedHost { [CmdletBinding()] [OutputType([int])] Param() Begin{} Process { $Test_Path_Result = Test-Path -Path "hkcu:\Software\PoshSSH" if ($Test_Path_Result -eq $false) { Write-...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/Posh-SSH/tests/Remove-SSHSession.Tests.ps1
Remove-SSHSession.Tests.ps1
Import-Module .\Posh-SSH.psd1 Describe "Remove-SSHSession" { Context "Parameters" { } Context "Action" { $Global:SshSessions = New-Object System.Collections.ArrayList $session = New-Object SSH.SshSession $session.host = "dummy...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/Posh-SSH/tests/Get-SSHSession.Tests.ps1
Get-SSHSession.Tests.ps1
Import-Module .\Posh-SSH.psd1 Describe "Get-SSHSession" { Context "Parameters" { It "should not throw if no parameter is given" { { Get-SSHSession } | Should not throw } It "Should not throw if index parameter is given" { { Get-SSHSession -SessionId 0 } | ...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/install.ps1
install.ps1
Write-Host -Object 'Installing ISESteroids' $version = $PSVersionTable.PSVersion.Major if ($version -lt 3) { Write-Warning 'ISESteroids requires PowerShell 3 or better.' Write-Warning "Your current PowerShell version is $version." return } $isepath = Join-Path -Path $pshome -ChildPath 'powershell_is...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Error/UnexpectedToken/fixthis.ps1
fixthis.ps1
param ( $Ast, $StartOffset, $Length ) 'This is a tricky one...!!'
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/TemplateScripts/XAML/Create XAML Action Table.ps1
Create XAML Action Table.ps1
# nachladen von WPF (nötig für powershell.exe, weil hier # anders als in der ISE die WPF Bibliotheken nicht # automatisch geladen werden: Add-Type -AssemblyName PresentationFramework $xaml = @" <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micros...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/TemplateScripts/XAML/Display XAML.ps1
Display XAML.ps1
# nachladen von WPF (nötig für powershell.exe, weil hier # anders als in der ISE die WPF Bibliotheken nicht # automatisch geladen werden: Add-Type -AssemblyName PresentationFramework $xaml = @" <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micros...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/FixerOnDemand/Fix Content/Convert String To Variable/ConvertTextToEnvironmentVariable.ps1
ConvertTextToEnvironmentVariable.ps1
# replaces literal strings with environment variables where appropriate & { function GetBestMatch($Text) { foreach($environmentString in $lookup) { if ($Text -match ([RegEx]::Escape($environmentString.Value) + '\b')) { return $environmentString } } } # g...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Quality Improvement/DoubleQuotes/DoubleQuotes.ps1
DoubleQuotes.ps1
& { Set-StrictMode -Off # fixes double quoted strings that do not really need double quotes $Strings = [ISESteroids.SteroidsFixer.Helpers]::GetAST('DoubleQuotedString') $pattern = "[$`'']" foreach($string in $strings) { if ($string.Extent.Text -notmatch '[$`'']') { $text = $string.Extent.Text.SubSt...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Final Touches/Requires/AddRequirements.ps1
AddRequirements.ps1
& { # do not update #requires statement for .psm1 files $extension = [System.IO.Path]::GetExtension($psise.PowerShellTabs.SelectedPowerShellTab.Files.SelectedFile.FullPath) if ($extension -ne '.psm1') { $editor = Get-SteroidsEditor Update-SteroidsRequiresStatement -ISEEditor $edito...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Spaces/OperatorAdjustSpace/OperatorAdjustSpace.ps1
OperatorAdjustSpace.ps1
& { $unary = [System.Management.Automation.Language.TokenFlags]::UnaryOperator $info = Get-SteroidsAST $lookup = @{} $tokenCount = $info.TokenList.Count # we need a minimum of three tokens for this test if ($tokenCount -ge 3) { for ($i=1; $i -lt $tokenCount-1; $i++) { $token = $info.Toke...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Spaces/ArrayAdjustSpace/ArrayAdjustSpace.ps1
ArrayAdjustSpace.ps1
& { # get all ArrayLiteralASTs $items = [ISESteroids.SteroidsFixer.Helpers]::GetAST('Array') foreach($item in $items) { $tokenlist = [ISESteroids.SteroidsFixer.Helpers]::GetToken($item.Extent.StartOffset, $item.Extent.EndOffset) $tokenCount = $tokenlist.Count for($i=0; $i-...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/ScriptBlock/ScriptBlockRemoveEmptyLines/ScriptBlockRemoveEmptyLines.ps1
ScriptBlockRemoveEmptyLines.ps1
& { Set-StrictMode -Off # removes any empty (blank) line that is positioned # - between opening brace and content # - between content and closing brace $crlf = -join [Char[]](13,10) $items = [ISESteroids.SteroidsFixer.Helpers]::GetAST('ScriptAndStatementblock') foreach($ScriptBlock in $items) { $starto...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/ScriptBlock/ScriptBlockAlignBracesSome/ScriptBlockAlignBracesSome.ps1
ScriptBlockAlignBracesSome.ps1
& { # purpose is to reformat scriptblocks # scriptblocks are a common element in many PowerShell structures # and can also be used standalone # to improve readability, this unit identifies the opening and # closing braces and makes sure these braces exist on individual lines # separated from other content (to ...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/ScriptBlock/ScriptBlockAlignBracesAll/ScriptBlockAlignBracesAll.ps1
ScriptBlockAlignBracesAll.ps1
& { Set-StrictMode -Off # purpose is to reformat scriptblocks # scriptblocks are a common element in many PowerShell structures # and can also be used standalone # to improve readability, this unit identifies the opening and # closing braces and makes sure these braces exist on individu...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Character Operations/Illegal Characters/IllegalCharacters.ps1
IllegalCharacters.ps1
# Replaces individual ASCII and UNICODE characters # use this to change illegal characters # illegal characters may be introduced when scripts are copied from # web pages or text editors, and typographic changes were made & { # get access to the editor: $Editor = Get-SteroidsEditor # get script con...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Character Operations/BacktickPlusSpace/BacktickSpace.ps1
BacktickSpace.ps1
# makes sure all lines end CRLF (ASCII code 13 and 10) & { # makes sure all lines end CRLF (ASCII code 13 and 10) & { # get access to editor: $Editor = Get-SteroidsEditor # RegEx pattern for various types of line endings: $pattern = '(?m)\`\s{1,}$' # find these line e...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Character Operations/NormalizeLineEndings/NormalizeLineEndings.ps1
NormalizeLineEndings.ps1
# makes sure all lines end CRLF (ASCII code 13 and 10) & { # get access to editor: $Editor = Get-SteroidsEditor # RegEx pattern for various types of line endings: $pattern = '\r\n|\n\r|\n|\r' # find these line endings and replace them with a normalized line ending: [Regex]::Matches($Editor...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Command/CommandPositionalParameter/CommandPositionalParameter.ps1
CommandPositionalParameter.ps1
& { Set-StrictMode -Off $commands = @{} # get all commands available foreach($command in (Get-Command -CommandType Function, Cmdlet)) { # add each unique command to a hash table $name = $command.Name if ($commands.ContainsKey($name) -eq $false) { $commands.Add($name, $com...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Command/CommandCase/CommandCase.ps1
CommandCase.ps1
# Case-corrects command names & { # array that holds all known command names: $commands = @{} # include all functions that are defined in the script $items = [ISESteroids.SteroidsFixer.Helpers]::GetAST('Function') # add each function that is defined in the script foreach($item in $items) ...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Command/CommandParameter/CommandParameter.ps1
CommandParameter.ps1
# Case-correct command parameter names & { # array that will hold all commands that are going to be fixed: $commands = @{} # get all functions and cmdlets (these command types use Powershell-style parameters): foreach($command in (Get-Command -CommandType Function, Cmdlet)) { $n...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Command/ReplaceAliases/ReplaceAliases.ps1
ReplaceAliases.ps1
# searches for Aliases and replaces them with the underlying # original command & { Set-StrictMode -Off # get access to the AST (abstract syntax tree): $info = Get-SteroidsAST # find commands in the script: $Commands = $info.Ast.FindAll({ $args[0] -is [System.Management.Automation.Language.Comma...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Pipeline/PipelineBreakAfterPipe/PipelineBreakAfterPipe.ps1
PipelineBreakAfterPipe.ps1
& { $crlf = -join [Char[]](13,10) $items = [ISESteroids.SteroidsFixer.Helpers]::GetAST('Pipeline') foreach($item in $items) { # do optimization only with 3 or more pipeline elements if ($item.PipelineElements.Count -le 2) { continue } $tokenList = [ISESteroids.SteroidsFixer.Helpers]::GetToken($item.Ex...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Pipeline/PipelineRemoveOutNull/PipelineRemoveOutNull.ps1
PipelineRemoveOutNull.ps1
& { $crlf = -join [Char[]](13,10) $items = [ISESteroids.SteroidsFixer.Helpers]::GetAST('Pipeline') foreach($item in $items) { if ($item.PipelineElements[-1].Extent.Text -eq 'Out-Null') { # remove last pipeline element [ISESteroids.SteroidsFixer.Helpers]::AddTextChange($item.PipelineElements[-2]....
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Reformat Structures/Reformat Hashtable/ReformatHashtable.ps1
ReformatHashtable.ps1
& { foreach($hashtable in [ISESteroids.SteroidsFixer.Helpers]::GetAST('Hashtable')) { if ($hashtable.Extent.Text.TrimStart().StartsWith('@') -eq $false -or $hashtable.KeyValuePairs.Count -eq 0) { continue } $sb = New-Object -TypeName System.Text.StringBuilder $null = $sb.AppendLine('@{') # find max...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Reformat Structures/RemoveSemicolon/RemoveSemicolon.ps1
RemoveSemicolon.ps1
& { $info = Get-SteroidsAST $Tokens = $info.TokenList $i = $Tokens.Count for($x=0; $x -lt $i; $x++) { # is this a semicolon? if ($Tokens[$x].Kind -eq 'Semi') { # is this token inside a structure where semicolons are useful? $DoReplace = Test-SteroidsTextChange -Extent $Tokens[$x].Extent -Ast ...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Fixer/Variables/NormalizeVariables/NormalizeVariables.ps1
NormalizeVariables.ps1
& { $variables = [ISESteroids.SteroidsFixer.Helpers]::GetAST('VariableExpression') $lookup = @{} foreach($variable in $variables) { if ($variable.Extent.Text.StartsWith('$') -or $variable.Extent.Text.StartsWith('@')) { $name = $variable.VariablePath.toString() if ($variable.Splatted...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/ISESteroids/2.3.0.46/Templates/Generic Header.ps1
Generic Header.ps1
<# Author: Version: Version History: Purpose: #>
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/xComputerManagement/1.3.0/Tests/xComputermanagement.Tests.ps1
xComputermanagement.Tests.ps1
$Module = "$PSScriptRoot\..\DSCResources\MSFT_xComputer\MSFT_xComputer.psm1" Remove-Module -Name MSFT_xComputer -Force -ErrorAction SilentlyContinue Import-Module -Name $Module -Force -ErrorAction Stop InModuleScope MSFT_xComputer { Describe 'MSFT_xComputer' { $SecPassword = ConvertTo...
PowerShellCorpus/Github/DamianFlynn_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/DamianFlynn_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/DamianFlynn_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/DamianFlynn_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/DamianFlynn_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/DamianFlynn_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/DamianFlynn_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/DamianFlynn_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/DamianFlynn_PSProfile/Modules/xActiveDirectory/2.6.0.0/Assert-HADC.ps1
Assert-HADC.ps1
# A configuration to Create High Availability Domain Controller $secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force $domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $safemodeAdministratorCred = New-Object System.Management.Automation.PSCr...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/xActiveDirectory/2.6.0.0/Assert-ParentChildDomains.ps1
Assert-ParentChildDomains.ps1
$secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force $domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $safemodeAdministratorCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $localcred = New-...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/xActiveDirectory/2.6.0.0/Misc/New-ADDomainTrust.ps1
New-ADDomainTrust.ps1
$Properties = @{ SourceDomain = New-xDscResourceProperty -Name SourceDomainName -Type String -Attribute Key ` -Description 'Name of the AD domain that is requesting the trust' TargetDomain = New-xDscResourceProperty -Nam...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/xActiveDirectory/2.6.0.0/DSCResources/MSFT_xADRecycleBin/Examples/xActiveDirectory_xADRecycleBin.ps1
xActiveDirectory_xADRecycleBin.ps1
Configuration Example_xADRecycleBin { Param( [parameter(Mandatory = $true)] [System.String] $ForestFQDN, [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $EACredential ) Import-DscResource -Module xActiveDirectory Node $AllNodes.NodeName {...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/xActiveDirectory/2.6.0.0/DSCResources/MSFT_xADRecycleBin/ResourceDesignerScripts/GeneratexADRecycleBinSchema.ps1
GeneratexADRecycleBinSchema.ps1
New-xDscResource -Name MSFT_xADRecycleBin -FriendlyName xADRecycleBin -ModuleName xActiveDirectory -Path . -Force -Property @( New-xDscResourceProperty -Name ForestFQDN -Type String -Attribute Key New-xDscResourceProperty -Name EnterpriseAdministratorCredential -Type PSCredential -Attribute Required New-...
PowerShellCorpus/Github/DamianFlynn_PSProfile/Modules/posh-gitdir/prompt.ps1
prompt.ps1
$defaultPromptHash = "HEYStcKFSSj9jrfqnb9f+A==" $md5 = [Security.Cryptography.MD5]::Create() $thePrompt = [Text.Encoding]::Unicode.GetBytes((Get-Command prompt | Select-Object -ExpandProperty Definition)) $thePromptHash = [Convert]::ToBase64String($md5.ComputeHash($thePrompt)) if ($thePromptHash -eq $defaultPro...
PowerShellCorpus/Github/joconsol_MonthlyExchangeEmailReport/MonthlyEmailReport.ps1
MonthlyEmailReport.ps1
######################################################### # Monthly mailbox email report # # Version: 1.2 # # Created: 28/10/2014 # # Creator: Nostalgiac # # # # Required config: # # $smtpServer # # $smtpFrom # # $smtpTo # # $smtpServer # ################################...
PowerShellCorpus/Github/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/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/orxan07_test/TestProjForGitHub/packages/jQuery.1.8.2/Tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # Determine the file paths $projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName $origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName if (Test-Path $projectIntelliSense...
PowerShellCorpus/Github/orxan07_test/TestProjForGitHub/packages/jQuery.1.8.2/Tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # VS 11 and above supports the new intellisense JS files $vsVersion = [System.Version]::Parse($dte.Version) $supportsJsIntelliSenseFile = $vsVersion.Major -ge 11 if (-not $supportsJsIntelliSenseFile) { $displayVersio...
PowerShellCorpus/Github/orxan07_test/TestProjForGitHub/packages/jQuery.1.8.2/Tools/common.ps1
common.ps1
function Get-Checksum($file) { $cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider" $fileInfo = Get-Item $file trap { ; continue } $stream = $fileInfo.OpenRead() if ($? -eq $false) { # Couldn't open file for reading return $null } $bytes = $...
PowerShellCorpus/Github/gladstone-institutes_targeted-file-expiration/DeleteScript.ps1
DeleteScript.ps1
####################### # PATH & Date options # ####################### # # Source path, where to look for files to delete # $path = "C:\TO-BE-DELETED" # # Age Limit Filter. Set files older than X days in the negative. Defaults to 2 months: -60 # $limit = (Get-Date).AddDays(-60) # Delete files ol...
PowerShellCorpus/Github/gladstone-institutes_targeted-file-expiration/MoveScript.ps1
MoveScript.ps1
####################### # PATH & Date options # ####################### # # Source path, where to look for files to hide # $Source = "C:\Users" # # Destination path, where we'll "hide" the files from users. # # To minimize performance impact on active imaging acquisition computers, it's suggest to keep th...
PowerShellCorpus/Github/tedhardyMSFT_EventLogUtilities/ListAllEvents/ListAllEvents/Get-LegacyEventSourceMessages.ps1
Get-LegacyEventSourceMessages.ps1
<# .SYNOPSIS Lists all messages for registered legacy event sources on the local machine .DESCRIPTION Iterates through the local registry for all registered legacy event sources. For each event source, retrieve the message DLL(s) associated with that event source. For all eventSource and message DLL combinati...
PowerShellCorpus/Github/tedhardyMSFT_EventLogUtilities/ListAllEvents/ListAllEvents/Get-ProviderEventMessages.ps1
Get-ProviderEventMessages.ps1
<# .SYNOPSIS Lists all event message data for registered manifested event providers on the local machine. .DESCRIPTION Iterates through the registered providers for all provider data. For each provider, retrieve the EventIDs/Versions, Keywords, Destinaion Channels, Message Descriptions and Templates associated...
PowerShellCorpus/Github/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xyunbo_PROASPNETMVC5/MvcMusicStore/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/xpando_Dash/Install.ps1
Install.ps1
$ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" if ($Host.Version.Major -lt 3) { throw "Powershell v3 or greater is required." } Push-Location $PSScriptRoot Write-Host "Downloading ConEmu..." Invoke-WebRequest 'https://conemu.codeplex.com/downloads/get/891710' -OutFile .\ConEmu...
PowerShellCorpus/Github/xpando_Dash/PowerShell/DirColors.ps1
DirColors.ps1
function Format-ChildItemSize($item) { if ($item -is [System.IO.DirectoryInfo]) { "" } elseif ($item.Length -lt 1KB) { (($item.Length.ToString("n0")) + " B ") } elseif ($item.Length -lt 1MB ) { ((($item.Length/1KB).ToString("n0")) + " KB") } elseif ($item.Length -lt 1GB ) { ((($...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Prompt.ps1
Prompt.ps1
if (which git -ErrorAction Ignore) { Enable-GitColors } function gitp { if (!(which git -ErrorAction Ignore)) { return } # Reset color, which can be messed up by Enable-GitColors $Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor # Git Prompt $realLASTEXITC...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Profile.ps1
Profile.ps1
Push-Location $PSScriptRoot Import-Module ".\Modules\Util" -DisableNameChecking Set-Alias which Get-Command Set-Alias l Get-ChildItem Add-Path @( ".\Scripts", "..\Tools", "..\Apps", "..\Apps\figlet", "..\Apps\Sysinternals" ) if (!(Test-Path ENV:NODE_PATH) -and (Test-Path ..\Apps\Node)) { $EN...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/New-CommandWrapper.ps1
New-CommandWrapper.ps1
############################################################################## ## ## New-CommandWrapper ## ## From Windows PowerShell Cookbook (O'Reilly) ## by Lee Holmes (http://www.leeholmes.com/guide) ## ############################################################################## <# .SYNOPSIS Adds ...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshHg/HgUtils.ps1
HgUtils.ps1
function isHgDirectory() { if(test-path ".hg") { return $true; } if(test-path ".git") { return $false; #short circuit if git repo } # Test within parent dirs $checkIn = (Get-Item .).parent while ($checkIn -ne $NULL) { $pathToTest = $checkIn.fullname + '/.hg' if ((Test-Pa...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshHg/HgTabExpansion.ps1
HgTabExpansion.ps1
$script:hgCommands = @() function HgTabExpansion($lastBlock) { switch -regex ($lastBlock) { #handles hgtk help <cmd> #handles hgtk <cmd> 'thg (help )?(\S*)$' { thgCommands($matches[2]); } #handles hg update <branch name> #handles hg merge <branch name> 'hg (up|update...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshHg/HgPrompt.ps1
HgPrompt.ps1
# For backwards compatibility $global:HgPromptSettings = $global:PoshHgSettings function Write-HgStatus($status = (get-hgStatus)) { if ($status) { $s = $global:PoshHgSettings $branchFg = $s.BranchForegroundColor $branchBg = $s.BranchBackgroundColor if($sta...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshHg/profile.example.ps1
profile.example.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) # Load posh-hg module from current directory Import-Module .\posh-hg # If module is installed in a default location ($env:PSModulePath), # use this instead (see about_Modules for more information): # Import-Module posh-hg # Set up...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshHg/Posh-Hg.ps1
Posh-Hg.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) # Load posh-hg module from current directory Import-Module .\posh-hg # If module is installed in a default location ($env:PSModulePath), # use this instead (see about_Modules for more information): # Import-Module posh-hg # Set up a...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshHg/Settings.ps1
Settings.ps1
$global:PoshHgSettings = New-Object PSObject -Property @{ #Before prompt BeforeText = "" BeforeForegroundColor = [ConsoleColor]::Yellow BeforeBackgroundColor = $Host.UI.RawUI.BackgroundColor #After prompt AfterText = "`r`n" AfterForegroundC...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshGit/TortoiseGit.ps1
TortoiseGit.ps1
# TortoiseGit $Global:TortoiseGitSettings = new-object PSObject -Property @{ TortoiseGitPath = "C:\Program Files\TortoiseGit\bin\TortoiseProc.exe" } function tgit { if($args) { if($args[0] -eq "help") { # Replace the built-in help behaviour with just a list of commands $tortoiseGitComm...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshGit/CheckVersion.ps1
CheckVersion.ps1
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) -match '(?<ver>\d+(?:\.\d+)+)') { $ve...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshGit/Utils.ps1
Utils.ps1
# General Utility Functions function Coalesce-Args { $result = $null foreach($arg in $args) { if ($arg -is [ScriptBlock]) { $result = & $arg } else { $result = $arg } if ($result) { break } } $result } Set-Alias ?? Coalesce-Args -F...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshGit/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 = [ConsoleCo...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Modules/Lib/PoshGit/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/xpando_Dash/PowerShell/Modules/Lib/PoshGit/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/xpando_Dash/PowerShell/Scripts/Install-JDK8.ps1
Install-JDK8.ps1
$ErrorActionPreference = "Stop" if ($Host.Version.Major -lt 3) { throw "Powershell v3 or greater is required." } Push-Location $PSScriptRoot $downloadDir = "$ENV:ConEmuDir\Apps" if (!(Test-Path $downloadDir)) { md $downloadDir | Out-Null } Push-Location $downloadDir if (Test-Path .\JDK8) { ...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Decrypt.ps1
Decrypt.ps1
param ( $cyphertext ) [System.Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null $content = [Convert]::FromBase64String($cyphertext) $env = New-Object Security.Cryptography.Pkcs.EnvelopedCms $env.Decode($content) $env.Decrypt() $utf8content = [text.encoding]::UTF8.GetString($env.Conten...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Install-JRE7.ps1
Install-JRE7.ps1
$ErrorActionPreference = "Stop" if ($Host.Version.Major -lt 3) { throw "Powershell v3 or greater is required." } Push-Location $PSScriptRoot $downloadDir = "$ENV:ConEmuDir\Apps" if (!(Test-Path $downloadDir)) { md $downloadDir | Out-Null } Push-Location $downloadDir if (Test-Path .\JRE7) { ...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Set-JREVersion.ps1
Set-JREVersion.ps1
param($version = "7") $JAVA_HOME = Resolve-Path "$ENV:ConEmuDir\Apps\JRE$version" $ENV:JRE_HOME = "$JAVA_HOME" $ENV:JAVA_HOME = "$JAVA_HOME" Add-Path @("$JAVA_HOME\bin")
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Install-Git.ps1
Install-Git.ps1
$ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" if ($Host.Version.Major -lt 3) { throw "Powershell v3 or greater is required." } Push-Location $PSScriptRoot $downloadDir = "$ENV:ConEmuDir\Apps" if (!(Test-Path $downloadDir)) { md $downloadDir | Out-Null } Push-Location...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Install-Figlet.ps1
Install-Figlet.ps1
$ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" if ($Host.Version.Major -lt 3) { throw "Powershell v3 or greater is required." } Push-Location $PSScriptRoot if (!(which go -ErrorAction Ignore)) { throw "Missing Go prgramming language. Use Install-Go before installing figlet...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Format-Hex.ps1
Format-Hex.ps1
<# .SYNOPSIS Outputs a file or pipelined input as a hexadecimal display. To determine the offset of a character in the input, add the number at the far-left of the row with the the number at the top of the column for that character. .EXAMPLE "Hello World" | Format-Hex 0 1 2 3 4 5 6 7 ...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/New-AesKey.ps1
New-AesKey.ps1
$algorithm = [System.Security.Cryptography.SymmetricAlgorithm]::Create("Rijndael") $keybytes = $algorithm.get_Key() $key = [System.Convert]::ToBase64String($keybytes) Write-Output $key
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Set-JDKVersion.ps1
Set-JDKVersion.ps1
param($version = "7") $JAVA_HOME = Resolve-Path "$ENV:ConEmuDir\Apps\JDK$version" $ENV:JRE_HOME = "$JAVA_HOME\jre" $ENV:JAVA_HOME = "$JAVA_HOME" Add-Path @("$JAVA_HOME\bin")
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Install-Node.ps1
Install-Node.ps1
$ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" if ($Host.Version.Major -lt 3) { throw "Powershell v3 or greater is required." } Push-Location $PSScriptRoot $downloadDir = "$ENV:ConEmuDir\Apps" if (!(Test-Path $downloadDir)) { md $downloadDir | Out-Null } Push-Location...
PowerShellCorpus/Github/xpando_Dash/PowerShell/Scripts/Install-Go.ps1
Install-Go.ps1
$ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" if ($Host.Version.Major -lt 3) { throw "Powershell v3 or greater is required." } Push-Location $PSScriptRoot $downloadDir = "$ENV:ConEmuDir\Apps" if (!(Test-Path $downloadDir)) { md $downloadDir | Out-Null } Push-Location...