Jump to content

How to start services (.EXE)


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 post
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 post
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 post
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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Canadian Dental Services
      Hi all,
      I recently did a clean upgrade to Windows 10 on 2 WKSTs previously running Windows 7 with Pulseway installed.  I am now at a loss as to how to re-add these units to my Pulseway instance.
      I see they are still showing up in the “Deployment Successful” tab under “Discovery & Deployment”.
      Is there a way to re-add these units without manually installing the Pulseway app on these WKSTs?
    • By RingTailedLemur7
      Hello, I have a question about the Pulseway app. When the pc is on all of the commands work great and are perfect for managing the pc. But I am attempting to turn on my pc when I am away from my home and then be able to fully control it like I was there. The issue is how the wake up command from sleep or from powered down will not work even when on my home network. How can I fix this. Also a side question, is there a way I would be able to see a live view of the screen or does it only allow screenshots of the screen. Thanks
    • By DQuiram
      We reinstalled Pulseway on a re-imaged system and after the install we noticed issues. In the patch mgmt section, the status was "assign failed" in red. We rebooted the system and then the service was not starting. We checked the service, it was set to start automatically and in the event log it was generating this error: "Service cannot be started.  The handle is invalid"  We removed the system from Pulseway, uninstalled, and reinstalled. Service is starting normally, but still getting the same issue of the patch policy failing to assign. I tried moving the system to another group that did not have a patch policy at all and got the same result. 
    • By Brant
      I've implemented a script that retrieves and stores the Windows Build Version number to a custom field in the system overview.   It works fine on MOST systems.  However, there are a small number systems that are unable to run the script.  The error message displayed includes: Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
      I used the "Insert Output Variable Code" in the script and verified that it includes the inserted text "Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable  .....".
      For some reason, a few systems do not seem to have the environment variable PWY_HOME set.
      It appears that these systems are using the Enable PowerShell User Impersonation option under Pulseway Manger > Settings > Runtime.
      What is the easiest way to make sure that all of my systems have the PWY_HOME variable set so that any future scripts will not fail because of a missing environment variable?
      Thanks,
      Brant
    • By devansh.gohil
      I had installed Pulseway and then wanted to delete it but I was not able to find Pulseway in the control panel uninstall feature and so I tried manually uninstalling files but that also did not work. I tried running the .msi installer again but an error came up saying that Pulseway is already installed but it still was not showing up. Please help me with this.
×
×
  • Create New...