full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/WithOptions.ps1
WithOptions.ps1
Function WithOptions { <# .SYNOPSIS Specify options for a DeploymentType .DESCRIPTION Specify options for a DeploymentType. This includes both DeploymentOptions and DeploymentParameters. These are passed directly to the DeploymentType script in two was: - They are spla...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/FromSource.ps1
FromSource.ps1
# From is a reserved keyword... Function FromSource { <# .SYNOPSIS Specify sources to deploy in a 'By' block of a PSDeploy.ps1 .DESCRIPTION Specify sources to deploy in a 'By' block of a PSDeploy.ps1 This is not intended to be used anywhere but in a *.PSDeploy.ps1 file. It is inclu...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/DependingOn.ps1
DependingOn.ps1
Function DependingOn { <# .SYNOPSIS Specify dependencies for a By block .DESCRIPTION Specify dependencies for a By block. IMPORTANT: This controls the order of operations. It does not prevent further execution o items if a dependency fails. This is not intended to be used ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/Public/WithPostScript.ps1
WithPostScript.ps1
Function WithPostScript { <# .SYNOPSIS Specify a script to run after the deployment in a By block .DESCRIPTION Specify a script to run after the deployment in a By block Keep in mind: * This runs in the current scope using dot sourcing * A FromSource with multip...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/PSGalleryScript.ps1
PSGalleryScript.ps1
<# .SYNOPSIS Deploys a script to a PowerShell repository like the PowerShell Gallery. .DESCRIPTION Deploys a script to a PowerShell repository like the PowerShell Gallery. This only supports publishing items that do not already have a PSScriptInfo header. We might support this ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/Git.ps1
Git.ps1
<# .SYNOPSIS Deploys / Push to a Git repository. .DESCRIPTION Deploys / Push to a Git repository. .PARAMETER Deployment Deployment to run .PARAMETER CommitMessage Message added to each commit .PARAMETER Tag Tag added to the commit #> [cmdletbinding()] para...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/CopyVMFile.ps1
CopyVMFile.ps1
<# .SYNOPSIS Uses Copy-VMfile cmdlet which ships with Hyper-V on Sever 2012 R2 .DESCRIPTION Uses Copy-VMfile cmdlet (introduced in Server 2012 R2 Hyper-V) to perform the deployment. The cmdlet has some issues while copying to C:\windows\System32 & 'C:\Program files' folder (issue...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/MkDocs.ps1
MkDocs.ps1
<# .SYNOPSIS Deploy a MkDocs Site to a filesystem Locationas a static site or JSON object, or deploy the static site to GitHub Pages. .DESCRIPTION Build and deploy documentation with MkDocs: * As a static site to a filesystem location * As a JSON representation ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/Artifactory.ps1
Artifactory.ps1
<# .SYNOPSIS Deploys file(s) to an Artifactory endpoint. .DESCRIPTION Deploys files to an Artifactory endpoint and optionally extract the file contents in Artifactory if the source file is an archive (zip, tar, tar.gz, or tgz). .PARAMETER Deployment Deployment to run ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/AppVeyorModule.ps1
AppVeyorModule.ps1
<# .SYNOPSIS Deploys a module as an AppVeyor artifact .DESCRIPTION Deploys a module as an AppVeyor artifact Deployment source should be either: The path to the module folder, or; The path to the module manifest End users can follow the DSC Resource Deve...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/FileSystemDiff.ps1
FileSystemDiff.ps1
<# .SYNOPSIS Deploy using Copy-Item for folder and file deployments checking for code differences .DESCRIPTION Deploy files using Copy-Item, but first check if the code in the destination file has changed since the last deployment. Scenarios: 1. File does not exis...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/PSGalleryModule.ps1
PSGalleryModule.ps1
<# .SYNOPSIS Deploys a module to a PowerShell repository like the PowerShell Gallery. .DESCRIPTION Deploys a module to a PowerShell-based repository like the PowerShell Gallery. Can also be used to deploy to a private instance of PowerShell Gallery or to any nuget-based repository. ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/vSphereOVF.ps1
vSphereOVF.ps1
<# .SYNOPSIS Deploys a OVF/OVA to a VMWare vSphere Infrastructure. .DESCRIPTION Deploys a OVF/OVA to a VMWare vSphere Infrastructure. You have to be connected to a vCenter Server or an ESXi before deploying the OVF/OVA. .PARAMETER Deployment Deployment to run .PARAMETE...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/Noop.ps1
Noop.ps1
<# .SYNOPSIS Display variables that a deployment script would receive. Used for testing and validation. .DESCRIPTION Display variables that a deployment script would receive. Used for testing and validation. .PARAMETER Deployment Deployment to process .PARAME...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/Task.ps1
Task.ps1
<# .SYNOPSIS Support deployments by handling simple tasks. .DESCRIPTION Support deployments by handling simple tasks. You can use a Task in two ways: As a scriptblock: By Task { "Run some deployment code in this scriptblock!" } ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/Chocolatey.ps1
Chocolatey.ps1
<# .SYNOPSIS Deploys a package to a Chocolatey repository. .DESCRIPTION Deploys a Chocolatey package to a nuget-based repository like the Chocolatey Gallery. Can also be used to deploy to a private instance of Chocolatey simple server or to any nuget-based repository. .PARAMETER De...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/ARM.ps1
ARM.ps1
<# .SYNOPSIS Deploy using Azure Resource Manager cmdlets. .DESCRIPTION Deploy using Azure Resource Manager. Runs in the current session (i.e. as the current user) .PARAMETER Deployment Deployment to run #> #Requires -modules AzureRM.Resources [cmdletbinding()] param ( ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/FilesystemRemote.ps1
FilesystemRemote.ps1
<# .SYNOPSIS Uses PSRemoting and deploys with Robocopy or Copy-Item for folder and file deployments, respectively. .DESCRIPTION Uses PSRemoting and deploys with Robocopy or Copy-Item for folder and file deployments, respectively. Runs in the specified remoting endpoint. Keep in...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/PSDirect.ps1
PSDirect.ps1
<# .SYNOPSIS Uses PowerShell direct (PSDirect) for deploying to a VM & Hyper-V host (running Windows Server 2016 & above) .DESCRIPTION Uses PowerShell direct introduced in Windows Server 2016. In order to run this deployment type, the PSDeploy deployment needs to be run on the Hyper-V host. ...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/PlatyPS.ps1
PlatyPS.ps1
<# .SYNOPSIS Deploys An External Help Xml file from PlatyPS markdown. .DESCRIPTION Deploys An External Help Xml file from PlatyPS markdown to specified help folder. .PARAMETER Deployment Deployment to run .PARAMETER Encoding Character encoding for your...
PowerShellCorpus/PowerShellGallery/PSDeploy/0.1.27/PSDeployScripts/FileSystem.ps1
FileSystem.ps1
<# .SYNOPSIS Deploy using Robocopy or Copy-Item for folder and file deployments, respectively. .DESCRIPTION Deploy using Robocopy or Copy-Item for folder and file deployments, respectively. Runs in the current session (i.e. as the current user) .PARAMETER Deployment Deploy...
PowerShellCorpus/PowerShellGallery/PowerEmpire/0.1/Listener.ps1
Listener.ps1
<# .Synopsis Get default Empire listener options. .DESCRIPTION Get default Empire listener options. .PARAMETER Id Empire session Id of the session to use. .PARAMETER Token Empire API token to use to execute the action. .PARAMETER ComputerName IP Address or FQDN of remote Empire server. .PAR...
PowerShellCorpus/PowerShellGallery/PowerEmpire/0.1/Stager.ps1
Stager.ps1
<# .SYNOPSIS Get information on available stagers on a Empire server. .DESCRIPTION Get information on available stagers on a Empire server. .PARAMETER Id Empire session Id of the session to use. .PARAMETER Token Empire API token to use to execute the action. .PARAMETER ComputerName IP Addr...
PowerShellCorpus/PowerShellGallery/PowerEmpire/0.1/Admin.ps1
Admin.ps1
<# .SYNOPSIS Get the version of a remote Empire headless server. .DESCRIPTION Get the version of a remote Empire headless server. .PARAMETER Id Empire session Id of the session to use. .PARAMETER Token Empire API token to use to execute the action. .PARAMETER ComputerName IP Address or FQD...
PowerShellCorpus/PowerShellGallery/PowerEmpire/0.1/Module.ps1
Module.ps1
<# .SYNOPSIS Get information on Empire modules. .DESCRIPTION Get information on Empire modules. .PARAMETER Id Empire session Id of the session to use. .PARAMETER Token Empire API token to use to execute the action. .PARAMETER ComputerName IP Address or FQDN of remote Empire server. .PARAM...
PowerShellCorpus/PowerShellGallery/PowerEmpire/0.1/Report.ps1
Report.ps1
<# .Synopsis Get logged events for actions taken in a Empire server. .DESCRIPTION Get logged events for actions taken in a Empire server. .PARAMETER Id Empire session Id of the session to use. .PARAMETER Token Empire API token to use to execute the action. .PARAMETER ComputerName IP Address ...
PowerShellCorpus/PowerShellGallery/PowerEmpire/0.1/Agents.ps1
Agents.ps1
<# .SYNOPSIS Get agents on a Epire server. .DESCRIPTION Get all current agents on a Epire server. .PARAMETER Id Empire session Id of the session to use. .PARAMETER Token Empire API token to use to execute the action. .PARAMETER ComputerName IP Address or FQDN of remote Empire server. .PAR...
PowerShellCorpus/PowerShellGallery/PowerEmpire/0.1/Session.ps1
Session.ps1
<# .SYNOPSIS Create a new session to an Empire server. .DESCRIPTION Create a new session to an Empire server. .PARAMETER ComputerName IP Address or FQDN of remote Empire server. .PARAMETER Port Port number to use in the connection to the remote Empire server. .PARAMETER NoSSLCheck Do not c...
PowerShellCorpus/PowerShellGallery/xWindowsRestore/1.0.0/Examples/ConfigureSystemRestore.ps1
ConfigureSystemRestore.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #wit...
PowerShellCorpus/PowerShellGallery/xWindowsRestore/1.0.0/Examples/CreateSystemRestorePoint.ps1
CreateSystemRestorePoint.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #wit...
PowerShellCorpus/PowerShellGallery/Fmg-PrettyJson/0.1.0/Get-NewtonsoftJsonSettings.ps1
Get-NewtonsoftJsonSettings.ps1
$fmgSerializerSettings = $null # Load Newtonsoft if([Type]::GetType("Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver") -eq $Null) { if($PSVersionTable.PSEdition -eq "Core") { [System.Reflection.Assembly]::LoadFile("$PSScriptRoot\bin\netstandard1.3\Newtonsoft.Json.dll") } else...
PowerShellCorpus/PowerShellGallery/Fmg-PrettyJson/0.1.0/ConvertTo-NewtonsoftJson.ps1
ConvertTo-NewtonsoftJson.ps1
function ConvertTo-NewtonsoftJson() { <# .SYNOPSIS Converts the PsObject, Array, or Hashtable into a json string. .DESCRIPTION An alternate ConvertTo-Json method that outputs readable json unlike the native version for Powershell 5 and below. .PARAMETER InputObject The Array, ...
PowerShellCorpus/PowerShellGallery/SslLabs/0.1.4/helpers/Test-SslLabsApi.ps1
Test-SslLabsApi.ps1
function Test-SslLabsApi { try { $null = Invoke-RestMethod -Method get -Uri "$ApiBase/info" } catch { throw $_ } }
PowerShellCorpus/PowerShellGallery/SslLabs/0.1.4/functions/Invoke-SslLabsAssessment.ps1
Invoke-SslLabsAssessment.ps1
function Invoke-SslLabsAssessment { [CmdletBinding()] param ( [Parameter(Mandatory = $true, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string] $HostName, [switch] $Publish, [switch] $IgnoreCertificate ) begin { $Ve...
PowerShellCorpus/PowerShellGallery/SslLabs/0.1.4/functions/Get-SslLabsCert.ps1
Get-SslLabsCert.ps1
function Get-SslLabsCert { [CmdletBinding()] param ( ) $VerbosePreference = "SilentlyContinue" Test-SslLabsApi $Splat = @{ Method = "Get" Uri = "$ApiBase/getRootCertsRaw" } $Response = Invoke-RestMethod @Splat $RawStrings = $Response -split '\n\n' | Wh...
PowerShellCorpus/PowerShellGallery/SslLabs/0.1.4/functions/Get-SslLabsEndpoint.ps1
Get-SslLabsEndpoint.ps1
function Get-SslLabsEndpoint { [CmdletBinding()] param ( [Parameter(Mandatory)] [string] $HostName, [Parameter(Mandatory)] [ipAddress] $IPAddress ) $VerbosePreference = "SilentlyContinue" Test-SslLabsApi $Splat = @{ Method = ...
PowerShellCorpus/PowerShellGallery/Automation.Database/1.0.61/scripts/Deploy.ps1
Deploy.ps1
param( [Parameter(Mandatory=$true)] $ApiKey, $NuGetVersion = "2.8.5.208", $NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" ) function Write-Succeed{ Write-Host "[Succeed]" -ForegroundColor Green } function Write-Status{ [cmdletbinding()] param ( [Parameter(M...
PowerShellCorpus/PowerShellGallery/cChoco-testing/2.0.1.1/ExampleConfig.ps1
ExampleConfig.ps1
Configuration myChocoConfig { Import-DscResource -Module cChoco Node "localhost" { LocalConfigurationManager { DebugMode = 'ForceModuleImport' } cChocoInstaller installChoco { InstallDir = "c:\choco" } cChocoPackageInstaller installChro...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Private/Base.ps1
Base.ps1
function Base { [CmdletBinding()] param ( [string]$WAPIHost, [string]$WAPIVersion, [Parameter(ValueFromRemainingArguments = $true)] $Splat ) "https://$WAPIHost/wapi/v$WAPIVersion/" }
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Private/Initialize-CallVars.ps1
Initialize-CallVars.ps1
function Initialize-CallVars { [CmdletBinding()] param( [Alias('host')] [string]$WAPIHost, [Alias('version')] [string]$WAPIVersion, [PSCredential]$Credential, [Alias('session')] [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, ...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Private/HighestVer.ps1
HighestVer.ps1
function HighestVer { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string]$WAPIHost, [Parameter(Mandatory=$true)] [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, [switch]$IgnoreCertificateValidation ) try { # Query the...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/Remove-IBObject.ps1
Remove-IBObject.ps1
function Remove-IBObject { [CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [Alias('_ref','ref')] [string[]]$ObjectRef, [Alias('args')] [string[]]$DeleteArgs, [Alias('...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/New-IBWAPISession.ps1
New-IBWAPISession.ps1
function New-IBWAPISession { [CmdletBinding()] param( [Parameter(Mandatory=$true,Position=0)] [Alias('host')] [string]$WAPIHost, [Parameter(Mandatory=$true,Position=1)] [PSCredential]$Credential, [switch]$IgnoreCertificateValidation ) # There'...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/Invoke-IBWAPI.ps1
Invoke-IBWAPI.ps1
function Invoke-IBWAPI { [CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory=$true,Position=0)] [Uri]$Uri, [Microsoft.PowerShell.Commands.WebRequestMethod]$Method=([Microsoft.PowerShell.Commands.WebRequestMethod]::Get), [PSCredential]$Credential, [O...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/Set-IBObject.ps1
Set-IBObject.ps1
function Set-IBObject { [CmdletBinding(SupportsShouldProcess)] param( [Parameter(ParameterSetName='ObjectOnly',Mandatory=$True,ValueFromPipeline=$True)] [PSObject[]]$IBObject, [Parameter(ParameterSetName='RefAndTemplate',Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineBy...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/Get-IBWAPIConfig.ps1
Get-IBWAPIConfig.ps1
function Get-IBWAPIConfig { [CmdletBinding()] param( [string]$WAPIHost, [switch]$List ) if ($List) { # list all configs foreach ($hostConfig in $script:Config.Values) { [PSCustomObject]$hostConfig | Select-Object WAPIHost,WAPIVersion,Credential,Web...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/Set-IBWAPIConfig.ps1
Set-IBWAPIConfig.ps1
function Set-IBWAPIConfig { [CmdletBinding()] param( [Alias('host')] [string]$WAPIHost, [Alias('version')] [string]$WAPIVersion, [PSCredential]$Credential, [Alias('session')] [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, ...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/Get-IBObject.ps1
Get-IBObject.ps1
function Get-IBObject { [CmdletBinding(SupportsShouldProcess)] param( [Parameter(ParameterSetName='ByRef',Mandatory=$True,Position=0,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [Alias('_ref','ref')] [string[]]$ObjectRef, [Parameter(ParameterSetName='B...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/Invoke-IBFunction.ps1
Invoke-IBFunction.ps1
function Invoke-IBFunction { [CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [Alias('_ref','ref')] [string[]]$ObjectRef, [Parameter(Mandatory=$True)] [Alias('name')] ...
PowerShellCorpus/PowerShellGallery/Posh-IBWAPI/1.1.1/Public/New-IBObject.ps1
New-IBObject.ps1
function New-IBObject { [CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory=$True)] [Alias('type')] [string]$ObjectType, [Parameter(Mandatory=$True,ValueFromPipeline=$True)] [PSObject[]]$IBObject, [Alias('fields')] [string[]]$Retur...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/HeloWorld.ps1
HeloWorld.ps1
configuration HeloWorld { Import-DscResource -ModuleName PSDesiredStateConfiguration File f { Contents = 'Helo World' DestinationPath = 'c:\temp\heloworld.txt' } File x { SourcePath = 'c:\Source' DestinationPath = 'c:\Destination...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/SpecialModule.ps1
SpecialModule.ps1
configuration SpecialModule { Import-DscResource -ModuleName PSDesiredStateConfiguration node $AllNodes.Where{$_.Role -eq 'DemoNode'}.NodeName { Script owner { GetScript = {@{}} SetScript = {Get-Process -id $pid} TestScript = {$false} ...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/7-Reboot.ps1
7-Reboot.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # If a reboot is required, pending.mof remains so post reboot LCM # can process the same psedit "$ScriptPath\RebootRequired.ps1" . "$ScriptPath\RebootRequired.ps1" RebootRequired -OutputPath "$OutputPath\RebootRequired" St...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/4-JobId.ps1
4-JobId.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # Every configuration run - new configuration or a consistency check is # identified with a unique id (job id). This can be used to retrieve results # later Invoke-ConsistencyCheck Get-WinEvent -Path "$TraceFolder\DscTrac...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/6-Ordering.ps1
6-Ordering.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # The graph is evaluated and converted into an internal list psedit "$ScriptPath\Ordering.ps1" . "$ScriptPath\Ordering.ps1" Ordering -OutputPath "$OutputPath\Ordering" Trace-xDscConfiguration -Path "$OutputPath\Ordering" -...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/0-CommonInit.ps1
0-CommonInit.ps1
$MyPath = Split-Path $MyInvocation.MyCommand.Path $DemoRoot = 'D:\Nana\Test' $OutputPath = "$DemoRoot\CompiledConfigurations" $TraceFolder = "$DemoRoot\Traces" Import-Module -Force "$MyPath\HelperMethods.psm1" $DomainController = 'Nana-XM-DC' $DNSServer = '92.168.1.100' $TestNode ...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/3-VersioningCheck.ps1
3-VersioningCheck.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # run the document against a V4 (LTSB) node copy "$OutputPath\HeloWorld\localhost.mof" "$OutputPath\HeloWorld\$V1Node.mof" # run it against a V1 node Start-DscConfiguration -Path "$OutputPath\Heloworld" -ComputerName $V1Nod...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/MetaConfiguration.ps1
MetaConfiguration.ps1
[DscLocalConfigurationManager()] configuration MetaConfig { Settings { RefreshFrequencyMins = 60 } }
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/Cleanup.ps1
Cleanup.ps1
Remove-Item -Recurse -Force C:\source pushd C:\Windows\System32\Configuration del *.mof cd .\PartialConfigurations del *.mof cd ..\ConfigurationStatus del *.mof popd
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/Ordering.ps1
Ordering.ps1
configuration Ordering { Import-DscResource -ModuleName PSDesiredStateConfiguration File One { Contents = 'One' DestinationPath = 'C:\Destination\One.txt' #DependsOn = "[File]Three" } File Two { Contents = 'Two' ...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/2-ClearingCache.ps1
2-ClearingCache.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # invoke consistency check and observe behavior Invoke-ConsistencyCheck dir "$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltInProvCache" dir $env:ProgramData\Microsoft\Windows\PowerShell\Configuration\Buil...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/RebootRequired.ps1
RebootRequired.ps1
configuration RebootRequired { Import-DscResource -ModuleName PSDesiredStateConfiguration Script reboot { GetScript = {@{}} SetScript = {$global:DSCMachineStatus = 1} TestScript = {$false} } }
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/9-MetaConfiguration.ps1
9-MetaConfiguration.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # meta configuration - new syntax psedit "$ScriptPath\MetaConfiguration.ps1" . "$ScriptPath\MetaConfiguration.ps1" MetaConfig -OutputPath "$ScriptPath\CompiledConfigurations\MetaConfiguration" # when no meta configuration ...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/5-ModuleLoading.ps1
5-ModuleLoading.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # Ensures required modules are present, loads schema and validates the resource values . "$ScriptPath\BadModuleVersion.ps1" BadModuleVersion -OutputPath "$OutputPath\BadModuleVersion" psedit "$OutputPath\BadModuleVersion\loca...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/BadModuleVersion.ps1
BadModuleVersion.ps1
Configuration BadModuleVersion { Import-DscResource -ModuleName xPSDesiredStateConfiguration xService service { Name = 'RemoteRegistry' State = 'Stopped' } }
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/0-MofStructure.ps1
0-MofStructure.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # Here is a sample configuration psedit "$ScriptPath\HeloWorld.ps1" # When this configuration is invoked it produces # a configuration document . "$ScriptPath\HeloWorld.ps1" HeloWorld -OutputPath "$OutputPath\HeloWorld" ...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/1-Pending.mof.ps1
1-Pending.mof.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # generate document using 0-MofStructure.ps1 # let us invoke the document Start-DscConfiguration -Wait -Verbose -Force -Path "$OutputPath\HeloWorld" -ComputerName localhost # When a document is delivered, LCM saves the d...
PowerShellCorpus/PowerShellGallery/LCMInternals/0.1/8-Additional.ps1
8-Additional.ps1
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path . "$ScriptPath\0-CommonInit.ps1" # Additional pieces of information are written by the LCM dir "$env:windir\system32\configuration\ConfigurationStatus" # you can retrieve information using Get-DscConfigurationStatus Get-DscConfigurationStatus -All -OutVar...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/Restore-Backup.ps1
Restore-Backup.ps1
function Restore-Backup( [string] $Path = ".", [string] $BackupPath, [Switch][bool] $Silent = $false ) { $path = (get-item $path).FullName $projectName = split-path -Leaf $Path $latestBackup = $null if (![string]::IsNullOrEmpty($BackupPath)) { $files = Get-ChildItem $BackupPath...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/Copy-ItemFiltered.ps1
Copy-ItemFiltered.ps1
function Copy-ItemFiltered { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] $SourceDir, [Parameter(Mandatory=$true)] [string] $TargetDir, [switch] $Force, [string[]] $Excludes, $message = "Copying items..." ) $SourceDir = (get-item $SourceDir).FullName $activity = "$message $sourc...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/Do-Backup.ps1
Do-Backup.ps1
function Copy-Backup ( [cmdletbinding()] [Parameter(Mandatory=$false)] [string]$Path = ".", $excludes = $null ) { $curpath=$Path $fullpath = (get-item $curpath).FullName #if ($curpath -eq $null) { #$curpath= [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definiti...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/Compare-StagingConfig.ps1
Compare-StagingConfig.ps1
[cmdletbinding] function Get-ConfigFile( [string] $Path = "." ) { $configname = "web.config" if (!(test-path (join-path $path $configname))) { $files = gci $Path -Filter "*.exe.config" | ? { $_.Name -notlike "*.vshost.exe.config" } if ($files -ne $null) { $configname = ...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/Copy-ItemRecursive.ps1
Copy-ItemRecursive.ps1
function Copy-ItemRecursive ( [Parameter(Mandatory=$true)] [string] $SourceDir, [Parameter(Mandatory=$true)] [string] $TargetDir, [switch] $Force, [string] $Filter, [string] $Include, [string] $Exclude ) { if (!(test-path $TargetDir)) { new-item -ItemType Directory -Path $TargetDir } Co...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/Create-TaskHere.ps1
Create-TaskHere.ps1
function New-TaskHere { [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter(Mandatory=$false)][String] $Executable = $null, [Parameter(Mandatory=$false)][String] $Name = $null, [Parameter(Mandatory=$false)][pscredential] [System.Management.Automation.Credential()] $credenti...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/Copy-FromStaging.ps1
Copy-FromStaging.ps1
function Copy-FromStaging { [cmdletbinding()] param ( [string] $Path = ".", $stagingdir = $null, [Alias("NoConfig", "IgnoreConfig")][switch][bool] $ExcludeConfig = $false, $Exclude = @("log/", "App_Data/") ) $verbose = ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent -eq $true) if ([str...
PowerShellCorpus/PowerShellGallery/beam.serverside/0.0.9/functions/new-task.ps1
new-task.ps1
function new-task { <# .Synopsis creates a task on specified computer .Description A Detailed Description of what the command does .Example New-SvcTask #> [CmdletBinding(DefaultParameterSetName="startatboot", SupportsShouldProcess=$true)] param( #Th...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/Original function/new-labvm function.ps1
new-labvm function.ps1
function New-LabVM { <# .SYNOPSIS Creates a new VM in the lab environment .DESCRIPTION Creates a new VM in the lab environment. Takes the name and IP-address of the VM as a parameter. IP-address must be in the 192.168.0.1/24 notation. The specification of a DNS-server and gateway is opti...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/AppVeyor/AppVeyorBuild.ps1
AppVeyorBuild.ps1
#---------------------------------# # Header # #---------------------------------# Write-Host 'Running AppVeyor build script' -ForegroundColor Yellow Write-Host "ModuleName : $env:ModuleName" Write-Host "Build version : $env:APPVEYOR_BUILD_VERSION" Write-Host "Author : $env:APPVEYO...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/AppVeyor/AppVeyorInstall.ps1
AppVeyorInstall.ps1
#---------------------------------# # Header # #---------------------------------# Write-Host 'Running AppVeyor install script' -ForegroundColor Yellow Write-Host "'$($psversiontable.psversion)' installed." -ForegroundColor Yellow #---------------------------------# # Install NuGet ...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/AppVeyor/AppVeyorDeploy.ps1
AppVeyorDeploy.ps1
#---------------------------------# # Header # #---------------------------------# Write-Host 'Running AppVeyor deploy script' -ForegroundColor Yellow #---------------------------------# # Update module manifest # #---------------------------------# if ($env:APPVEYOR_REPO_BRANCH...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/AppVeyor/AppVeyorTest.ps1
AppVeyorTest.ps1
#---------------------------------# # Header # #---------------------------------# Write-Host 'Running AppVeyor test script' -ForegroundColor Yellow Write-Host "Current working directory: $pwd" #---------------------------------# # Run Pester Tests # #----------------------...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/Templates/TestConfig.ps1
TestConfig.ps1
configuration TestConfig { Node WebServer { WindowsFeature IIS { Ensure = 'Present' Name = 'Web-Server' IncludeAllSubFeature = $true } } Node NotWebServer { WindowsFeature IIS { ...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/Templates/AzureDSCPullConfig.ps1
AzureDSCPullConfig.ps1
# The DSC configuration that will generate metaconfigurations [DscLocalConfigurationManager()] Configuration DscMetaConfigs { param ( [Parameter(Mandatory=$True)] [String]$RegistrationUrl, [Parameter(Mandatory=$True)] [String]$RegistrationKey, [Parameter(Mand...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/Templates/Compile_Azure_DSC_Node.config.ps1
Compile_Azure_DSC_Node.config.ps1
#region Azure Login Login-AzureRmAccount #endregion #region upload config Import-AzureRmAutomationDscConfiguration -SourcePath "<fill me in>" ` -Published ` -ResourceGroupName "<fill me in>" ` ...
PowerShellCorpus/PowerShellGallery/NewLabEnvironment/2.4/Tests/AppVeyorDemo.Tests.ps1
AppVeyorDemo.Tests.ps1
#---------------------------------# # PSScriptAnalyzer tests # #---------------------------------# $Scripts = Get-ChildItem “$PSScriptRoot\..\” -Filter ‘*.ps1’ | Where-Object {$_.name -NotMatch ‘Tests.ps1’} $Modules = Get-ChildItem “$PSScriptRoot\..\” -Filter ‘*.psm1’ $Rules = Get-ScriptAnalyzerRule if (...
PowerShellCorpus/PowerShellGallery/TemplateConfigModule/1.0.0.3/Tests/Acceptance/TemplateConfig.Acceptance.Tests.ps1
TemplateConfig.Acceptance.Tests.ps1
#
PowerShellCorpus/PowerShellGallery/powershell-yaml/0.2/Load-Assemblies.ps1
Load-Assemblies.ps1
# Copyright 2016 Cloudbase Solutions Srl # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
PowerShellCorpus/PowerShellGallery/powershell-yaml/0.2/Tests/powershell-yaml.Tests.ps1
powershell-yaml.Tests.ps1
# Copyright 2016 Cloudbase Solutions Srl # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
PowerShellCorpus/PowerShellGallery/PSWinGlue/0.3.3/Functions/Get-PendingReboot.ps1
Get-PendingReboot.ps1
Function Get-PendingReboot { <# .SYNOPSIS Gets the pending reboot status on a local or remote computer. .DESCRIPTION This function will query the registry on a local or remote computer and determine if the system is pending a reboot, from Microsoft updates, Configuration Manager Client SDK, Pending...
PowerShellCorpus/PowerShellGallery/PSWinGlue/0.3.3/Functions/Update-GitRepository.ps1
Update-GitRepository.ps1
Function Update-GitRepository { [CmdletBinding()] # The path to the Registry keys containing potential Git installation details $GitInstallRegPaths = @('HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', # Native bitness 'HKCU:\SOFTWARE\Wow6432Node\Microsof...
PowerShellCorpus/PowerShellGallery/PSWinGlue/0.3.3/Functions/Get-InstalledPrograms.ps1
Get-InstalledPrograms.ps1
Function Get-InstalledPrograms { <# .Synopsis Fetches the list of installed software on a system via the Windows Registry. .Description Returns a list of software installed on a system determined from installations that have registered themselves in the Windows Registry...
PowerShellCorpus/PowerShellGallery/PSWinGlue/0.3.3/Functions/Get-TaskSchedulerEvent.ps1
Get-TaskSchedulerEvent.ps1
Function Get-TaskSchedulerEvent { <# .Synopsis Fetches events matching given IDs from the Task Scheduler event log. .Parameter EventIds An array of integers specifying the event IDs we want to match in the query. The default is "(111,202,203,323,329,331)" which correspo...
PowerShellCorpus/PowerShellGallery/PSWinGlue/0.3.3/Functions/Install-Font.ps1
Install-Font.ps1
Function Install-Font { <# .Synopsis Installs one or more fonts. .Parameter FontPath The path to the font to be installed or a directory containing fonts to install. .Parameter Recurse Searches for fonts to install recursively when a path to a directory is prov...
PowerShellCorpus/PowerShellGallery/PSWinGlue/0.3.3/Scripts/Install-IRESSExcelAddins.ps1
Install-IRESSExcelAddins.ps1
[CmdletBinding()] Param( [Parameter(Mandatory=$false)] [Switch]$Reinstall ) # Ensure that any errors we receive are considered fatal $ErrorActionPreference = 'Stop' # The path to the Registry key containing the IRESS installation details $IressInstallRegPath = 'HKLM:\Software\Wow6432Node\DFS\IRE...
PowerShellCorpus/PowerShellGallery/PSWinGlue/0.3.3/Scripts/Install-ExcelAddin.ps1
Install-ExcelAddin.ps1
[CmdletBinding()] Param( [Parameter(Position=0,Mandatory=$true)] [String]$AddinPath, [Parameter(Mandatory=$false)] [Switch]$Reinstall, [Parameter(Mandatory=$false)] [Switch]$NoCopy ) # Ensure that any errors we receive are considered fatal $ErrorActionPreference = 'Stop' ...
PowerShellCorpus/PowerShellGallery/SLPSLib/1.0/HelperFunctions.ps1
HelperFunctions.ps1
Function Backup-SLDocument{ [CmdletBinding(Defaultparametersetname='Default')] Param( [parameter(Mandatory=$true,Position=0)] [SpreadsheetLight.SLDocument]$WorkBookInstance, [parameter(Mandatory=$true,Position=1,Parametersetname='Path')] [String]$Path ...
PowerShellCorpus/PowerShellGallery/posh-azurecli/0.1.10/BuildPackage.ps1
BuildPackage.ps1
.\tools\NuGet.exe pack posh-azurecli.nuspec
PowerShellCorpus/PowerShellGallery/posh-azurecli/0.1.10/utils.ps1
utils.ps1
function FindInPath() # http://blogs.msdn.com/b/stuartleeks/archive/2015/07/02/finding-files-in-the-path-with-powershell.aspx { param ( [string] $filename ) $matches = $env:Path.Split(';') | ?{$_ -ne ''} | %{ join-path $_ $filename} | ?{ test-path $_ } if ($matches.Length -...
PowerShellCorpus/PowerShellGallery/posh-azurecli/0.1.10/DevInstall.ps1
DevInstall.ps1
# clean choco cache dir $env:ProgramData\chocolatey\lib\posh-azurecli* | Remove-Item -Recurse -Force # install choco package from local dir choco install posh-azurecli -source "$pwd" -pre -force
PowerShellCorpus/PowerShellGallery/posh-azurecli/0.1.10/AzureCliExpansion.ps1
AzureCliExpansion.ps1
# This PS script replicates the functionality in https://github.com/Azure/azure-xplat-cli/blob/90a20ee00e0741a5ec8cece69bf5e18bf1e0ecda/lib/autocomplete.js # An alternative approach would be to look at ways to directly invoke the functionality and capture the output :-) # This has a dependency on plugins json files (...