mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-15 02:35:47 +00:00
18 lines
560 B
PowerShell
18 lines
560 B
PowerShell
function Set-SnipeitPSLegacyApiKey {
|
|
[CmdletBinding(
|
|
SupportsShouldProcess = $true,
|
|
ConfirmImpact = "Low"
|
|
)]
|
|
param(
|
|
[string]$apiKey
|
|
)
|
|
process {
|
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
|
if($PSVersionTable.PSVersion -ge '7.0'){
|
|
$SnipeitPSSession.legacyApiKey = ConvertTo-SecureString -AsPlainText -String $apiKey
|
|
} else {
|
|
$SnipeitPSSession.legacyApiKey = ConvertTo-SecureString -Force -AsPlainText -String $apiKey
|
|
}
|
|
}
|
|
}
|
|
}
|