Skip to content

Instantly share code, notes, and snippets.

@bruno-brant
Created December 28, 2023 19:07
Show Gist options
  • Save bruno-brant/d49e32042044fdf01939ab476d21024c to your computer and use it in GitHub Desktop.
Save bruno-brant/d49e32042044fdf01939ab476d21024c to your computer and use it in GitHub Desktop.
PowerShell Toolbox
param (
[Parameter(Mandatory=$true)]
[string]$RelativePath
)
$ComputerName = $env:COMPUTERNAME
$AbsolutePath = Convert-Path $RelativePath
$UNCPath = $AbsolutePath -replace "^([A-Za-z]):", '$1$'
$UNCPath = $UNCPath -replace '\\', '\'
$UNCPath = "\\$ComputerName\$UNCPath"
return $UNCPath
param (
[string[]]$ComputerName,
[string] $FilePath,
[string] $CertStoreLocation
)
$FilePath = ConvertTo-UNCPath $FilePath
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
param ($FilePath)
Write-Host "Installing to $env:COMPUTERNAME"
Write-Host "File: $FilePath"
Import-PfxCertificate -FilePath $FilePath -CertStoreLocation $CertStoreLocation
} -ArgumentList @($FilePath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment