Skip to content

Commit

Permalink
Update help
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Jan 6, 2023
1 parent ba9fbbb commit 9d45211
Show file tree
Hide file tree
Showing 40 changed files with 832 additions and 249 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
Import-Module -Name "Pester" -Force -ErrorAction "Stop"
Import-Module -Name "$env:GITHUB_WORKSPACE\VcRedist" -Force
$Config = [PesterConfiguration]::Default
$Config = New-PesterConfiguration
$Config.Run.Path = "$env:GITHUB_WORKSPACE\tests"
$Config.Run.PassThru = $True
$Config.CodeCoverage.Enabled = $True
Expand Down
2 changes: 1 addition & 1 deletion VcRedist/Private/Import-MdtModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Import-MdtModule {
[CmdletBinding(SupportsShouldProcess = $false)]
[OutputType([System.Boolean])]
param (
[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $Force
)

Expand Down
6 changes: 3 additions & 3 deletions VcRedist/Private/New-MdtApplicationFolder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ function New-MdtApplicationFolder {
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([System.Boolean])]
param (
[Parameter(Mandatory = $True, Position = 0)]
[Parameter(Mandatory = $true, Position = 0)]
[ValidateNotNullOrEmpty()]
[System.String] $Drive,

[Parameter(Mandatory = $True, Position = 1)]
[Parameter(Mandatory = $true, Position = 1)]
[ValidateNotNullOrEmpty()]
[Alias('AppFolder')]
[System.String] $Name,

[Parameter(Mandatory = $False, Position = 2)]
[Parameter(Mandatory = $false, Position = 2)]
[ValidateNotNullOrEmpty()]
[System.String] $Description = "Microsoft Visual C++ Redistributables imported with VcRedist https://vcredist.com/"
)
Expand Down
2 changes: 1 addition & 1 deletion VcRedist/Private/New-MdtDrive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function New-MdtDrive {
PSProvider = "MDTProvider"
Root = $Path
#NetworkPath = $Path
Description = $description
Description = $Description
}
New-PSDrive @params | Add-MDTPersistentDrive
}
Expand Down
4 changes: 2 additions & 2 deletions VcRedist/Private/Test-PSCore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ function Test-PSCore {

# Check whether current PowerShell environment matches or is higher than $Version
if (($PSVersionTable.PSVersion -ge [System.Version]::Parse($Version)) -and ($PSVersionTable.PSEdition -eq "Core")) {
Write-Output -InputObject $True
Write-Output -InputObject $true
}
else {
Write-Output -InputObject $False
Write-Output -InputObject $false
}
}
6 changes: 3 additions & 3 deletions VcRedist/Public/Export-VcManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ function Export-VcManifest {
.EXTERNALHELP VcRedist-help.xml
#>
[Alias("Export-VcXml")]
[CmdletBinding(SupportsShouldProcess = $False, HelpURI = "https://vcredist.com/export-vcmanifest/")]
[CmdletBinding(SupportsShouldProcess = $false, HelpURI = "https://vcredist.com/export-vcmanifest/")]
[OutputType([System.String])]
param (
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline)]
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline)]
[ValidateNotNull()]
[ValidateScript( { if (Test-Path -Path $(Split-Path -Path $_ -Parent) -PathType 'Container') { $True } else { throw "Cannot find path $(Split-Path -Path $_ -Parent)" } })]
[ValidateScript( { if (Test-Path -Path $(Split-Path -Path $_ -Parent) -PathType 'Container') { $true } else { throw "Cannot find path $(Split-Path -Path $_ -Parent)" } })]
[System.String] $Path
)

