title: Having trouble passing Credentials to Start-Service in Powershell without getting an invalid argument error
body: <p>I have script that I'm using within a batch file to run a script to start service that requires the user starting the service to pass in a username and password the service requires. An input box comes up and I am able to enter in the credentials. </p>
  
  <pre><code>$srvName = Get-Service | Where-Object { $_.ServiceName -like ‘myService’ }
  Start-Service net -arg $srvName -Credential (Get-Credential)Out-File C:\a.txt
  </code></pre>
  
  <p>However, the services doesn't start, and in my outfile, I get the following error.</p>
  
  <pre><code>CategoryInfo          : InvalidArgument: (:) [Start-Service], ParameterBindingException
      + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartServiceCommand
  </code></pre>
  
  <p>When I look, I find plenty of examples of setting credentials for a service using Powershell, but only one for doing what I want to do and it obviously doesn't work. </p>