I am using below powershell script to execute
param([string]$Server,[string]$locusername,[string]$locpassword)
$password = '$locpassword' | ConvertTo-SecureString -asPlainText -Force
$username = $locusername
$cred = New-Object System.Management.Automation.PSCredential($username,$password)
and i am getting error
Cannot bind argument to parameter 'String' because it is null. + CategoryInfo : InvalidData: (:) [ConvertTo-SecureString], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
'$locpassword'
, this is valid input for ConvertTo-SecureString and should not throw an error. – user2226112