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 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.
    • By ArrowNM
      A Dark Mode option for both the RMM Web UI and PSA UI would be nice.
    • By Bob | PTI B.V.
      Hi all,
      Do anyone of you have a script to remove Solarwinds products? In our case, that should be the N-able Windows agent and Solarwinds MSP (SolarWinds MSP Cache Service, SolarWinds MSP Patch Management Engine, SolarWinds MSP RPC Server). Or have any experience removing it using automation?
      Thanks in advance!
       
    • By SpartanGolf6
      I use Pulseway to monitor my finicky Dell Inspiron 15 7000 Gaming Laptop and I noticed my laptop has thousands upon thousands of logs in Event Logs. I specifically need the 'Application Event Logs', 'Security' and 'System' event logs saved, ideally as a .CSV file. I don't know much PowerShell/Bash/VBScript, so I was hoping someone knows how to do this.
    • By Joe Savage
      Hi there,
      Just wondering if this is an option. I attempted to do the following with batch, but didn't work due to the %appdata% value resolving to somewhere in C:\Windows.
      mkdir %appdata%\Microsoft\Teams\Backgrounds\Uploads copy "\\SERVER\SHARE\Teams Backup Images\*.jpg" %appdata%\Microsoft\Teams\Backgrounds\Uploads /y  
      Any ideas?
      Cheers,
      Joe
×
×
  • Create New...