full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_Archive.EndToEnd.Tests.ps1
MSFT_Archive.EndToEnd.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } Describe 'Archive End to End Test...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_ScriptResource.Integration.Tests.ps1
MSFT_ScriptResource.Integration.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } # Import CommonTestHelper for Ent...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_RegistryResource_KeyAndNameOnly.config.ps1
MSFT_RegistryResource_KeyAndNameOnly.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Key, [ValidateSet('Present', 'Absent')] [String] ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_EnvironmentResource.config.ps1
MSFT_EnvironmentResource.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Name, [ValidateNotNull()] [String] $...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/ServiceSet.Integration.Tests.ps1
ServiceSet.Integration.Tests.ps1
<# These tests should only be run in AppVeyor since they currently require the AppVeyor administrator account credential to run. Also please note that these tests are currently dependent on each other. They must be run in the order given and if one test fails, subsequent tests will also fail....
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_MsiPackage_LogPath.ps1
MSFT_MsiPackage_LogPath.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $ProductId, [Parameter(Mandatory = $true)] [ValidateNo...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_Archive.Integration.Tests.ps1
MSFT_Archive.Integration.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } Describe 'Archive Integration Tes...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsOptionalFeature.config.ps1
MSFT_WindowsOptionalFeature.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Name, [ValidateSet('Present', 'Absent')] [ValidateNot...
PowerShellCorpus/PowerShellGallery/MrAScheduledRestartComputer/1.1/Remove-ExpiredScheduledRestartComputerJob.ps1
Remove-ExpiredScheduledRestartComputerJob.ps1
<# .Synopsis Clean up expired Scheduled Restart-Computer jobs and scripts. .DESCRIPTION Clean up expired Scheduled Restart-Computer jobs and scripts. .PARAMETER JobNamePrefix The prefix of the scheduled restart computer job exists to differentiate the restart jobs from other PowerShell scheduled jo...
PowerShellCorpus/PowerShellGallery/MrAScheduledRestartComputer/1.1/Submit-ScheduledRestartComputerJob.ps1
Submit-ScheduledRestartComputerJob.ps1
<# .Synopsis Schedule a restart of a computer using PowerShell scheduled jobs. .DESCRIPTION Schedule a restart of a computer. You can specify a time in the future when a computer or list of computers will be restarted. .PARAMETER ComputerName Enter the name(s) of computers for which you need to sche...
PowerShellCorpus/PowerShellGallery/MrAScheduledRestartComputer/1.1/Remove-ScheduledRestartComputerJob.ps1
Remove-ScheduledRestartComputerJob.ps1
<# .Synopsis Remove scheduled Restart-Computer job and script. .DESCRIPTION Remove scheduled Restart-Computer job and script. .NOTES Created by: Jason Wasser @wasserja Modified: 6/2/2017 .PARAMETER Name The full name of the scheduled restart computer job if known. .PARAMETER JobNamePrefix ...
PowerShellCorpus/PowerShellGallery/MrAScheduledRestartComputer/1.1/Get-ScheduledRestartComputerJob.ps1
Get-ScheduledRestartComputerJob.ps1
<# .Synopsis Get scheduled Restart-Computer job and associated script. .DESCRIPTION Get Scheduled Restart-Computer job and associated script. .PARAMETER Name The full name of the scheduled restart computer job if known. .PARAMETER JobNamePrefix The prefix of the scheduled restart computer job exis...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/Status.ps1
Status.ps1
############################################################ # DSC Azure Test Example - Status # # This script will show the detailed status of the Virtual # Machine in Azure. # # Before running this script, do the following: # * Open PowerShell and run Get-AzurePublishSettingsFile # * Download the .publishsetting...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/CreateWithDSCExtension.ps1
CreateWithDSCExtension.ps1
############################################################ # DSC Azure Test Example - CREATEwithDSCExtension # # This script will create a test Virtual Machine in Azure, # including the prerequisites - Affinity Group, Storage, # and Cloud Service. # # This example also loads PowerShell Just Enough Administration # in...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/LCM.ps1
LCM.ps1
############################################################ # DSC Azure Test Example - LCM Apply Only # # This script configures your local machine to apply DSC # configurations 'only' which means not to include # DSC automatically monitoring for drift or # re-applying the configuration automationally. # # Set the...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/Create_SqlDatabase.ps1
Create_SqlDatabase.ps1
<# Configuration creates Azure SQL Database #> configuration CreateSqlDatabase { param ( $workingDirectory, $name, $serverCredential, $serverName, $ruleName, $startIPAddress, $endIPAddress, $azureSubscriptionName, $azure...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/SetupSubscription.ps1
SetupSubscription.ps1
############################################################ # DSC Azure Test Example - SETUP SUBSCRIPTION # # Before running this script, do the following: # * Open PowerShell and run Get-AzurePublishSettingsFile # * Download the .publishsettings file in to $workingdir # # Set the folder where your files will liv...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/Destroy.ps1
Destroy.ps1
############################################################ # DSC Azure Test Example - DESTROY # # NOTES - this script removes everything in the test environment # from Azure and then makes sure the subscription is no longer # set as Current for the LocalSystem. # # This script is DESTRUCTIVE without a method of resto...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/RemoveVMs.ps1
RemoveVMs.ps1
############################################################ # DSC Azure Test Example - REMOVE VMS # # This script removes specific VMs from Azure # # This script is DESTRUCTIVE without a method of restoration # # The subscription must be in place in order to access Azure # and do work, so if this is being run in a new...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/PublishConfigurationArchiveToStorage.ps1
PublishConfigurationArchiveToStorage.ps1
# Sample configuration to Publish Configuration Archive to Storage Configuration PublishToStorage { Import-DscResource -Module xAzure xAzureVMDscConfiguration Publish { StorageAccountName = 'dscazext' Ensure = 'Present' ContainerName ...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/Create.ps1
Create.ps1
############################################################ # DSC Azure Test Example - CREATE # # This script will create a test Virtual Machine in Azure, # including the prerequisites - Affinity Group, Storage, # and Cloud Service. # # This example also loads PowerShell Just Enough Administration # inside the VM via ...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/Create_FirewallRule.ps1
Create_FirewallRule.ps1
<# Configuration creates Azure SQL Database Server Firewall Rule #> configuration CreateSqlDatabaseServerFirewallRule { param ( $workingDirectory, $ruleName, $serverName, $startIPAddress, $endIPAddress, $azureSubscriptionName, $azurePubli...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/scriptextensionfiles/InstallJEA.ps1
InstallJEA.ps1
Invoke-WebRequest -Uri 'http://nuget.org/nuget.exe' -OutFile "$env:TEMP\NuGet.exe" &"$env:TEMP\NuGet.exe" install xJea -NoCache -Source http://msconfiggallery.cloudapp.net/api/v2/ -ExcludeVersion -PackageSaveMode "nuspec" -OutputDirectory "$env:ProgramFiles\WindowsPowerShell\Modules" &'winrm' quickconfig -quiet ...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/Examples/ServerCoreTest/ServerCoreTest.ps1
ServerCoreTest.ps1
configuration ServerCoreTest { WindowsFeature NoGUI { Ensure = 'Absent' Name = 'Server-Gui-Mgmt-Infra' } LocalConfigurationManager { ConfigurationMode = 'ApplyOnly' RebootNodeIfNeeded = 'True' } }
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/ResourceDesignerScripts/GenerateXAzureSqlDatabase.ps1
GenerateXAzureSqlDatabase.ps1
$Name = New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description 'Name of the database' $ServerName = New-xDscResourceProperty -Name ServerName -Type String -Attribute Key -Description 'Name of the database server in which database should be created' $MaximumSizeInGB = New-xDscResourceProperty -N...
PowerShellCorpus/PowerShellGallery/xAzure/0.2.0.0/ResourceDesignerScripts/GenerateXAzureSqlDatabaseServerFirewallRule.ps1
GenerateXAzureSqlDatabaseServerFirewallRule.ps1
$Name = New-xDscResourceProperty -Name RuleName -Type String -Attribute Key -Description 'Name of the firewall rule' $ServerName = New-xDscResourceProperty -Name ServerName -Type String -Attribute Key -Description 'Name of the database server for which firewall rule should be created' $StartIPAddress = New-xDscResour...
PowerShellCorpus/PowerShellGallery/Daterpillar.Automation/4.6.8/Convert-DllToSchema.ps1
Convert-DllToSchema.ps1
<# .SYNOPSIS This function genertes a xml schema from a dll assembly. .DESCRIPTION This function reads a specified assembly file, and generates a 'http://static.acklann.com/schema/v2/daterpillar.xsd' xml file using the CLR types defined and decorated with the appropriate [System.Attribute] types. .PARAMETER A...
PowerShellCorpus/PowerShellGallery/myActiveDirectory/1.1.0.0/Test/Test_myAdSubnet.ps1
Test_myAdSubnet.ps1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.127 Created on: 25/08/2016 10:44 Created by: Jean-Yves Moschetto Organization: CARIB INFRA - YOURSYSTEMS Filename: ==============...
PowerShellCorpus/PowerShellGallery/myActiveDirectory/1.1.0.0/Test/Test_myAdExchPrepareSchema.ps1
Test_myAdExchPrepareSchema.ps1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.127 Created on: 25/08/2016 10:44 Created by: Jean-Yves Moschetto Organization: CARIB INFRA - YOURSYSTEMS Filename: ==============...
PowerShellCorpus/PowerShellGallery/myActiveDirectory/1.1.0.0/Test/Test_myAdSite.ps1
Test_myAdSite.ps1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.127 Created on: 25/08/2016 10:44 Created by: Jean-Yves Moschetto Organization: CARIB INFRA - YOURSYSTEMS Filename: ==============...
PowerShellCorpus/PowerShellGallery/myActiveDirectory/1.1.0.0/Test/Test_myAdExchPrepareAD.ps1
Test_myAdExchPrepareAD.ps1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.127 Created on: 25/08/2016 10:44 Created by: Jean-Yves Moschetto Organization: CARIB INFRA - YOURSYSTEMS Filename: ==============...
PowerShellCorpus/PowerShellGallery/myActiveDirectory/1.1.0.0/Test/Test_myAdExchPrepareAllDomains.ps1
Test_myAdExchPrepareAllDomains.ps1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.127 Created on: 25/08/2016 10:44 Created by: Jean-Yves Moschetto Organization: CARIB INFRA - YOURSYSTEMS Filename: ==============...
PowerShellCorpus/PowerShellGallery/myActiveDirectory/1.1.0.0/Test/Test_myAdWaitForObject.ps1
Test_myAdWaitForObject.ps1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.127 Created on: 25/08/2016 10:44 Created by: Jean-Yves Moschetto Organization: CARIB INFRA - YOURSYSTEMS Filename: ==============...
PowerShellCorpus/PowerShellGallery/DynamicsCRM-Automation/8.1.1610.2100/DynamicsCRM-Automation.ps1
DynamicsCRM-Automation.ps1
Function New-CrmPSDrive { Param ( [Parameter(Mandatory=$True)] [string]$Name, [Parameter(Mandatory=$True)] [PowerShellLibrary.Crm.CmdletProviders.IDiscoveryServiceAdapter]$DiscoveryServiceAdapter, [Parameter(Mandatory=$True)] [PowerShellLibrary.Crm.CmdletProviders.IOrganizationServiceAdapter[]]$Orga...
PowerShellCorpus/PowerShellGallery/HPEVCCmdlets/1.0.0.0/ShowLicense.ps1
ShowLicense.ps1
<# (c) © Copyright 2017 Hewlett Packard Enterprise Development, L.P. All rights reserved. #> Add-Type @' public class AsyncPipeline { public System.Management.Automation.PowerShell Pipeline ; public System.IAsyncResult AsyncResult ; } '@ function Create-ThreadPool { [Cmdletbinding()] Param ...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Private/Get-VMPortgroup.ps1
Get-VMPortgroup.ps1
<# .NOTES https://github.com/equelin/vmware-powercli-workflows #> Function Get-VMPortgroup { [CmdletBinding()] Param ( # Name of the portgroup [Parameter(Mandatory=$True)] [ValidateNotNullOrEmpty()] [String]$Name, # vCenter connexion object ...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Private/Get-DestinationNetwork.ps1
Get-DestinationNetwork.ps1
<# .NOTES https://github.com/equelin/vmware-powercli-workflows #> Function Get-DestinationNetwork { [CmdletBinding()] Param ( # Config object [Parameter(Mandatory=$True)] [ValidateNotNullOrEmpty()] [Object]$cfg, # Source vCenter connexion object ...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Private/Get-DestinationDatastore.ps1
Get-DestinationDatastore.ps1
<# .NOTES https://github.com/equelin/vmware-powercli-workflows #> Function Get-DestinationDatastore { [CmdletBinding()] Param ( # Config object [Parameter(Mandatory=$True)] [ValidateNotNullOrEmpty()] [Object]$cfg, # Source vCenter connexion object ...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Private/Get-DestinationCluster.ps1
Get-DestinationCluster.ps1
<# .NOTES https://github.com/equelin/vmware-powercli-workflows #> Function Get-DestinationCluster { [CmdletBinding()] Param ( # Config object [Parameter(Mandatory=$True)] [ValidateNotNullOrEmpty()] [Object]$cfg, # Source vCenter connexion object ...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Private/Get-DestinationVMHost.ps1
Get-DestinationVMHost.ps1
<# .NOTES https://github.com/equelin/vmware-powercli-workflows #> Function Get-DestinationVMHost { [CmdletBinding()] Param ( # Config object [Parameter(Mandatory=$True)] [ValidateNotNullOrEmpty()] [Object]$cfg, # Source vCenter connexion object ...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Public/Invoke-xVCvMotion.ps1
Invoke-xVCvMotion.ps1
#Requires -Version 3 -Modules PSake, Pester, VMware.VimAutomation.Core Function Invoke-xVCvMotion { <# .NOTES https://github.com/equelin/vmware-powercli-workflows #> [cmdletbinding(ConfirmImpact = 'Medium')] param( [Parameter(Mandatory=$False)] [switch]$Mig...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Public/Move-xVCvMotion.ps1
Move-xVCvMotion.ps1
<# .NOTES https://github.com/equelin/vmware-powercli-workflows #> Function Move-xVCvMotion { [CmdletBinding(SupportsShouldProcess = $True,ConfirmImpact = 'High')] Param ( # Config object [Object]$cfg, # Source vCenter connexion object $sourceVCConn, ...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Configs/Config_Test_1.ps1
Config_Test_1.ps1
$cfg = @{} #### MANDATORY PARAMETERS # Informations about the source vCenter $cfg.sourcevc = @{ vc = 'srv-vcenter-01.lab.nantes' user = 'administrator@vsphere.local' password = 'Cheopsfr44@' } # Information about the destination vCenter $cfg.destinationvc = @{ vc = 'srv-vcenter-02.lab.na...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Configs/Config.ps1
Config.ps1
$cfg = @{} #Do not modify this line #### MANDATORY PARAMETERS # Informations about the source vCenter $cfg.sourcevc = @{ vc = 'srv-vcenter-01.example.com' user = 'administrator@vsphere.local' password = 'VMware1!' } # Information about the destination vCenter $cfg.destinationvc = @{ vc =...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Configs/Config_Test_2.ps1
Config_Test_2.ps1
$cfg = @{} #### MANDATORY PARAMETERS # Informations about the source vCenter $cfg.sourcevc = @{ vc = 'srv-vcenter-02.lab.nantes' user = 'administrator@vsphere.local' password = 'Cheopsfr44@' } # Information about the destination vCenter $cfg.destinationvc = @{ vc = 'srv-vcenter-03.lab.na...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/PSake/psakeBuild.ps1
psakeBuild.ps1
properties { # Importing config file . $Config } task default -depends Connection, Test, Disconnection task Connection { # Check for already open session to desired source vCenter server If ($cfg.sourcevc.vc -notin $global:DefaultVIServers.Name) { Try { # Attempt conne...
PowerShellCorpus/PowerShellGallery/PSxVCvMotion/1.0.0/Tests/Pre.Tests.ps1
Pre.Tests.ps1
[CmdletBinding()] Param( # The $cfg hashtable from a single config file [object]$Cfg, $sourceVCConn, $destVCConn ) $VM = Get-Cluster $cfg.cluster.source -Server $sourceVCConn | Get-VM $cfg.vm.scope -Server $sourceVCConn -erroraction SilentlyContinue | Where-Object {$cfg.vm.exclusion -notcontain...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/init.ps1
init.ps1
param($installPath, $toolsPath, $package) $psakeModule = Join-Path $toolsPath psake.psm1 import-module $psakeModule
PowerShellCorpus/PowerShellGallery/psake/4.6.0/psake-config.ps1
psake-config.ps1
<# ------------------------------------------------------------------- Defaults ------------------------------------------------------------------- $config.buildFileName="default.ps1" $config.framework = "4.0" $config.taskNameFormat="Executing {0}" $config.verboseError=$false $config.coloredOutput = $true $config.modul...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/chocolateyInstall.ps1
chocolateyInstall.ps1
$nugetPath = $env:ChocolateyInstall $nugetExePath = Join-Path $nuGetPath 'bin' $packageBatchFileName = Join-Path $nugetExePath "psake.bat" $psakeDir = (Split-Path -parent $MyInvocation.MyCommand.Definition) #$path = ($psakeDir | Split-Path | Join-Path -ChildPath 'psake.cmd') $path = Join-Path $psakeDir 'psake.cmd' W...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/psake.ps1
psake.ps1
# Helper script for those who want to run psake without importing the module. # Example run from PowerShell: # .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0" # Must match parameter definitions for psake.psm1/invoke-psake # otherwise named parameter binding fails param( [Parameter(Position=0,Mandatory=0)...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/properties.ps1
properties.ps1
properties { $x = $null $y = $null $z = $null } task default -depends TestProperties task TestProperties { Assert ($x -ne $null) "x should not be null. Run with -properties @{'x' = '1'; 'y' = '2'}" Assert ($y -ne $null) "y should not be null. Run with -properties @{'x' = '1'; 'y' = '2'}" Asser...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/continueonerror.ps1
continueonerror.ps1
Task default -Depends TaskA Task TaskA -Depends TaskB { "Task - A" } Task TaskB -Depends TaskC -ContinueOnError { "Task - B" throw "I failed on purpose!" } Task TaskC { "Task - C" }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/parameters.ps1
parameters.ps1
properties { $my_property = $p1 + $p2 } task default -depends TestParams task TestParams { Assert ($my_property -ne $null) "`$my_property should not be null. Run with -parameters @{'p1' = 'v1'; 'p2' = 'v2'}" }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/formattaskname_scriptblock.ps1
formattaskname_scriptblock.ps1
properties { $testMessage = 'Executed Test!' $compileMessage = 'Executed Compile!' $cleanMessage = 'Executed Clean!' } task default -depends Test formatTaskName { param($taskName) write-host $taskName -foregroundcolor Green } task Test -depends Compile, Clean { $testMessage } task Compile -depends Clean ...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/preandpostaction.ps1
preandpostaction.ps1
task default -depends Test task Test -depends Compile, Clean -PreAction {"Pre-Test"} -Action { "Test" } -PostAction {"Post-Test"} task Compile -depends Clean { "Compile" } task Clean { "Clean" }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/preandpostcondition.ps1
preandpostcondition.ps1
properties { $runTaskA = $false $taskBSucceded = $true } task default -depends TaskC task TaskA -precondition { $runTaskA -eq $true } { "TaskA executed" } task TaskB -postcondition { $taskBSucceded -eq $true } { "TaskB executed" } task TaskC -depends TaskA,TaskB { "TaskC executed." }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/checkvariables.ps1
checkvariables.ps1
Properties { $x = 1 $y = 2 } FormatTaskName "[{0}]" Task default -Depends Verify Task Verify -Description "This task verifies psake's variables" { Assert (Test-Path 'variable:\psake') "psake variable was not exported from module" Assert ($psake.ContainsKey("version")) "psake variable does not contain 'v...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/msbuild40.ps1
msbuild40.ps1
Framework "4.0" # Framework "4.0x64" task default -depends ShowMsBuildVersion task ShowMsBuildVersion { msbuild /version }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/tasksetupandteardown.ps1
tasksetupandteardown.ps1
TaskSetup { "Executing task setup" } TaskTearDown { "Executing task tear down" } Task default -depends TaskB Task TaskA { "TaskA executed" } Task TaskB -depends TaskA { "TaskB executed" }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/default.ps1
default.ps1
properties { $testMessage = 'Executed Test!' $compileMessage = 'Executed Compile!' $cleanMessage = 'Executed Clean!' } task default -depends Test task Test -depends Compile, Clean { $testMessage } task Compile -depends Clean { $compileMessage } task Clean { $cleanMessage } task ? -Description "Helpe...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/paralleltasks.ps1
paralleltasks.ps1
Task ParallelTask1 { "ParallelTask1" } Task ParallelTask2 { "ParallelTask2" } Task ParallelNested1andNested2 { $jobArray = @() @("ParallelTask1", "ParallelTask2") | ForEach-Object { $jobArray += Start-Job { param($scriptFile, $taskName) Invoke-psake $s...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/requiredvariables.ps1
requiredvariables.ps1
properties { $x = $null $y = $null $z = $null } task default -depends TestRequiredVariables # you can put arguments to task in multiple lines using ` task TestRequiredVariables ` -description "This task shows how to make a variable required to run task. Run this script with -properties @{x = 1; y = ...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/formattaskname_string.ps1
formattaskname_string.ps1
properties { $testMessage = 'Executed Test!' $compileMessage = 'Executed Compile!' $cleanMessage = 'Executed Clean!' } task default -depends Test formatTaskName "-------{0}-------" task Test -depends Compile, Clean { $testMessage } task Compile -depends Clean { $compileMessage } task Clean { $cleanM...
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/nested.ps1
nested.ps1
Properties { $x = 1 } Task default -Depends RunNested1, RunNested2, CheckX Task RunNested1 { Invoke-psake .\nested\nested1.ps1 } Task RunNested2 { Invoke-psake .\nested\nested2.ps1 } Task CheckX{ Assert ($x -eq 1) '$x was not 1' }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/nested/nested2.ps1
nested2.ps1
Properties { $x = 200 } Task default -Depends Nested2CheckX Task Nested2CheckX{ Assert ($x -eq 200) '$x was not 200' }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/nested/nested1.ps1
nested1.ps1
Properties { $x = 100 } Task default -Depends Nested1CheckX Task Nested1CheckX{ Assert ($x -eq 100) '$x was not 100' }
PowerShellCorpus/PowerShellGallery/psake/4.6.0/examples/passingParametersString/parameters.ps1
parameters.ps1
properties { $buildOutputPath = ".\bin\$buildConfiguration" } task default -depends DoRelease task DoRelease { Assert ("$buildConfiguration" -ne $null) "buildConfiguration should not have been null" Assert ("$buildConfiguration" -eq 'Release') "buildConfiguration=[$buildConfiguration] should have been 'Rel...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Get-Subscription.ps1
Get-Subscription.ps1
function Get-Subscription { <# .SYNOPSIS This script can be used to get a subscription from a topic. .DESCRIPTION This script can be used to get a subscription from a topic. .PARAMETER TopicPath Specifies the path of the topic that this subscription description belongs to...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Import-Module.ps1
Import-Module.ps1
# Import-Module.ps1 # # Place any pre-initialisation script here # Note: # * When executed the module is not yet loaded # * Everything you define here (e.g. a variable) is defined OUTSIDE the module scope. # If this script is loaded via "ScriptsToProcess" it will incorrectly # show up as loaded module, see ...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/New-Queue.ps1
New-Queue.ps1
function New-Queue { <# .SYNOPSIS This script can be used to provision a namespace and queue. .DESCRIPTION This script can be used to provision a namespace and a queue. .PARAMETER Path Specifies the full path of the queue. .PARAMETER AutoDeleteOnIdle Spe...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Get-Subscriptions.ps1
Get-Subscriptions.ps1
function Get-Subscriptions { <# .SYNOPSIS This script can be used to get all subscriptions from a topic. .DESCRIPTION This script can be used to get all subscriptions from a topic. .PARAMETER TopicPath Specifies the path of the topic that this subscription description bel...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Get-Queue.ps1
Get-Queue.ps1
function Get-Queue { <# .SYNOPSIS This script can be used to get a queue from a namespace. .DESCRIPTION This script can be used to get a queue from a namespace. .PARAMETER Path Specifies the full path of the queue. #> [CmdletBinding(PositionalBinding=$True)] Pa...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/New-Subscription.ps1
New-Subscription.ps1
function New-Subscription { <# .SYNOPSIS This script can be used to provision a namespace and subscription. .DESCRIPTION This script can be used to provision a namespace and a subscription. .PARAMETER TopicPath Specifies the path of the topic that this subscription descr...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/New-Topic.ps1
New-Topic.ps1
function New-Topic { <# .SYNOPSIS This script can be used to provision a namespace and topic. .DESCRIPTION This script can be used to provision a namespace and a topic. .PARAMETER Path Specifies the full path of the topic. .PARAMETER AutoDeleteOnIdle Spe...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Remove-Queue.ps1
Remove-Queue.ps1
function Remove-Queue { <# .SYNOPSIS This script can be used to delete a queue. .DESCRIPTION This script can be used to delete a queue. .PARAMETER Path Specifies the full path of the queue. .PARAMETER Force Force remove, ignore message count .PAR...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Get-Topic.ps1
Get-Topic.ps1
function Get-Topic { <# .SYNOPSIS This script can be used to get a topic from a namespace. .DESCRIPTION This script can be used to get a topic from a namespace. .PARAMETER Path Specifies the full path of the queue. #> [CmdletBinding(PositionalBinding=$True)] Pa...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Remove-Subscription.ps1
Remove-Subscription.ps1
function Remove-Subscription { <# .SYNOPSIS This script can be used to delete a subscription from a topic. .DESCRIPTION This script can be used to delete a subscription from a topic. .PARAMETER TopicPath Specifies the path of the topic that this subscription description b...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Get-Queues.ps1
Get-Queues.ps1
function Get-Queues { <# .SYNOPSIS This script can be used to get queues from a namespace. .DESCRIPTION This script can be used to get queues from a namespace. .PARAMETER Namespace Specifies the name of the Service Bus namespace. #> [CmdletBinding(PositionalBinding...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Remove-Topic.ps1
Remove-Topic.ps1
function Remove-Topic { <# .SYNOPSIS This script can be used to delete a topic. .DESCRIPTION This script can be used to delete a topic. .PARAMETER Path Specifies the full path of the topic. .PARAMETER Force Force remove, ignore subscription count ...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/Get-Topics.ps1
Get-Topics.ps1
function Get-Topics { <# .SYNOPSIS This script can be used to get topics from a namespace. .DESCRIPTION This script can be used to get topics from a namespace. .PARAMETER Namespace Specifies the name of the Service Bus namespace. #> [CmdletBinding(PositionalBindin...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.Azure.ServiceBus.Management/1.0.1.20160201/New-NotificationHub.ps1
New-NotificationHub.ps1
function New-NotifcationHub { <# .SYNOPSIS This script can be used to provision a namespace and an notification hub. .DESCRIPTION This script can be used to provision a namespace and an notification hub. In particular, the script allows to specify the following parameters: ...
PowerShellCorpus/PowerShellGallery/AWSExt/0.1/Patch-ModuleManifest.ps1
Patch-ModuleManifest.ps1
<# .Author Trevor Sullivan <trevor@trevorsullivan.net> .Description Publishes the PowerShell module to the PowerShell Gallery. This PowerShell script is invoked by AppVeyor after the "Deploy" phase has completed successfully. .Parameter Path The path to the module manifest file. .Paramete...
PowerShellCorpus/PowerShellGallery/AWSExt/0.1/Completers/AWS.S3.BucketName.ArgumentCompleter.ps1
AWS.S3.BucketName.ArgumentCompleter.ps1
$ArgumentCompleter = @{ ### Command to dynamically retrieve all appropriate commands to register with: ### (Get-Command -Module AWSPowerShell -ParameterName BucketName).Name.ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard CommandName = @( 'Copy-S3Object', 'Enable-RSLogging', '...
PowerShellCorpus/PowerShellGallery/AWSExt/0.1/Completers/AWS.IAM.UserName.ArgumentCompleter.ps1
AWS.IAM.UserName.ArgumentCompleter.ps1
$ArgumentCompleter = @{ ### Command to dynamically retrieve all appropriate commands to register with: ### (Get-Command -Module AWSPowerShell -Name *IAM* -ParameterName UserName).ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard; CommandName = @( 'Add-IAMUserToGroup', 'Disable-IAMMFADevi...
PowerShellCorpus/PowerShellGallery/AWSExt/0.1/Completers/AWS.EC2.InstanceId.ArgumentCompleter.ps1
AWS.EC2.InstanceId.ArgumentCompleter.ps1
$ArgumentCompleter = @{ ### Command to dynamically retrieve all appropriate commands to register with: ### (Get-Command -Module AWSPowerShell -Name *ec2* -ParameterName InstanceId).ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard; CommandName = @( 'Add-EC2ClassicLinkVpc', 'Add-EC2Networ...
PowerShellCorpus/PowerShellGallery/AWSExt/0.1/Completers/AWS.R53Domains.DomainName.ArgumentCompleter.ps1
AWS.R53Domains.DomainName.ArgumentCompleter.ps1
$ArgumentCompleter = @{ ### Command to dynamically retrieve all appropriate commands to register with: ### (Get-Command -Module AWSPowerShell -Name *R53D* -ParameterName DomainName).ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard; CommandName = @( 'Disable-R53DDomainAutoRenew', 'Disabl...
PowerShellCorpus/PowerShellGallery/AWSExt/0.1/Completers/AWS.IAM.GroupName.ArgumentCompleter.ps1
AWS.IAM.GroupName.ArgumentCompleter.ps1
$ArgumentCompleter = @{ ### Command to dynamically retrieve all appropriate commands to register with: ### (Get-Command -Module AWSPowerShell -Name *IAM* -ParameterName GroupName).ForEach({ "'{0}'," -f $PSItem }) | Set-Clipboard; CommandName = @( 'Add-IAMUserToGroup', 'Get-IAMAttachedGr...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.System.Logging/1.4.1.20160715/Out-Message.ps1
Out-Message.ps1
function Out-Message { <# .SYNOPSIS Logs a message to default message log target. .DESCRIPTION Logs a message to default message log target. Logs a message in SYSLOG style to a defined autoselected log target in a synchronous way. .OUTPUTS This Cmdlet does not return a parameter. .PARAMETER pat...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.System.Logging/1.4.1.20160715/Import-Module.ps1
Import-Module.ps1
# Import-Module.ps1 # # Place any pre-initialisation script here # Note: # * When executed the module is not yet loaded # * Everything you define here (e.g. a variable) is defined OUTSIDE the module scope. # If this script is loaded via "ScriptsToProcess" it will incorrectly # show up as loaded module, see ...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.System.Logging/1.4.1.20160715/Assert-IsTrue.ps1
Assert-IsTrue.ps1
function Assert-IsTrue { <# .SYNOPSIS Checks if the given expression or value is true and throws an exception if false. .OUTPUTS The Cmdlet returns `$null`. .DESCRIPTION Checks if the given expression or value is true and throws an exception if false. The Cmdlet has two aliases which should only be used (...
PowerShellCorpus/PowerShellGallery/biz.dfch.PS.System.Logging/1.4.1.20160715/Out-MessageException.ps1
Out-MessageException.ps1
function Out-MessageException { <# .SYNOPSIS Writes an error record to a log target. .DESCRIPTION Writes an error record to a log target. This Cmdlet writes a complete ErrorRecord to a log target including the actual ErrorRecord, the exception and a stack trace. If the exception contains inner exceptions they...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Find-WindowsUpdate.ps1
Find-WindowsUpdate.ps1
function Find-WindowsUpdate { <# .Synopsis Finds updates for windows and other products .Description Finds updates for windows and other products that use the Microsoft Update system. .Example Find-WindowsUpdate .Link Get-InstalledUpdate #> param( ...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Get-InstalledUpdate.ps1
Get-InstalledUpdate.ps1
function Get-InstalledUpdate { <# .Synopsis Gets updates installed on the system .Description Gets windows and microsoft updates installed on the system .Example Get-InstalledUpdate .Link Get-InstalledKBNumber #> param() process { ...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Disable-WindowsUpdate.ps1
Disable-WindowsUpdate.ps1
function Disable-WindowsUpdate { <# .Synopsis Disables automatic updates .Description Disables automatic updates on the current machine .Link Enable-WindowsUpdate #> $AUSettigns = (New-Object -com "Microsoft.Update.AutoUpdate").Settings $AUSettigns.No...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Get-InstalledKBNumber.ps1
Get-InstalledKBNumber.ps1
function Get-InstalledKBNumber { <# .Synopsis Gets the installed KB numbers .Description Gets the installed KB numbers on the current machine .Link Get-InstalledUpdate .Example Get-InstalledKBNumber #> param() Get-InstalledUpdate | ...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Test-UpdateRebootRequired.ps1
Test-UpdateRebootRequired.ps1
function Test-UpdateRebootRequired { <# .Synopsis Determines a reboot is required .Description Determines if a reboot is required after applying an update. .Link Install-WindowsUpdate #> param() end { (New-Object -ComObject "Microsoft.Upd...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Install-WindowsUpdate.ps1
Install-WindowsUpdate.ps1
function Install-WindowsUpdate { <# .Synopsis Installs windows updates .Description Installs windows updates discovered with Find-WindowsUpdate .Example Find-WindowsUpdate -Recommended | Install-WindowsUpdate .Link Find-WindowsUpdate #> ...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Patchy.ezformat.ps1
Patchy.ezformat.ps1
$moduleName = 'Patchy' $ModuleRoot = "$home\Documents\WindowsPowerShell\Modules\$moduleName" $formatting = @() $formatting += Write-FormatView -TypeName "System.__ComObject#{c1c2f21a-d2f4-4902-b5c6-8a081c19a890}", "System.__ComObject#{70cf5c82-8642-42bb-9dbc-0cfd2...
PowerShellCorpus/PowerShellGallery/Patchy/1.0/Enable-WindowsUpdate.ps1
Enable-WindowsUpdate.ps1
function Enable-WindowsUpdate { <# .Synopsis Enables automatic updates .Description Enables automatic updates on the current machine .Link Disable-WindowsUpdate #> $AUSettigns = (New-Object -com "Microsoft.Update.AutoUpdate").Settings $AUSettigns....