full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/moohrdy_WWWCourse/Lista 8/zad1/packages/EntityFramework.6.1.1/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/moohrdy_WWWCourse/Lista 8/zad1/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/moohrdy_WWWCourse/Lista 8/zad2/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/moohrdy_WWWCourse/Lista 8/zad2/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/moohrdy_WWWCourse/Lista 8/zad2/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/moohrdy_WWWCourse/Lista 8/zad2/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/moohrdy_WWWCourse/Lista 8/zad2/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/moohrdy_WWWCourse/Lista 8/zad2/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/moohrdy_WWWCourse/Lista 8/zad2/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/geek1311_Templates/Lab04Start.CentralUS.ps1
Lab04Start.CentralUS.ps1
<# .SYNOPSIS This script, in combination with an ARM template called by the script, is used to create the infrastructure starting point for Lab 04 of the Azure ITPRO Camp lab exercises.The script creates two storage accounts: one in East US, and the other in East US 2. The script creates two virtual mac...
PowerShellCorpus/Github/UNT-CAS-ITS_Write-Log/Write-Log.ps1
Write-Log.ps1
<# .SYNOPSIS Write messages to a log file in CMTrace.exe compatible format or Legacy text file format. .DESCRIPTION Write messages to a log file in CMTrace.exe compatible format or Legacy text file format and optionally display in the console. Can also specify parameters via $env:Write-Log variable. Store variab...
PowerShellCorpus/Github/UNT-CAS-ITS_Write-Log/Write-Log.Tests.ps1
Write-Log.Tests.ps1
# Documentation: https://github.com/VertigoRay/Write-Log/wiki/WriteLog-Tests $here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") . "$here\$sut" $VerbosePreference = 'SilentlyContinue' # $VerbosePreference = 'Continue' Describ...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc/Examples/FullExamples/NewFarm.ps1
NewFarm.ps1
<# .EXAMPLE This example shows how to install the prerequisites, binaries and set up a new farm on the local server. #> Configuration Example { param() Import-DscResource -ModuleName OfficeOnlineServerDsc $requiredFeatures = @( "Web-Server", ...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc/Examples/Resources/OfficeOnlineServerFarm/1-NewFarm.ps1
1-NewFarm.ps1
<# .EXAMPLE This example shows how to create a basic web apps farm. There are many more options that can be configured on this resource, but this minimum configuration will deploy a farm that has editing enabled. #> Configuration Example { param() Import-DscResource -Mo...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc/Examples/Resources/OfficeOnlineServerMachine/1-JoinFarm.ps1
1-JoinFarm.ps1
<# .EXAMPLE This example shows how to join a machine to an Office Web Apps farm. This shows that the new server will use all roles (it is not recommended to split roles out to dedicated servers for Office Online Server farms of less than 50 servers). #> Configuration Example { ...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc/Examples/Resources/OfficeOnlineServerInstall/1-InstallBinaries.ps1
1-InstallBinaries.ps1
<# .EXAMPLE This example shows how to install the binaries for office online server to the local server. #> Configuration Example { param() Import-DscResource -ModuleName OfficeOnlineServerDsc OfficeOnlineServerInstall InstallBinaries { Ensure = "...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/.vscode/RunGlobalTestsOnly.ps1
RunGlobalTestsOnly.ps1
Import-Module (Join-Path $PSScriptRoot "..\Tests\Unit\OfficeOnlineServerDsc.TestHarness.psm1") $DscTestsPath = Join-Path $PSScriptRoot "..\Modules\OfficeOnlineServerDsc\DscResource.Tests" if ((Test-Path $DscTestsPath) -eq $false) { throw "Unable to locate DscResource.Tests repo at '$DscTestsPath', common DSC r...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/.vscode/RunAllTests.ps1
RunAllTests.ps1
Import-Module (Join-Path $PSScriptRoot "..\Tests\Unit\OfficeOnlineServerDsc.TestHarness.psm1" -Resolve) -Force $DscTestsPath = Join-Path $PSScriptRoot "..\Modules\OfficeOnlineServerDsc\DscResource.Tests" -Resolve if ((Test-Path $DscTestsPath) -eq $false) { Write-Warning "Unable to locate DscResource.Tests rep...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Unit/OfficeOnlineServerDsc/MSFT_OfficeOnlineServerMachine.tests.ps1
MSFT_OfficeOnlineServerMachine.tests.ps1
[CmdletBinding()] param( [String] $WACCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\15.0.4569.1506\OfficeWebApps.psm1" -Resolve) ) $Script:DSCModuleName = 'OfficeOnlineServerDsc' $Script:DSCResourceName = 'MSFT_OfficeOnlineServerMachine' $Global:CurrentWACCmdletModule = $WACCmdletModule [Stri...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Unit/OfficeOnlineServerDsc/OfficeOnlineServerDsc.Util.Tests.ps1
OfficeOnlineServerDsc.Util.Tests.ps1
[CmdletBinding()] param( [String] $WACCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\15.0.4569.1506\OfficeWebApps.psm1" -Resolve) ) $Global:CurrentWACCmdletModule = $WACCmdletModule [String] $moduleRoot = Join-Path -Path $PSScriptRoot -ChildPath "..\..\..\Modules\OfficeOnlineServerDsc" -Resolve if ( (-...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Unit/OfficeOnlineServerDsc/MSFT_OfficeOnlineServerInstall.tests.ps1
MSFT_OfficeOnlineServerInstall.tests.ps1
[CmdletBinding()] param( [String] $WACCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\15.0.4569.1506\OfficeWebApps.psm1" -Resolve) ) $Script:DSCModuleName = 'OfficeOnlineServerDsc' $Script:DSCResourceName = 'MSFT_OfficeOnlineServerInstall' $Global:CurrentWACCmdletModule = $WACCmdletModule [Stri...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Unit/OfficeOnlineServerDsc/MSFT_OfficeOnlineServerFarm.tests.ps1
MSFT_OfficeOnlineServerFarm.tests.ps1
[CmdletBinding()] param( [String] $WACCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\15.0.4569.1506\OfficeWebApps.psm1" -Resolve) ) $Script:DSCModuleName = 'OfficeOnlineServerDsc' $Script:DSCResourceName = 'MSFT_OfficeOnlineServerFarm' $Global:CurrentWACCmdletModule = $WACCmdletModule [String]...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Integration/MSFT_OfficeOnlineServerWebAppsFarm.Integration.tests.ps1
MSFT_OfficeOnlineServerWebAppsFarm.Integration.tests.ps1
$Script:DSCModuleName = 'OfficeOnlineServerDsc' $Script:DSCResourceName = 'MSFT_OfficeOnlineServerFarm' [String] $moduleRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)) if ( (-not (Test-Path -Path (Join-Path -Path $moduleRoot -ChildPath 'DSCResource....
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Integration/MSFT_OfficeOnlineServerWebAppsFarm.config.ps1
MSFT_OfficeOnlineServerWebAppsFarm.config.ps1
$webAppsFarm = @{ InternalURL = 'http://webfarm.contoso.com/' ExternalURL = 'http://externalfarm.contoso.com/' AllowHttp = $true EditingEnabled = $true SSLOffloaded = $false LogLocation = 'C:\Logs' LogRetentionInDays = 7 LogVerbosity = 'Verbose' Proxy = 'http://proxy.contoso...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Integration/MSFT_OfficeOnlineServerInstall.Integration.tests.ps1
MSFT_OfficeOnlineServerInstall.Integration.tests.ps1
$Script:DSCModuleName = 'OfficeOnlineServerDsc' $Script:DSCResourceName = 'MSFT_OfficeOnlineServerInstall' [String] $moduleRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)) if ( (-not (Test-Path -Path (Join-Path -Path $moduleRoot -ChildPath 'DSCResourc...
PowerShellCorpus/Github/PowerShell_OfficeOnlineServerDsc/Tests/Integration/MSFT_OfficeOnlineServerInstall.config.ps1
MSFT_OfficeOnlineServerInstall.config.ps1
configuration MSFT_OfficeOnlineServerInstall_config { Import-DscResource -ModuleName 'OfficeOnlineServerDsc' node localhost { OfficeOnlineServerInstall Integration_Test { Path = 'C:\InstallBits\setup.exe' } } }
PowerShellCorpus/Github/degant_powershell/src/Azure/Upload-AzureRmADCertificate.ps1
Upload-AzureRmADCertificate.ps1
######################################################################################################################### # Task : Upload Certificate to Azure AD resource # Description : Upload a local certificate file (.cer or .pfx) to an Azure AD resource if it isn't already present. # Validates whet...
PowerShellCorpus/Github/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/Ilya2017_GameStore/GameStore/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/lostrocked_ArtifactRepo/Demos/ExecuteRAAgent.ps1
ExecuteRAAgent.ps1
New-Item -Path c:\Azure1 -ItemType directory Invoke-WebRequest "https://caraazuredemo.blob.core.windows.net/raagentuploadcontainer/nolio_agent_windows_6_2_0_b3017.exe" -OutFile "C:/Azure1/nolio_agent_windows_6_2_0_b3017.exe" Invoke-WebRequest "https://caraazuredemo.blob.core.windows.net/raagentuploadcontainer/Install...
PowerShellCorpus/Github/donkey_MailboxStatistics/MailboxStatistics-Report.ps1
MailboxStatistics-Report.ps1
<# MailboxStatistics-Report.ps1 generate mailbox statistics reporting to out-file Version 1.0.3 (27.03.2017) by DonMatteo Mail: think@unblog.ch Blog: think.unblog.ch #> Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -erroraction silentlyContinue $date = Get-Date -format F $exch = [system.en...
PowerShellCorpus/Github/donkey_MailboxStatistics/MailboxStatistics-html-Report.ps1
MailboxStatistics-html-Report.ps1
<# MailboxStatistics-html-Report.ps1 generate mailbox statistics reporting to out-file Version 1.0.3 (27.03.2017) by DonMatteo Mail: think@unblog.ch Blog: think.unblog.ch #> $a = "<style>" $a = $a + "BODY{background-color:GhostWhite;}" $a = $a + "TABLE{border-width: 1px;border-style: solid;border-colo...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-RegularPrice.ps1
New-RegularPrice.ps1
function New-RegularPrice { $p = New-Object psobject -property @{ PriceType = 0 } $p.PSObject.TypeNames.Insert(0,'Price') $p.PSObject.TypeNames.Insert(1,'RegularPrice') $p | Add-Member -MemberType ScriptMethod -Name charge -Value { param( [Parameter(Mandatory=$tru...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-Customer.Tests.ps1
New-Customer.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") . "$here${directorySeparatorChar}$sut" Describe "New-Customer" { beforeEach { $Customer = New-Customer -Name Jake } It "Simple creation Name=Jake" { ...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-ChildrensPrice.ps1
New-ChildrensPrice.ps1
function New-ChildrensPrice { $p = New-Object psobject -property @{ PriceType = 0 } $p.PSObject.TypeNames.Insert(0,'Price') $p.PSObject.TypeNames.Insert(0,'ChildrensPrice') $p | Add-Member -MemberType ScriptMethod -Name charge -Value { param( [Parameter(Mandatory=...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-Rental.Tests.ps1
New-Rental.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") . "$here${directorySeparatorChar}$sut" Describe "New-Rental Basic creation" { beforeEach { $Price = New-RegularPrice $Movie = New-Movie -Title "Being There" -Pri...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-Movie.ps1
New-Movie.ps1
function New-Movie { param( [Parameter(Mandatory=$true)] [string]$Title, [Parameter(Mandatory=$false)] [ValidateScript({$_.PSObject.TypeNames[0] -eq 'Price' })] $Price ) $m = New-Object psobject -property @{ Title = $Title Price = $Price ...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-NewReleasePrice.ps1
New-NewReleasePrice.ps1
function New-NewReleasePrice { $p = New-Object psobject -property @{ PriceType = 0 } $p.PSObject.TypeNames.Insert(0,'Price') $p.PSObject.TypeNames.Insert(0,'NewReleasePrice') $p | Add-Member -MemberType ScriptMethod -Name charge -Value { param( [Parameter(Mandator...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-Customer.ps1
New-Customer.ps1
function New-Customer { param( [Parameter(Mandatory=$true)] [String] $Name ) $c = New-Object psobject -property @{ Name = $Name Rentals = New-Object System.Collections.ArrayList } $c.PSObject.TypeNames.Insert(0,'Customer') $c | Add-Member -MemberType Scr...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-Rental.ps1
New-Rental.ps1
function New-Rental { param( [Parameter(Mandatory=$true)] [ValidateScript({$_.PSObject.TypeNames[0] -eq 'Movie' })] $Movie, [Parameter(Mandatory=$true)] [int] $DaysRented ) $r = New-Object psobject -property @{ Movie = $Movie DaysRented = $Da...
PowerShellCorpus/Github/rsmcbain_powershell/refactoring/New-Movie.Tests.ps1
New-Movie.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' . "$here\$sut" Describe "New Movie Basic - Star Wars, 0" { BeforeEach { $Price = New-RegularPrice $Movie = New-Movie -Title "Star Wars" -Price $Price ...
PowerShellCorpus/Github/Tervis-Tumbler_ZebraPowerShell/Get-DisneyZebraConfigs.ps1
Get-DisneyZebraConfigs.ps1
$PrintServer = "Disney" $DriverNameMatchString = "ZDesigner*" $DriverNamesToExcludeMatchString = "*ZDesigner LP 2844*" $SavePath = "C:\Users\alozano\Documents\WindowsPowerShell\Scripts\Get-DisneyZebraConfig\ZebraConfigDump" $PrinterObjects = Get-Printer -ComputerName "Disney" | where {$_.DriverName -like $Dri...
PowerShellCorpus/Github/AdamPaternostro_Azure-Turn-On-Blob-Encryption-For-All-Storage-Accounts/Azure-Turn-On-Blob-Encryption-For-All-Storage-Accounts.ps1
Azure-Turn-On-Blob-Encryption-For-All-Storage-Accounts.ps1
# Finds any ARM storage accounts that have blob encrypted turned off and enables it # https://docs.microsoft.com/en-us/azure/storage/storage-service-encryption Login-AzureRmAccount $subscriptionList = Get-AzureRmSubscription foreach ($s in $subscriptionList) { # Note: we can write this to loop through a...
PowerShellCorpus/Github/Kungsbacka_WikiToPdf/WikiToPdf.ps1
WikiToPdf.ps1
. "$PSScriptRoot\Config.ps1" function LogError([object]$o) { "--- $(Get-Date -Format 'G')" | Out-File -FilePath "$PSScriptRoot\error.log" -Append "URL: $($Script:currentUrl)" | Out-File -FilePath "$PSScriptRoot\error.log" -Append $o | Out-File -FilePath "$PSScriptRoot\error.log" -Append "`r`n" |...
PowerShellCorpus/Github/Kungsbacka_WikiToPdf/Config.example.ps1
Config.example.ps1
$Script:Config = @{ # Full path to wikihtmltopdf executable WkhtmltopdfPath = 'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe' # Destination directory Destination = 'C:\Pdf' # Set this to $false to perform an incremental export instead of full AlwaysDoFullExport = $false # Always do...
PowerShellCorpus/Github/gerald-magno_Powershell/SitesInCollection.ps1
SitesInCollection.ps1
#Specify tenant admin and site URL $adminUrl = "https://<tenant>-admin.sharepoint.com/" $siteUrl = "https://<tenant>.sharepoint.com/" #Use Credential Manager module #Install-Module -Name CredentialManager if ((Get-Module CredentialManager).Count -eq 0) { #Write-Host "module doesnt exist" Import-Modul...
PowerShellCorpus/Github/terryjintry_OLSource1.ko-kr/.openpublishing.build.ps1
.openpublishing.build.ps1
param( [string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1", [string]$parameters ) # Main $errorActionPreference = 'Stop' # Step-1 Download buildcore script to local echo "download build core script to local with source ur...
PowerShellCorpus/Github/neh123us_AngularIntroduction/packages/EntityFramework.5.0.0-rc/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/neh123us_AngularIntroduction/packages/EntityFramework.5.0.0-rc/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/neh123us_AngularIntroduction/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/neh123us_AngularIntroduction/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/neh123us_AngularIntroduction/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/neh123us_AngularIntroduction/packages/Newtonsoft.Json.7.0.1-beta1/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/install?version=" + $package.Version $dte2 = Get-Interface $dte ([EnvDTE80.DTE2]) if ($dte2.ActiveWin...
PowerShellCorpus/Github/ghostsquad_AetherCore/TestCommon.ps1
TestCommon.ps1
$ErrorActionPreference = "Stop" Set-StrictMode -Version Latest $private:here = Split-Path $MyInvocation.MyCommand.Path -Parent $private:modulePath = (Get-ChildItem -Path $here -Filter *.psd1)[0].FullName if((Test-Path (Join-Path $here 'test.config.ps1'))) { . $here\test.config.ps1 } Import-Module $private:mo...
PowerShellCorpus/Github/ghostsquad_AetherCore/Run-Tests.ps1
Run-Tests.ps1
param ( [string]$TestName = "*", [switch]$Debug, [switch]$CurrentContext = $false ) $ErrorActionPreference = "Stop" if($Debug){ $DebugPreference = "Continue" } $here = (Split-Path -Parent $MyInvocation.MyCommand.Path) if($currentContext) { Import-Module Pester Invoke-Pester -Test...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Attach-PSNote.Tests.ps1
Attach-PSNote.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Attach-PSNote" { Context "Given Name, Value" { It "Adds name/value as note property" { $expectedName = "foo" $expectedValue = "bar" ...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Where-Object.Test.ps1
Where-Object.Test.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path . "$here\..\TestCommon.ps1" Describe 'Where-Any' { Context 'using $_' { It 'When piped objects, given 1-10, condition $_ > 5, returns true' { $result = @(1..10) | Where-Any {$_ -gt 5} $result | Should Be $true }...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Assert-ScriptBlockParametersEqual.Tests.ps1
Assert-ScriptBlockParametersEqual.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path . "$here\..\TestCommon.ps1" Describe "Assert-ScriptBlockParametersEqual" { It 'Given X is Null, expect exception' { $y = {param($a)} { Assert-ScriptBlockParametersEqual $null $y } | Should Throw 'X or Y is Null' } It 'Given...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Get-Delegate.Tests.ps1
Get-Delegate.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe 'Get-Delegate Static Methods' { Context '[string]::format | get-delegate -delegate ''func[string,object,string]''' { It 'formats a string' { $delegate = [strin...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/PSCustomObjectExtensions.Tests.ps1
PSCustomObjectExtensions.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" function _AddNoteProperties1Arg { param ( [object]$object = (New-PSObject) ) $hash = @{p1=4; p2="Q4"; p3=(New-PSObject)} $object = New-PSObject $object.PSAddMe...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Attach-PSScriptMethod.Tests.ps1
Attach-PSScriptMethod.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Attach-PSScriptMethod" { BeforeEach { $expectedMethodName = "foo" $expectedScript = {return "bar"} } Context "Given Name, Script" { It "Attac...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Invoke-Using.Tests.ps1
Invoke-Using.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" if (-not ([System.Management.Automation.PSTypeName]'TestDisposable').Type) { Add-Type -WarningAction Ignore -TypeDefinition @" using System; public class TestDisposable ...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Add-TypeAccelerator.Tests.ps1
Add-TypeAccelerator.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Add-TypeAccelerator" { It "Can add type accelerator" { Add-TypeAccelerator List "System.Collections.Generic.List``1" $MyList = New-Object List[String] $M...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/New-PSObject.Tests.ps1
New-PSObject.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path . "$here\..\TestCommon.ps1" Describe "New-PSObject" { It "creates a new PSCustomObject" { $actualObject = New-PSObject $actualObject.GetType() | Should Be ([System.Management.Automation.PSCustomObject]) } It "adds properties ...
PowerShellCorpus/Github/ghostsquad_AetherCore/tests/Attach-PSProperty.Tests.ps1
Attach-PSProperty.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path # here : /branch/tests/Poshbox.Test . "$here\..\TestCommon.ps1" Describe "Attach-PSProperty" { BeforeEach { $expectedPropertyName = "foo" $expectedGetterScript = {return "bar"} $expectedSetterScript = {return} } Con...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Get-CurrentFunctionName.ps1
Get-CurrentFunctionName.ps1
function Get-CurrentFunctionName { return (Get-Variable MyInvocation -Scope 1).Value.MyCommand.Name; }
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-PSCredential.ps1
New-PSCredential.ps1
function New-PSCredential { param ( [string]$UserName, [string]$Password ) Guard-ArgumentNotNullOrEmpty 'UserName' $UserName Guard-ArgumentNotNullOrEmpty 'Password' $Password $secpasswd = ConvertTo-SecureString $Password -AsPlainText -Force return New-Object System.Ma...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Where-Any.ps1
Where-Any.ps1
# Originally taken from: http://stackoverflow.com/questions/1499466/powershell-equivalent-of-linq-any # But with some enhancements if the user uses "-InputObject" <# .SYNOPSIS Tests if any object in an array matches the expression .EXAMPLE @( "red", "blue" ) | Where-Any { $_ -eq "blue" } | Write-Host ...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-PSObject.ps1
New-PSObject.ps1
function New-PSObject { param( [System.Collections.Hashtable]$Property ) return (New-Object PSObject -Property $Property) }
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Guard-FileExists.ps1
Guard-FileExists.ps1
function Guard-FileExists { param( [string]$ArgumentName = $(throw 'parameter -ArgumentName is required.'),, [string]$FileName ) Guard-ArgumentNotNullOrEmpty $ArgumentName $FileName Guard-ArgumentValid $ArgumentName ('File not found: {0}' -f $FileName) ([System.IO.File]::Exists($...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Add-TypeAccelerator.ps1
Add-TypeAccelerator.ps1
############################################################################## #.SYNOPSIS # Add a type accelerator to the current session. # #.DESCRIPTION # The Add-TypeAccelerator function allows you to add a simple type accelerator # (like [regex]) for a longer type (like [System.Text.RegularExpressions.Regex])...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/ConvertTo-HashTable.ps1
ConvertTo-HashTable.ps1
function ConvertTo-HashTable { param ( [parameter(ValueFromPipeline)] [PSObject]$inputObject ) process { $hashtable = @{} foreach($property in $inputObject.psobject.properties) { [Void]$hashtable.Add($property.Name, $property.Value) } ...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Attach-PSNote.ps1
Attach-PSNote.ps1
function Attach-PSNote { [cmdletbinding(DefaultParameterSetName='buildingblocks')] param ( [Parameter(Position=0,ParameterSetName='buildingblocks')] [Parameter(ParameterSetName='PSNoteProperty')] [PSObject]$InputObject, [Parameter(Position=1,ParameterSetName='buildingbloc...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-PSObjectEqualityComparer.ps1
New-PSObjectEqualityComparer.ps1
function New-PSObjectEqualityComparer { param ( [Func[PSObject, PSObject, bool]]$EqualsDelegate, [Func[PSObject, int]]$GetHashCodeDelegate ) return (new-object [Aether.Core.PSObjectEqualityComparer]($EqualsDelegate, $GetHashCodeDelegate)) }
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Attach-PSProperty.ps1
Attach-PSProperty.ps1
function Attach-PSProperty { [cmdletbinding(DefaultParameterSetName = 'buildingblocks')] param ( [Parameter(Position=0,ParameterSetName='buildingblocks')] [Parameter(Position=0,ParameterSetName='PsScriptProperty')] [PSObject]$InputObject, [Parameter(Position=1,ParameterSe...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Guard-ArgumentNotNull.ps1
Guard-ArgumentNotNull.ps1
function Guard-ArgumentNotNull { param( [string]$ArgumentName, [object]$ArgumentValue ) if($ArgumentValue -eq $null) { throw (New-Object System.ArgumentNullException($ArgumentName)) } }
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Get-Delegate.ps1
Get-Delegate.ps1
# http://poshcode.org/3327 #requires -version 3 function Get-Delegate { <# .SYNOPSIS Create an action[] or func[] delegate for a psmethod reference. .DESCRIPTION Create an action[] or func[] delegate for a psmethod reference. .PARAMETER Method A PSMethod reference to create a delegate for. This parameter acc...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-Lazy.ps1
New-Lazy.ps1
#Describe "Lazy" { # $lazy = New-Lazy { return "test" } # # It "Should not have a value evaluated" { # $lazy.IsValueCreated.Should.Be($false) # } # # It "Should get lazy value" { # $lazy.Value.Should.Be("test") # $lazy.IsValueCreated.Should.Be($true) # } #} function New...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-DynamicModuleBuilder.ps1
New-DynamicModuleBuilder.ps1
function New-DynamicModuleBuilder { # .SYNOPSIS # Creates a new assembly and a dynamic module within the current AppDomain. # .DESCRIPTION # Prepares a System.Reflection.Emit.ModuleBuilder class to allow construction of dynamic types. # The ModuleBuilder is created to allow the creation o...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Guard-ArgumentValid.ps1
Guard-ArgumentValid.ps1
function Guard-ArgumentValid { param( [string]$ArgumentName = $(throw 'parameter -ArgumentName is required.'), [string]$Message = "Argument Failed Validation", [bool]$Test ) if(-not $Test) { throw (New-Object System.ArgumentException($Message, $ArgumentName)) } ...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Guard-ArgumentNotNullOrEmpty.ps1
Guard-ArgumentNotNullOrEmpty.ps1
function Guard-ArgumentNotNullOrEmpty { param( [string]$ArgumentName, $ArgumentValue ) Guard-ArgumentNotNull $ArgumentName $ArgumentValue if($ArgumentValue -is [System.Collections.IEnumerable]) { if (!$ArgumentValue.GetEnumerator().MoveNext()) { throw (New...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Invoke-Using.ps1
Invoke-Using.ps1
# http://support-hq.blogspot.com/2011/07/using-clause-for-powershell.html function Invoke-Using { param ( $InputObject = $(throw "The parameter -inputObject is required."), [ScriptBlock]$ScriptBlock = $(throw "The parameter -scriptBlock is required.") ) Try { $ScriptBlock.In...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Attach-PSScriptMethod.ps1
Attach-PSScriptMethod.ps1
function Attach-PSScriptMethod { [cmdletbinding(DefaultParameterSetName = 'buildingblocks')] param ( [Parameter(Position=0,ParameterSetName = 'buildingblocks')] [Parameter(Position=0,ParameterSetName = 'PSScriptMethod')] [PSObject]$InputObject, [Parameter(Position=1,Param...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Create-DirectoryIfNotExists.ps1
Create-DirectoryIfNotExists.ps1
function Create-DirectoryIfNotExists { param ( [string]$Path ) [Void][System.IO.Directory]::CreateDirectory($Path) }
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-GenericObject.ps1
New-GenericObject.ps1
#http://www.leeholmes.com/blog/2006/08/18/creating-generic-types-in-powershell/ function New-GenericObject { ## New-GenericObject.ps1 ## Creates an object of a generic type: ## ## Usage: ## ## # Simple generic collection ## $list = New-GenericObject System.Collections.ObjectModel...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Assert-ScriptBlockParametersEqual.ps1
Assert-ScriptBlockParametersEqual.ps1
function Assert-ScriptBlockParametersEqual { param ( [ScriptBlock]$x, [ScriptBlock]$y, [Switch]$AssertNamesMatch, [Switch]$Strict ) if($x -eq $null -or $y -eq $null) { throw (New-Object Aether.Core.ParametersNotEquivalentException('X or Y is Null')) } ...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Invoke-Generic.ps1
Invoke-Generic.ps1
function Invoke-Generic { #.Synopsis # Invoke Generic method definitions via reflection: [CmdletBinding()] param( [Parameter(Position=0,ValueFromPipelineByPropertyName=$true)] [Alias('On','Type')] $InputObject, [Parameter(Position=1,ValueFromPipelineByPropertyName=...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-Enum.ps1
New-Enum.ps1
function New-Enum { # .SYNOPSIS # Creates a new enum (System.Enum) from a hashtable using an existing dynamic module. # .DESCRIPTION # New-Enum dynamically creates an enum with the specified name (and namespace). # # A hashtable is used to populate the enum. All values passed in via ...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/Guard-DirectoryExists.ps1
Guard-DirectoryExists.ps1
function Guard-DirectoryExists { param( [string]$ArgumentName = $(throw 'parameter -ArgumentName is required.'), [string]$DirectoryName ) Guard-ArgumentNotNullOrEmpty $ArgumentName $DirectoryName Guard-ArgumentValid $ArgumentName ('Directory not found: {0}' -f $DirectoryName) ([S...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/PSCustomObjectExtensions.ps1
PSCustomObjectExtensions.ps1
# Usage # $p.PSAddMember("q1","Value1") # $p.PSAddMember("q3",{"*"* $this.Threads.Count},"ScriptProperty") # $hash = @{q3=4; q4="Q4"; q5=(gsv alg)} # $p.PSAddMember($hash) Update-TypeData -TypeName System.Object ` -MemberType ScriptMethod ` -MemberName PSAddNoteProperty ` -Value { switch ...
PowerShellCorpus/Github/ghostsquad_AetherCore/functions/New-Closure.ps1
New-Closure.ps1
function New-Closure { #.SYNOPSIS # A more fine grained approach to capturing variables than GetNewClosure #.EXAMPLE # $acc = New-Closure @{t = 0} {param($v = 1) $t += $v; $t} ; & $acc 10 ; & $acc # 10 # 11 [OutputType([scriptblock])] [CmdletBinding()] param( [System.Collections.IDictionary]$Variable...