Hi i am trying to write a powershell script which starts ReportServer service using a windows domain account. Below is what i have got so far:
$username = "HPA\wms_sql"$password = cat C:\securestring.txt | convertto-securestring
$cred = new-object System.Management.Automation.PSCredential $username,$password
Start-Service "SQL Server Reporting Services (MSSQLSERVER)" -credential $cred
Everytime i run this i keep getting the error:
Start-Service : A parameter cannot be found that matches parameter name 'credential'.
At line:12 char:72
+ Start-Service "SQL Server Reporting Services (MSSQLSERVER)" -credential <<<< $cred
+ CategoryInfo : InvalidArgument: (:) [Start-Service], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartServiceCommand
I cannot figure out what i am doing wrong, any help is much appreciated. Am i putting the -credential argument in the wrong place?