full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForOutputType.ps1
Test-ForOutputType.ps1
function Test-ForOutputType { <# .Synopsis Tests for the presence of an output type .Description Tests for the presence of an output type. If the output type isn't a declared object, this also checks to see that the output .Example Get-Command CommandToTest | ...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForCommonParameterMistake.ps1
Test-ForCommonParameterMistake.ps1
function Test-ForCommonParameterMistake { param( [Parameter(ParameterSetName='TestCommandInfo',Mandatory=$true,ValueFromPipeline=$true)] [Management.Automation.CommandInfo] $CommandInfo ) begin { $commonSwitches = "AllowClobber", "AsJob", ...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForParameterSetAmbiguity.ps1
Test-ForParameterSetAmbiguity.ps1
None
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForUnusedVariable.ps1
Test-ForUnusedVariable.ps1
function Test-ForUnusedVariable { #region ScriptTokenValidation Parameter Statement param( <# This parameter will contain the tokens in the script, and will be automatically provided when this command is run within ScriptCop. This parameter should not be used directly, exce...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ModuleHasAWalkthru.ps1
Test-ModuleHasAWalkthru.ps1
None
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-Help.ps1
Test-Help.ps1
function Test-Help { <# .Synopsis Tests the quality of a commands's help .Description Tests the quality of a command's help. Checks for the following things: - Presence of a Help Topic - The same content in the synopsis and description - The presen...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForUnusableFunction.ps1
Test-ForUnusableFunction.ps1
function Test-ForUnusableFunction { #region ScriptTokenValidation Parameter Statement param( <# This parameter will contain the tokens in the script, and will be automatically provided when this command is run within ScriptCop. This parameter should not be used directly, e...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ModuleHasAnAboutTopic.ps1
Test-ModuleHasAnAboutTopic.ps1
None
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForSlowScript.ps1
Test-ForSlowScript.ps1
function Test-ForSlowScript { #region ScriptTokenValidation Parameter Statement [OutputType([Nullable])] param( <# This parameter will contain the tokens in the script, and will be automatically provided when this command is run within ScriptCop. This parameter should ...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForUnimportedModuleFile.ps1
Test-ForUnimportedModuleFile.ps1
function Test-ForUnimportedModuleFile { param( [Parameter(ParameterSetName='TestModuleInfo',Mandatory=$true,ValueFromPipeline=$true)] [Management.Automation.PSModuleInfo] $ModuleInfo ) process { $verbNounPairFiles = $ModuleInfo.Path | Split-Path | ...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-DocumentationQuality.ps1
Test-DocumentationQuality.ps1
function Test-DocumentationQuality { #region ScriptTokenValidation Parameter Statement param( <# This parameter will contain the tokens in the script, and will be automatically provided when this command is run within ScriptCop. This parameter should not be used directly, e...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ParameterAttribute.ps1
Test-ParameterAttribute.ps1
function Test-ParameterAttribute { #region ScriptTokenValidation Parameter Statement param( <# This parameter will contain the scriptToken in the script, and will be automatically provided when this command is run within ScriptCop. This parameter should not be used directly...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ModuleManifestQuality.ps1
Test-ModuleManifestQuality.ps1
param( [Parameter(ParameterSetName='TestModuleInfo',Mandatory=$true,ValueFromPipeline=$true)] [Management.Automation.PSModuleInfo] $ModuleInfo ) process { $moduleRoot = $ModuleInfo | Split-Path $ModuleManifest = $ModuleInfo | Split-Path | Get-Chil...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-CommandNamingConvention.ps1
Test-CommandNamingConvention.ps1
function Test-CommandNamingConvention { param( [Parameter(ParameterSetName='TestCommandInfo',Mandatory=$true,ValueFromPipeline=$true)] [Management.Automation.CommandInfo] $CommandInfo ) begin { $standardVerbs = @{} Get-Verb | ForEach-Object...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ProcessBlockImplemented.ps1
Test-ProcessBlockImplemented.ps1
function Test-ProcessBlockImplemented { #region ScriptTokenValidation Parameter Statement param( <# This parameter will contain the tokens in the script, and will be automatically provided when this command is run within ScriptCop. This parameter should not be used directly...
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ParameterNamingConvention.ps1
Test-ParameterNamingConvention.ps1
None
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Rules/Test-ForPipelineParameter.ps1
Test-ForPipelineParameter.ps1
None
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Fixers/Repair-ModuleManifest.ps1
Repair-ModuleManifest.ps1
None
PowerShellCorpus/PowerShellGallery/ScriptCop/1.5.2.0/Tests/ScriptCoverage.Test.ps1
ScriptCoverage.Test.ps1
# Start out by making en empty directory New-Item .\TestDirectory -ItemType Directory -Force # Now let's create two scripts. The first script has # a 50/50 chance of saying "Hello World" or "Goodbye World" ' if ((0,1 | Get-Random)) { "Hello World" } else { "Goodbye World" } ' | ...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-WebFile.ps1
Get-WebFile.ps1
# Wrapped for pester mocking... Function Get-WebFile { param($URL, $Path) # We have the info, check for file, download it! $webclient = New-Object System.Net.WebClient $webclient.DownloadFile($URL, $Path) $webclient.Dispose() }
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Sort-PSDependency.ps1
Sort-PSDependency.ps1
function Sort-PSDependency { [cmdletbinding()] param( [object[]]$Dependencies ) $Order = @{} Foreach($Dependency in $Dependencies) { if($Dependency.DependsOn) { if(-not $Order.ContainsKey($Dependency.DependencyName)) { $Order.add($...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-ClonedObject.ps1
Get-ClonedObject.ps1
# Idea from http://stackoverflow.com/questions/7468707/deep-copy-a-dictionary-hashtable-in-powershell # borrowed from http://stackoverflow.com/questions/8982782/does-anyone-have-a-dependency-graph-and-topological-sorting-code-snippet-for-pow function Get-ClonedObject { param($DeepCopyObject) $memStream = new-o...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Add-ToItemCollection.ps1
Add-ToItemCollection.ps1
function Add-ToItemCollection { param( $Delimiter = ';', $Reference, # e.g. ENV:Path $Item, # e.g. 'C:\Project', [switch]$Append ) $Existing = ( Get-Item -Path $Reference | Select -ExpandProperty Value ) -split $Delimiter | Where {$_ -ne $Item} if($Append) { ...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Validate-DependencyParameters.ps1
Validate-DependencyParameters.ps1
function Validate-DependencyParameters { [cmdletbinding()] param( [string[]]$Required, [string[]]$Parameters ) foreach($RequiredParam in $Required) { if($Parameters -notcontains $RequiredParam) { return $false } } $true }
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-ProjectDetail.ps1
Get-ProjectDetail.ps1
# Borrowed and tweaked from BuildHelpers. TODO: Doc, commit back there function Get-ProjectDetail { <# .SYNOPSIS Get the name for this project .FUNCTIONALITY CI/CD .DESCRIPTION Get the name for this project Evaluates based on the following scenarios: * Sub...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-Parameter.ps1
Get-Parameter.ps1
# Borrowed from http://poshcode.org/5929 with a minor tweak for validateset - thanks all! Function Get-Parameter { #.Synopsis # Enumerates the parameters of one or more commands #.Description # Lists all the parameters of a command, by ParameterSet, including their aliases, type, etc. # # By defau...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Save-NugetPackage.ps1
Save-NugetPackage.ps1
# All credit and major props to Joel Bennett for this simplified solution that doesn't depend on PowerShellGet # https://gist.github.com/Jaykul/1caf0d6d26380509b04cf4ecef807355 function Save-NugetPackage { [CmdletBinding()] param( [Parameter(ValueFromPipelineByPropertyName,Mandatory)]$Name, [Par...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Invoke-ExternalCommand.ps1
Invoke-ExternalCommand.ps1
# Pester wasn't mocking git... # Borrowed idea from https://github.com/pester/Pester/issues/415 function Invoke-ExternalCommand { [cmdletbinding()] param($Command, [string[]]$Arguments, [switch]$Passthru) Write-Verbose "Running $Command with arguments $($Arguments -join "; ")" $result = $null $res...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-TaggedDependency.ps1
Get-TaggedDependency.ps1
Function Get-TaggedDependency { param( [object[]]$Dependency, [string[]]$Tags ) # Only return deployment with all specified tags foreach($Depend in $Dependency) { $Include = $False foreach($Tag in @($Tags)) { if($Depend.Tags -contains $Tag) ...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Add-ObjectDetail.ps1
Add-ObjectDetail.ps1
function Add-ObjectDetail { <# .SYNOPSIS Decorate an object with - A TypeName - New properties - Default parameters .DESCRIPTION Helper function to decorate an object with - A TypeName - New properties - Default paramet...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Resolve-DependScripts.ps1
Resolve-DependScripts.ps1
# Borrowed from Pester and stripped down # This might be overkill function Resolve-DependScripts { param ([object[]] $Path, [bool]$Recurse = $True) $resolvedScriptInfo = @( foreach ($object in $Path) { $unresolvedPath = [string] $object if ($unresolvedPath -notmatch '[\...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-PropertyOrder.ps1
Get-PropertyOrder.ps1
#function to extract properties Function Get-PropertyOrder { <# .SYNOPSIS Gets property order for specified object .DESCRIPTION Gets property order for specified object .PARAMETER InputObject A single object to convert to an array of property value pairs. .PARAMETER Member...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Sort-WithCustomList.ps1
Sort-WithCustomList.ps1
# Thanks to https://gallery.technet.microsoft.com/scriptcenter/Sort-With-Custom-List-07b1d93a Function Sort-ObjectWithCustomList { Param ( [parameter(ValueFromPipeline=$true)] [PSObject] $InputObject, [parameter(Position=1)] [String] $Property, [parameter()]...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-Hash.ps1
Get-Hash.ps1
function Get-Hash { <# .SYNOPSIS Calculates the hash on a given file based on the seleced hash algorithm. .DESCRIPTION Calculates the hash on a given file based on the seleced hash algorithm. Multiple hashing algorithms can be used with this command. ....
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Find-NugetPackage.ps1
Find-NugetPackage.ps1
# All credit and major props to Joel Bennett for this simplified solution that doesn't depend on PowerShellGet # https://gist.github.com/Jaykul/1caf0d6d26380509b04cf4ecef807355 function Find-NugetPackage { [CmdletBinding()] param( # The name of a package to find [Parameter(Mandatory)] $N...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Import-PSDependModule.ps1
Import-PSDependModule.ps1
function Import-PSDependModule { [cmdletbinding()] param ( [string[]]$Name = $ModulePath, $Action = $PSDependAction ) if($PSDependAction -contains 'Import') { foreach($Mod in $Name) { Write-Verbose "Importing [$Mod]" Import-Module -Name $Mod -S...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-ParameterName.ps1
Get-ParameterName.ps1
Function Get-ParameterName { #Get parameter names for a specific command [cmdletbinding()] param( [string]$command, [string]$parameterset = $null, [string[]]$excludeDefault = $( "Verbose", "Debug", "ErrorAction", ...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Bootstrap-Nuget.ps1
Bootstrap-Nuget.ps1
# Check for nuget exe. If it doesn't exist, create full path to parent, and download it function BootStrap-Nuget { [cmdletbinding()] param( $NugetPath = "$env:APPDATA\nuget.exe" ) if($c = Get-Command 'nuget.exe' -ErrorAction SilentlyContinue) { write-verbose "Found Nuget at [$($c.pa...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Private/Get-TopologicalSort.ps1
Get-TopologicalSort.ps1
# Thanks to http://stackoverflow.com/questions/8982782/does-anyone-have-a-dependency-graph-and-topological-sorting-code-snippet-for-pow # Input is a hashtable of @{ID = @(Depended,On,IDs);...} function Get-TopologicalSort { param( [Parameter(Mandatory = $true, Position = 0)] [hashtable] $edgeList ) #...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Install-Dependency.ps1
Install-Dependency.ps1
Function Install-Dependency { <# .SYNOPSIS Install a specific dependency .DESCRIPTION Install a specific dependency. Typically you would use Invoke-PSDepend rather than this. Takes output from Get-Dependency * Runs dependency scripts depending on each dependencies type....
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Invoke-PSDepend.ps1
Invoke-PSDepend.ps1
Function Invoke-PSDepend { <# .SYNOPSIS Invoke PSDepend .DESCRIPTION Invoke PSDepend Searches for and runs *.depend.psd1 and requirements.psd1 files in the current and nested paths See Get-Help about_PSDepend for more information. .PARAMETER Path Path to a spe...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Get-PSDependScript.ps1
Get-PSDependScript.ps1
Function Get-PSDependScript { <# .SYNOPSIS Get dependency types and associated scripts .DESCRIPTION Get dependency types and associated scripts Checks PSDependMap.psd1, verifies dependency scripts exist, returns a hashtable of these. .PARAMETER Path Pat...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Get-Dependency.ps1
Get-Dependency.ps1
function Get-Dependency { <# .SYNOPSIS Read a dependency psd1 file .DESCRIPTION Read a dependency psd1 file The resulting object contains these properties DependencyFile : Path to psd1 file this dependency is defined in DependencyName : Unique dependency nam...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Test-Dependency.ps1
Test-Dependency.ps1
Function Test-Dependency { <# .SYNOPSIS Test a specific dependency .DESCRIPTION Test a specific dependency. Validates whether a dependency exists Takes output from Get-Dependency * Runs dependency scripts depending on each dependencies type. * Appends a 'Depen...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Get-PSDependType.ps1
Get-PSDependType.ps1
Function Get-PSDependType { <# .SYNOPSIS Get dependency types and related information .DESCRIPTION Get dependency types and related information Checks PSDependMap.psd1 for dependency types, verifies dependency scripts exist, gets help content for dependency scripts,...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Import-Dependency.ps1
Import-Dependency.ps1
Function Import-Dependency { <# .SYNOPSIS Import a specific dependency .DESCRIPTION Import a specific dependency, if that dependency supports it. Takes output from Get-Dependency * Runs dependency scripts depending on each dependencies type. * Imports items if ...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/Public/Invoke-DependencyScript.ps1
Invoke-DependencyScript.ps1
Function Invoke-DependencyScript { <# .SYNOPSIS Invoke a dependency script .DESCRIPTION Invoke a dependency script See Get-Help about_PSDepend for more information. .PARAMETER Dependency Dependency object from Get-Dependency. .PARAMETER PSDependTypePath Sp...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/Git.ps1
Git.ps1
<# .SYNOPSIS Clone a git repository .DESCRIPTION Clone a git repository Note: We require git.exe in your path Relevant Dependency metadata: DependencyName (Key): Git URL You can override this with the 'Name'. If you specify only an A...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/GitHub.ps1
GitHub.ps1
<# .SYNOPSIS EXPERIMENTAL: Download a GitHub repository .DESCRIPTION EXPERIMENTAL: Download a GitHub repository The Git dependency type requires git.exe. The FileDownload type would just pull an archive down. This type will... download a repository via HTTP, ...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/FileDownload.ps1
FileDownload.ps1
<# .SYNOPSIS Download a file .DESCRIPTION Download a file Relevant Dependency metadata: DependencyName (Key): The key for this dependency is used as the URL. This can be overridden by 'Source' Name: Optional file name for the downloaded file. Defaults to parsin...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/PSGalleryModule.ps1
PSGalleryModule.ps1
<# .SYNOPSIS Installs a module from a PowerShell repository like the PowerShell Gallery. .DESCRIPTION Installs a module from a PowerShell repository like the PowerShell Gallery. Relevant Dependency metadata: Name: The name for this module Version: Used to identi...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/PSGalleryNuget.ps1
PSGalleryNuget.ps1
<# .SYNOPSIS Installs a module from a PowerShell repository like the PowerShell Gallery using nuget.exe .DESCRIPTION Installs a module from a PowerShell repository like the PowerShell Gallery using nuget.exe Note: If we find an existing module that doesn't meet the specified criteria i...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/Noop.ps1
Noop.ps1
<# .SYNOPSIS Display variables that a dependency script would receive. Used for testing and validation. .DESCRIPTION Display variables that a dependency script would receive. Used for testing and validation. .PARAMETER Dependency Dependency to process .PARAME...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/Task.ps1
Task.ps1
<# .SYNOPSIS Support dependencies by handling simple tasks. .DESCRIPTION Support dependencies by handling simple tasks. Relevant Dependency metadata: Target: One or more scripts to run for this task Parameters: Parameters to call against the task scripts .P...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/Package.ps1
Package.ps1
<# .SYNOPSIS EXPERIMENTAL: Installs a package using the PackageManagement module .DESCRIPTION EXPERIMENTAL: Installs a package using the PackageManagement module Relevant Dependency metadata: Name: The name for this Package Version: Used to identify existing ins...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/Command.ps1
Command.ps1
<# .SYNOPSIS Invoke a PowerShell command .DESCRIPTION Invoke a PowerShell command Converts the provided string into a scriptblock, invokes it in the current session. Beware quoting rules If a terminating error occurs, we write it and continue processing. Use FailOnError to c...
PowerShellCorpus/PowerShellGallery/PSDepend/0.1.51/PSDependScripts/FileSystem.ps1
FileSystem.ps1
<# .SYNOPSIS EXPERIMENTAL: Use Robocopy or Copy-Item for folder and file dependencies, respectively. .DESCRIPTION EXPERIMENTAL: Use Robocopy or Copy-Item for folder and file dependencies, respectively. Runs in the current session (i.e. as the current user) Relevant Dependency ...
PowerShellCorpus/PowerShellGallery/AzureRM.Storage/3.1.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/AzureRM.Storage/2.8.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/MsrcSecurityUpdates/1.7.2/MsrcSecurityUpdates.tests.ps1
MsrcSecurityUpdates.tests.ps1
# Import module would only work if the module is found in standard locations # Import-Module -Name MsrcSecurityUpdates -Force Import-Module .\MsrcSecurityUpdates.psd1 -Verbose -Force # Set-MSRCApiKey -ApiKey "API KEY PLACEHOLDER" -Verbose if (-not ($global:MSRCApiKey)) { Write-Warning -Message 'You need to use...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Private/Get-MsrcCvrfProductVulnerability.ps1
Get-MsrcCvrfProductVulnerability.ps1
Function Get-MsrcCvrfProductVulnerability { <# .SYNOPSIS Get product vulnerability details from a CVRF document .DESCRIPTION CVRF documents next products into several places, including: -Vulnerabilities -Threats -Remediations -Product Tree This funct...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Private/Get-CVRFID.ps1
Get-CVRFID.ps1
Function Get-CVRFID { [CmdletBinding()] Param( [Parameter()] [Alias('CVRFID')] [string]$ID ) Begin { } Process { $RestMethod = @{ uri = '{0}/Updates?{1}' -f $global:msrcApiUrl,$global:msrcApiVersion Headers = @{ 'Accept' = 'application/json' } E...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Private/Get-KBDownloadUrl.ps1
Get-KBDownloadUrl.ps1
Function Get-KBDownloadUrl { <# .SYNOPSIS Takes the kb output from Get-MsrcCvrfAffectedSoftware and builds the html to insert into a document. .DESCRIPTION Takes the kb output from Get-MsrcCvrfAffectedSoftware and builds the html to insert into a document. .PARAMETER KBArticleObject ...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Private/Test-CVRFID.ps1
Test-CVRFID.ps1
Function Test-CVRFID { [CmdletBinding()] [OutputType('System.Boolean')] Param( [Parameter(Mandatory)] [ValidateNotNullorEmpty()] [Alias('CVRFID')] [string]$ID ) Begin {} Process { if (Get-CVRFID -ID $ID) { $true } else { $false } } End {} } # SIG # Begin si...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Private/Get-MsrcThreatExploitStatus.ps1
Get-MsrcThreatExploitStatus.ps1
Function Get-MsrcThreatExploitStatus { <# .SYNOPSIS Split a semicolon delimited string into a custom object .DESCRIPTION Split a semicolon delimited string into a custom object .PARAMETER ExploitStatusString The Exploit Status string, which is delimited .EXAMPLE ...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Get-MsrcCvrfAffectedSoftware.ps1
Get-MsrcCvrfAffectedSoftware.ps1
Function Get-MsrcCvrfAffectedSoftware { <# .SYNOPSIS Get details of products affected by a CVRF document .DESCRIPTION CVRF documents next products into several places, including: -Vulnerabilities -Threats -Remediations -Product Tree This function gat...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Get-MsrcCvrfExploitabilityIndex.ps1
Get-MsrcCvrfExploitabilityIndex.ps1
Function Get-MsrcCvrfExploitabilityIndex { <# .SYNOPSIS Get the exploitability index of vulnerabilities found in CVRF document .DESCRIPTION This function gathers the Exploitability Index from vulnerabilities in a CVRF document. .PARAMETER Vulnerability A vulnerability objec...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Get-MsrcCvrfCVESummary.ps1
Get-MsrcCvrfCVESummary.ps1
Function Get-MsrcCvrfCVESummary { <# .SYNOPSIS Get the CVE summary from vulnerabilities found in CVRF document .DESCRIPTION This function gathers the CVE Summary from vulnerabilities in a CVRF document. .PARAMETER Vulnerability A vulnerability object or objects from a CVRF ...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Set-MSRCApiKey.ps1
Set-MSRCApiKey.ps1
#Requires -Version 3.0 Function Set-MSRCApiKey { [CmdletBinding(SupportsShouldProcess)] Param( [Parameter(Mandatory)] $ApiKey, [Parameter()] [System.Uri]$Proxy, [Parameter()] [ValidateNotNull()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credenti...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Get-MsrcSecurityBulletinHtml.ps1
Get-MsrcSecurityBulletinHtml.ps1
Function Get-MsrcSecurityBulletinHtml { [CmdletBinding()] Param( [Parameter(Mandatory,ValueFromPipelineByPropertyName)] $Vulnerability, [Parameter(Mandatory,ValueFromPipelineByPropertyName)] $ProductTree, [Parameter(Mandatory,ValueFromPipelineByPropertyName)] $DocumentTracking, ...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Get-MsrcVulnerabilityReportHtml.ps1
Get-MsrcVulnerabilityReportHtml.ps1
Function Get-MsrcVulnerabilityReportHtml { <# .SYNOPSIS Use a CVRF document to create a Vulnerability summary .DESCRIPTION Use a CVRF document to create a Vulnerability summary .PARAMETER Vulnerability The Vulnerability node of a CVRF document .PARAMETER Produ...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Set-MsrcAdalAccessToken.ps1
Set-MsrcAdalAccessToken.ps1
#Requires -Version 3.0 Function Set-MSRCAdalAccessToken { [CmdletBinding()] Param() Begin {} Process { $authority = 'https://login.windows.net/microsoft.onmicrosoft.com/' $authContext = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext($authority) $rUri = N...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Get-MsrcCvrfDocument.ps1
Get-MsrcCvrfDocument.ps1
Function Get-MsrcCvrfDocument { <# .SYNOPSIS Get a MSRC CVRF document .DESCRIPTION Calls the MSRC CVRF API to get a CVRF document by ID .PARAMETER ID Get the CVRF document for the specified CVRF ID (ie. 2016-Aug) .PARAMETER AsXml Get the output as Xml ...
PowerShellCorpus/PowerShellGallery/MsrcSecurityUpdates/1.7.2/Public/Get-MsrcSecurityUpdate.ps1
Get-MsrcSecurityUpdate.ps1
#Requires -Version 3.0 Function Get-MsrcSecurityUpdate { <# .SYNOPSIS Get MSRC security updates .DESCRIPTION Calls the CVRF Update API to get a list of security updates .PARAMETER After Get security updates released after this date .PARAMETER Before Get se...
PowerShellCorpus/PowerShellGallery/xRobocopy/2.0.0.0/Examples/xRobocopy.SimpleCopyOptions.ps1
xRobocopy.SimpleCopyOptions.ps1
#some sample usage of xRobocopy module to sync folders #for all possible options please refer to robocopy documentation https://technet.microsoft.com/en-us/library/cc733145.aspx configuration RobocopyExample { Import-DscResource -ModuleName xRobocopy Node 'localhost' { LocalConfig...
PowerShellCorpus/PowerShellGallery/xRobocopy/2.0.0.0/Examples/xRobocopy.NetworkAndCredentials.ps1
xRobocopy.NetworkAndCredentials.ps1
configuration DeployContent { param ( [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PsCredential] $Credential ) Import-DscResource -ModuleName xRobocopy Node 'localhost' { xRobocopy Content { Source = '...
PowerShellCorpus/PowerShellGallery/xRobocopy/2.0.0.0/Resources/xDscResourceDesigner_CreateScript.ps1
xDscResourceDesigner_CreateScript.ps1
$modules = 'C:\Program Files\WindowsPowerShell\Modules\' $modulename = 'xRobocopy' $Description = 'This module is used to facilitate large file copies with complex requirements such as multithreading, restarts, and exclusions when recursing content.' if (!(test-path (join-path $modules $modulename))) { $mod...
PowerShellCorpus/PowerShellGallery/MenuShell/0.2/Start-MenuShell.ps1
Start-MenuShell.ps1
function Start-MenuShell { <# .Synopsis Starts MenuShell, a simple console menu maker .Description Starts MenuShell, a simple console based menu on top of PowerShell. .Example Start-MenuShell -Menu @{ "(P)erformance" = @{ "CPU" = { ...
PowerShellCorpus/PowerShellGallery/MenuShell/0.2/MenuShell.EzFormat.ps1
MenuShell.EzFormat.ps1
$moduleRoot = "$home\documents\windowspowershell\modules\MenuShell" Write-FormatView -TypeName "MenuShell" -Action { $menuShell = $_ Clear-Host if ($menuShell.Name) { $host.UI.RawUI.Windowtitle =$menuShell.Name } $menuShell.Menu.GetEnumerator() | ...
PowerShellCorpus/PowerShellGallery/cSQLConfig/1.4.1/Examples/SQLPushStandAlone.ps1
SQLPushStandAlone.ps1
#requires -Version 5 $computers = 'OHSQL1016' $OutputPath = 'D:\DSCLocal' $cim = New-CimSession -ComputerName $computers #requires -Version 5 [DSCLocalConfigurationManager()] Configuration LCM_Push { Param( [string[]]$ComputerName ) Node $ComputerName { Settings { ...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Core/CoreFunctions.ps1
CoreFunctions.ps1
function Get-CSRegistryKey { <# .SYNOPSIS Enumerates registry subkeys for a specified path. Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .DESCRIPTION Get-CSRegistryKey returns all keys for a specified path. .PARAMETER Hive Specifies the registry hive. WMI only supports registry o...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/ArtifactRetrieval/NetworkProfiles.ps1
NetworkProfiles.ps1
function Get-CSNetworkProfile { <# .SYNOPSIS Retrieves network profile information. Author: Jesse Davis (@secabstraction) License: BSD 3-Clause .DESCRIPTION Get-CSNetworkProfile retrieves and parses network profile information stored in the registry. .PARAMETER CimSession Specifies the CIM session ...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/ArtifactRetrieval/AppCompatCache.ps1
AppCompatCache.ps1
function Get-CSAppCompatCache { <# .SYNOPSIS Retrieves and parses entries from the AppCompatCache based on OS version. Author: Jesse Davis (@secabstraction) License: BSD 3-Clause .DESCRIPTION Get-CSAppCompatCache parses entries from the Application Compatibility Cache stored in the registry. .PARAMETE...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/ArtifactRetrieval/UserAssist.ps1
UserAssist.ps1
function Get-CSUserAssist { <# .SYNOPSIS Retrieves and parses user assist entries. Author: Jesse Davis (@secabstraction) License: BSD 3-Clause .DESCRIPTION Get-CSUserAssist retrieves and parses user assist entry information stored in the registry. .PARAMETER CimSession Specifies the CIM session to ...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/ArtifactRetrieval/SuspiciousURLs.ps1
SuspiciousURLs.ps1
function Get-CSTypedURL { <# .SYNOPSIS Lists URLs typed into the Internet Explorer URL bar. Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .DESCRIPTION Get-CSTypedURL retrieves URLs that were typed into the Internet Explorer URL bar. .PARAMETER CimSession Specifies the CIM session ...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/ArtifactRetrieval/Autoruns.ps1
Autoruns.ps1
function Get-CSRegistryAutoStart { <# .SYNOPSIS List installed autostart execution points present in the registry. Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .DESCRIPTION Get-CSRegistryAutoStart lists autorun points present in the registry locally or remotely. Get-CSRegistryAutoSt...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/ArtifactRetrieval/AppCompatDatabases.ps1
AppCompatDatabases.ps1
function Get-CSInstalledAppCompatShimDatabase { <# .SYNOPSIS List installed application compatibility databases. Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .DESCRIPTION Get-InstalledAppCompatShimDatabase lists details about all installed application compatibility databases (SDB). Whi...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/ArtifactRetrieval/SuspiciousFiles.ps1
SuspiciousFiles.ps1
function Get-CSScheduledTaskFile { <# .SYNOPSIS Lists file information associated with installed scheduled tasks. Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .DESCRIPTION The ability to remotely query scheduled tasks was not introduced until Windows 8. Get-CSScheduledTaskFile offers t...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Auditing/Bitlocker.ps1
Bitlocker.ps1
function Get-CSBitlockerKeyProtector { <# .SYNOPSIS Obtains Bitlocker volume key material. Author: Matthew Graeber (@mattifestation) Inspiration/Motivation: Jared Atkinson (@jaredcatkinson), Brian Reitz (@brian_psu) License: BSD 3-Clause .DESCRIPTION Get-CSBitlockerKeyProtector retrieves key material fo...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Auditing/AntiVirusInfo.ps1
AntiVirusInfo.ps1
Function Get-CSAVInfo { <# .SYNOPSIS This function enumerates the Anti Virus installed on a remote host and any helpful registry keys. Author: Chris Ross (@xorrior) License: BSD 3-Clause .DESCRIPTION Get-CSAVInfo uses the AntiVirusProduct WMI class to enumerate Anti Virus on a local or remote host. ...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Auditing/ProxyConfig.ps1
ProxyConfig.ps1
Function Get-CSProxyConfig { <# .SYNOPSIS Enumerates a target host's proxy settings. Author: Chris Ross (@xorrior) License: BSD 3-Clause .DESCRIPTION Get-CSProxyConfig enumerates a target host's proxy settings. Provide a user name to enumerate the proxy settings through the HKU root key with the specif...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Auditing/ACLAudits.ps1
ACLAudits.ps1
function Get-CSServicePermission { <# .SYNOPSIS Lists each group granted potentially vulnerable service access permissions. Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .DESCRIPTION Get-CSServicePermission is used to perform service ACL audits at scale. For each computer, it iterates t...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Auditing/DeviceGuard.ps1
DeviceGuard.ps1
function Get-CSDeviceGuardStatus { <# .SYNOPSIS Obtains Device Guard configuration status information Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .DESCRIPTION Get-CSDeviceGuardStatus obtains information about available and configured Device Guard settings. This function will only work...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Tests/Module.Tests.ps1
Module.Tests.ps1
Set-StrictMode -Version Latest $TestScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent $ModuleRoot = Resolve-Path "$TestScriptRoot\.." $ModuleManifest = "$ModuleRoot\CimSweep.psd1" Remove-Module [C]imSweep $Module = Import-Module $ModuleManifest -Force -ErrorAction Stop -PassThru Describe 'Module-...
PowerShellCorpus/PowerShellGallery/CimSweep/0.6.1.1/Tests/Core.CimSweep.Tests.ps1
Core.CimSweep.Tests.ps1
Set-StrictMode -Version Latest $ProgressPreference = 'Continue' $TestScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent $ModuleRoot = Resolve-Path "$TestScriptRoot\.." $ModuleManifest = "$ModuleRoot\CimSweep.psd1" Remove-Module [C]imSweep Import-Module $ModuleManifest -Force -ErrorAction Stop $...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/run-tests.ps1
run-tests.ps1
cd "$PSScriptRoot" invoke-pester
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/OneGetTestHelper.ps1
OneGetTestHelper.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/PSModule/PSModule.IntegrationTest.Tests.ps1
PSModule.IntegrationTest.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/PSModule/PSModule.Get.Tests.ps1
PSModule.Get.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
PowerShellCorpus/PowerShellGallery/PackageManagementProviderResource/1.0.3/Test/PSModule/PSModule.Set.and.Test.Tests.ps1
PSModule.Set.and.Test.Tests.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...