SnipeitPS/SnipeitPS/Private/Set-SnipeitPSLegacyApiKey.ps1
2021-09-03 19:44:43 +03:00

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
}
}
}
}