Powershell Popup Message with timer - powershell

Hello my programming gods...
I'm trying to create a popup message with timer with powershell to include with SCCM scripts. This popup will be called if a program needing update is detected.
What I want is something like this that I found on the net:
Basically:
1- I want to be able to put a banner in the popup window.
2- The name of the program to be updated
3- Show a timer
4- When the timer is expired or the next button is pressed, the script would continue and installed the update.
I began thinkering with this tutorial: https://www.red-gate.com/simple-talk/sysadmin/powershell/building-a-countdown-timer-with-powershell/
So far the timer works but everything is pretty barebone. Am I on the right track? How would you go about it? Also, the popup window don't go to the foreground... Dunno what Im doing wrong.
I am not a programmer and I'm trying to do this as a favor for someone. I just don't really know how I should go about it. Maybe powershell is not the good tool for this?

It looks like you are looking for a tool such as below:
https://psappdeploytoolkit.com/
https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/releases
PS-App-Deployment Toolkit provides a set of functions to perform common application deployment tasks etc.
I use this myself for handy deployments to users within my workplace through SCCM.
See the above links for instructions and detail.

Related

Can you program a powershell script to press next in an install wizard?

I'd like to create a Powershell script to press the next button in an installation wizard.
I'm troubleshooting a script that a client wrote to help them automate the process of installing software. This script can allegedly fully install any program (with some small amount of customization from program to program).
Now I've gotten it to work to a point where it launches the install wizard, but then nothing happens. Their problem only happens further down the install process, but I can't seem to figure out why the first part of it being able to press next doesn't work.
I can provide code if necessary.
What line of code I should look for in the script that could make the script push the "next" and/or "continue" buttons?
Can you? Probably.
Powershell has access to .Net API and even native Windows API, so you could go low-level enough to enumerate windows in the installer window, find the window labeled 'Next' and send a pair of mouseDown, mouseUp events to the button.
Should you? Probably not.
As mentioned in comments, any good installer system supports some method of installing silently. MSI, if I recall correctly, has a way of recording manual steps performed by a user and store them in a Response File. Then you may pass the .rsp file in later executions of the installer.
See other answers:
How to make better use of msi files

This error keeps showing up on my desktop

This Javascript error keeps showing up on my desktop, and when i delete it another one will pop up.
Can anybody with knowledge about this please help me?
Oh the image is on Danish so yeah. Translated it says that there was a script-error with the script, and asks if i still want to play the script on this site.
Solution Found
Go to Control Panel
Go to Programs and Functions
See if there is any program that refers to the url-error-message you got, and if there is, delete it.
Note If the program is a program that you need to have for running your system or just an important program, don't delete it, there could be other ways to fix it.
Other ways to fix it
1. Start up the installer that you used to install the program, if there is a button that says "Repair software/program" or something like that; tap the button.
If there isn't a button that says "Repair software/program" (or something like that); try to install the program again.

Start an application at system start without login

