Why does this command line restart Windows 7? - windows

I'm writing an automated, deplorable script that uninstalls Windows 10 related updates and files from Windows 7, 8, and 8.1. However, when I run the following command line in Windows 7, It initiates a system reboot within a minute, leaving the rest of the script to be interrupted in the process.
wusa /uninstall /kb:******* /quiet
What exactly is going on? Windows 8.1 handles it fine, but Windows 7 always seems to shutdown mid-script. As a side note, the update will in fact be uninstalled once the system preps back up. When running the command without /quiet at the end, there is an uninstall confirmation box, and then one after that which asks to reboot now or later. Could it be that the /quiet command is selecting "Restart Now"? If so, how can I select "Restart Later" without having a prompt appear?

As described in KB934307, an unattended installation (or uninstallation) will by default reboot automatically if one is needed to complete the operation.
Use the /norestart option to prevent that from happening.
If you do use /norestart, make sure you check the return value. This will be 3010 if a restart is needed or 0 if no restart is needed; any other value indicates that the operation failed. At the end of the script, if any of the changes returned 3010 you should reboot the machine or advise the user to do so.

Related

MSI not upgrading when ran under system account

I am running an MSI on a remote machine using PsExec using this command:
psexec -accepteula \\$(remote-machine-fqdn) -s cmd /c "msiexec.exe /qn /I $(path-to-msi) /Lv $(path-to-log-file)"
This works fine the first time, in that installs the application.
However, subsequent runs (and this is being run as part of a CI build in TFS) causes multiple versions of the application to appear in 'Add and Remove Programs'. If I run the installers myself (log on to the server, click on the MSI, etc.), then it upgrades correctly so the problem does not appear to be in installer itself.
I think the problem is to do with running as the system account (the -s switch in the PsExec command), but I can see no reason why this should be happening. Anyone seen this before?
Try passing ALLUSERS=1 public property to msi while fresh and upgrade installations.

Unable to Open/Install Git on Windows 10

When I open the file I downloaded from https://git-scm.com/download and then Windows, nothing happens. I've tried running it as a normal user and administrator but nothing happens. Not even a processor in the Task Manager opens.
What could cause this? Is it because Git hasn't been updated for Windows 10 yet, or is it something else? I just did a clean install of Windows 10.
Perhaps, you could try chocolatey (even if I'm not sure it will change something...) :
https://chocolatey.org/packages/git
Or the RC for the next to be released git for Windows :
https://github.com/git-for-windows/git/releases
Try running the installer from command prompt.
More details
This is what just happened to me. When double-clicked, or even ran as admin, Git-2.34.1-64-bit.exe shows this. None of those 3 buttons work.
The only thing that helped was running the file from command prompt.
This is a weird one.
Update
A similar thing just happened again with node-v17.3.0-x64. This time, I would get this screen even when running from command prompt.
But it would work just fine if the cmd.exe is ran as an administrator.
It's maddening.

Abort NSIS silent installer

I've created an NSIS installer that installs a certain program. Everything works fine but I wonder if it is possible to abort the installation when it runs in silent mode.
So is there a way to abort an installation when I install an NSIS installer via the command line with this command: installer.exe /S /D=Path/To/Directory?
I tried to abort it via CTRL+C as it works for other programs, too, but that didn't work.
NSIS is not a console program so it is not going to respond to console keyboard shortcuts.
Even if you could trick it into behaving like a console program when started silent it is not going to work in a stable manner because CTRL+C will just kill the process unless the program has added extra code to handle the aborting events...

installing Cygwin 1.7.15-1 on Win 7

I downloaded and ran setup, and it seemed to completed normally, but after it completed I didn't have cygwin in my startup menu or a shortcut on my desktop, both of which I selected. The C:\cygwin does exist, with subdirectories under it. I execute c:\cygwin\bin\xterm. It flashed on the screen with an error message, but it was too quick to read. I have run cygwin before on XP without problems, but this is the first time with Win 7.
Is there some background process that needs to be running for cygwin to work? I am wondering if the installation is OK, but I am just missing the startup menu entry or desktop icon which starts a background process, or is there some path or registry entry I need to make.
The problem was I didn't install as administrator. When I went back and re-installed as administrator, everything worked fine.

Suppress the reboot prompt for the .NET 3.5 SP1 redist

I have an InstallShield 2009 Basic MSI project that I've modified to load the 3.5 SP1 redistributable for the .NET framework. It loads fine but as soon as it finishes it displays a prompt saying the system has to reboot, and you can either say yes and it will reboot, or no and it will stop the install.
I then went in and edited the .NET Framework 3.5 Service Pack 1 (Web Download) redistributable using InstallShield's prerequisite editor. I changed the behavior if it needs a reboot to 'Note it, fail to resume if the machine is rebooted, and reboot after the installation'. I interpreted that as meaning the reboot prompt would not be shown until the end of the install, but it still showed up in the same place.
Is there a way to suppress the prompt until the end of the install? Do I need to pick a different option from that drop-down in the pre-req editor?
Bonus question: if I need to run my install unattended, is there a way to automatically have it reboot after the entire install is finished if one is needed?
EDIT:
The command switches mentioned below would probably work, but in the case of running the install unattended it will be launched from another program, and I really don't want to modify that app just for this one case. Here's a better question: is a reboot really required after installing .NET 3.5 SP1, or is it one of those things where a reboot would be good but is not absolutely needed for programs to start using the 3.5 framework?
If you type msiexec /? in the Start -> Run box, you'll get a screen with command line options for the MSI runtime, including the following:
Restart Options
/norestart
Do not restart after the installation is complete
/promptrestart
Prompts the user for restart if necessary
/forcerestart
Always restart the computer after installation
You can suppress the reboot prompt entirely by adding the following to the MSI's setup command line:
REBOOT=ReallySuppress
But then it won't prompt at the end of your complete install, as it sounds like you were hoping for; you're just stopping the prompting altogether.
As for your additional question, you can force a reboot with the following switch:
REBOOT=Force REBOOTPROMPT=Supress
Here you're telling the Windows Installer to prompt for a reboot always, and then suppressing the prompt so it just happens.

Resources