It should have been there all along. It would be difficult to check for any error in any operation of any command in LockFiles.cmd, only that LockFiles.cmd ran to the end and finished. Exit /b 0 forces an exit code of 0 (success) after the file runs all the way to the end, so really all that matters is that the file runs all commands to the end and then reports that it finished since it has to work if it runs, which is what this command does. I have no idea why this was an issue for you (it's not for me), but if it's happening with you it's probably an issue for many others too. So I'll make this correction in the next version of Sledgehammer which I'm trying really hard to get out within the next 7 days. I'll update the script with it. Thanks for the report and the help.
@pf100 If you take the WMIC-less script from my post, use the Powershell variant. The other one, strangely, fails for me although it should work as well.
That's basically how this whole script has been over the years. I thought a particular bit of code would work but it didn't and the thing that did work wasn't what I expected and half of it turned out to be trial and error. I was planning to DM you tomorrow to see where you are on this, so thanks for the work you've done.
I have only replaced and tested the code snippets a few others provided. As said, the Powershell one (edited 2.7.3-rc1) works fine in the dev builds. It should work for Windows 10 and the Servers, as well. Older OS are not applicable. - It's an unconditional, hard edit. WMIC won't be used even if available. - Powershell is a little bit slower, but the script doesn't depend on it too much. - Only the main script has been patched. - @rpo has still posted a few possible improvements.
I converted this script (sledgehammer) into a fully Powershell script for my own use and works flawlessly, I just updated using PS1 + Update Manager. Spoiler: Sample #-------------------------------------------------------# # Starts Windows Update Service and Open Updater App # #-------------------------------------------------------# Start-Process -FilePath $wub -ArgumentList "/e" while ((Get-Service wuauserv).status -eq 'STOPPED') { [System.Windows.Forms.Application]:oEvents() Sleep -m 1 } Add-Content -Path "$CurrentDir\usingupdatescript.control" -Value "Just a Control" # Use WUMGR Start-Process -FilePath $wumgr -ArgumentList "-update -online 7971f918-a847-4430-9279-4a52d1efe18d -provisioned" while ((Get-Process | Where-Object {$_.MainWindowTitle -like "*Update Manager*Xanatos*"}) -eq $null) { [System.Windows.Forms.Application]:oEvents() Sleep -m 1 } #---------------------------------# # Closes Load Screen after load # #---------------------------------# $LoadScreen.Close(); #-----------------------------------------------------------# # Waits Updates and Keep Windows Update Service Running # #-----------------------------------------------------------# while ((Get-Process -Name *wumgr*) -or (Get-Process -Name *wumt*)) { if ((Get-Service -Name wuauserv).Status -ne 'Running') { Start-Process -FilePath $wub -ArgumentList "/e" } Sleep 5 }
Thank you i also thought to write the same but is waiting for you to write this on your MDL thread. Very Nice objective Thread to control WU.
Three years ago i converted the script into PowerShell. The structure was changed and i used a extensive number of functions. One problem with PowerShell is that it offers no goto statement, you have to deal wirh embedded if blocks and while blocks. But this makes the script cleaner.
And I had to not use the entire script being powershell because I wouldn't be able to maintain it, and I'm sure my powershell illiteracy has caused you and others frustration at times. What I wish I had known from the beginning is that I don't have to be a great coder, I just have to have an idea that works and create a working sample and somebody else will help. Ideally the script would be beautifully written by a professional coder. But I have to be able to fully test it and if it's all powershell I can't fully tweak and test it in case of issues such as the task completion error code issue I fixed the other day with "exit /b 0". Not to downplay any of your other contributions, but when you fixed the failed tasks caused by foreign language characters in the path with vbscript that was really a thing of beauty and I would probably have never figured that out in a million years, and I tried really hard to figure it out, so I have to go outside of my comfort zone sometimes. I consulted renowned Batch Script God Rob van der Woude and got nowhere because I don't think what you did with vbscript is actually possible with batch script and would have required ugly hacky workarounds otherwise. The code I've used of yours in the script that is not batch script probably will never have to be maintained or altered but I understand it well enough to be able to work with it. Also, some info not specific to you while I'm typing, but I promised I'd try to get an update out within 7 days about 10 days ago but since then I sprained my shoulder really bad and then had to build my daughter a pc and all of that set me back about 2 weeks. In the next day or two I will threaten everyone I know with death if they don't leave me the hell alone so I can get this update out the door.
@pf100 Possibly, this is currently the best solution because the script uses nsudo which has different files for amd64 and arm64.
Windows 11 arm64 needs one more check just in case (because it support both x64/arm64 interchangeably) Code: if /i "%PROCESSOR_ARCHITECTURE%"=="amd64" if exist "%SystemRoot%\SysArm32\cmd.exe" set "xBit=arm64"