Cobalah untuk menetapkan nilai pada $pass sebelum pemipaan:
$pass = convertto-securestring "abc123"-asplaintext -force
Import-Csv C:\sl.csv | ForEach-Object {New-Item $(Encode-Sqlname $_.Name) -ItemType Registration -Value ("server=$($_.Name);integrated security=true") -Credential (New-Object System.Management.Automation.PSCredential("sa", $pass)) }