We have a new server running and we got some new programs doing import routines. So far so good... But there is one program that is put into autostart folder. So it doesn't run until admin logs in and it stops if we logout.
I'd like to put this one into a seperate session so it may work without any interaction by simply starting it with the task scheduler at startup. Is this the right way to do this? Is it safe if I log in later and log out?
Many thanks!
Edit: The applications shows as a symbol in the task bar if running, it can be configured by this. Anything I must know about this if I change?
Edit: It is not my application, I cannot rewrite it as a service.
I successfully added the application by using task schelduler on startup. Login and logout will not quit the application but no symbol is shown. Please add details to my side questions and I'll mark your answer as the accepted one.
Edit: Ended up using this one. If I have to configure, I stop the application in task manager and start it again by link. After that I quit the application and restart it by task scheduler manual start.
You need to run your program as a Windows Service. One way of doing it is using the sc.exe program:
> sc create <new_service_name> binPath= "c:\myapp\myapp.exe"
You can read about it here.
You need to separate your application in two.
To allow it to run without a user session, you need a windows service. That should handle all the background stuff. You can then register the service and set it to start when the system starts.
To allow it to have a UI, and show up in the notification area, you need a windows application. This will be in autostart as usual, and will communicate with the service - for example, over named pipes.
While it is still (barely) possible to run an UI application without a user session, it's only maintained for backwards compatibility, and already shows a lot of problems. It will likely be removed altogether in the future, because it breaks quite a few contracts. Do not rely on hacks like this.
I also used the task scheduler to create the application at system startup. It should be noted that if you want to use for mining, you have to disable an option in "settings" where it says that if the application lasts more than three days in a row it will end.
It really works wonderfully!
it is a old question but I recently solved in another way...
(before I was using a scheduled-task for startup but this gave me diverse problems with lots software...)
Some programs also for diverse reasons must be run at a user level... or even inside a specific user session...
So the best way I found was to use a tool like Sysinternal/Autoruns to program the auto-logon to a specific user (it is a registry setting)... and in the startup-folder of that user (or any other "autorun/autolaunch" task)... run a script that first locks the screen... and next runs the other intended programs... that will run under that user profile...
so you can choose a standard user or a administrator... or even launch programs from a standard user in adminsitrator mode...
I hope will help...
This "hack" solved me many problems with startup apps...
I could not get the "sc create" command to work. Instead I manually edited the registry using regedit. I added a new key in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services.
I used the following page to figure out required parameters and their values. Note that the names do not map.
https://learn.microsoft.com/en-us/windows-hardware/drivers/install/inf-addservice-directive
Old question, but for anyone that stumbles here. Use srvany to set the program as a custom service.
Note that when you do this with for example dropbox, googledrive, etc., you will need stop the service, then open the program normally to make changes like password, updates, etc.
below is a well enough intro.
https://www.iceflatline.com/2015/12/run-a-windows-application-as-a-service-with-srvany/
Download the tool kit here
https://www.microsoft.com/en-us/download/details.aspx?id=17657
Convert user application to Service and Register it using Regsvr32 or installutil.exe. It will start the service using SYSTEM user account. Which is a high privilege account.
Note : You can`t run any Window based application. Even a Message only window.

Refresh/Restart Explorer via Remoting

I have some code that unpins and pins items from the task bar and start menu, which I run using Remoting, as a means of cleaning up lab machines between sessions. It works great, other than I need to log off and back on to see the changes. This is somewhat similar to another bit of code I have, which changes the icon of a shortcut in order to "badge" it as an updated file. That code also requires a refresh, but there I am able to use a technique I found here...This does a refresh of Explorer and the desktop shortcut shows up correctly. However, the same code does not do a refresh of the task bar it seems. I also found this, which also seems to not impact the Taskbar.
Also, this is related to the Remoting, because when I run the same code "locally" no refresh is needed. So, curious if anyone knows a way to directly refresh the task bar (and Start Menu) via Remoting? Or am I going to need to brute force it and just log the user off?
Well, this is interesting, and proof that sometimes we look for complex solutions to simple problems. All the examples I found are pretty complex, but what works fine is simply this...
Stop-Process -processName: Explorer
No need even to restart, as Explorer restarts automatically and near instantly.

eclipse stop popup "Web launch already running"

I am developing in PHP with Xdebug and for some reason every now and then the debug session stops working, so i click again the debug button but it gives me this error all the time "Web launch already running", so i have to go to Debug Perspective and click "Terminate and Relaunch".
Is there a way to make eclipse automatically terminate and relaunch or launch two sessions or don't show this popup, for 2 years this popup has been bugging me xD
As noted in response to questions like this one and this one, the best current solution appears to be binding "Terminate and Relaunch" to a keyboard shortcut.
Not automatic, but at least a lot less clicking around.
I have taken care of pesky popups in Eclipse with AutoHotkey script which have worked very well. I could create an AutoHotkey script which sends specific keystrokes automatically every time there is a specific pop-up.
So the flow I had in mind was as follows :
You click on the debug button -> The Error popup appears and as soon as that happens the AutoHotKey script kicks in and automatically does what you have to do manually.
If you think that might be worth looking into then we can talk more in a Chat session somewhere. I would need some information about the Pop up using the AU3_Spy.exe bundled with the AutoHotkey Installer.
Searching on Google, I found that many people have the same problem.
Bellow are some links that help you, I think:
https://aptanastudio.tenderapp.com/discussions/questions/123-definitive-installation-guide-for-php-debugging-on-linuxubuntu
A good article: http://www.latenightpc.com/blog/archives/2008/05/24/a-complete-lamp-development-environment-xampp-eclipse-pdt-and-xdebug
See this, too: http://www.eclipse.org/forums/index.php/m/57493/
Take a look here, too: Getting error in XDEBUG
So, read and try, read and try.