ms-iot/content

Use powershell command to setup and start service

Closed this issue · 2 comments

I could not get the 2 following lines to work on my raspberry pi 3

sc config SEMgrSvc start=auto
sc start SEMgrSvc

I thing it would be better to encourage people to use Powershell to do this and use the following commands

Set-Service SEMgrSvc -StartupType "Automatic"
Start-Service SEMgrSvc

It worked like a charm for me.

EDIT: Here is the result when I run the command with sc:

[192.168.1.58]: PS C:\Data\Users\Administrator\Documents> sc config SEMgrSvc start=auto
A positional parameter cannot be found that accepts argument 'start=auto'.
    + CategoryInfo          : InvalidArgument: (:) [Set-Content], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetContentCommand

We've added instructions for both in the sample page.

rzdhop commented

It's been some time since this post, but I'd like to add additional information.
(I've seen this issue bc I stepped upon almost the same problem)

When using the command :

sc config SEMgrSvc start=auto
sc start SEMgrSvc

He was using PowerShell command Set-Service & Start-Services
But the syntax provided is for sc.exe which is different from sc !

When using sc.exe SEMgrSvc start= auto it should work !
Or use sc SEMgrSvc -StartupType "Automatic"

C:\Users\%USER%> Get-Alias sc

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           sc -> Set-Content