Expand Down
4 changes: 2 additions & 2 deletions VcRedist/Public/Get-InstalledVcRedist.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ function Get-InstalledVcRedist {
<#
.EXTERNALHELP VcRedist-help.xml
#>
[CmdletBinding(SupportsShouldProcess = $False, HelpURI = "https://vcredist.com/get-installedvcredist/")]
[CmdletBinding(SupportsShouldProcess = $false, HelpURI = "https://vcredist.com/get-installedvcredist/")]
[OutputType([System.Management.Automation.PSObject])]
param (
[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $ExportAll
)

Expand Down
10 changes: 5 additions & 5 deletions VcRedist/Public/Get-VcList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ function Get-VcList {
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(DefaultParameterSetName = "Manifest", HelpURI = "https://vcredist.com/get-vclist/")]
param (
[Parameter(Mandatory = $False, Position = 0, ParameterSetName = "Manifest")]
[Parameter(Mandatory = $false, Position = 0, ParameterSetName = "Manifest")]
[ValidateSet("2005", "2008", "2010", "2012", "2013", "2015", "2017", "2019", "2022")]
[System.String[]] $Release = @("2012", "2013", "2022"),

[Parameter(Mandatory = $False, Position = 1, ParameterSetName = "Manifest")]
[Parameter(Mandatory = $false, Position = 1, ParameterSetName = "Manifest")]
[ValidateSet("x86", "x64")]
[System.String[]] $Architecture = @("x86", "x64"),

[Parameter(Mandatory = $False, Position = 2, ValueFromPipeline, ParameterSetName = "Manifest")]
[Parameter(Mandatory = $false, Position = 2, ValueFromPipeline, ParameterSetName = "Manifest")]
[ValidateNotNull()]
[ValidateScript( { if (Test-Path -Path $_ -PathType "Leaf") { $True } else { throw "Cannot find file $_" } })]
[ValidateScript( { if (Test-Path -Path $_ -PathType "Leaf") { $true } else { throw "Cannot find file $_" } })]
[Alias("Xml")]
[System.String] $Path = (Join-Path -Path $MyInvocation.MyCommand.Module.ModuleBase -ChildPath "VisualCRedistributables.json"),

[Parameter(Mandatory = $False, Position = 0, ParameterSetName = "Export")]
[Parameter(Mandatory = $false, Position = 0, ParameterSetName = "Export")]
[ValidateSet("Supported", "All", "Unsupported")]
[System.String] $Export = "Supported"
)
Expand Down
36 changes: 18 additions & 18 deletions VcRedist/Public/Import-VcConfigMgrApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@ function Import-VcConfigMgrApplication {
.EXTERNALHELP VcRedist-help.xml
#>
[Alias('Import-VcCmApp')]
[CmdletBinding(SupportsShouldProcess = $True, HelpURI = "https://vcredist.com/import-vcconfigmgrapplication/")]
[CmdletBinding(SupportsShouldProcess = $true, HelpURI = "https://vcredist.com/import-vcconfigmgrapplication/")]
[OutputType([System.Management.Automation.PSObject])]
param (
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline)]
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline)]
[ValidateNotNull()]
[System.Management.Automation.PSObject] $VcList,

[Parameter(Mandatory = $True, Position = 1)]
[Parameter(Mandatory = $true, Position = 1)]
[ValidateScript( { if (Test-Path -Path $_ -PathType 'Container') { $true } else { throw "Cannot find path $_." } })]
[System.String] $Path,

[Parameter(Mandatory = $True, Position = 2)]
[Parameter(Mandatory = $true, Position = 2)]
[System.String] $CMPath,

[Parameter(Mandatory = $True, Position = 3)]
[Parameter(Mandatory = $true, Position = 3)]
[ValidateScript( { if ($_ -match "^[a-zA-Z0-9]{3}$") { $true } else { throw "$_ is not a valid ConfigMgr site code." } })]
[System.String] $SMSSiteCode,

[Parameter(Mandatory = $False, Position = 4)]
[Parameter(Mandatory = $false, Position = 4)]
[ValidatePattern('^[a-zA-Z0-9]+$')]
[System.String] $AppFolder = "VcRedists",

