full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/Load.ps1 | Load.ps1 | $PreLoad = {
Import-Module (Join-Path $PluginPath 'pscolor\src\module\pscolor.psm1') -Global -Force
}
$PostLoad = {}
$Config = {}
$Shutdown = {}
$Unload = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/Plugin.ps1 | Plugin.ps1 | # Nothing |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/private/Get-CallerPreference.ps1 | Get-CallerPreference.ps1 | function Get-CallerPreference {
<#
.Synopsis
Fetches "Preference" variable values from the caller's scope.
.DESCRIPTION
Script module functions do not automatically inherit their caller's variables, but they can be
obtained through the $PSCmdlet variable in Advanced Functions. Th... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/private/Write-FileLength.ps1 | Write-FileLength.ps1 | # Helper method to write file length in a more human readable format
function Write-FileLength
{
param ($length)
if ($length -eq $null)
{
return ""
}
elseif ($length -ge 1GB)
{
return ($length / 1GB).ToString("F") + 'GB'
}
elseif ($length -ge 1MB)
{
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/other/PreLoad.ps1 | PreLoad.ps1 | if (-not $Script:ModulePath) {
$ModulePath = Split-Path $script:MyInvocation.MyCommand.Path
}
# This is used for the PSColor functions
$Script:PSColor = @{
File = @{
Default = @{ Color = 'White' }
Directory = @{ Color = 'Cyan'}
Hidden = @{ Color = 'DarkGray'; Pattern = ... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/other/PostLoad.ps1 | PostLoad.ps1 | # Nothing |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/public/Add-OMPColorAction.ps1 | Add-OMPColorAction.ps1 | Function Add-OMPColorAction {
<#
.SYNOPSIS
Adds a new colorization action to take against a particular output type.
.DESCRIPTION
Adds a new colorization action to take against a particular output type.
.PARAMETER Type
Object type to colorize.
.PARAMETER Action
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/public/Set-OMPPSColor.ps1 | Set-OMPPSColor.ps1 | Function Set-OMPPSColor {
<#
.SYNOPSIS
Sets the PSColor settings.
.DESCRIPTION
Sets the PSColor settings.
.PARAMETER Setting
Hash containging the PSColor settings.
.EXAMPLE
PS> Set-OMPPSColor -Setting @{
File = @{
Default = @... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/public/Write-CutString.ps1 | Write-CutString.ps1 | function Write-CutString {
<#
.Synopsis
Helper method for simulating ellipsis in PSColor modified output
.DESCRIPTION
Helper method for simulating ellipsis in PSColor modified output
.PARAMETER Message
Message to modify
.PARAMETER Length
Length to limit output ... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/public/Out-Default.ps1 | Out-Default.ps1 | function Out-Default {
<#
.SYNOPSIS
Proxy Out-Default command required for colorization of console output.
.DESCRIPTION
Proxy Out-Default command required for colorization of console output.
.PARAMETER Transcript
TBD
.PARAMETER InputObject
TBD
#>
[CmdletBinding(Hel... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/public/Get-OMPColorAction.ps1 | Get-OMPColorAction.ps1 | Function Get-OMPColorAction {
<#
.SYNOPSIS
Get one or all of the OMP color actions.
.DESCRIPTION
Get one or all of the OMP color actions.
.PARAMETER Name
Name of the setting
.EXAMPLE
PS> Get-OMPColorAction -Name 'SomeTypeName'
Shows the action assi... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/pscolor/src/module/src/public/Remove-OMPColorAction.ps1 | Remove-OMPColorAction.ps1 | Function Remove-OMPColorAction {
<#
.SYNOPSIS
Removes a colorization action.
.DESCRIPTION
Removes a colorization action.
.PARAMETER Name
Type name to remove
.EXAMPLE
PS> Remove-OMPColorAction -Name 'Custom.Type'
.NOTES
Author: Zachary Loeber... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/o365/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {}
$Config = {}
$Shutdown = {}
$Unload = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/o365/src/Connect-ExchangeMFA.ps1 | Connect-ExchangeMFA.ps1 | # https://www.powershellgallery.com/packages/Load-ExchangeMFA/1.1/Content/Load-ExchangeMFA.ps1
Function Global:Connect-ExchangeMFA {
function Install-ClickOnce {
[CmdletBinding()]
Param(
$Manifest = "https://cmdletpswmodule.blob.core.windows.net/exopsmodule/Microsoft.Online.CSE.PSModule.Client.... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/o365/src/Connect-SkypeOnline.ps1 | Connect-SkypeOnline.ps1 | function Global:Connect-SkypeOnline{
[CmdLetBinding()]
param()
try {
Import-Module SkypeOnlineConnector
$proxysettings = New-PSSessionOption -ProxyAccessType IEConfig
$upn = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.userprincipalname
$cre... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/o365/src/Connect-ExchangeLocal.ps1 | Connect-ExchangeLocal.ps1 | Function Global:Connect-ExchangeLocal([string]$Server = "" ) {
try {
$URI = 'http://' + $Server + '/PowerShell/'
# $proxysettings = New-PSSessionOption -ProxyAccessType IEConfig
$upn = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.userprincipalname
$creds... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/o365/src/Connect-ExchangeOnline.ps1 | Connect-ExchangeOnline.ps1 | Function Global:Connect-ExchangeOnline {
[CmdletBinding()]
$proxysettings = New-PSSessionOption -ProxyAccessType IEConfig
$upn = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.userprincipalname
$creds = Get-Credential -UserName $upn -Message "Enter password for $upn"
$se... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/fileutils/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {}
$Config = {}
$Shutdown = {}
$Unload = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/fileutils/src/fileutils.ps1 | fileutils.ps1 | # Credit Adam Driscoll
# https://github.com/adamdriscoll/PoshInternals/blob/master/PendMoves.ps1
# This can also be installed by installing the module PoshInternals
function Global:Get-PendingFileRenameOperation
{
<#
.Synopsis
Gets the pending file rename operations that will take place on the ... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/psdefaultparams/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {}
$Config = {
# A few example psdefaultparametervalues to start with
$Global:PSDefaultParameterValues.Clear()
#$Global:PSDefaultParameterValues.Add("*:Credential",$Cred) # Uncomment to always have -Credential be populated with $Cred
$Global:PSDefaultParameterValues.A... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/psdefaultparams/src/Plugin.ps1 | Plugin.ps1 | <#
#A quick template function
function Global:Some-Function {
[CmdletBinding( )]
Param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string]$Name
)
Begin {
$Names = @()
}
Process {
$Names += $Name
}
End {
$Names ... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/powerline/Load.ps1 | Load.ps1 | $PreLoad = {
Import-OMPModule 'Powerline'
}
$PostLoad = {}
$Config = {}
$Shutdown = {}
$Unload = {
Remove-OMPModule -Name 'powerline' -PluginSafe
} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/powerline/src/Plugin.ps1 | Plugin.ps1 | # customize git prompt display settings |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/psreadline/Load.ps1 | Load.ps1 | $PreLoad = {
if (-not (Test-OMPProfileSetting -Name 'PSReadlineHistoryPath')) {
try {
Add-OMPProfileSetting -Name 'PSReadlineHistoryPath' -Value (Join-Path (Split-Path $Profile) '.powershell.history')
}
catch {
throw 'Unable to add psreadline profile settting PS... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/psreadline/src/psreadline.ps1 | psreadline.ps1 | # Nothing |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/consoleui/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {}
$Config = {}
$Shutdown = {}
$Unload = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/consoleui/src/Spin-busy.ps1 | Spin-busy.ps1 | function Global:Spin-Busy {
param(
[Int]$msWait = 0,
[String]$spinStr = '-\|/. ',
[Char[]]$spinChars = [Char[]] ($spinStr.ToCharArray()),
[System.Management.Automation.Host.PSHostRawUserInterface] $rawUI = (Get-Host).UI.RawUI,
[ConsoleColor]$bgColor = $rawUI.BackgroundC... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/consoleui/src/Read-Choice.ps1 | Read-Choice.ps1 | function Global:Read-Choice {
Param(
[Parameter(Position=0)]
[System.String]$Message,
[Parameter(Position=1)]
[ValidateNotNullOrEmpty()]
[System.String[]]$Choices = @('&Yes','&No','Yes to &All','No &to All'),
[Parameter(Position=2)]
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/consoleui/src/Create-Menu.ps1 | Create-Menu.ps1 | function Global:CreateMenu ($Title,$MenuItems,$TitleColor,$LineColor,$MenuItemColor)
{
#CreateMenu -Title "THIS IS TITLE" -MenuItems "Exchange Server","Active Directory","Sytem Center Configuration Manager","Lync Server","Microsoft Azure" -TitleColor Red -LineColor Cyan -MenuItemColor Yellow
[string]$Title =... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/consoleui/src/Read-HostContinue.ps1 | Read-HostContinue.ps1 | Function Global:Read-HostContinue {
param (
[Parameter(Position=0)]
[String]$PromptTitle = '',
[Parameter(Position=1)]
[string]$PromptQuestion = 'Continue?',
[Parameter(Position=2)]
[string]$YesDescription = 'Do this.',
[Parameter(Position=3)]
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/vmware/Load.ps1 | Load.ps1 | $PreLoad = {
if (-not (Get-Module 'VMware.VimAutomation.Core' -ListAvailable)) {
throw 'vmware OhMyPsh plugin requires the vmware PowerCLI module be installed!'
} else {
Import-OMPModule 'VMware.VimAutomation.Core'
Set-OMPTheme -NoProfileUpdate
}
}
$PostLoad = {}
$Config = {... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/vmware/src/Plugin.ps1 | Plugin.ps1 | # Put custom vmware based functions here. |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/moduleupgrade/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {
if (-not (Test-OMPProfileSetting -Name 'ModuleAutoUpgradeFrequency')) {
Write-Output "Setting initial module upgrade frequency settings to occur every 7 times the module is loaded"
Write-Output "Modify your json profile to change this frequency."
Add-OMPProfi... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/moduleupgrade/src/Read-HostContinue.ps1 | Read-HostContinue.ps1 | Function Global:Read-HostContinue {
param (
[Parameter(Position=0)]
[String]$PromptTitle = '',
[Parameter(Position=1)]
[string]$PromptQuestion = 'Continue?',
[Parameter(Position=2)]
[string]$YesDescription = 'Do this.',
[Parameter(Position=3)]
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/moduleupgrade/src/Upgrade-InstalledModule.ps1 | Upgrade-InstalledModule.ps1 | #Requires -Version 5
Function Global:Upgrade-InstalledModule {
<#
.SYNOPSIS
A small wrapper for PowerShellGet to upgrade installed modules.
.DESCRIPTION
A small wrapper for PowerShellGet to upgrade installed modules.
.PARAMETER ModuleName
Show modules which would get upgr... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/moduleclean/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {
if (-not (Test-OMPProfileSetting -Name 'ModuleAutoCleanFrequency')) {
Write-Output "Setting initial module clean frequency settings to occur every 8 times the module is loaded"
Add-OMPProfileSetting -Name 'ModuleAutoCleanFrequency' -Value 8
$AutoCleanFreq =... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/moduleclean/src/Read-HostContinue.ps1 | Read-HostContinue.ps1 | Function Global:Read-HostContinue {
param (
[Parameter(Position=0)]
[String]$PromptTitle = '',
[Parameter(Position=1)]
[string]$PromptQuestion = 'Continue?',
[Parameter(Position=2)]
[string]$YesDescription = 'Do this.',
[Parameter(Position=3)]
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/moduleclean/src/Remove-OldModule.ps1 | Remove-OldModule.ps1 | #Requires -Version 5
function Global:Remove-OldModule {
<#
.SYNOPSIS
A small wrapper for PowerShellGet to remove all older installed modules.
.DESCRIPTION
A small wrapper for PowerShellGet to remove all older installed modules.
.PARAMETER ModuleName
Name of a module to ch... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/psgit/Load.ps1 | Load.ps1 | $PreLoad = {
Import-OMPModule 'PSGit'
}
$PostLoad = {}
$Config = {
# customize git prompt display settings
Set-GitPromptSettings -SeparatorText '' -BeforeText '' -BeforeChangesText '' -AfterChangesText '' -AfterNoChangesText '' `
-BranchText "$([PowerLine.Prompt]::Branch) " -B... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/psgit/src/git.ps1 | git.ps1 | # Nothing |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/net/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {}
$Config = {}
$Shutdown = {}
$UnLoad = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/net/src/net.ps1 | net.ps1 | # function Reset-WiFi
# {
# $adapter = Get-WmiObject Win32_NetworkAdapter | Where { $_.Name.Contains("Wireless") }
# $wireless.Disable()
# Sleep(8)
# $wireless.Enable()
# }
# function Reset-Lan
# {
# $adapter = Get-WmiObject Win32_NetworkAdapter | Where { $_.Name.Contains("Local") }
# ... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/helpers/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {}
$Config = {}
$Shutdown = {}
$UnLoad = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/helpers/src/helpers.ps1 | helpers.ps1 | function Global:Reset-Module ($ModuleName) {
Remove-Module $ModuleName
Import-Module $ModuleName -force -pass | Format-Table Name, Version, Path -AutoSize
}
function Global:here {
# Little helper function. Great for quick paths to the clipboard (ie. here | clip)
(Get-Location).Path
}
functio... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/banner/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {
Write-SessionBannerToHost
}
$Config = {}
$Shutdown = {}
$Unload = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/banner/src/Write-SessionBannerToHost.ps1 | Write-SessionBannerToHost.ps1 | function Global:Write-SessionBannerToHost {
[CmdletBinding()]
param(
[int]$Spacer = 1,
[switch]$AttemptAutoFit
)
Begin {
# Retreive the current OS platform based on the existence of some known default variables in Powershell 6.
function Get-OSPlatform {
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/vagrant/Load.ps1 | Load.ps1 | $PreLoad = {}
$PostLoad = {
Write-Output "Vagrant status module loaded. Use Write-VagrantStatusDetailed for information about current vagrant boxes."
}
$config = {}
$Shutdown = {}
$Unload = {} |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/plugins/vagrant/src/Plugin.ps1 | Plugin.ps1 | # Based on the great work by Posh-git!
#
# Vagrant status is slower then is resonable for a prompt to render. I am making some assumptions
# by scraping the .vagrant folder for any id files that should represent active/aborted some sort
# of Vagrant machine activity.
function Global:Get-VagrantFile {
$fileNam... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/golagola.ps1 | golagola.ps1 | function global:prompt {
$realCommandStatus = $?
$realLASTEXITCODE = $LASTEXITCODE
if ( $realCommandStatus -eq $True ) {
$EXIT="Green"
} else {
$EXIT="Red"
}
$Path = $pwd.ProviderPath
Write-Host
Write-Host "$env:USERNAME" -NoNewLine -ForegroundColor Magenta
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/blocky.ps1 | blocky.ps1 | function global:prompt {
$realCommandStatus = $?
$realLASTEXITCODE = $LASTEXITCODE
$Path = $pwd.ProviderPath
Write-Host
Write-Host " $Path " -NoNewLine -ForegroundColor Black -BackgroundColor White
if($gitStatus){
checkGit($Path)
}
if ( $realCommandStatus -eq $True ) {
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/base1.ps1 | base1.ps1 | function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
$Host.UI.RawUI.ForegroundColor = "White"
Write-Host
Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green
if($gitStatus){
checkGit($pwd.ProviderPath)
}
$global:LASTEXITCODE = $realLASTEXITCODE
Write-Host... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/solarizedlight.ps1 | solarizedlight.ps1 | # Host Foreground
$Host.PrivateData.ErrorForegroundColor = 'Red'
$Host.PrivateData.WarningForegroundColor = 'Yellow'
$Host.PrivateData.DebugForegroundColor = 'Green'
$Host.PrivateData.VerboseForegroundColor = 'Blue'
$Host.PrivateData.ProgressForegroundColor = 'Gray'
# Host Background
$Host.PrivateData.ErrorBac... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/jaykul.ps1 | jaykul.ps1 | <#
This is a theme as a token of appretiation for a fellow PowerSheller I've learned a whole
lot from. It's one of his older prompts (slightly tweaked) but still looks pretty damn cool.
#>
function global:prompt {
$realCommandStatus = $?
$realLASTEXITCODE = $LASTEXITCODE
# Output prompt ... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/solarizeddark.ps1 | solarizeddark.ps1 | # L
# Host Foreground
$Host.PrivateData.ErrorForegroundColor = 'Red'
$Host.PrivateData.WarningForegroundColor = 'Yellow'
$Host.PrivateData.DebugForegroundColor = 'Green'
$Host.PrivateData.VerboseForegroundColor = 'Blue'
$Host.PrivateData.ProgressForegroundColor = 'Gray'
# Host Background
$Host.PrivateData.Err... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/norm.ps1 | norm.ps1 | <# Based on norm zsh theme. Check it (https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/norm.zsh-theme) #>
function global:prompt {
$realCommandStatus = $?
$realLASTEXITCODE = $LASTEXITCODE
$lambda = [char]::ConvertFromUtf32(955)
$forwardArrow = [char]::ConvertFromUtf32(8594)
if... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/powerline.ps1 | powerline.ps1 | <#
Another one of Joel Bennett's works.
This is an example of an advanced theme with some additional plugin requirements
You can either install and set the modules to autoload with OhMyPsh OR just
enable the powerline and psgit plugins which will automatically download, install,
and load the ap... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/themes/base2.ps1 | base2.ps1 | function Global:Test-Administrator {
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
function Global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
Write-Host
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/templates/plugin/Load.ps1 | Load.ps1 | <#
NOTE: In either of the sections below you have the following variables at your disposal
$PluginPath = The current path of your plugin minus the name (ie. C:\temp\)
$Name = The name of your plugin folder. (ie. myplugin)
So the full path to where this file is saved would be:
... |
PowerShellCorpus/PowerShellGallery/OhMyPsh/0.0.5/templates/plugin/src/Plugin.ps1 | Plugin.ps1 | <#
#A quick template function
function Global:Some-Function {
[CmdletBinding( )]
Param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string]$Name
)
Begin {
$Names = @()
}
Process {
$Names += $Name
}
End {
$Names ... |
PowerShellCorpus/PowerShellGallery/PSModuleTemplate/1.0.0.2/Resources/New-ProjectTemplate/PSModuleName.Tests.ps1 | PSModuleName.Tests.ps1 | $Script:Config = Import-PowerShellDataFile -Path "$PSScriptRoot\config.psd1"
Import-Module -Name '.\<ModuleName>' -Force
Import-Module -Name '.\Functions.psm1' -Force
Describe 'Description Name' {
Context 'Context Name #1' {
It 'UnProtect-Config works with raw strings' {
'Hello Wor... |
PowerShellCorpus/PowerShellGallery/PSModuleTemplate/1.0.0.2/Resources/New-ProjectTemplate/Program.ps1 | Program.ps1 | <#
.SYNOPSIS
Lorem ipsum dolor sit amet.
.DESCRIPTION
Lorem ipsum dolor sit amet.
.PARAMETER Param1
Lorem ipsum dolor sit amet.
.PARAMETER Param2
Lorem ipsum dolor sit amet.
.INPUTS
Lorem ipsum dolor sit amet..
.OUTPUTS
Lorem ipsum dolor sit amet.
#>
[CmdletBinding()]
Param(
[Parameter(Man... |
PowerShellCorpus/PowerShellGallery/cWSMan/1.0.1.31/Examples/Sample_cWSManListener_HTTP.ps1 | Sample_cWSManListener_HTTP.ps1 | configuration Sample_cWSManListener_HTTP
{
Import-DscResource -Module cWSMan
Node $NodeName
{
cWSManListener HTTP
{
Transport = 'HTTP'
Ensure = 'Present'
} # End of cWSManListener Resource
} # End of Node
} # End of Configuration
|
PowerShellCorpus/PowerShellGallery/cWSMan/1.0.1.31/Examples/Sample_cWSManListener_HTTPS.ps1 | Sample_cWSManListener_HTTPS.ps1 | configuration Sample_cWSManListener_HTTPS
{
Import-DscResource -Module cWSMan
Node $NodeName
{
cWSManListener HTTP
{
Transport = 'HTTPS'
Ensure = 'Present'
Issuer = 'CN=CONTOSO.COM Issuing CA, DC=CONTOSO, DC=COM'
} # End of cWSManListener Resource... |
PowerShellCorpus/PowerShellGallery/cWSMan/1.0.1.31/Tests/Unit/BMD_cWSManListener.Tests.ps1 | BMD_cWSManListener.Tests.ps1 | $DSCResourceName = 'BMD_cWSManListener'
$DSCModuleName = 'cWSMan'
$Splat = @{
Path = $PSScriptRoot
ChildPath = "..\..\DSCResources\$DSCResourceName\$DSCResourceName.psm1"
Resolve = $true
ErrorAction = 'Stop'
}
$DSCResourceModuleFile = Get-Item -Path (Join-Path @Splat)
$moduleRoot = "${env:ProgramFi... |
PowerShellCorpus/PowerShellGallery/cLocalGroup/1.0.1/Examples/Sample_cLocalGroup.ps1 | Sample_cLocalGroup.ps1 |
configuration Sample_cLocalGroup
{
Import-DscResource -ModuleName cLocalGroup
cLocalGroup LocalGroup1
{
Ensure = 'Present'
GroupName = 'Group-1'
Description = 'Created by the cLocalGroup DSC resource'
Members = 'IIS APPPOOL\DefaultAppPool', 'NT AUTHORITY\IUSR'
... |
PowerShellCorpus/PowerShellGallery/cLocalGroup/1.0.1/ResourceDesignerScripts/GenerateCLocalGroupSchema.ps1 | GenerateCLocalGroupSchema.ps1 |
#requires -Version 4.0 -Modules xDSCResourceDesigner
$ModuleName = 'cLocalGroup'
$ResourceName = 'cLocalGroup'
$DscResourceProperties = @(
(New-xDscResourceProperty -Type String -Attribute Write -Name Ensure -ValidateSet 'Absent', 'Present' -Description 'Indicates if the group exists. Set this property t... |
PowerShellCorpus/PowerShellGallery/cLocalGroup/1.0.1/Tests/ResourceDesignerTests.ps1 | ResourceDesignerTests.ps1 |
#requires -Version 4.0 -Modules xDSCResourceDesigner
Split-Path -Path $PSScriptRoot -Parent |
Join-Path -ChildPath 'DSCResources' |
Get-ChildItem -Directory |
Test-xDscResource -Name {$_.FullName} -Verbose
|
PowerShellCorpus/PowerShellGallery/_LibraryTest1/1.0.0.3/bin/library.ps1 | library.ps1 |
#region Source Code
$source = @'
using System;
namespace sqlcollective.dbatools
{
namespace Configuration
{
using System.Collections;
/// <summary>
/// Configuration Manager as well as individual configuration object.
/// </summary>
[Serializable]
... |
PowerShellCorpus/PowerShellGallery/PSJsonCredential/1.1.3.0/Tests/PSJsonCredential.Tests.ps1 | PSJsonCredential.Tests.ps1 | #requires -version 5.0
#Pester tests for the PSJsonCredential Module
$modroot = Split-Path (Split-path $MyInvocation.MyCommand.Path)
Write-host "Importing moduling from $modroot" -ForegroundColor Cyan
Import-Module $modRoot -force
InModuleScope PSJsonCredential {
$plainText = "myPassword"
$user = "co... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Test/TestModuleImport.ps1 | TestModuleImport.ps1 | BuildTask TestModuleImport -Stage Test -Properties @{
Order = 0
Implementation = {
$exceptionMessage = powershell.exe -NoProfile -Command "
try {
Import-Module $($buildInfo.ReleaseManifest.FullName) -ErrorAction Stop
exit 0
} catc... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Test/TestModule.ps1 | TestModule.ps1 | BuildTask TestModule -Stage Test -Properties @{
Order = 2
Implementation = {
if (-not (Get-ChildItem (Join-Path $buildInfo.Source 'test') -Filter *.tests.ps1 -Recurse -File)) {
throw 'The PS project must have tests!'
}
$invokePester = {
param... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Test/TestSolution.ps1 | TestSolution.ps1 | BuildTask TestSolution -Stage Test -Properties @{
ValidWhen = { (Test-Path (Join-Path $buildInfo.Source 'class\*.sln')) -and (Test-Path (Join-Path $buildInfo.Source 'class\packages\NUnit.ConsoleRunner.*\tools\nunit3-console.exe')) }
Order = 2
Implementation = {
Push-Location (Join-... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Test/AddAppVeyorCommitMessage.ps1 | AddAppVeyorCommitMessage.ps1 | BuildTask AddAppveyorCommitMessage -Stage Test -Properties @{
Order = 3
ValidWhen = { Get-Command Add-AppVeyorCompilationMessage -ErrorAction SilentlyContinue }
Implementation = {
# Pester
$pester = Invoke-Pester @params
$path = Join-Path $buildInfo.Output 'pest... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Test/UploadAppVeyorTestResults.ps1 | UploadAppVeyorTestResults.ps1 | BuildTask UploadAppVeyorTestResults -Stage Test -Properties @{
Order = 3
ValidWhen = { $null -ne $env:APPVEYOR_JOB_ID }
Implementation = {
$path = Join-Path $buildInfo.Output ('{0}.xml' -f $buildInfo.ModuleName)
if (Test-Path $path) {
$webClient = New-Object S... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Test/ValidateTestResults.ps1 | ValidateTestResults.ps1 | BuildTask ValidateTestResults -Stage Test -Properties @{
Order = 4
Implementation = {
$testsFailed = $false
$path = Join-Path $buildInfo.Output 'pester-output.xml'
$pester = Import-CliXml $path
# PSScriptAnalyzer
$path = Join-Path $buildInfo.Output 'p... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Test/PSScriptAnalyzer.ps1 | PSScriptAnalyzer.ps1 | BuildTask PSScriptAnalyzer -Stage Test -Properties @{
Order = 1
ValidWhen = { Get-Module PSScriptAnalyzer -ListAvailable }
Implementation = {
'enumeration', 'class', 'private', 'public', 'InitializeModule.ps1' | ForEach-Object {
$path = Join-Path $buildInfo.Source $_
... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Release/UpdateCatalog.ps1 | UpdateCatalog.ps1 | BuildTask UpdateCatalog -Stage Release -Properties @{
Order = 1
ValidWhen = { $null -ne $env:CodeSigningCertificate }
Implementation = {
New-FileCatalog $buildInfo.Package -Path $buildInfo.Package -CatalogVersion $buildInfo.Version
}
} |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Release/SignModule.ps1 | SignModule.ps1 | BuildTask SignModule -Stage Release -Properties @{
Order = 1
ValidWhen = { $null -ne $env:CodeSigningCertificate }
Implementation = {
Set-AuthenticodeSignature '...'
}
} |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Publish/UpdateVersion.ps1 | UpdateVersion.ps1 | BuildTask UpdateVersion -Stage Publish -Properties @{
Order = 0
Implementation = {
Update-Metadata (Join-Path $buildInfo.Source $buildInfo.ReleaseManifest.Name) -PropertyName ModuleVersion -Value $buildInfo.Version
}
} |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Publish/PublishToCurrentUser.ps1 | PublishToCurrentUser.ps1 | BuildTask PublishToCurrentUser -Stage Publish -Properties @{
Order = 1
Implementation = {
$path = '{0}\Documents\WindowsPowerShell\Modules\{1}' -f $home, $buildInfo.ModuleName
if (-not (Test-Path $path)) {
$null = New-Item $path -ItemType Directory
}
C... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Publish/PublishToPSGallery.ps1 | PublishToPSGallery.ps1 | BuildTask PublishToPSGallery -Stage Publish -Properties @{
Order = 2
ValidWhen = { $null -ne $env:NuGetApiKey }
Implementation = {
Publish-Module -Path $buildInfo.Package -NuGetApiKey $env:NuGetApiKey -Repository PSGallery -ErrorAction Stop
}
} |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/Merge.ps1 | Merge.ps1 | BuildTask Merge -Stage Build -Properties @{
Order = 4
Implementation = {
$mergeItems = 'enumeration', 'class', 'private', 'public', 'InitializeModule.ps1' | ForEach-Object {
Join-Path $buildInfo.Source $_
}
$fileStream = [System.IO.File]::Create($buildInfo.Re... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/TestAttributeSyntax.ps1 | TestAttributeSyntax.ps1 | BuildTask TestAttributeSyntax -Stage Build -Properties @{
Order = 2
Implementation = {
$hasSyntaxErrors = $false
Get-ChildItem 'public', 'private', 'InitializeModule.ps1' -Filter *.ps1 -File -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Extension -eq '.ps1'... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/UpdateMarkdownHelp.ps1 | UpdateMarkdownHelp.ps1 | BuildTask UpdateMarkdownHelp -Stage Build -Properties @{
Order = 1025
ValidWhen = { Get-Module platyPS -ListAvailable }
Implementation = {
$exceptionMessage = powershell.exe -NoProfile -Command "
try {
Import-Module $($buildInfo.ReleaseManifest.FullNam... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/ImportDependencies.ps1 | ImportDependencies.ps1 | BuildTask ImportDependencies -Stage Build -Properties @{
ValidWhen = { Test-Path (Join-Path $buildInfo.Source 'modules.config') }
Implementation = {
$libPath = Join-Path $buildInfo.Package 'lib'
if (-not (Test-Path $libPath)) {
$null = New-Item $libPath -ItemType Directory
... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/Clean.ps1 | Clean.ps1 | BuildTask Clean -Stage Build -Properties @{
Order = 0
Implementation = {
if (Get-Module $buildInfo.ModuleName) {
Remove-Module $buildInfo.ModuleName
}
Get-ChildItem $buildInfo.Package.Parent.FullName -Directory -ErrorAction SilentlyContinue |
Whe... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/BuildProject.ps1 | BuildProject.ps1 | BuildTask BuildProject -Stage Build -Properties @{
Order = 0
ValidWhen = { (Test-Path (Join-Path $buildInfo.Source 'class\*.*proj')) -and -not (Test-Path (Join-Path $buildInfo.Source 'class\*.sln')) }
Implementation = {
Push-Location 'class'
try {
$n... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/CompileClass.ps1 | CompileClass.ps1 | BuildTask Clean -Stage Build -Properties @{
ValidWhen = { -not (Test-Path (Join-Path $buildInfo.Source 'class\*.sln')) -and -not (Test-Path (Join-Path $this.Source 'class\*.*proj')) -and (Test-Path (Join-Path $buildInfo.Source 'class\*.cs')) }
Implementation = {
$outputPath = Join-Path $buildInf... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/UpdateMetadata.ps1 | UpdateMetadata.ps1 | BuildTask UpdateMetadata -Stage Build -Properties @{
Implementation = {
try {
# Version
Update-Metadata $buildInfo.ReleaseManifest -PropertyName ModuleVersion -Value $buildInfo.Version
# RootModule
if (Enable-Metadata $buildInfo.ReleaseMani... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/CopyModuleFiles.ps1 | CopyModuleFiles.ps1 | BuildTask CopyModuleFiles -Stage Build -Properties @{
Order = 3
Implementation = {
$exclude = 'class', 'enumeration', 'private', 'public', 'InitializeModule.ps1', 'modules.config', 'packages.config', 'test', 'help'
Get-ChildItem $buildInfo.Source -Exclude $exclude |
C... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/TestSyntax.ps1 | TestSyntax.ps1 | BuildTask TestSyntax -Stage Build -Properties @{
Order = 1
Implementation = {
$hasSyntaxErrors = $false
Get-ChildItem 'public', 'private', 'InitializeModule.ps1' -Filter *.ps1 -File -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Extension -eq '.ps1' -and $... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Build/BuildSolution.ps1 | BuildSolution.ps1 | BuildTask BuildSolution -Stage Build -Properties @{
Order = 3
ValidWhen = { Test-Path (Join-Path $buildInfo.Source 'class\*.sln') }
Implementation = {
Push-Location (Join-Path $buildInfo.Source 'class')
try {
$webClient = New-Object System.Net.WebCli... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Setup/UpdateAppVeyorYml.ps1 | UpdateAppVeyorYml.ps1 | BuildTask UpdateAppVeyorYml -Stage Setup -Properties @{
Order = 0
ValidWhen = {
$appVeyorYml = Join-Path $buildInfo.ProjectRoot 'appveyor.yml'
(Test-Path $appVeyorYml) -and (Get-Item $appVeyorYml).Size -gt 0
}
Implementation = {
$path = Join-Path $buildInfo.... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/task/Setup/UpdateAppVeyorVersion.ps1 | UpdateAppVeyorVersion.ps1 | BuildTask UpdateAppVeyorVersion -Stage Setup -Properties @{
Order = 1
ValidWhen = { Test-Path (Join-Path $buildInfo.ProjectRoot 'appveyor.yml') }
Implementation = {
$versionString = '{0}.{1}.{{build}}' -f $buildInfo.Version.Major, $buildInfo.Version.Minor
$path = Join-Pa... |
PowerShellCorpus/PowerShellGallery/Indented.Build/2.16.0/var/tests/CodingConventions.tests.ps1 | CodingConventions.tests.ps1 | function Get-ItemFromAst {
# .SYNOPSIS
# Get an item from the abstract syntax tree.
# .DESCRIPTION
# Searches for an item using the specified predicate.
# .PARAMETER Ast
# The base of the tree to search from.
# .PARAMETER Query
# Used to create the predicate.
# .INP... |
PowerShellCorpus/PowerShellGallery/ImprovedConvertFromJson/1.0.8/functions/ConvertFrom-JsonWithArgs.Tests.ps1 | ConvertFrom-JsonWithArgs.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"
InModuleScope ImprovedConvertFromJson {
#region Test data
$jsonHash = @"
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
... |
PowerShellCorpus/PowerShellGallery/ImprovedConvertFromJson/1.0.8/functions/ConvertFrom-JsonWithArgs.ps1 | ConvertFrom-JsonWithArgs.ps1 | <#
.SYNOPSIS
Deserializes the input object from JSON
.PARAMETER InputObject
JSON string
.PARAMETER MaxJsonLength
Maximum length to support for the input string, defaults to [int]::MaxValue
#>
function ConvertFrom-JsonWithArgs
{
[CmdletBinding()]
param
(
[parameter(ParameterSetName = 'object',... |
PowerShellCorpus/PowerShellGallery/ChefAutomate/0.1.7/functions/Get-ChefAutomateUserToken.ps1 | Get-ChefAutomateUserToken.ps1 | <#
.SYNOPSIS
Returns the status of the nominated Chef Automate server.
.DESCRIPTION
Returns the status of the nominated Chef Automate server. Does not require an authentication token.
.EXAMPLE
C:\PS> Get-ChefAutomateStatus -automateServer 'chef-automate.company.com'
.INPUTS
Takes the DNS... |
PowerShellCorpus/PowerShellGallery/ChefAutomate/0.1.7/functions/Save-ChefAutomateComplianceProfile.ps1 | Save-ChefAutomateComplianceProfile.ps1 | <#
.SYNOPSIS
Downloads the nominated compliance profile as a tarball.
.DESCRIPTION
Downloads the nominated compliance profile as a tarball from the Chef Automate compliance store and saves it to a specific path or the current path.
.EXAMPLE
C:\PS> Save-ChefAutomateComplianceProfiles -automateSer... |
PowerShellCorpus/PowerShellGallery/ChefAutomate/0.1.7/functions/Get-ChefAutomateComplianceProfile.ps1 | Get-ChefAutomateComplianceProfile.ps1 | <#
.SYNOPSIS
Returns the details of a single compliance profile for a nominated owner.
.DESCRIPTION
Returns the details of a single compliance profile for a nominated owner from the Chef Automate compliance store.
.EXAMPLE
C:\PS> Get-ChefAutomateComplianceProfiles -automateServer 'chef-automate.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.