Created
December 28, 2023 19:07
-
-
Save bruno-brant/d49e32042044fdf01939ab476d21024c to your computer and use it in GitHub Desktop.
PowerShell Toolbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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