[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $Silent,

[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $NoCopy,

[Parameter(Mandatory = $False, Position = 5)]
[Parameter(Mandatory = $false, Position = 5)]
[ValidatePattern('^[a-zA-Z0-9]+$')]
[System.String] $Publisher = "Microsoft",

[Parameter(Mandatory = $False, Position = 6)]
[Parameter(Mandatory = $false, Position = 6)]
[ValidatePattern('^[a-zA-Z0-9\+ ]+$')]
[System.String] $Keyword = "Visual C++ Redistributable"
)
Expand All @@ -61,7 +61,7 @@ function Import-VcConfigMgrApplication {
try {
# Import the ConfigurationManager.psd1 module
Write-Verbose -Message "Importing module: $($env:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1."
Import-Module -Name "$($env:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" -Verbose:$False > $null
Import-Module -Name "$($env:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" -Verbose:$false > $null

# Create the folder for importing the Redistributables into
if ($AppFolder) {
Expand Down Expand Up @@ -129,17 +129,17 @@ function Import-VcConfigMgrApplication {
FilePath = "$env:SystemRoot\System32\robocopy.exe"
ArgumentList = "*.exe `"$folder`" `"$ContentLocation`" /S /XJ /R:1 /W:1 /NP /NJH /NJS /NFL /NDL"
}
$result = Invoke-Process @invokeProcessParams
Invoke-Process @invokeProcessParams | Out-Null
}
catch [System.Exception] {
$Err = $_
$Target = Join-Path -Path $ContentLocation -ChildPath $(Split-Path -Path $VcRedist.URI -Leaf)
if (Test-Path -Path $Target) {
Write-Verbose -Message "Copy successful: [$Target]."
}
else {
Write-Warning -Message "Failed to copy Redistributables from [$folder] to [$ContentLocation]."
Write-Warning -Message "Captured error (if any): [$result]."
throw $_.Exception.Message
throw $Err
}
}
}
Expand All @@ -161,7 +161,7 @@ function Import-VcConfigMgrApplication {
$ApplicationName = "Visual C++ Redistributable $($VcRedist.Release) $($VcRedist.Architecture) $($VcRedist.Version)"
$cmAppParams = @{
Name = $ApplicationName
Description = "$Publisher $ApplicationName imported by $($MyInvocation.MyCommand)"
Description = "$Publisher $ApplicationName imported by $($MyInvocation.MyCommand). https://vcredist.com"
SoftwareVersion = $VcRedist.Version
LinkText = $VcRedist.URL
Publisher = $Publisher
Expand All @@ -188,7 +188,7 @@ function Import-VcConfigMgrApplication {
}
catch [System.Exception] {
Write-Warning -Message "Failed to set location to: $Path."
throw $_.Exception.Message
throw $_
}
}

Expand All @@ -209,7 +209,7 @@ function Import-VcConfigMgrApplication {
# Create the detection method
$params = @{
Hive = "LocalMachine"
Is64Bit = if ($VcRedist.UninstallKey -eq "64") { $True } else { $False }
Is64Bit = if ($VcRedist.UninstallKey -eq "64") { $true } else { $false }
KeyName = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$($VcRedist.ProductCode)"
}
$detectionClause = New-CMDetectionClauseRegistryKey @params
Expand All @@ -225,7 +225,7 @@ function Import-VcConfigMgrApplication {
UninstallCommand = $VcRedist.SilentUninstall
LogonRequirementType = "WhetherOrNotUserLoggedOn"
InstallationBehaviorType = "InstallForSystem"
Comment = "Generated by $($MyInvocation.MyCommand)"
Comment = "Generated by $($MyInvocation.MyCommand). https://vcredist.com"
}
Add-CMScriptDeploymentType @cmScriptParams > $null
}
Expand Down
6 changes: 3 additions & 3 deletions VcRedist/Public/Import-VcIntuneApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ function Import-VcIntuneApplication {
<#
.EXTERNALHELP VcRedist-help.xml
#>
[CmdletBinding(SupportsShouldProcess = $False, HelpURI = "https://vcredist.com/import-vcintuneapplication/")]
[CmdletBinding(SupportsShouldProcess = $false, HelpURI = "https://vcredist.com/import-vcintuneapplication/")]
[OutputType([System.String])]
param (
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline)]
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline)]
[ValidateNotNull()]
[System.Management.Automation.PSObject] $VcList
)
Expand Down Expand Up @@ -73,7 +73,7 @@ function Import-VcIntuneApplication {
$RequirementRule = New-IntuneWin32AppRequirementRule @params

# Detection rule
if ($VcRedist.UninstallKey -eq "32") { $Check32BitOn64System = $True } else { $Check32BitOn64System = $False }
if ($VcRedist.UninstallKey -eq "32") { $Check32BitOn64System = $true } else { $Check32BitOn64System = $false }
$DetectionRuleArgs = @{
"Existence" = $true
"KeyPath" = $IntuneManifest.DetectionRule.KeyPath -replace "{guid}", $VcRedist.ProductCode
Expand Down
30 changes: 15 additions & 15 deletions VcRedist/Public/Import-VcMdtApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@ function Import-VcMdtApplication {
.EXTERNALHELP VcRedist-help.xml
#>
[Alias("Import-VcMdtApp")]
[CmdletBinding(SupportsShouldProcess = $True, HelpURI = "https://vcredist.com/import-vcmdtapplication/")]
[CmdletBinding(SupportsShouldProcess = $true, HelpURI = "https://vcredist.com/import-vcmdtapplication/")]
[OutputType([System.Management.Automation.PSObject])]
param (
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline)]
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline)]
[ValidateNotNull()]
[System.Management.Automation.PSObject] $VcList,

[Parameter(Mandatory = $True, Position = 1)]
[ValidateScript( { if (Test-Path -Path $_ -PathType 'Container') { $True } else { throw "Cannot find path $_" } })]
[Parameter(Mandatory = $true, Position = 1)]
[ValidateScript( { if (Test-Path -Path $_ -PathType 'Container') { $true } else { throw "Cannot find path $_" } })]
[System.String] $Path,

[Parameter(Mandatory = $True, Position = 2)]
[ValidateScript( { if (Test-Path -Path $_ -PathType 'Container') { $True } else { throw "Cannot find path $_" } })]
[Parameter(Mandatory = $true, Position = 2)]
[ValidateScript( { if (Test-Path -Path $_ -PathType 'Container') { $true } else { throw "Cannot find path $_" } })]
[System.String] $MdtPath,

[Parameter(Mandatory = $False, Position = 3)]
[Parameter(Mandatory = $false, Position = 3)]
[ValidatePattern('^[a-zA-Z0-9]+$')]
[ValidateNotNullOrEmpty()]
[System.String] $AppFolder = "VcRedists",

[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $Silent,

[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $DontHide,

[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $Force,

[Parameter(Mandatory = $False, Position = 4)]
[Parameter(Mandatory = $false, Position = 4)]
[ValidatePattern('^[a-zA-Z0-9]+$')]
[System.String] $MdtDrive = "DS099",

[Parameter(Mandatory = $False, Position = 5)]
[Parameter(Mandatory = $false, Position = 5)]
[ValidatePattern('^[a-zA-Z0-9]+$')]
[System.String] $Publisher = "Microsoft",

[Parameter(Mandatory = $False, Position = 6)]
[Parameter(Mandatory = $false, Position = 6)]
[ValidatePattern('^[a-zA-Z0-9-]+$')]
[System.String] $Language = "en-US"
)
Expand Down Expand Up @@ -137,8 +137,8 @@ function Import-VcMdtApplication {
$importMDTAppParams = @{
Path = $TargetMdtFolder
Name = $ApplicationName
Enable = $True
Reboot = $False
Enable = $true
Reboot = $false
Hide = $(if ($DontHide.IsPresent) { "False" } else { "True" })
Comments = "Generated by $($MyInvocation.MyCommand), https://vcredist.com/"
ShortName = "$($VcRedist.Name) $($VcRedist.Architecture)"
Expand Down
12 changes: 6 additions & 6 deletions VcRedist/Public/Install-VcRedist.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ function Install-VcRedist {
<#
.EXTERNALHELP VcRedist-help.xml
#>
[CmdletBinding(SupportsShouldProcess = $True, HelpURI = "https://vcredist.com/install-vcredist/")]
[CmdletBinding(SupportsShouldProcess = $true, HelpURI = "https://vcredist.com/install-vcredist/")]
[OutputType([System.Management.Automation.PSObject])]
param (
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline)]
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline)]
[ValidateNotNull()]
[System.Management.Automation.PSObject] $VcList,

[Parameter(Mandatory = $False, Position = 1)]
[ValidateScript( { if (Test-Path -Path $_ -PathType 'Container') { $True } else { throw "Cannot find path $_" } })]
[Parameter(Mandatory = $false, Position = 1)]
[ValidateScript( { if (Test-Path -Path $_ -PathType 'Container') { $true } else { throw "Cannot find path $_" } })]
[System.String] $Path = (Resolve-Path -Path $PWD),

[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $Silent,

[Parameter(Mandatory = $False)]
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter] $Force
)

Expand Down
Loading

0 comments on commit 9d45211

Please sign in to comment.