full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/RabbitMQTools/1.1/Tests/AddQueue.Tests.ps1
AddQueue.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path . "$here\TestSetup.ps1" . "$here\..\Public\Add-RabbitMQQueue.ps1" function TearDownTest($VirtualHost = "/", $Queues) { foreach($queue in $queues){ Remove-RabbitMQQueue -BaseUri $server -name $queue -ErrorAction Continue -Confirm:$false } } D...
PowerShellCorpus/PowerShellGallery/RabbitMQTools/1.1/Tests/RemoveVirtualHost.Tests.ps1
RemoveVirtualHost.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path . "$here\TestSetup.ps1" . "$here\..\Public\Remove-RabbitMQVirtualHost.ps1" function SetUpTest($vhosts = ("vh1","vh2")) { Add-RabbitMQVirtualHost -BaseUri $server -Name $vhosts } function TearDownTest($vhosts = ("vh1","vh2")) { foreach($vhost i...
PowerShellCorpus/PowerShellGallery/RabbitMQTools/1.1/Tests/AddVirtualHost.Tests.ps1
AddVirtualHost.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path . "$here\TestSetup.ps1" . "$here\..\Public\Add-RabbitMQVirtualHost.ps1" function TearDownTest() { $vhosts = Get-RabbitMQVirtualHost -BaseUri $server -Name vh3, vh4 ($vhosts) | Remove-RabbitMQVirtualHost -BaseUri $server -ErrorAction Continue -Confir...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Deploy/Download_MDT_Prereqs.ps1
Download_MDT_Prereqs.ps1
Configuration DownloadMDTPrereqs { Import-Module -Name PSDesiredStateConfiguration, cMDTBuildLab Import-DscResource -ModuleName PSDesiredStateConfiguration Import-DscResource -ModuleName cMDTBuildLab node $AllNodes.Where{$_.Role -match "MDT Server"}.NodeName { LocalConfigurationMana...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Deploy/ImageFactoryV3-Build.ps1
ImageFactoryV3-Build.ps1
<# .Synopsis ImageFactory 3.2 .DESCRIPTION Run this script for build Windows Reference Images on remote Hyper-V host .EXAMPLE Edit config ImageFactoryV3.xml with your settings: <Settings> <ReportFrom>AutoBuild@build.lab</ReportFrom> <ReportTo>AutoBuild@build.lab</ReportTo> ...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Deploy/Deploy_MDT_Server.ps1
Deploy_MDT_Server.ps1
Configuration DeployMDTServerContract { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments')] Param( [Parameter(Mandatory=$true, HelpMessage = "Enter password for MDT Local A...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Deploy/Import-ISO.ps1
Import-ISO.ps1
### # Script for prepare Windows distributives # # 1. Download source Windows ISO from VLSC, MSDN on Evaluation portals # 2. Save to folders on MDT server or File server: # \\server\ISO # + Windows 10 # + 14393.0.160715-1616.RS1_RELEASE_CLIENTENTERPRISEEVAL_OEMRET_X86FRE_EN-US.ISO # + Window...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildUpdateBootImage.ps1
Example-cMDTBuildUpdateBootImage.ps1
# # cMDTBuildUpdateBootImage Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildUpdateBootImage updateBootImage { Version = "1.0" PSDeploymentShare = $PSDriveName PsDrivePath = $PSDrivePath ExtraDirector...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildBootstrapIni.ps1
Example-cMDTBuildBootstrapIni.ps1
# # cMDTBuildBootstrapIni Example # $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildBootstrapIni ini { Ensure = "Present" Path = "$($PSDrivePath)\Control\Bootstrap.ini" Content = @" [Settings] Priority=Default [Default] DeployRoot=\\$($ComputerName)\De...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildPersistentDrive.ps1
Example-cMDTBuildPersistentDrive.ps1
# # cMDTBuildPersistentDrive Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" $ComputerName = "$env:computername" Configuration MDTServer { cMDTBuildPersistentDrive DeploymentPSDrive { Ensure = "Present" Name = $PSDriveName Path = $PSDrivePa...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildCustomize.ps1
Example-cMDTBuildCustomize.ps1
# # cMDTBuildCustomize Example # $PSDrivePath = "E:\MDTBuildLab" $SourcePath = "E:\Source" Configuration MDTServer { cMDTBuildCustomize PEExtraFiles { Ensure = "Present" Name = "PEExtraFiles" Path = $PSDrivePath SourcePath = "$($SourcePath)/PEExtraFi...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildCustomSettingsIni.ps1
Example-cMDTBuildCustomSettingsIni.ps1
# # cMDTBuildCustomSettingsIni Example # $ComputerName = "$env:computername" $PSDrivePath = "E:\MDTBuildLab" $Company = "MDT Build Lab" $TimeZoneName = "Ekaterinburg Standard Time" $WSUSServer = "http://fqdn:port" $UserLocale = "en-US" $KeyboardLocale = "en-US;ru-RU" Configuration MDTS...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildApplication.ps1
Example-cMDTBuildApplication.ps1
# # cMDTBuildApplication Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildApplication WMF5 { Ensure = "Present" Name = "Install - Windows Management Framework 5.0 - x64" Path = "\Applications\Core\Microsoft" CommandLine...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildPackage.ps1
Example-cMDTBuildPackage.ps1
# # cMDTBuildPackage Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildPackage KB3125574_x64 { Ensure = "Present" Name = "Package_for_KB3125574 neutral amd64 6.1.4.4" Path = "Packages\Windows ...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildSelectionProfile.ps1
Example-cMDTBuildSelectionProfile.ps1
# # cMDTBuildSelectionProfile Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildSelectionProfile Win10x64 { Ensure = "Present" Name = "Windows 10 x64" Comments = "Packages for Windows 10 x64" IncludePath =...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildDirectory.ps1
Example-cMDTBuildDirectory.ps1
# # cMDTBuildDirectory Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildDirectory Windows10 { Ensure = "Present" Name = "Windows 10" Path = "$($PSDriveName):\Operating Systems" PSDriveName = $PSDriveN...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildTaskSequenceCustomize.ps1
Example-cMDTBuildTaskSequenceCustomize.ps1
# # cMDTBuildTaskSequenceCustomize Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" $TSID = "REFW10X64-001" $TSFile = "$($PSDrivePath)\Control\$($TSID)\ts.xml" Configuration MDTServer { cMDTBuildTaskSequenceCustomize AddFeatures { TSFile = $TSFile Name = "In...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildPreReqs.ps1
Example-cMDTBuildPreReqs.ps1
# # cMDTBuildPreReqs Example # $SourcePath = "E:\Source" Configuration MDTServer { cMDTBuildPreReqs MDTPreReqs { Ensure = "Present" DownloadPath = "$SourcePath" } }
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildOperatingSystem.ps1
Example-cMDTBuildOperatingSystem.ps1
# # cMDTBuildOperatingSystem Example # $SourcePath = "E:\Source" $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildOperatingSystem Win10x64 { Ensure = "Present" Name = "Windows 10 x64" Path = "Windows 10" Sour...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Examples/Example-cMDTBuildTaskSequence.ps1
Example-cMDTBuildTaskSequence.ps1
# # cMDTBuildTaskSequence Example # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildTaskSequence Win10x64 { Ensure = "Present" Name = "Windows 10 x64" Path = "Windows 10" OSName = "Windows 10\Windows 10 E...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildTaskSequenceCustomize.ps1
Test-cMDTBuildTaskSequenceCustomize.ps1
# # cMDTBuildTaskSequenceCustomize Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" $TSID = "REFW10X64-001" $TSFile = "$($PSDrivePath)\Control\$($TSID)\ts.xml" Configuration MDTServer { cMDTBuildTaskSequenceCustomize AddFeatures { TSFile = $TSFile Name = "Insta...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildPersistentDrive.ps1
Test-cMDTBuildPersistentDrive.ps1
# # cMDTBuildPersistentDrive Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" $ComputerName = "$env:computername" Configuration MDTServer { cMDTBuildPersistentDrive DeploymentPSDrive { Ensure = "Present" Name = $PSDriveName Path = $PSDrivePath Descriptio...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildUpdateBootImage.ps1
Test-cMDTBuildUpdateBootImage.ps1
# # cMDTBuildUpdateBootImage Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildUpdateBootImage updateBootImage { Version = "1.0" PSDeploymentShare = $PSDriveName PsDrivePath = $PSDrivePath ExtraDirectory = "Extra" ...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildBootstrapIni.ps1
Test-cMDTBuildBootstrapIni.ps1
# # cMDTBuildBootstrapIni Test # $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildBootstrapIni ini { Ensure = "Present" Path = "$($PSDrivePath)\Control\Bootstrap.ini" Content = @" [Settings] Priority=Default [Default] DeployRoot=\\$($ComputerName)\Deploymen...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildDirectory.ps1
Test-cMDTBuildDirectory.ps1
# # cMDTBuildDirectory Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildDirectory Windows10 { Ensure = "Present" Name = "Windows 10" Path = "$($PSDriveName):\Operating Systems" PSDriveName = $PSDriveName PSDrivePa...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildPackage.ps1
Test-cMDTBuildPackage.ps1
# # cMDTBuildPackage Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildPackage KB3125574_x64 { Ensure = "Present" Name = "Package_for_KB3125574 neutral amd64 6.1.4.4" Path = "Packages\Windows 7" PackageSourcePath = "Update ...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildOperatingSystem.ps1
Test-cMDTBuildOperatingSystem.ps1
# # cMDTBuildOperatingSystem Test # $SourcePath = "E:\Source" $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildOperatingSystem Win10x64 { Ensure = "Present" Name = "Windows 10 x64" Path = "Windows 10" SourcePath = "$SourcePath\...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildTaskSequence.ps1
Test-cMDTBuildTaskSequence.ps1
# # cMDTBuildTaskSequence Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildTaskSequence Win10x64 { Ensure = "Present" Name = "Windows 10 x64" Path = "Windows 10" OSName = "Windows 10\Windows 10 Ente...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildPreReqs.ps1
Test-cMDTBuildPreReqs.ps1
# # cMDTBuildPreReqs Test # $SourcePath = "E:\Source" Configuration MDTServer { cMDTBuildPreReqs MDTPreReqs { Ensure = "Present" DownloadPath = "$SourcePath" } }
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildApplication.ps1
Test-cMDTBuildApplication.ps1
# # cMDTBuildApplication Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildApplication WMF5 { Ensure = "Present" Name = "Install - Windows Management Framework 5.0 - x64" Path = "\Applications\Core\Microsoft" CommandLine = ...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildCustomize.ps1
Test-cMDTBuildCustomize.ps1
# # cMDTBuildCustomize Test # $PSDrivePath = "E:\MDTBuildLab" $SourcePath = "E:\Source" Configuration MDTServer { cMDTBuildCustomize PEExtraFiles { Ensure = "Present" Name = "PEExtraFiles" Path = $PSDrivePath SourcePath = "$($SourcePath)/PEExtraFiles" TestFiles...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildCustomSettingsIni.ps1
Test-cMDTBuildCustomSettingsIni.ps1
# # cMDTBuildCustomSettingsIni Test # $ComputerName = "$env:computername" $PSDrivePath = "E:\MDTBuildLab" $Company = "MDT Build Lab" $TimeZoneName = "Ekaterinburg Standard Time" $WSUSServer = "http://fqdn:port" $UserLocale = "en-US" $KeyboardLocale = "en-US;ru-RU" Configuration MDTServ...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Tests/Test-cMDTBuildSelectionProfile.ps1
Test-cMDTBuildSelectionProfile.ps1
# # cMDTBuildSelectionProfile Test # $PSDriveName = "MDT001" $PSDrivePath = "E:\MDTBuildLab" Configuration MDTServer { cMDTBuildSelectionProfile Win10x64 { Ensure = "Present" Name = "Windows 10 x64" Comments = "Packages for Windows 10 x64" IncludePath = "P...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Sources/Config-NetFwRules.ps1
Config-NetFwRules.ps1
Enable-NetFirewallRule -DisplayGroup “File and Printer Sharing” -Verbose Enable-NetFirewallRule -DisplayGroup “File and Printer Sharing over SMBDirect” -Verbose Enable-NetFirewallRule -DisplayGroup “Remote Desktop” -Verbose Enable-NetFirewallRule -DisplayGroup “Remote Shutdown” -Verbose Enable-NetFirewallRule -Disp...
PowerShellCorpus/PowerShellGallery/cMDTBuildLab/1.3.0/Sources/Customize-DefaultProfile.ps1
Customize-DefaultProfile.ps1
$winVer = (Get-CimInstance -ClassName win32_operatingsystem).version if ($winVer -like '6.3*') { # Windows 8.1 / Windows 2012 R2 Invoke-Item "Z:\Applications\Configure - Set Start Layout\Theme01.deskthemepack" Import-StartLayout -LayoutPath "Z:\Applications\Configure - Set Start Layout\Default_Start_Scr...
PowerShellCorpus/PowerShellGallery/Posh-SSH/1.7.7/PortForward.ps1
PortForward.ps1
############################################################################################## # SSH Port Forwarding <# .Synopsis Redirects traffic from a local port to a remote host and port via a SSH Session. .DESCRIPTION Redirects TCP traffic from a local port to a remote host and port via a SSH Sess...
PowerShellCorpus/PowerShellGallery/Posh-SSH/1.7.7/Sftp.ps1
Sftp.ps1
######################################################################################## # SFTP Functions # .ExternalHelp Posh-SSH.psm1-Help.xml function Get-SFTPSession { param( [Parameter(Mandatory=$false, Position=0)] [Alias('Index')] [Int32[]] ...
PowerShellCorpus/PowerShellGallery/Posh-SSH/1.7.7/Trust.ps1
Trust.ps1
# .ExternalHelp Posh-SSH.psm1-Help.xml function Get-SSHTrustedHost { [CmdletBinding()] [OutputType([int])] Param() Begin{} Process { $Test_Path_Result = Test-Path -Path "hkcu:\Software\PoshSSH" if ($Test_Path_Result -eq $false) { Write-...
PowerShellCorpus/PowerShellGallery/Posh-SSH/1.7.7/tests/Remove-SSHSession.Tests.ps1
Remove-SSHSession.Tests.ps1
Import-Module .\Posh-SSH.psd1 Describe "Remove-SSHSession" { Context "Parameters" { } Context "Action" { $Global:SshSessions = New-Object System.Collections.ArrayList $session = New-Object SSH.SshSession $session.host = "dummy...
PowerShellCorpus/PowerShellGallery/Posh-SSH/1.7.7/tests/Get-SSHSession.Tests.ps1
Get-SSHSession.Tests.ps1
Import-Module .\Posh-SSH.psd1 Describe "Get-SSHSession" { Context "Parameters" { It "should not throw if no parameter is given" { { Get-SSHSession } | Should not throw } It "Should not throw if index parameter is given" { { Get-SSHSession -SessionId 0 } | ...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/ExampleConfig.ps1
ExampleConfig.ps1
Configuration myChocoConfig { Import-DscResource -Module cChoco Node "localhost" { LocalConfigurationManager { DebugMode = 'ForceModuleImport' } cChocoInstaller installChoco { InstallDir = "c:\choco" } cChocoPackageInstaller installChrome { ...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/Examples/cChocoInstaller_cChocoPackageInstallExample.ps1
cChocoInstaller_cChocoPackageInstallExample.ps1
Configuration InstallChoco { Import-DscResource -Module cChoco Node "localhost" { cChocoPackageInstaller installSkypeWithChocoParams { Name = 'skype' Ensure = 'Present' AutoUpgrade = $True }...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/Examples/cChocoInstaller_cChocoInstallerExample.ps1
cChocoInstaller_cChocoInstallerExample.ps1
Configuration InstallChoco { Import-DscResource -Module cChoco Node "localhost" { cChocoInstaller InstallChoco { InstallDir = "c:\choco" } cChocoPackageInstaller installSkypeWithChocoParams { Name = 'skype' ...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/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:A...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/AppVeyor/AppVeyorInstall.ps1
AppVeyorInstall.ps1
#---------------------------------# # Header # #---------------------------------# Write-Host 'Running AppVeyor install script' -ForegroundColor Yellow #---------------------------------# # Install NuGet # #---------------------------------# Write-Host 'Installi...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/AppVeyor/AppVeyorDeploy.ps1
AppVeyorDeploy.ps1
#---------------------------------# # Header # #---------------------------------# Write-Host 'Running AppVeyor deploy script' -ForegroundColor Yellow #---------------------------------# # Update module manifest # #---------------------------------# Write-Host 'Creating ...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/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/cChoco/2.3.1.0/Tests/cChocoInstaller_Tests.ps1
cChocoInstaller_Tests.ps1
#---------------------------------# # Pester tests for cChocoInstall # #---------------------------------# $ResourceName = ((Split-Path $MyInvocation.MyCommand.Path -Leaf) -split '_')[0] $ResourceFile = (Get-DscResource -Name $ResourceName).Path Describe "Testing $ResourceName loaded from $ResourceFile" { Co...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/Tests/cChoco_ScriptAnalyzerTests.ps1
cChoco_ScriptAnalyzerTests.ps1
#---------------------------------# # PSScriptAnalyzer tests # #---------------------------------# $Rules = Get-ScriptAnalyzerRule #Only run on cChocoInstaller.psm1 for now as this is the only resource that has had code adjustments for PSScriptAnalyzer rules. $Modules = Get-ChildItem “$PSScriptRoot...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/Tests/cChoco_xDscResourceTests.ps1
cChoco_xDscResourceTests.ps1
#---------------------------------# # xDscResourceTests Pester # #---------------------------------# $DSC = Get-DscResource | Where-Object {$_.Module.Name -eq 'cChoco'} Describe 'Testing all DSC resources using xDscResource designer.' { foreach ($Resource in $DSC) { if (-not ($Resource.Implemen...
PowerShellCorpus/PowerShellGallery/cChoco/2.3.1.0/Tests/cChocoPackageInstall_Tests.ps1
cChocoPackageInstall_Tests.ps1
#----------------------------------------# # Pester tests for cChocoPackageInstall # #----------------------------------------# $ResourceName = ((Split-Path -Path $MyInvocation.MyCommand.Path -Leaf) -split '_')[0] $ResourceFile = (Get-DscResource -Name $ResourceName).Path $TestsPath = (split-path -path $MyI...
PowerShellCorpus/PowerShellGallery/GithubConnect/0.8/Public/repository.ps1
repository.ps1
Function Get-GithubOrgRepository { param ( [Parameter(mandatory=$true)] [string]$OrganisationName ) Begin {} Process { if (-not ($BasicCreds)) { throw 'Please run Connect-Github first to get an authentication token for Github' } try { ...
PowerShellCorpus/PowerShellGallery/GithubConnect/0.8/Public/authentication.ps1
authentication.ps1
Function Connect-Github { <# .Synopsis Connects PowerShell to the Github API .DESCRIPTION This function will connect the current PowerShell session to the Github API via Basic Authentication. Also supports 2 Factor Authentication via One Time Password. ...
PowerShellCorpus/PowerShellGallery/GithubConnect/0.8/Public/webhook.ps1
webhook.ps1
Function Get-GithubWebhook { param ( [Parameter(Mandatory=$true)] [string]$githubuser, [Parameter(Mandatory=$false)] [string]$githubrepository, [Parameter(Mandatory=$false)] [string]$OneTimePassword ) Begin {} Process { if (-not (...
PowerShellCorpus/PowerShellGallery/GithubConnect/0.8/Public/teams.ps1
teams.ps1
Function Get-GithubTeams { param ( [Parameter(mandatory=$true)] [string]$OrganisationName, [parameter(mandatory=$false)] [string]$OneTimePassword ) Begin {} Process { if (-not ($BasicCreds)) { throw 'Please run Connect-Github first to get a...
PowerShellCorpus/PowerShellGallery/GithubConnect/0.8/Public/branch.ps1
branch.ps1
Function List-GithubBranches { param ( [parameter(mandatory=$true)] [string]$githubuser, [parameter(mandatory=$true)] [string]$githubrepository ) Begin {} Process { if (-not ($BasicCreds)) { throw 'Please run Connect-Github first to get an a...
PowerShellCorpus/PowerShellGallery/GithubConnect/0.8/Public/organisation.ps1
organisation.ps1
Function Add-GithubUserToOrganisation { param ( [Parameter(mandatory=$true)] [string]$OrganisationName, [Parameter(mandatory=$true)] [string]$githubusername, [ValidateSet('admin','member')] [Parameter(mandatory=$false)] [string]$role='member', ...
PowerShellCorpus/PowerShellGallery/GithubConnect/0.8/Public/pullrequest.ps1
pullrequest.ps1
Function Get-GithubPullRequests { <# .Synopsis Gets Pull Requests for a repository .DESCRIPTION This function will list all Pull Requests for a given Repository. For now only the last 30 Pull Requests will be returned. Parsing all PRs is quite time c...
PowerShellCorpus/PowerShellGallery/AzureAutomationVsoGitSync/1.2.1/Public/Sync-VsoGitRmRunbooks.ps1
Sync-VsoGitRmRunbooks.ps1
<# .SYNOPSIS Syncs all runbooks in a VSO git repository to an Azure Automation account. .DESCRIPTION Syncs all runbooks in a VSO git repository to an Azure Automation account starting with dependent (child) runbooks and followed by parent runbooks to an existing Automation Account. This runbook will recur...
PowerShellCorpus/PowerShellGallery/AzureAutomationVsoGitSync/1.2.1/Public/Sync-VsoGitSmRunbooks.ps1
Sync-VsoGitSmRunbooks.ps1
<# .SYNOPSIS Syncs all runbooks in a VSO git repository to an Azure Automation account. .DESCRIPTION Syncs all runbooks in a VSO git repository to an Azure Automation account starting with dependent (child) runbooks and followed by parent runbooks to an existing Automation Account. This runbook will recursi...
PowerShellCorpus/PowerShellGallery/InvokeTwitterAPIs/2.4/InvokeTwitterAPIs.ps1
InvokeTwitterAPIs.ps1
Publish-Module -Name InvokeTwitterAPIs -NuGetApiKey 4204f47b-136d-447d-b839-5b48634f0344
PowerShellCorpus/PowerShellGallery/psservicenow/0.1.13/MAKE.ps1
MAKE.ps1
function ZipFiles { param( $zipfilename, $sourcedir ) Add-Type -Assembly System.IO.Compression.FileSystem $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal [System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, $zipfilename, $compressionLevel, $true) } f...
PowerShellCorpus/PowerShellGallery/psservicenow/0.1.13/PSServiceNow.Tests.ps1
PSServiceNow.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $DefaultsFile = "$here\PSServiceNow.Pester.Defaults.json" # Load defaults from file (merging into $global:ServiceNowPesterTestDefaults if(Test-Path $DefaultsFile){ $defaults = if($global:ServiceNowPesterTestDefaults){$global:ServiceNowPesterTestDefaults}...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Write-RGB.ps1
Write-RGB.ps1
function Write-RGB { <# .SYNOPSIS Write to the console in 24-bit colors! .DESCRIPTION This function lets you write to the console using 24-bit color depth. You can specify colors using its RGB values. .EXAMPLE Write-RGB 'PowerShell rocks!' ...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Invoke-PathShortener.ps1
Invoke-PathShortener.ps1
function Invoke-PathShortener { <# .SYNOPSIS Path Shortener .EXAMPLE Invoke-PathShortener Will take the current path and shortened it using default values. .EXAMPLE Invoke-PathShortener -KeepBefore 3 Will shorten the current path an...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Set-PowerlinePrompt.ps1
Set-PowerlinePrompt.ps1
function Set-PowerlinePrompt { $global:branchSymbol = [char]57504 $global:dividerSymbolFull = [char]57520 $global:arrowUpSymbol = [char]42779 $global:arrowDownSymbol = [char]42780 $global:isAdmin = Test-IsAdmin if (Get-Module -Name 'psgit' -ListAvailable) { $customPrompt = { ...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/volumeControls.ps1
volumeControls.ps1
function Get-MasterVolume { Write-Output ([Math]::Round([CoreAudio.API]::GetMasterVolume(),0)) } function Set-MasterVolume { param([int]$Volume) if ($Volume) { [CoreAudio.API]::SetMasterVolume($Volume) } } function Test-MasterVolumeIsMuted { [CoreAudio.API]::GetMasterVolumeMute() } functi...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Invoke-Highlight.ps1
Invoke-Highlight.ps1
function Invoke-Highlight { <# .SYNOPSIS Highlight patterns in string(s). .DESCRIPTION This function will let you define a regular expression pattern and highlight matches in a string or string array. .EXAMPLE Get-Content .\file.txt | Invoke-Hi...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Invoke-Pause.ps1
Invoke-Pause.ps1
function Invoke-Pause { <# .SYNOPSIS Will pause output of large objects. .DESCRIPTION This function will stop output of large objects at windows height, and lets you continue by pressing any key. .EXAMPLE Get-Content -Path file.txt | Invoke-Pau...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Invoke-Touch.ps1
Invoke-Touch.ps1
function Invoke-Touch { <# .SYNOPSIS PowerShell inplementation of the Unix/Linux utility called touch. .DESCRIPTION Touch let's you update the access date and / or modification date of a file. If the file don't exist, an empty file will be created unless you use t...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Set-Prompt.ps1
Set-Prompt.ps1
function Set-Prompt { param ([ScriptBlock] $ScriptBlock) $null = New-Item -Path function:prompt -Value $ScriptBlock -Force }
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Show-Calendar.ps1
Show-Calendar.ps1
function Show-Calendar { <# .SYNOPSIS Show calendar. .DESCRIPTION This function is a PowerShell version of the *NIX cal command and will show a calendar of the chosen month(s). The current day will be marked with a '*'. For best results, use tog...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Test-IsAdmin.ps1
Test-IsAdmin.ps1
function Test-IsAdmin { $windowsIdentity=[System.Security.Principal.WindowsIdentity]::GetCurrent() $windowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($windowsIdentity) $adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator Write-Output ($windowsPrincipal.IsInRole($adm)) ...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Get-ArchiveContents.ps1
Get-ArchiveContents.ps1
Add-Type -AssemblyName System.IO.Compression.FileSystem function Get-ArchiveContents { [CmdletBinding()] param ( [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] [string] $Path ) $Path = Resolve-Path -Path $Path $conten...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Invoke-ColorizedFileListing.ps1
Invoke-ColorizedFileListing.ps1
function Invoke-ColorizedFileListing { <# .SYNOPSIS Provides colorized file listing. .DESCRIPTION This function is a replacement for Get-ChildItem when used to list files and folders, and adds colorization of file types as well ...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Update-FileInfoType.ps1
Update-FileInfoType.ps1
function Update-FileInfoType { <# Update FileInfo type to include SizeOnDisk Author: Øyvind Kallstad #> $typeData = Get-TypeData System.IO.FileInfo $scriptBlock = { $blockSize = $this.PSDrive.BlockSize $size = $this.Length [math]::Ceiling($size/$blockSize) * $bloc...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Get-SpecialFolder.ps1
Get-SpecialFolder.ps1
function Get-SpecialFolder { param ([System.Environment+SpecialFolder] $Name) if (-not $Name) { [Enum]::GetValues([System.Environment+SpecialFolder]) } else { Write-Output (,([PSCustomObject] @{ Name = $Name.ToString() Path = [System.Envi...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Update-PSDriveInfoType.ps1
Update-PSDriveInfoType.ps1
function Update-PSDriveInfoType { <# Update PSDriveInfo type to include BlockSize Author: Øyvind Kallstad #> $typeData = Get-TypeData System.Management.Automation.PSDriveInfo $scriptBlock = { if ($this.Provider.ImplementingType -eq [Microsoft.PowerShell.Commands.FileSystemProvide...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Resolve-PathEx.ps1
Resolve-PathEx.ps1
function Resolve-PathEx { <# .SYNOPSIS Resolve-Path extended to also work with files that don't exist. .DESCRIPTION You can use Resolve-PathEx when you want to handle both filenames and paths in a single parameter in your functions. The function returns an object,...
PowerShellCorpus/PowerShellGallery/Communary.ConsoleExtensions/1.0.69/Functions/Resize-Console.ps1
Resize-Console.ps1
function Resize-Console { <# .SYNOPSIS Resize the PowerShell console programmatically. .DESCRIPTION This function lets you resize the PowerShell console window by setting custom width and height properties, as well as maximize and restore the console w...
PowerShellCorpus/PowerShellGallery/cSCCM/1.4/Examples/SCCMConfiguration.ps1
SCCMConfiguration.ps1
Configuration SCCMConfiguration { param ( [Parameter(Mandatory=$true)][ValidateNotNullorEmpty()][PsCredential]$SCCMAdministratorCredential ) Import-DSCResource -ModuleName cSCCM Node $AllNodes.NodeName { cCMFolder Device_All { FolderN...
PowerShellCorpus/PowerShellGallery/LogInsight/1.0/Examples/Query-Events-TimeInterval.ps1
Query-Events-TimeInterval.ps1
Import-Module -Name LogInsight $sConnect = @{ Server = 'LogInsight.local.lab' User = 'admin' Password = 'VMware1!' } Connect-LogInsight @sConnect $start = (Get-Date).AddHours(-1) $intervalMinutes = 10 $constraint = (Get-LogInsightConstraint -Field 'timestamp' -Operator GE -Value $start), ...
PowerShellCorpus/PowerShellGallery/LogInsight/1.0/Examples/Query-Events-Timestamp.ps1
Query-Events-Timestamp.ps1
Import-Module -Name LogInsight $sConnect = @{ Server = 'LogInsight.local.lab' User = 'admin' Password = 'VMware1!' } Connect-LogInsight @sConnect $constraint = Get-LogInsightConstraint -Field 'timestamp' -Operator GE -Value (Get-Date).AddHours(-1) $result = Get-LogInsightEvent -Constraint $c...
PowerShellCorpus/PowerShellGallery/LogInsight/1.0/Examples/Query-Events-Hostname.ps1
Query-Events-Hostname.ps1
Import-Module -Name LogInsight $sConnect = @{ Server = 'LogInsight.local.lab' User = 'admin' Password = 'VMware1!' } Connect-LogInsight @sConnect $constraint = Get-LogInsightConstraint -Field 'hostname' -Operator STARTS_WITH -Value 'esx1' $result = Get-LogInsightEvent -Constraint $constraint...
PowerShellCorpus/PowerShellGallery/LogInsight/1.0/Examples/Query-Bins.ps1
Query-Bins.ps1
Import-Module -Name LogInsight $sConnect = @{ Server = 'LogInsight.local.lab' User = 'admin' Password = 'VMware1!' } Connect-LogInsight @sConnect $constraint = Get-LogInsightConstraint -Field 'hostname' -Operator STARTS_WITH -Value 'esx1' $result = Get-LogInsightEvent -Constraint $constraint...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Src/Build.ps1
Build.ps1
param ( [switch]$clean ) if ( $clean ) { remove-item SMLets.Module.dll -ea silentlycontinue remove-item SMLets.Module.dll-Help.xml -ea silentlycontinue remove-item SMLets.Module.pdb -ea silentlycontinue exit } # this function creates the Get-SMLetsVersion cmdlet file function New-SMLetsVersio...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/Test-SortParameter.ps1
Test-SortParameter.ps1
$PT = "System.WorkItem.Incident.View.ProjectionType" $props = "CreatedDate","ID","DisplayName",{$_.object.get_id()} set-alias gsop get-SCSMObjectProjection set-alias os out-string $count = 10 ### PROJECTION "PROJECTION" $r = gsop $PT -max $count if ( $r.Count -eq $count ) { "PASS - Count" } else { "FAIL - Cou...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test-newproblem.ps1
test-newproblem.ps1
param ( $count = 10 , [switch]$whatif, [switch]$Verbose, [switch]$debug) BEGIN { function Get-Priority { param ( [string]$myurgency, [string]$myimpact ) $hunt = "${myurgency}${myimpact}" $PriorityData = (get-scsmobject -class (get-scsmclass -name System.WorkItem.Incident.Gener...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test004.ps1
test004.ps1
BEGIN { # the definition of Out-TestLog . ./Common.ps1 $TESTNAME = $MyInvocation.MyCommand $STARTTIME = [datetime]::Now $TESTFAILED = $FALSE } END { try { [array]$r = get-scsmtask if ( $null -ne $r[0] ) { Out-TestLog ("PASS: " + [datetime]...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test-newprojectionobject.ps1
test-newprojectionobject.ps1
param ( $count = 10 , [switch]$whatif, [switch]$Verbose) BEGIN { function new-FileAttachmentStream { param ( $count = 3 ) $OPEN = ([io.filemode]::Open) $RACC = ([io.fileaccess]::Read) $RSHR = ([io.fileshare]::read) for($i = 0; $i -lt $count; $i++) { ...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test009.ps1
test009.ps1
# Test the filter parameter to get-scsmobject. It should handle # property -eq # property -gt # property -lt # property -ne # property -like # property -isnull # property -isnotnull # the same for GenericProperty # property1 -eq value -and property2 -eq value2 # property1 -gt value -and property2 -gt value2...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test011.ps1
test011.ps1
BEGIN { # get the Out-TestLog function . ./Common # import common functions (get-lorem) . ../DataGen/Common.ps1 $TESTNAME = $MyInvocation.MyCommand $name = "System.WorkItem.Incident" $STARTTIME = [datetime]::Now $CClass = get-scsmclass -name "microsoft.windows.computer$" ...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/Invoke-Test.ps1
Invoke-Test.ps1
#requires -version 2.0 [CmdletBinding(SupportsShouldProcess=$true)] param ( [string[]]$tests ) BEGIN { # dot source the common stuff . ./common.ps1 $ShowResults = $false # these can be functions, or scripts if ( $tests ) { [string[]]$testprograms = $tests } ...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/get-IncidentPriority.ps1
get-IncidentPriority.ps1
$PriorityData = (get-scsmobject System.WorkItem.Incident.GeneralSetting).PriorityMatrix if ( $PriorityData ) { $matrix = [xml]$PriorityData } $Impact = Get-SCSMEnumeration System.WorkItem.TroubleTicket.ImpactEnum. | sort Ordinal $Urgency = Get-SCSMEnumeration System.WorkItem.TroubleTicket.UrgencyEnum. | sort...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test010.ps1
test010.ps1
BEGIN { # set-psdebug -trace 2 # the definition of Out-TestLog . ./Common.ps1 $TESTNAME = $MyInvocation.MyCommand $name = "System.WorkItem.Incident" $STARTTIME = [datetime]::Now $IncidentTitle = "Test010 - $STARTTIME" $Urgency = "Medium" $Impact = "High" ...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/Test-soro.ps1
Test-soro.ps1
. ..\DataGen\Common.ps1 if ( ! (get-scsmmanagementpack -name SOTESTMP )) { New-SCSMManagementPack -name SOTESTMP } $mp = Get-SCSMManagementPack SOTESTMP $user = get-scsmuser | select -first 1 $now = get-date $title = get-lorem 6 $soArgs = @{ Title = $title CostInformation = "C...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test008.ps1
test008.ps1
BEGIN { # the definition of Out-TestLog . ./Common.ps1 $MPNAME = "EnumTestMP" $MPFILENAME = "${MPNAME}.xml" $TESTNAME = $MyInvocation.MyCommand $name = "System.WorkItem.Incident" $STARTTIME = [datetime]::Now # CREATE THE MP HERE function New-EnumMP { @" <?xml version...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test006.ps1
test006.ps1
# this test ensures that the cmdlets that should be here are here BEGIN { # the definition of Out-TestLog . ./Common.ps1 $TESTNAME = $MyInvocation.MyCommand $name = "Microsoft.windows.computer" $STARTTIME = [datetime]::Now } END { try { $o = get-scsmclass $name$|get-sc...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test007.ps1
test007.ps1
BEGIN { # the definition of Out-TestLog . ./Common.ps1 $TESTNAME = $MyInvocation.MyCommand $name = "Microsoft.windows.computer" $STARTTIME = [datetime]::Now } END { try { $o = get-scsmannouncement if ( $null -ne $o ) { Out-TestLog ("PASS: " + [datetime]::Now ...
PowerShellCorpus/PowerShellGallery/SMLets/0.5.0.1/Test/test005.ps1
test005.ps1
# this test ensures that the cmdlets that should be here are here BEGIN { # the definition of Out-TestLog . ./Common.ps1 $TESTNAME = $MyInvocation.MyCommand $DOCUMENT = "${TESTDIR}\Document.RTF" $class = Get-SCSMClass -Name "System.Knowledge.Article" # get rid of the article we're crea...