public/Add-GzProtectDataAlias.ps1
$gzAliases = @{ "ConvertTo-UnprotectedByteArray" = "ConvertTo-GzUnprotectedByteArray" "Get-ProtectDataOption" = "Get-GzProtectDataOption" "Protect-Blob" = "Protect-GzBlob" "Protect-String" = "Protect-GzString" "Set-ProtectDataOption" = "Set-GzProtectDataOption" "Unprotect-Blob" = "Unprotect-GzBlob" "Unprotect-String" = "Unprotect-GzString" }; function Remove-GzProtectDataAlias() { <# .SYNOPSIS Removes the aliases that map to Gz prefixed commands for the Gz-Db module. .DESCRIPTION Removes the aliases that map to Gz prefixed commands. For example, removes the alias Protect-Blob that points to Protect-GzBlob. .EXAMPLE PS C:\> Remove-GzProtectDataAlias .INPUTS None .OUTPUTS None .NOTES Aliases are to remove the Gz Prefix #> foreach($key in $gzAliases.Keys) { if($null -ne (Get-Alias $key -EA SilentlyContinue)) { Remove-Item alias:\$key } } } function Add-GzProtectDataAlias() { <# .SYNOPSIS Adds the aliases that map to Gz prefixed commands for the Gz-ProtectData module. .DESCRIPTION Adds the aliases that map to Gz prefixed commands. For example, adds the alias Protect-Blob that points to Protect-GzBlob. .EXAMPLE PS C:\> Add-GzProtectDataAlias .INPUTS Inputs (if any) .OUTPUTS Output (if any) .NOTES Aliases are to remove the Gz Prefix #> foreach($key in $gzAliases.Keys) { if($null -eq (Get-Alias $key -EA SilentlyContinue)) { Set-Alias -Name ($key) -Value $gzAliases[$key] -Scope Global } } } |