Jump to content

How to start services (.EXE)


Danny Agrippa
 Share

Recommended Posts

Hi All,

 

When a proces has been killed or not responding.

I want to restart it with a script.

Example: Icloud program stopped working (Proces named: icloud.exe) located C:\Program Files\Icloud\Icloud.exe.

Now i make a script : "C:\Program Files\Icloud\Icloud.exe"

If i run that script on the system it doesnt start icloud again.

Is my script incorrect? Pulseway notify's me it was done succesfully but it didn't start. (Took 2 seconds)

I also tested this with notepad: C:\Windows\System32\notepad.exe also this one didnt start up.

Ill hope you guys can tell me what i'm doing wrong.

 

Kind Regards,

Danny

Link to comment
Share on other sites

  • Administrators

Hi Danny,

If you want to start a windows service you should use the "net start serviceName" command however if you want to start GUI applications in the console session you need to use PowerShell, setup the PowerShell impersonation in the Pulseway Manager app in the Settings -> Runtime tab and finally use Start-Job { C:\Windows\System32\notepad.exe } .

-Paul

Link to comment
Share on other sites

19 hours ago, Paul said:

Hi Danny,

If you want to start a windows service you should use the "net start serviceName" command however if you want to start GUI applications in the console session you need to use PowerShell, setup the PowerShell impersonation in the Pulseway Manager app in the Settings -> Runtime tab and finally use Start-Job { C:\Windows\System32\notepad.exe } .

-Paul

Hi Paul,

I didn't work that much with powershell.

In Pulseway I found the way how to impersonate but if I fill in my credentials from Windows it doesn't work.

Do I need to configure this in powershell also or is that not necessary?

- Danny Agrippa

Link to comment
Share on other sites

  • Administrators
23 hours ago, Danny Agrippa said:

Hi Paul,

I didn't work that much with powershell.

In Pulseway I found the way how to impersonate but if I fill in my credentials from Windows it doesn't work.

Do I need to configure this in powershell also or is that not necessary?

- Danny Agrippa

It should work... Can you please PM me your email address so we can get in touch via email to see what the problem is?

-Paul

Link to comment
Share on other sites

  • 2 years later...
  • 3 months later...
On 11/24/2016 at 1:28 AM, Paul said:

Hi Danny,

If you want to start a windows service you should use the "net start serviceName" command however if you want to start GUI applications in the console session you need to use PowerShell, setup the PowerShell impersonation in the Pulseway Manager app in the Settings -> Runtime tab and finally use Start-Job { C:\Windows\System32\notepad.exe } .

-Paul

Hi Paul,

I have the same issue, just the difference is that I want to start Dropbox. I checked your instructions but under Runtime tab, I can't see any thing for Start-Job. All I can see is an option for Enable PowerShell User Impersonation and fields for Username and password. Could you please assist me that what step I am missing. Thank you.

Kind regards,

Varinder

Link to comment
Share on other sites

  • 3 weeks later...
  • Staff

Hi @Varinder,

If you want to run the application in users session with GUI, then you will need to use the PsExec to do that.

Quote

 

However if you want to start the service in user session, then you might do it using powershell after you have enabled the Powershell Impersonation using required user account.

Link to comment
Share on other sites

  • 11 months later...

if you like to run a command as the user a quick way is to create and run a scheduled task setup as the logged in user and run it, see power shell example to start and restart explorer.

 

#By eDecisions

$TasknameStop = "ExplorerStop"
$TasknameStart = "ExplorerStart"
$lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser")

SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStop /RU $lastlogon /TR "taskkill /f /im explorer.exe"
SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStart /RU $lastlogon /TR "explorer.exe" 
start-sleep -s 1
schtasks /Run /TN $TasknameStop
start-sleep -s 1
schtasks /Run /TN $TasknameStart
start-sleep -s 1
schtasks /delete /tn $TasknameStop /f
schtasks /delete /tn $TasknameStart /f

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...