full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xDisk/1-xDisk_InitializeDataDisk.ps1
1-xDisk_InitializeDataDisk.ps1
<# .EXAMPLE This configuration will wait for disk 2 to become available, and then make the disk available as two new formatted volumes, 'G' and 'J', with 'J' using all available space after 'G' has been created. It also creates a new ReFS formated volume on disk 3 attached as drive lette...
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xWaitForDisk/2-xWaitForDisk_InitializeDataDiskWithAccessPath.ps1
2-xWaitForDisk_InitializeDataDiskWithAccessPath.ps1
<# .EXAMPLE This configuration will wait for disk 2 to become available, and then make the disk available as two new formatted volumes mounted to folders c:\SQLData and c:\SQLLog, with c:\SQLLog using all available space after c:\SQLData has been created. #> Configuration Example { ...
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xWaitForDisk/3-xWaitForDisk_InitializeDataDiskWithAccessPath.ps1
3-xWaitForDisk_InitializeDataDiskWithAccessPath.ps1
<# .EXAMPLE This configuration will wait for disk 2 to become available, and then make the disk available as two new formatted volumes mounted to folders c:\SQLData and c:\SQLLog, with c:\SQLLog using all available space after c:\SQLData has been created. #> Configuration Example { ...
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xWaitForDisk/4-xWaitForDisk_InitializeDataDiskWithAccessPathUsingUniqueId.ps1
4-xWaitForDisk_InitializeDataDiskWithAccessPathUsingUniqueId.ps1
<# .EXAMPLE This configuration will wait for disk with Unique Id '5E1E50A401000000001517FFFF0AEB84' to become available, and then make the disk available as two new formatted volumes mounted to folders c:\SQLData and c:\SQLLog, with c:\SQLLog using all available space after c:\SQLData h...
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xWaitForDisk/1-xWaitForDisk_InitializeDataDisk.ps1
1-xWaitForDisk_InitializeDataDisk.ps1
<# .EXAMPLE This configuration will wait for disk 2 to become available, and then make the disk available as two new formatted volumes, 'G' and 'J', with 'J' using all available space after 'G' has been created. It also creates a new ReFS formated volume on Disk 3 attached as drive lette...
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xMountImage/1-xMountImage_DismountISO.ps1
1-xMountImage_DismountISO.ps1
<# .EXAMPLE This configuration will unmount an ISO file that is mounted in S:. #> configuration Example { Import-DscResource -ModuleName xStorage xMountImage ISO { ImagePath = 'c:\Sources\SQL.iso' DriveLetter = 'S' Ensure = 'Absent' } }
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xMountImage/2-xMountImage_MountISO.ps1
2-xMountImage_MountISO.ps1
<# .EXAMPLE This configuration will mount an ISO file as drive S:. #> configuration Example { Import-DscResource -ModuleName xStorage xMountImage ISO { ImagePath = 'c:\Sources\SQL.iso' DriveLetter = 'S' } xWaitForVolume WaitForISO { DriveLett...
PowerShellCorpus/PowerShellGallery/xStorage/3.1.0.0/Examples/Resources/xMountImage/3-xMountImage_MountVHD.ps1
3-xMountImage_MountVHD.ps1
<# .EXAMPLE This configuration will mount a VHD file and wait for it to become available. #> configuration Example { Import-DscResource -ModuleName xStorage xMountImage MountVHD { ImagePath = 'd:\Data\Disk1.vhd' DriveLetter = 'V' } xWaitForVolume WaitForVH...
PowerShellCorpus/PowerShellGallery/AstHelper/0.1/Public/Get-AstType.ps1
Get-AstType.ps1
function Get-AstType { <# .SYNOPSIS Returns all of the types of AST objects in a script. .DESCRIPTION Parses the contents of a provided script and gets a list of all the AST object types. .EXAMPLE Get-AstType -ScriptPath .\MyScript.ps1 .NOTES Author: Thomas Rayner (@MrThomasRayner), workin...
PowerShellCorpus/PowerShellGallery/AstHelper/0.1/Public/Get-AstObject.ps1
Get-AstObject.ps1
function Get-AstObject { <# .SYNOPSIS Returns all the AST objects in a script that are of a specified type. .DESCRIPTION Takes the content of a script, parses it, and returns all the objects in a script that are of that type. .EXAMPLE Get-AstObject -ScriptPath .\MyScript.ps1 -Type CommandAst ....
PowerShellCorpus/PowerShellGallery/AstHelper/0.1/Public/Invoke-ScriptTokenize.ps1
Invoke-ScriptTokenize.ps1
function Invoke-Tokenize { <# .SYNOPSIS Tokenizes a script. .DESCRIPTION Gets the content of a script located at a given path and tokenizes it. .EXAMPLE Invoke-Tokenize -ScriptPath .\MyScript.ps1 .NOTES Author: Thomas Rayner (@MrThomasRayner), workingsysadmin.com .LINK http://workin...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Get-XAMLDialogsByCategory.ps1
Get-XAMLDialogsByCategory.ps1
#requires -Version 3 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: Get-XAMLDialogsByCategory.ps1 ...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Open-XAMLDialog.ps1
Open-XAMLDialog.ps1
#requires -Version 3 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: Open-XAMLDialog.ps1 ===...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Initialize-XAMLDialog.ps1
Initialize-XAMLDialog.ps1
#requires -Version 3 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: Initialize-XAMLDialog.ps1 ...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Start-PSGUIManager.ps1
Start-PSGUIManager.ps1
#requires -Version 2 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: ExecByShortcut.ps1 ====...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Export-Dialogs.ps1
Export-Dialogs.ps1
#requires -Version 2 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: Export-Dialogs.ps1 =====...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/InstallDialogs.ps1
InstallDialogs.ps1
#requires -Version 2 -Modules PSGUI <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: InstallDialogs.ps1...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Install-PSGUIModule.ps1
Install-PSGUIModule.ps1
#requires -Version 2 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: Install-PSGUIModule.ps1 ...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/New-XAMLDialog.ps1
New-XAMLDialog.ps1
#requires -Version 2 <# .NOTES =========================================================================== Created on: 29.07.2016 Created by: David das Neves Version: 0.53 Project: PSGUI Filename: New-XAMLDialog.ps1 ====...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/New-LinkForPSGUIManager.ps1
New-LinkForPSGUIManager.ps1
#requires -Version 1 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.59 Project: PSGUI Filename: New-LinkForGUIManager.ps1 ...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Rename-XAMLDialog.ps1
Rename-XAMLDialog.ps1
#requires -Version 2 <# .NOTES =========================================================================== Created on: 06.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: Rename-XAMLDialog.ps1 ==...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Internal/Internal_UserInput/Internal_UserInput.ps1
Internal_UserInput.ps1
<# .NOTES =========================================================================== Created on: 25.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI Filename: Internal_UserInput.ps1 ===================================...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Internal/Internal_UserInput/Internal_UserInput_Debug.ps1
Internal_UserInput_Debug.ps1
<# .NOTES =========================================================================== Debugging file with preset lines to start debugging. =========================================================================== #> #Debugging lines #Only creating all variables for data anal...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Internal/Internal_About/Internal_About.ps1
Internal_About.ps1
<# .NOTES =========================================================================== Created on: 08.10.2015 Created by: David das Neves Version: 0.1 Project: PSGUI Filename: Internal_About.ps1 =======================================...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Internal/Internal_Start/Internal_Start.ps1
Internal_Start.ps1
<# .NOTES =========================================================================== Created on: 08.10.2015 Created by: David das Neves Version: 0.1 Project: PSGUI Filename: Internal_Start.ps1 =======================================...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Internal/Internal_Clean/Internal_Clean.ps1
Internal_Clean.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/03_ShowDialogResult/03_ShowDialogResult_Debug.ps1
03_ShowDialogResult_Debug.ps1
<# .NOTES =========================================================================== Debugging file with preset lines to start debugging. =========================================================================== #> #Debugging lines #Only creating all variables for data analysis Open-...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/03_ShowDialogResult/03_ShowDialogResult.ps1
03_ShowDialogResult.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/06_Bindings3/06_Bindings3.ps1
06_Bindings3.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/08_AddColumntoListviewwithnewBinding/08_AddColumntoListviewwithnewBinding.ps1
08_AddColumntoListviewwithnewBinding.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/07_Bindings_Complete/07_Bindings_Complete.ps1
07_Bindings_Complete.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/05_Bindings2/05_Bindings2.ps1
05_Bindings2.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/11_Styles_Event_Trigger/11_Styles_Event_Trigger.ps1
11_Styles_Event_Trigger.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/04_Bindings1/04_Bindings1.ps1
04_Bindings1.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/Example_PCInformation/Example_PCInformation.ps1
Example_PCInformation.ps1
<# .NOTES =========================================================================== Created on: 04.10.2015 Created by: David das Neves Version: 0.1 Project: PSGUI - PSGUI_Manager Filename: Example_PCInformation.ps1 ================...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/SCCM_LogAnalyzer/SCCM_LogAnalyzer_Debug.ps1
SCCM_LogAnalyzer_Debug.ps1
<# .NOTES =========================================================================== Debugging file with preset lines to start debugging. =========================================================================== #> #Debugging lines #Only creating all variables for data anal...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/SCCM_LogAnalyzer/SCCM_LogAnalyzer.ps1
SCCM_LogAnalyzer.ps1
#requires -Version 5 <# .NOTES =========================================================================== Created on: 02.08.2016 Created by: David das Neves Version: 0.1 Project: SCCM_LogAnalyzer Filename: LogFileParser.ps1 ...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/01_UserInput/01_UserInput.ps1
01_UserInput.ps1
#region PreFilling #endregion #region EventHandler $01_UserInput.Add_Closed( { #Get-Variable -Name 01_UserInput* | Clear-Variable #Get-Variable -Name 01_UserInput* | Remove-Variable } ) #endregion $01_UserInput_bOK.Add_Click( { Set-Variable -Name Returnvalue...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/12_Dispatcherinvoke_ProgressBar/12_Dispatcherinvoke_ProgressBar.ps1
12_Dispatcherinvoke_ProgressBar.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/12_Dispatcherinvoke_ProgressBar/12_Dispatcherinvoke_ProgressBar_Debug.ps1
12_Dispatcherinvoke_ProgressBar_Debug.ps1
<# .NOTES =========================================================================== Debugging file with preset lines to start debugging. =========================================================================== #> #Debugging lines #Only creating all variables for data anal...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/MouseTracker/MouseTracker.ps1
MouseTracker.ps1
#requires -Version 1 <# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 ====================================================...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/20_PSGUIManager_Example/20_PSGUIManager_Example.ps1
20_PSGUIManager_Example.ps1
#requires -Version 3 -Modules PSGUI <# .NOTES =========================================================================== Created on: 05.07.2016 Created by: David das Neves Version: 0.5 Project: 20_PSGUIManager_Example Filename: ...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/02_PCInformation/02_PCInformation.ps1
02_PCInformation.ps1
<# .NOTES =========================================================================== Created on: 04.10.2015 Created by: David das Neves Version: 0.1 Project: PSGUI - PSGUI_Manager Filename: 02_PCInformation.ps1 =====================...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/10_Styles_Data_Trigger/10_Styles_Data_Trigger.ps1
10_Styles_Data_Trigger.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/Example_UserInput/Example_UserInput.ps1
Example_UserInput.ps1
#region PreFilling #endregion #region EventHandler $Example_UserInput.Add_Closed( { #Get-Variable -Name Example_UserInput* | Clear-Variable #Get-Variable -Name Example_UserInput* | Remove-Variable } ) #endregion $Example_UserInput_bOK.Add_Click( { Set-Variab...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Examples/09_Styles_Property_Trigger/09_Styles_Property_Trigger.ps1
09_Styles_Property_Trigger.ps1
<# .NOTES =========================================================================== Created on: Created by: Version: Project: Filename: .ps1 =========================================================================== .DESC...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/Dialogs/Production/Clean/Clean.ps1
Clean.ps1
#region PreFilling #endregion #region EventHandler #endregion
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/PSGUI_Manager/PSGUI_Manager.tests.ps1
PSGUI_Manager.tests.ps1
# this is a Pester test file #region Further Reading # http://www.powershellmagazine.com/2014/03/27/testing-your-powershell-scripts-with-pester-assertions-and-more/ #endregion #region LoadScript # load the script file into memory # attention: make sure the script only contains function definitions # and no act...
PowerShellCorpus/PowerShellGallery/PSGUI/0.58/PSGUI_Manager/PSGUI_Manager.ps1
PSGUI_Manager.ps1
#requires -Version 3 <# .NOTES =========================================================================== Created on: 25.07.2016 Created by: David das Neves Version: 0.5 Project: PSGUI_Manager Filename: PSGUI_Manager.ps1 ...
PowerShellCorpus/PowerShellGallery/NTFSSecurity/4.2.3/NTFSSecurity.Init.ps1
NTFSSecurity.Init.ps1
#region Internals #region C# Code $type_NTFS1 = @' using System; using System.IO; using System.Collections; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; namespace NTFS { public class DriveInfoExt { [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSe...
PowerShellCorpus/PowerShellGallery/SNMPSharpNet/0.0.1/Public/Invoke-SNMPGet.ps1
Invoke-SNMPGet.ps1
function Invoke-SNMPGet { <# .SYNOPSIS Perform a SNMP Get Request and return the results .DESCRIPTION This can be used to perform a simple Get request against one or more hosts. Only SNMP v1 and v2 is supported at this time. SNMP v3 is not supported. .NOTES Uses the SnmpSharpNet library (htt...
PowerShellCorpus/PowerShellGallery/FormatTools/0.5.0/Tests/FormatTools.Tests.ps1
FormatTools.Tests.ps1
Describe "Tests Format-Banner" { BeforeAll { $strs = "this is","a test" $banner = Format-Banner -strings $strs $ExpectedOutput = @( " ", " ##### # # # #### # #### ", " # # # # # ...
PowerShellCorpus/PowerShellGallery/ChocolateyGet/1.0.0.1/Test/ChocolateyGet.tests.ps1
ChocolateyGet.tests.ps1
$ChocolateyGet = "ChocolateyGet" import-module packagemanagement Get-Packageprovider -verbose $provider = Get-PackageProvider -verbose -ListAvailable if($provider.Name -notcontains $ChocolateyGet) { $a= Find-PackageProvider -Name $ChocolateyGet -verbose -ForceBootstrap if($a.Name -eq $ChocolateyGet...
PowerShellCorpus/PowerShellGallery/Merge-DscConfigData/1.1.2/Tests/Unit/Merge-DscConfigData.Tests.ps1
Merge-DscConfigData.Tests.ps1
# Ensuring PSScriptAnalyzer ignores the use of Invoke-Expression [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingInvokeExpression', '')] param() $ModuleName = 'Merge-DscConfigData' If ( Get-Module -Name $ModuleName ) { Remove-Module -Name $ModuleName } Import-Module "$($PSScriptRoot)\..\..\...
PowerShellCorpus/PowerShellGallery/deepmind/1.4.0/DeepMind.Tests.ps1
DeepMind.Tests.ps1
. $PSScriptRoot\Helpers\AppVeyorHelpers.ps1 Import-Module $PSScriptRoot\DeepMind.psm1 -Force Describe "Add-DeepMind" { It "Adds <A> and <B> in the cloud and returns <Expected>" -TestCases @( @{ A = 1; B = 1; Expected = 2 }, @{ A = 100; B = 10; Expected = 110 }, @{ A = -1; B = 1; Expected ...
PowerShellCorpus/PowerShellGallery/deepmind/1.4.0/Helpers/AppVeyorHelpers.ps1
AppVeyorHelpers.ps1
<#PSScriptInfo .VERSION 0.1 .AUTHOR nohwnd .GUID f8dab2f8-5b75-4d64-95eb-9b8b10cdd97a .DESCRIPTION AppVeyor helpers for tag parsing and running tests conditionally. #> function Get-Environment () { $env:Environment } function Set-Environment { param ( [ValidateSet("Development","Release")] ...
PowerShellCorpus/PowerShellGallery/Posh-SubnetTools/1.0/Functions/Get-SubnetSize.ps1
Get-SubnetSize.ps1
#!/usr/bin/env powershell #requires -Version 1.0 function Get-SubnetSize { <# .SYNOPSIS Returns the possible number of hosts that a subnet can contain. .DESCRIPTION This function returns the possible number of hosts that the subnet can contain, by default...
PowerShellCorpus/PowerShellGallery/Posh-SubnetTools/1.0/Tests/Get-SubnetSize.tests.ps1
Get-SubnetSize.tests.ps1
Import-Module $PSScriptRoot\..\Functions\Get-SubnetSize.ps1 -Force -Verbose Describe 'Get-SubnetSize' { Context 'Script Analyzer' { It 'Does not have any issues with the Script Analyser - Get-SubnetSize' { Invoke-ScriptAnalyzer $PSScriptRoot\..\Functions\Get-SubnetSize.ps1 | Should be $null ...
PowerShellCorpus/PowerShellGallery/AzureRM.ServiceFabric/0.2.0/AzureRmProfileStartup.ps1
AzureRmProfileStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # 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.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.ServiceFabric/0.2.0/ResourceManagerStartup.ps1
ResourceManagerStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # 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.apach...
PowerShellCorpus/PowerShellGallery/OktaAWSToken/0.0.39/OrgConfig.ps1
OrgConfig.ps1
<# .SYNOPSIS This helper function assists user to create the config OktaAWSToken.config JSON file. The script will be executed upon importing the module. #> if (-not (test-path $PSScriptRoot\OktaAWSToken.config)) { Write-Warning "Initializing config file: $PSScriptRoot\OktaAWSToken.config." $ac...
PowerShellCorpus/PowerShellGallery/PowerBot/3.6/UpdateCommands.ps1
UpdateCommands.ps1
[CmdletBinding()] param( [Hashtable[]]$Settings = $ExecutionContext.SessionState.Module.PrivateData, [String]$BaseDirectory = $ExecutionContext.SessionState.Module.ModuleBase, [String]$FileName = $ExecutionContext.SessionState.Module.Name, [Switch]$Force ) # if( $ExecutionContext.SessionState.Modul...
PowerShellCorpus/PowerShellGallery/posh-p4/1.4/profile.example.ps1
profile.example.ps1
# Powershell profile example for posh-p4 #Zougi. 27/02/2016 Import-Module posh-p4 function global:prompt { $realLASTEXITCODE = $LASTEXITCODE Write-Host($pwd.ProviderPath) -nonewline #perforce status Write-P4Prompt $global:LASTEXITCODE = $realLASTEXITCODE return "> " } # # a...
PowerShellCorpus/PowerShellGallery/posh-p4/1.4/P4Prompt.ps1
P4Prompt.ps1
<# .SYNOPSIS perforce prompt for windows powershell .DESCRIPTION posh-p4 Module: Bring P4 pending changelist info to the prompt. Kinda like we have with posh-git .NOTES Author: Frederic ROUSSEAU #> # you can override this settings from your $PROFILE $global:P4PromptSettings = New-Object PSObject -Pr...
PowerShellCorpus/PowerShellGallery/posh-p4/1.4/P4TabExpansion.ps1
P4TabExpansion.ps1
<# .SYNOPSIS perforce tab completion for windows powershell .DESCRIPTION posh-p4 Module: Bring tab auto completion (/tab expansion) for windows powershell. type p4, press tab, auto complete is there .NOTES Author: Frederic ROUSSEAU #> #list of p4 commands $script:p4Cmd = @( 'add' ...
PowerShellCorpus/PowerShellGallery/Discovery/1.0.1/Get-Type.ps1
Get-Type.ps1
function Get-Type { <# .Synopsis Gets the types that are currenty loaded in .NET, or gets information about a specific type .Description Gets all of the loaded types, or gets the possible values for an enumerated type or value. .Example # Gets all load...
PowerShellCorpus/PowerShellGallery/Discovery/1.0.1/Get-ExtensionMethod.ps1
Get-ExtensionMethod.ps1
function Get-ExtensionMethod { <# .Synopsis Gets loaded extension methods .Description Gets the currently loaded extension methods .Example Get-ExtensionMethod .Link Get-Type #> param() [AppDomain]::CurrentDomain.GetAssemblies() | For...
PowerShellCorpus/PowerShellGallery/Discovery/1.0.1/Find-CommandWithParameterType.ps1
Find-CommandWithParameterType.ps1
function Find-CommandWithParameterType { <# .Synopsis Gets commands that accept a particular type of parameter .Description Searches through the loaded commands to identify commands that accept a parameter of a type. .Example [int] | Find-CommandWithParameterType...
PowerShellCorpus/PowerShellGallery/Discovery/1.0.1/Get-ProgID.ps1
Get-ProgID.ps1
function Get-ProgID { <# .Synopsis Gets all of the ProgIDs registered on a system .Description Gets all ProgIDs registered on the system. The ProgIDs returned can be used with New-Object -comObject .Example ...
PowerShellCorpus/PowerShellGallery/Discovery/1.0.1/Search-WMI.ps1
Search-WMI.ps1
function Search-Wmi { <# .Synopsis Searches the WMI repository .Description Searches the help metadata that is built into the WMI repository to find WMI classes to fit a particular need. The search can look for: - Information by class name - Keywords in the description text - Keywords in...
PowerShellCorpus/PowerShellGallery/Discovery/1.0.1/InstallAddComType.ps1
InstallAddComType.ps1
$cp = New-Object CodeDom.Compiler.CompilerParameters $cp.CompilerOptions = "/unsafe" $null =$cp.ReferencedAssemblies.Add([object].Assembly.Location) $null = $cp.ReferencedAssemblies.Add([psobject].Assembly.Location) Add-Type -PassThru -CompilerParameters $cp -TypeDefinition @" using System; using System.IO; u...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Private/request.ps1
request.ps1
function request( [string]$Url, [int]$Timeout ) { if ([string]::IsNullOrWhiteSpace($url)) {throw 'The URL is empty'} $request = [System.Net.WebRequest]::Create($Url) if ($Timeout) { $request.Timeout = $Timeout*1000 } $response = $request.GetResponse() $response.Close() $response }
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Private/is_version.ps1
is_version.ps1
# Returns [bool] function is_version( [string] $Version ) { $re = '^(\d{1,16})\.(\d{1,16})\.*(\d{1,16})*\.*(\d{1,16})*(-[^.-]+)*$' if ($Version -notmatch $re) { return $false } $v = $Version -replace '-.+' return [version]::TryParse($v, [ref]($__)) }
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Private/is_url.ps1
is_url.ps1
# Returns [bool] function is_url([string] $Url ) { [Uri]::IsWellFormedUriString($URL, [UriKind]::Absolute) }
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Private/AUPackage.ps1
AUPackage.ps1
class AUPackage { [string] $Path [string] $Name [bool] $Updated [bool] $Pushed [string] $RemoteVersion [string] $NuspecVersion [string[]] $Result [string] $Error [string] $NuspecPath [xml] $NuspecXml AUPackage([string] $Path ){ i...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Private/check_url.ps1
check_url.ps1
# Returns nothing if url is valid, error otherwise function check_url( [string] $Url, [int]$Timeout, $ExcludeType='text/html' ) { if (!(is_url $Url)) { return "URL syntax is invalid" } try { $response = request $url $Timeout if ($response.ContentType -like "*${ExcludeType}*") { retur...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Public/Get-RemoteFiles.ps1
Get-RemoteFiles.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 22-Feb-2017. <# .SYNOPSIS Get Latest URL32 and/or URL64 into tools directxory. .DESCRIPTION This function will download the binaries pointed to by $Latest.URL32 and $Latest.URL34. The function is used to embed binaries into the Chocola...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Public/Test-Package.ps1
Test-Package.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 15-Nov-2016. <# .SYNOPSIS Test Chocolatey package .DESCRIPTION The function can test install, uninistall or both and provide package parameters during test. It will force install and then remove the Chocolatey package if called with...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Public/Get-RemoteChecksum.ps1
Get-RemoteChecksum.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 26-Nov-2016. <# .SYNOPSIS Download file from internet and calculate its checksum #> function Get-RemoteChecksum( [string] $Url, $Algorithm='sha256' ) { $fn = [System.IO.Path]::GetTempFileName() Invoke-WebRequest $Url -OutFile $fn -...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Public/Update-AUPackages.ps1
Update-AUPackages.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 02-Dec-2016. <# .SYNOPSIS Update all automatic packages .DESCRIPTION Function Update-AUPackages will iterate over update.ps1 scripts and execute each. If it detects that a package is updated it will push it to the Chocolatey communi...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Public/Update-Package.ps1
Update-Package.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 19-Dec-2016. <# .SYNOPSIS Update automatic package .DESCRIPTION This function is used to perform necessary updates to the specified files in the package. It shouldn't be used on its own but must be part of the script which defines t...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Public/Push-Package.ps1
Push-Package.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 22-Oct-2016. <# .SYNOPSIS Push latest created package to the Chocolatey community repository. .DESCRIPTION The function uses they API key from the file api_key in current or parent directory, environment variable or cached nuget API...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Public/Get-AUPackages.ps1
Get-AUPackages.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 12-Nov-2016. <# .SYNOPSIS Get AU packages .DESCRIPTION Returns list of directories that have update.ps1 script in them and package name doesn't start with the '_' char (unpublished packages, not considered by Update-AUPackages ...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/Git.ps1
Git.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 09-Nov-2016. # https://www.appveyor.com/docs/how-to/git-push/ param( $Info, # Git username [string] $User, # Git password. You can use Github Token here if you omit username. [string] $Password, #Force git commit...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/History.ps1
History.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 09-Dec-2016. <# .SYNOPSIS Create update history as markdown report .DESCRIPTION Shows one date per line and all of the packages pushed to the Chocolatey community repository during that day. First letter of the package name links to...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/Gist.ps1
Gist.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 10-Nov-2016. <# .SYNOPSIS Create update history as markdown report using git commit log. .DESCRIPTION Shows one date per line and all of the packages pushed to the Chocolatey community repository during that day. First letter of the pac...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/RunInfo.ps1
RunInfo.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 21-Sep-2016. <# .SYNOPSIS Save run info to the file and exclude sensitive information. .DESCRIPTION Run this plugin as the last one to save all other info produced during the run. To load it for inspection use `$info = Import-CliXml...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/Report.ps1
Report.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 10-Nov-2016. <# .SYNOPSIS Create different types of reports about the current run. .DESCRIPTION The plugin saves state of all packages in a file that can be used locally or uploaded via other plugins to remote (such as Gist or Mail). ...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/Mail.ps1
Mail.ps1
# Author: Miodrag Milic <miodrag.milic@gmail.com> # Last Change: 12-Nov-2016. param( $Info, [string] $To, [string] $Server, [string] $UserName, [string] $Password, [int] $Port, [string[]] $Attachment, [switch] $EnableSsl, [string] $UserMessage, # Do...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/Report/text.ps1
text.ps1
$UserMessage = $Params.UserMessage $Title = if ($Params.Title) { $Params.Title } else { 'Update-AUPackages' } #============================================================================== function title($txt) { "r`n{0}`r`n{1}`r`n" -f $txt,('-'*$txt.Length) } function indent($txt, $level=4) { $txt -spli...
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/Report/markdown.ps1
markdown.ps1
. $PSScriptRoot\markdown_funcs.ps1 $Github_UserRepo = $Params.Github_UserRepo $UserMessage = $Params.UserMessage $NoAppVeyor = $Params.NoAppVeyor $IconSize = if ($Params.IconSize) { $Params.IconSize } else { 32 } $NoIcons = $Params.NoIcons $Title = if ($Params.Title) { $Params....
PowerShellCorpus/PowerShellGallery/AU/2017.3.29/Plugins/Report/markdown_funcs.ps1
markdown_funcs.ps1
function md_fix_newline($Text) { $Text -replace "\.`n", "\.`n " | Out-String } function md_title($Title, $Level=2 ) { "" "#"*$Level + ' ' + $Title | Out-String "" } function md_code($Text) { "`n" + '```' ($Text -join "`n").Trim() '```' + "`n" } function md_table($result, ...
PowerShellCorpus/PowerShellGallery/ACMESharpRoute53Automation/1.0.4/Private/Register-LetsEncryptCertificateRequest.ps1
Register-LetsEncryptCertificateRequest.ps1
<# .NOTES Author: Robert D. Biddle https://github.com/RobBiddle https://github.com/RobBiddle/ACMESharpRoute53Automation ACMESharpRoute53Automation Copyright (C) 2017 Robert D. Biddle This program comes with ABSOLUTELY NO WARRANTY; for details type `"help Get-NewLetsEncryptCertificate -full`"...
PowerShellCorpus/PowerShellGallery/ACMESharpRoute53Automation/1.0.4/Private/Push-LetsEncryptChallengeToRoute53.ps1
Push-LetsEncryptChallengeToRoute53.ps1
<# .NOTES Author: Robert D. Biddle https://github.com/RobBiddle https://github.com/RobBiddle/ACMESharpRoute53Automation ACMESharpRoute53Automation Copyright (C) 2017 Robert D. Biddle This program comes with ABSOLUTELY NO WARRANTY; for details type `"help Get-NewLetsEncryptCertificate -full`"...
PowerShellCorpus/PowerShellGallery/ACMESharpRoute53Automation/1.0.4/Private/Get-AllRoute53Records.ps1
Get-AllRoute53Records.ps1
<# .NOTES Author: Robert D. Biddle https://github.com/RobBiddle https://github.com/RobBiddle/ACMESharpRoute53Automation ACMESharpRoute53Automation Copyright (C) 2017 Robert D. Biddle This program comes with ABSOLUTELY NO WARRANTY; for details type `"help Get-NewLetsEncryptCertificate -full`"...
PowerShellCorpus/PowerShellGallery/ACMESharpRoute53Automation/1.0.4/Private/Complete-LetsEncryptCertificateRequest.ps1
Complete-LetsEncryptCertificateRequest.ps1
<# .NOTES Author: Robert D. Biddle https://github.com/RobBiddle https://github.com/RobBiddle/ACMESharpRoute53Automation ACMESharpRoute53Automation Copyright (C) 2017 Robert D. Biddle This program comes with ABSOLUTELY NO WARRANTY; for details type `"help Get-NewLetsEncryptCertificate -full`"...
PowerShellCorpus/PowerShellGallery/ACMESharpRoute53Automation/1.0.4/Public/Get-NewLetsEncryptCertificate.ps1
Get-NewLetsEncryptCertificate.ps1
<# .SYNOPSIS ACMESharpRoute53Automation is a PowerShell module which automates the ACMESharp process of obtaining SSL certificates from LetsEncrypt.org https://letsencrypt.org using Amazon AWS Route53 https://aws.amazon.com/route53/ to enable the DNS Domain Validation method .DESCRIPTION --- REQUIRES AWSPow...
PowerShellCorpus/PowerShellGallery/cCDROMdriveletter/1.2.0/Examples/Sample_SetCDtoZ.ps1
Sample_SetCDtoZ.ps1
# Sets the CD drive letter to Z: Configuration Sample_SetCDtoZ { Import-DscResource -module cCDROMdriveletter Node localhost { cCDROMdriveletter cdrom { DriveLetter = "Z" Ensure = "Present" } } } # Creates a mof and applies the resour...
PowerShellCorpus/PowerShellGallery/cCDROMdriveletter/1.2.0/Tests/cCDRomdriveletter.Tests.ps1
cCDRomdriveletter.Tests.ps1
# TODO: tests would be nice
PowerShellCorpus/PowerShellGallery/PSColor/1.0.0.0/ServiceController.ps1
ServiceController.ps1
# Outputs a line of a ServiceController function Write-Color-Service { param ([string]$color = "white", $service) Write-host ("{0,-8}" -f $_.Status) -foregroundcolor $color -noNewLine Write-host (" {0,-18} {1,-39}" -f (CutString $_.Name 18), (CutString $_.DisplayName 38)) -foregroundcolor "white" } ...