Assets/New-OpsCreds.ps1

<#
.SYNOPSIS
    Creates and stores credentials securely.
.PARAMETER Name
    Name of the credential (filename).
#>

param (
    [Parameter(Mandatory=$true)]
    [string]$Name
)

$SecretsDir = "C:\Ops\Secrets"
if (-not (Test-Path $SecretsDir)) {
    New-Item -ItemType Directory -Path $SecretsDir -Force | Out-Null
}

$Cred = Get-Credential
$Path = Join-Path $SecretsDir "$Name.xml"

$Cred | Export-Clixml -Path $Path
Write-Host "Credential saved to $Path"