full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Csv/Test-ColumnIsValid.ps1 | Test-ColumnIsValid.ps1 | function Test-ColumnIsValid {
<#
.SYNOPSIS
Validates a column value in a single CSV row.
.DESCRIPTION
It is useful in Get-CsvData / Get-ValidationRules to validate columns read from CSV row.
It returns empty array if the value is valid, or array of error messages if it's invalid.
.EXA... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Csv/Get-CsvData.ps1 | Get-CsvData.ps1 | function Get-CsvData {
<#
.SYNOPSIS
Reads CSV file using specific encoding and running optional Validation and Transformation rules.
.DESCRIPTION
After CSV file is read, Validation phase is run, that is for each row $CsvValidationRules scriptblock is invoked, which returns array of string:... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Utils/Set-SimpleAcl.ps1 | Set-SimpleAcl.ps1 | function Set-SimpleAcl {
<#
.SYNOPSIS
Sets a simple ACL rule for given Path.
.DESCRIPTION
Returns true if an access rule has been added. False if it was already present.
.EXAMPLE
Set-SimpleAcl -Path 'c:\test' -User 'Everyone' -Permission 'FullControl' -Type 'Allow'
#>
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Utils/Stop-ProcessForcefully.ps1 | Stop-ProcessForcefully.ps1 | function Stop-ProcessForcefully {
<#
.SYNOPSIS
Kills process forcefully along with its children.
.EXAMPLE
Stop-ProcessForcefully -Process $process
#>
[CmdletBinding()]
[OutputType([void])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWMICmdlet', '')]
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Utils/Start-ExternalProcess.ps1 | Start-ExternalProcess.ps1 |
function Start-ExternalProcess {
<#
.SYNOPSIS
Runs external process.
.DESCRIPTION
Runs an external process with proper logging and error handling.
It fails if anything is present in stderr stream or if exitcode is non-zero.
.EXAMPLE
Star... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Utils/New-ConnectionParameters.ps1 | New-ConnectionParameters.ps1 | function New-ConnectionParameters {
<#
.SYNOPSIS
Creates an universal connection parameters object that can be conveniently used for opening connections.
.DESCRIPTION
It returns following hashtable:
```
@{
Nodes = <array of nodes>
NodesAsString = <nodes in string format>
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Utils/ConvertTo-Date.ps1 | ConvertTo-Date.ps1 | function ConvertTo-Date {
<#
.SYNOPSIS
Converts a string to a DateTime using specified DateFormat.
.DESCRIPTION
See https://msdn.microsoft.com/en-us/library/az4se3k1%28v=vs.110%29.aspx for description of format strings.
.EXAMPLE
$date = ConvertTo-Date -String '2015-03-05' -DateFormat 'yyy... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.2/Public/Utils/Convert-HashtableToString.ps1 | Convert-HashtableToString.ps1 | function Convert-HashtableToString {
<#
.SYNOPSIS
Converts hashtable or any other dictionary to a serializable string. It also supports nested hashtables.
.EXAMPLE
Convert-HashtableToString -Hashtable @{'key' = 'value'; 'keyNested' = @{'a' = 'b'}}
@{'key'='value'; 'keyNested'=@{'a'='b'; }... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Private/Log/Write-LogToStdOut.ps1 | Write-LogToStdOut.ps1 | function Write-LogToStdOut() {
<#
.SYNOPSIS
Outputs the Message to stdout using colors.
.EXAMPLE
Write-LogToStdOut -Header "Header" -Message "Message" -Severity $Severity
#>
[CmdletBinding()]
[OutputType([void])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAv... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Private/Log/Write-LogToPSOutput.ps1 | Write-LogToPSOutput.ps1 | function Write-LogToPSOutput() {
<#
.SYNOPSIS
Outputs the Message using Write-Output function. Helper function.
.EXAMPLE
Write-LogToPSOutput -Header "Header" -Message "Message"
#>
[CmdletBinding()]
[OutputType([void])]
param(
[string]
$Header,
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Private/Log/Write-LogToFile.ps1 | Write-LogToFile.ps1 | function Write-LogToFile() {
<#
.SYNOPSIS
Outputs the Message to file. Helper function.
.EXAMPLE
Write-LogToFile -Header "Header" -Message "Message" -Severity $Severity
#>
[CmdletBinding()]
[OutputType([void])]
param(
[Parameter(Mandatory=$false)]
[string] ... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Private/Log/Write-LogToEventLog.ps1 | Write-LogToEventLog.ps1 | function Write-LogToEventLog() {
<#
.SYNOPSIS
Outputs the Message to event log.
.DESCRIPTION
Creates new event log source if not exists.
#>
[CmdletBinding()]
[OutputType([string])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '')]
par... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Private/Log/Test-LogSeverity.ps1 | Test-LogSeverity.ps1 | function Test-LogSeverity() {
<#
.SYNOPSIS
Checks if message severity is greater on equal to config severity.
.EXAMPLE
Test-LogSeverity -MessageSeverity
#>
[CmdletBinding()]
[OutputType([bool])]
param(
[Parameter(Mandatory=$true)]
[int]
$M... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Private/Utils/Write-EventsToLog.ps1 | Write-EventsToLog.ps1 | function Write-EventsToLog {
<#
.SYNOPSIS
Get logs from event.
.DESCRIPTION
Catches output from event for OutputDataSourceIdentifier (stdout) and ErrorDataSourceIdentifier (error)
and writes proper logs.
.OUTPUTS
If event was generated for ErrorDataSourceIdentier then "StandardError" ... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Log/Write-Log.ps1 | Write-Log.ps1 | Function Write-Log {
<#
.SYNOPSIS
Writes a nicely formatted Message to stdout/file/event log.
.DESCRIPTION
It uses optional $LogConfiguration object which describes logging configuration (see LogConfiguration.ps1).
It can be set using Set-LogConfiguration function.
.INPUTS
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Log/Set-LogConfiguration.ps1 | Set-LogConfiguration.ps1 | Function Set-LogConfiguration {
<#
.SYNOPSIS
Sets global logging configuation (used by Write-Log).
.DESCRIPTION
It sets $LogConfiguration object which describes logging configuration (see LogConfiguration.ps1).
.EXAMPLE
Set-LogConfiguration -LogLevel 'Warn' -LogFile "$PSScriptR... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Log/Write-ErrorRecord.ps1 | Write-ErrorRecord.ps1 | function Write-ErrorRecord {
<#
.SYNOPSIS
Logs ErrorRecord message, including script StackTrace and exception StackTrace.
.EXAMPLE
$Global:ErrorActionPreference = 'Stop'
try {
...
} catch {
Write-ErrorRecord
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Csv/Test-ColumnIsValid.ps1 | Test-ColumnIsValid.ps1 | function Test-ColumnIsValid {
<#
.SYNOPSIS
Validates a column value in a single CSV row.
.DESCRIPTION
It is useful in Get-CsvData / Get-ValidationRules to validate columns read from CSV row.
It returns empty array if the value is valid, or array of error messages if it's invalid.
.EXA... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Csv/Get-CsvData.ps1 | Get-CsvData.ps1 | function Get-CsvData {
<#
.SYNOPSIS
Reads CSV file using specific encoding and running optional Validation and Transformation rules.
.DESCRIPTION
After CSV file is read, Validation phase is run, that is for each row $CsvValidationRules scriptblock is invoked, which returns array of string:... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Utils/Set-SimpleAcl.ps1 | Set-SimpleAcl.ps1 | function Set-SimpleAcl {
<#
.SYNOPSIS
Sets a simple ACL rule for given Path.
.DESCRIPTION
Returns true if an access rule has been added. False if it was already present.
.EXAMPLE
Set-SimpleAcl -Path 'c:\test' -User 'Everyone' -Permission 'FullControl' -Type 'Allow'
#>
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Utils/Stop-ProcessForcefully.ps1 | Stop-ProcessForcefully.ps1 | function Stop-ProcessForcefully {
<#
.SYNOPSIS
Kills process forcefully along with its children.
.EXAMPLE
Stop-ProcessForcefully -Process $process
#>
[CmdletBinding()]
[OutputType([void])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWMICmdlet', '')]
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Utils/Start-ExternalProcess.ps1 | Start-ExternalProcess.ps1 |
function Start-ExternalProcess {
<#
.SYNOPSIS
Runs external process.
.DESCRIPTION
Runs an external process with proper logging and error handling.
It fails if anything is present in stderr stream or if exitcode is non-zero.
.EXAMPLE
Star... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Utils/New-ConnectionParameters.ps1 | New-ConnectionParameters.ps1 | function New-ConnectionParameters {
<#
.SYNOPSIS
Creates an universal connection parameters object that can be conveniently used for opening connections.
.DESCRIPTION
It returns following hashtable:
```
@{
Nodes = <array of nodes>
NodesAsString = <nodes in string format>
... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Utils/ConvertTo-Date.ps1 | ConvertTo-Date.ps1 | function ConvertTo-Date {
<#
.SYNOPSIS
Converts a string to a DateTime using specified DateFormat.
.DESCRIPTION
See https://msdn.microsoft.com/en-us/library/az4se3k1%28v=vs.110%29.aspx for description of format strings.
.EXAMPLE
$date = ConvertTo-Date -String '2015-03-05' -DateFormat 'yyy... |
PowerShellCorpus/PowerShellGallery/PSCI/1.1.7/baseModules/PPoShTools/1.0.0/Public/Utils/Convert-HashtableToString.ps1 | Convert-HashtableToString.ps1 | function Convert-HashtableToString {
<#
.SYNOPSIS
Converts hashtable or any other dictionary to a serializable string. It also supports nested hashtables.
.EXAMPLE
Convert-HashtableToString -Hashtable @{'key' = 'value'; 'keyNested' = @{'a' = 'b'}}
@{'key'='value'; 'keyNested'=@{'a'='b'; }... |
PowerShellCorpus/PowerShellGallery/PSSoftware/1.0.29/ExampleUsage.ps1 | ExampleUsage.ps1 | param (
[Parameter(Mandatory)]
[string[]]$Client,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$InstallerFilePath,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$ModuleFolderPath = 'C:\Program Files\WindowsPowerShell\Modules\PSSoftware'
)
foreach ($c in $Client) {
... |
PowerShellCorpus/PowerShellGallery/PSSoftware/1.0.29/test.ps1 | test.ps1 | $ErrorActionPreference = 'Stop'
try {
Import-Module -Name Pester
$ProjectRoot = $ENV:APPVEYOR_BUILD_FOLDER
$testResultsFilePath = "$ProjectRoot\TestResults.xml"
Invoke-Pester -Path "$ProjectRoot\PSSoftware.Tests.ps1" -OutputFormat NUnitXml -OutputFile $testResultsFilePath -EnableExit
$Address = "https://ci.appv... |
PowerShellCorpus/PowerShellGallery/PSSoftware/1.0.29/publish.ps1 | publish.ps1 | $ErrorActionPreference = 'Stop'
try {
## Don't upload the build scripts and appveyor.yml to PowerShell Gallery
$tempmoduleFolderPath = "$env:Temp\PSSoftware"
$null = mkdir $tempmoduleFolderPath
## Move all of the files/folders to exclude out of the main folder
$excludeFromPublish = @(
'PSSoftware\\buildscripts... |
PowerShellCorpus/PowerShellGallery/PSSoftware/1.0.29/install.ps1 | install.ps1 | $provParams = @{
Name = 'NuGet'
MinimumVersion = '2.8.5.208'
Force = $true
}
$null = Install-PackageProvider @provParams
$null = Import-PackageProvider @provParams
$requiredModules = @('Pester','PowerShellGet','PSScriptAnalyzer')
foreach ($m in $requiredModules) {
Write-Host "Installing module [$($m)]..."
Instal... |
PowerShellCorpus/PowerShellGallery/PSSoftware/1.0.29/PSSoftware.Tests.ps1 | PSSoftware.Tests.ps1 | #region import modules
$ThisModule = "$($MyInvocation.MyCommand.Path -replace '\.Tests\.ps1$', '').psd1"
$ThisModuleName = (($ThisModule | Split-Path -Leaf) -replace '\.psd1')
Get-Module -Name $ThisModuleName -All | Remove-Module -Force
Import-Module -Name $ThisModule -Force -ErrorAction Stop
#endregion
descr... |
PowerShellCorpus/PowerShellGallery/PSSoftware/1.0.29/build.ps1 | build.ps1 | $ErrorActionPreference = 'Stop'
try {
$manifestFilePath = "$env:APPVEYOR_BUILD_FOLDER\PSSoftware.psd1"
$manifestContent = Get-Content -Path $manifestFilePath -Raw
$functionsToExport = @(
'Compare-FilePath',
'Compare-FolderPath',
'Convert-CompressedGuidToGuid',
'Convert-GuidToCompressedGuid',
'Convert-To... |
PowerShellCorpus/PowerShellGallery/PSSoftware/1.0.29/LaunchScript.ps1 | LaunchScript.ps1 | [CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Mandatory)]
[string[]]$Client,
[Parameter(Mandatory)]
[ValidateSet('Install', 'Upgrade', 'Uninstall', 'Detect')]
[string]$Type,
[Parameter(Mandatory)]
[ValidateScript({ Test-Path -Path $_ -PathType Container })]
[string]$ServerSideClientDe... |
PowerShellCorpus/PowerShellGallery/TestModule-Chelnak/1.1.0/Functions/Public/Get-TestModule.ps1 | Get-TestModule.ps1 | function Get-TestModule {
<#
.SYNOPSIS
Connect to a vRA Server
.DESCRIPTION
Connect to a vRA Server and generate a connection object with Servername, Token etc
.PARAMETER Server
vRA Server to connect to
.PARAMETER Tenant
Tenant to connect to
.PARAMETER Username
Username to co... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Private/_SetCertPolicy.ps1 | _SetCertPolicy.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Private/_GetDefault.ps1 | _GetDefault.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Import-PasswordStateApiKey.ps1 | Import-PasswordStateApiKey.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Get-PasswordStateApiKey.ps1 | Get-PasswordStateApiKey.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/New-PasswordStatePassword.ps1 | New-PasswordStatePassword.ps1 | #requires -Version 3
<#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/New-PasswordStateRandomPassword.ps1 | New-PasswordStateRandomPassword.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Get-PasswordStateListPasswords.ps1 | Get-PasswordStateListPasswords.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Find-PasswordStatePassword.ps1 | Find-PasswordStatePassword.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Get-PasswordStatePassword.ps1 | Get-PasswordStatePassword.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Initialize-PasswordStateRepository.ps1 | Initialize-PasswordStateRepository.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Set-PasswordStateDocument.ps1 | Set-PasswordStateDocument.ps1 | #requires -Version 3
<#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Get-PasswordStateAllLists.ps1 | Get-PasswordStateAllLists.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Get-PasswordStateList.ps1 | Get-PasswordStateList.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Export-PasswordStateApiKey.ps1 | Export-PasswordStateApiKey.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Get-PasswordStatePasswordHistory.ps1 | Get-PasswordStatePasswordHistory.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Get-PasswordStateAllPasswords.ps1 | Get-PasswordStateAllPasswords.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/PasswordState/1.2.1/Public/Set-PasswordStatePassword.ps1 | Set-PasswordStatePassword.ps1 | <#
Copyright 2015 Brandon Olin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... |
PowerShellCorpus/PowerShellGallery/Team/0.1.22/src/common.ps1 | common.ps1 | Set-StrictMode -Version Latest
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
function _handleException {
param(
[Parameter(Position=1)]
$ex
)
if ($ex.Exception.PSObject.Properties.Match('Response').count -gt 0 -and $ex.Exception.Response.StatusCode -ne "BadRequest") {
$m... |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/DnvmTabExpansion.ps1 | DnvmTabExpansion.ps1 | function DebugMessage($message){
[System.Diagnostics.Debug]::WriteLine("PoshDnvm:$message")
}
function DnvmTabExpansion($lastBlock) {
$cmd = $lastBlock -replace "^dnvm\s*", ""
switch -Regex ($cmd) {
##########################################
#
# dnvm <cmd>
... |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/BuildPackage.ps1 | BuildPackage.ps1 | .\tools\NuGet.exe pack posh-dnvm.nuspec |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/RunPester.ps1 | RunPester.ps1 | function GetLineNumber($stackTrace){
if($stackTrace -match "at line: (\d*)"){
$matches[1];
} else {
$null
}
}
function GetFileName($stackTrace){
if($stackTrace -match "at line: (?:\d*) in (.*)\n"){
$matches[1];
} else {
$null
}
}
function FormatResult ($result){
process {
$lineNumber =... |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/DevInstall.ps1 | DevInstall.ps1 | # clean choco cache
dir $env:ProgramData\chocolatey\lib\posh-dnvm* | Remove-Item -Recurse -Force
# install choco package from local dir
choco install posh-dnvm -source "$pwd" -pre -force |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/PesterMatchArray.ps1 | PesterMatchArray.ps1 | function PesterMatchArray($value, $expectedMatch) {
$value = @($value)
if($value.Length -ne $expectedMatch.Length){
return $false;
}
for($i=0; $i -lt $expectedMatch.Length; $i++){
if(-not($value -contains $expectedMatch[$i])){
return $false;
}
}
retu... |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/DnvmTabExpansion.Tests.ps1 | DnvmTabExpansion.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"
Import-Module "$here\PesterMatchArray.psm1" -Force
# # Failing tests to test the problemMatcher when running tests in VSCode :-)
# Describe "failing test" {
# ... |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/chocolateyInstall.ps1 | chocolateyInstall.ps1 | $packageName = 'posh-dnvm'
$sourcePath = Split-Path -Parent $MyInvocation.MyCommand.Definition
$targetPath = Join-Path ([System.Environment]::GetFolderPath("MyDocuments")) "WindowsPowerShell\Modules\posh-dnvm"
if(Test-Path $targetPath){
Write-Host "Remove previous module folder"
Remove-Item -Path $targ... |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/chocolateyUninstall.ps1 | chocolateyUninstall.ps1 | $packageName = 'posh-dnvm'
$sourcePath = Split-Path -Parent $MyInvocation.MyCommand.Definition
$targetPath = Join-Path ([System.Environment]::GetFolderPath("MyDocuments")) "WindowsPowerShell\Modules\posh-dnvm"
if(Test-Path $targetPath){
Remove-Item -Path $targetPath -Recurse -Force
}
# remove profile en... |
PowerShellCorpus/PowerShellGallery/posh-dnvm/1.0.0.8/PesterMatchArray.Tests.ps1 | PesterMatchArray.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"
## Test Assertion functions takenb from: https://github.com/pester/Pester/blob/ebfb0997365fea29f25b2aa3065378a3765eff4c/Functions/Assertions/Test-Assertion.ps1
fu... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Private/Get-OS.ps1 | Get-OS.ps1 | # This Wrapper is needed to mock the PSVersionTable with Pester
Function Get-PSVersion() {
[CmdletBinding()]
[OutputType('System.Version')]
Param()
Return $PSVersionTable.PSVersion
}
Function Get-OS() {
<#
.SYNOPSIS
Get-OS returns the current running OS Type.... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Private/Get-ConduitConfigPath.ps1 | Get-ConduitConfigPath.ps1 | Function Get-ConduitConfigPath() {
<#
.SYNOPSIS
Returns a valid path for the conduit config file.
.DESCRIPTION
Depending on the current OS this returns a valid path for the conduit config file.
.INPUTS
[None]
.OUTPUTS
[String]
.EXAMPLE
$... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Config/Update-ConduitMehods.ps1 | Update-ConduitMehods.ps1 | Function Update-ConduitMethods() {
<#
.SYNOPSIS
Update-ConduitMethods updates all known conduitmehtods to a local cache like list.
.DESCRIPTION
This function is a helper for Invoke-ConduitMethod. It updates a local cache list to validate the method
param from Invoke-ConduitMe... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Config/Set-ConduitConfig.ps1 | Set-ConduitConfig.ps1 | Function Set-ConduitConfig() {
<#
.SYNOPSIS
Set-ConduitConfig stores your configuration.
.DESCRIPTION
This function is needet to take care of your config. You need to specify the config key you would like to
change, followed by the desired value.
.PARAMETER Key
... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Config/Get-ConduitConfig.ps1 | Get-ConduitConfig.ps1 | Function Get-ConduitConfig() {
<#
.SYNOPSIS
Get-ConduitConfig returns saved config values.
.DESCRIPTION
This function is a helper for other top level functions. You can use it to validate your
saved configuration.
.PARAMETER Key
Specify the config key you woul... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Classes/PhabricatorAPI.ps1 | PhabricatorAPI.ps1 | Enum OSType {
Windows
Linux
OSX
}
Class Ponduit {
# hidden backend properties
hidden [OSType]$_OS
hidden [String]$_ConduitToken
hidden [String]$_ConduitConfigPath
hidden [String]$_PhabricatorURI
hidden [String[]]$_ConduitMethods
Ponduit () {
# Init intern... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Classes/ClassLoader.ps1 | ClassLoader.ps1 | If ($PSVersionTable.PSVersion.Major -ge 5) {
Write-Verbose "ClassLoader: Importing Classes..."
$ClassPath = Join-Path -Path $PSScriptRoot -ChildPath "*.ps1"
$Items = Get-ChildItem -Path $ClassPath -Recurse -Exclude 'ClassLoader.ps1'
ForEach ($Item in $Items) {
Write-Verbose $Item.BaseName
... |
PowerShellCorpus/PowerShellGallery/Ponduit/1.3.86/Conduit/Invoke-ConduitMethod.ps1 | Invoke-ConduitMethod.ps1 | Function Invoke-ConduitMethod() {
<#
.SYNOPSIS
Invoke-ConduitMethod runs a API call agains the given Phabricator instance.
.DESCRIPTION
Use the Invoke-ConduiMethod Cmdlet to interact with a given Phabricator instance. Therefore you can choose
any known conduit method listed i... |
PowerShellCorpus/PowerShellGallery/PowerClippy/1.0/XAMltest.ps1 | XAMltest.ps1 | #ERASE ALL THIS AND PUT XAML BELOW between the @" "@
$inputXML = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Name="window" WindowStyle="None" Height="657" Width="525" Background="Transparent" BorderBrush="Transparent"
Re... |
PowerShellCorpus/PowerShellGallery/PowerClippy/1.0/Public/Invoke-Clippy.ps1 | Invoke-Clippy.ps1 | <#
.Synopsis
Notify your users or coworkers with a familiar friend
.DESCRIPTION
Provides a helpful way to interact with users using Clippy, the beloved Office Assistant from Office '97
.EXAMPLE
Invoke-Clippy -text 'Would you like to install Windows 10?' -Button1Text Yes -Button2Text 'Restart PC'
... |
PowerShellCorpus/PowerShellGallery/PSGithubSearch/1.0/Tests/Unit/PSGithubSearch.Tests.ps1 | PSGithubSearch.Tests.ps1 | $ModuleName = 'PSGithubSearch'
Import-Module "$($PSScriptRoot)\..\..\$($ModuleName).psd1" -Force
Describe 'Find-GitHubRepository' {
Context 'Keywords' {
It 'All results have the specified keyword' {
$KeywordTest = Find-GitHubRepository -Keywords 'PowerShell' -User 'MathieuBu... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/1. Configuration/Setup.Tests.ps1 | Setup.Tests.ps1 | #requires -Version 3 -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use. Defaults to Vester\Configs\Config.ps1
[string]$ConfigName
)
Pr... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/1. Configuration/Config.Tests.ps1 | Config.Tests.ps1 | #requires -Version 3 -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use. Defaults to Vester\Configs\Config.ps1
[string]$ConfigName
)
Pr... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/ChassisDiscovery.Tests.ps1 | ChassisDiscovery.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/PowerRedundancy.Tests.ps1 | PowerRedundancy.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/DefaultVnicBehavior.Tests.ps1 | DefaultVnicBehavior.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/LocatorLeds.Tests.ps1 | LocatorLeds.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/EnabledDownPorts.Tests.ps1 | EnabledDownPorts.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
# NOTE: THERE IS AN ISSUE HERE. The Cisco UCS XML p... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/FaultRetention.Tests.ps1 | FaultRetention.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/UptimeDisruption.Tests.ps1 | UptimeDisruption.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/DefaultVhbaBehavior.Tests.ps1 | DefaultVhbaBehavior.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/TopInfo.Tests.ps1 | TopInfo.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/NetworkControl.Tests.ps1 | NetworkControl.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/3. Comprehensive/DnsServers.Tests.ps1 | DnsServers.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Comprehen... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/2. Simple/UnassociatedProfiles.Tests.ps1 | UnassociatedProfiles.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Simple: U... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/2. Simple/GlobalVsans.Tests.ps1 | GlobalVsans.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Simple: G... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/2. Simple/PoolOrder.Tests.ps1 | PoolOrder.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Simple: P... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/2. Simple/DefaultPoolSchema.Tests.ps1 | DefaultPoolSchema.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Simple: D... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/2. Simple/Firmware.Tests.ps1 | Firmware.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Simple: U... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/2. Simple/PoolUtilization.Tests.ps1 | PoolUtilization.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Simple: P... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Diagnostics/2. Simple/RecentFaults.Tests.ps1 | RecentFaults.Tests.ps1 | #requires -Modules Pester, Cisco.UcsManager
[CmdletBinding()]
Param(
# Optionally fix all config drift that is discovered. Defaults to false (off)
[switch]$Remediate = $false,
# Optionally define a different config file to use.
[string]$ConfigName
)
Process {
# Tests
Describe -Name 'Simple: F... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Enable-PuptrTest.ps1 | Enable-PuptrTest.ps1 | #requires -version 4
function Enable-PuptrTest {
<#
.SYNOPSIS
Enable a UcsPuptr test
.DESCRIPTION
This function enables a UcsPuptr test in the Diagnostics folder by name
.PARAMETER Name
Name of test to enable
.INPUTS
None
.OUTPUTS
... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Get-PuptrCredential.ps1 | Get-PuptrCredential.ps1 | #requires -version 4
function Get-PuptrCredential {
<#
.SYNOPSIS
Gets list of current UcsPuptr credentials
.DESCRIPTION
This function gets a list of UcsPuptr credentials and returns their names
.INPUTS
None
.OUTPUTS
None
.NOTES
Au... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Get-PuptrTest.ps1 | Get-PuptrTest.ps1 | #requires -version 4
function Get-PuptrTest {
<#
.SYNOPSIS
Gets list of UcsPuptr tests and their state
.DESCRIPTION
This function gets a list of tests depending on the Type parameter.
It will return the names of the tests and whether or not they are enabled
.PARAM... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Invoke-PuptrTest.ps1 | Invoke-PuptrTest.ps1 | #requires -version 4
function Invoke-PuptrTest {
<#
.SYNOPSIS
Provide an extremely light-weight approach to Cisco UCS configuration management
.DESCRIPTION
Utilize Pester and Cisco UCS PowerTool to provide a set if Operation Validation tests with the option
to remediate if... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Remove-PuptrConfig.ps1 | Remove-PuptrConfig.ps1 | #requires -version 4
function Remove-PuptrConfig {
<#
.SYNOPSIS
Remove a configuration file
.DESCRIPTION
This function removes an existing UcsPuptr configuration file
.PARAMETER Name
Name of configuration file (Test, Prod, Peanuts, etc)
.INPUTS
No... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Remove-PuptrCredential.ps1 | Remove-PuptrCredential.ps1 | #requires -version 4
function Remove-PuptrCredential {
<#
.SYNOPSIS
Remove a credential file
.DESCRIPTION
This function removes an existing UcsPuptr credential file
.PARAMETER Name
User name / name of the credential file
.INPUTS
None
.OUT... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Export-PuptrConfig.ps1 | Export-PuptrConfig.ps1 | #requires -version 4
function Export-PuptrConfig {
<#
.SYNOPSIS
Makes a backup copy of a UcsPuptr configuration file
.DESCRIPTION
This function will make a copy of the named configuration file and save
it in the specified path
.PARAMETER Name
Name of t... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/New-PuptrConfig.ps1 | New-PuptrConfig.ps1 | #requires -version 4
function New-PuptrConfig {
<#
.SYNOPSIS
Create a new configuration file
.DESCRIPTION
This function creates a new configuration file from template and opens it in the default .ps1 editor
.PARAMETER Name
Name of configuration file (Test, Prod, P... |
PowerShellCorpus/PowerShellGallery/ucs-puptr/0.0.3/Functions/Get-PuptrConfig.ps1 | Get-PuptrConfig.ps1 | #requires -version 4
function Get-PuptrConfig {
<#
.SYNOPSIS
Gets list of UcsPuptr configurations
.DESCRIPTION
This function gets a list of UcsPuptr configurations and returns their names
.INPUTS
None
.OUTPUTS
None
.NOTES
Author: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.