How to check if a given KB is installed on Windows? - windows

Is there a way to check if a given KB is installed on Windows? Specifically, I'd like to find out if KB2999226 is installed on Windows Server 2012 R2.
Thanks.

As already mentioned in the comment section of the question, you need to explore the Windows Update Agent API to exactly achieve this.
To search for an update say KBDDDDDDD using cmd, you can use the following:
wmic qfe get hotfixid | find "KBDDDDDDD"
You can directly call this query in C++ with the help of system() function. Please check this post to know about how to Execute CMD commands using C++.

Related

UsoClient cannot find windows updates, but a manual scan does

I use this script:
UsoClient.exe StartScan
UsoClient.exe StartDownload
UsoClient.exe StartInstall
I opened the windows update window before I run the code to see what will be do.
It starts scan about 1ms and write out, No new updates available at the moment.
If I manually start san to press the start now button it founds some updates and installs it.
Why? What is the wrong with the code?
I would highly recommend using this method instead. It is a PowerShell Windows Update module that is specifically made for this task. Intructions/code is below.
1) Verify that you have PowerShell 5 or newer, this is required
$PSVersionTable.PSVersion
2) Run PowerShell as admin and run the following
Install-Module PSWindowsUpdate
3) Register to use the Microsoft Update Service instead of the standard Windows Update Service
Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d
4) You should now be able to run the following command, which (by the parameters) will go searching for windows updates and install all of them that are available. I recommend looking at the help for Get-WUInstall to view what options are available to use and reboot the machine if necessary.
Get-WUInstall –MicrosoftUpdate –AcceptAll –AutoReboot
control update
usoclient StartInteractiveScan

Need to see if all Critical Updates are installed on a Windows Server in VBScript

I have a requirement where I need to check Remote Servers to see if all of their Critical updates are installed and then return PASS or FAIL.
Is there a way with WMI for me to do this with VBScript?
EDIT:
I did find this
Windows Update Check with vbscript but it only works on the local machine and not remote.
This link with UpdateHF_v2.6a.vbs by Rob Dunn is made to work with all versions of Windows. It's made with VBS to use WMI, and works on local and remote hosts.. I've been using 2.5a for years. There is no changelog, though Rob is updating the script in response to feedback.
http://community.spiceworks.com/scripts/show/82-windows-update-agent-force-script-email-results-version-2-6
If you need "wrappers" to do this in bulk using a list of computers and psexec to run it, let me know. :)

How to run a Metro-App from PowerShell on Windows 8?

Related to another question on Superuser, I'm trying to run a Metro based application from the command-line. According to a comment on my superuser question, I could maybe find an answear on a PowerShell command or script. I already tried but found anything on any internet reference about PowerShell and Windows 8...
So, there is some specific way/command to call and run a Metro-style application from a PowerShell command on Windows 8?
There is no direct way to do this but there are a couple indirect ways.
vsdebuglaunchnotify, which comes with Visual Studio, can be called from PowerShell.
You could create your own exe that uses IApplicationActivationManager.
If the app is associated with any file types you could launch an associated file.
More information is covered in this thread on MSDN:
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/8d1b0861-5903-4289-8cb8-541ddaa012fb
Here's a blog post by Powertoe that uses the IApplicationActivationManager way of doing it:
http://powertoe.wordpress.com/2012/11/02/get-a-list-of-metro-apps-and-launch-them-in-windows-8-using-powershell/
He provides code here http://poshcode.org/3740 that provides a Start-MetroApp commandlet for powershell.
Alternatively: I think some Metro Apps have protocol handlers, so that you can talk to them via a URI (e.g. "appname:dosomething") but I'm not sure how widely used this is.

SQL Server using Windows Authentication

I'm totally new to Windows programming.
I wish to connect to a SQL Server that utilizes AD authentication. All we need is a simplest possible command line utility to fetch some data and dump it to a text file. Can I use VBScript for this/any-other-simple-script?
My first preference was to use Perl on Unix. Tried dbi:Sybase, doesn't seem to work :(.
TIA.
Edit: I don't have admin privs so my options are pretty limited. Cannot install Python.
If you want a simple "script" try out python pymssql:
http://pymssql.sourceforge.net/
available for windows python 2.4 , 2.5 , 2.6:
http://sourceforge.net/projects/pymssql/files/pymssql/1.0.2/
just install it and check out the samples:
http://pymssql.sourceforge.net/examples_pymssql.php
Googling by keywords powershell + sql server + windows authentication gives several solutions:
http://www.mssqltips.com/tip.asp?tip=1947
http://www.powershellcommunity.org/Forums/tabid/54/aff/24/aft/4540/afv/topic/Default.aspx
http://technet.microsoft.com/en-us/magazine/gg313741.aspx
etc

Registry key for Install update and hotfix information on windows 7

I am working on windows 7 support. In my application I want to gather installed updates and patches. Currently I am gathering it from WIn32_QuickFixEngineering. But it is not giving information for InstalledSDate , Description.
I need to get this either from registry or API (C++ application). In other operating system like XP, 2k3 registry keys are-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates
But these are not present on windows 7.
Can any one give thought on this..
I was also trying to figure out where the registry key for "Hotfix" had moved to.
I am setting up a debug symbol server on Windows 7. While I was following instructions from the book Debugging Applications for Microsoft ... Windows (by John Robbins), I was getting the error "Unable to enumerate the hot fix key" from a piece of vbscript code that Mr. Robbins recommends.
I realized that the vbs code is looking for the reg key SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix, which is not present on Windows 7.
While searching for a substitute key (or any other alternative), I found some helpful information here: http://forums.cnet.com/5208-12546_102-0.html?threadID=327588
The command shown on that cnet forum was a viable substitute in my case:
wmic qfe list full
shown at the cmd.exe prompt:
C:\Users\All Users>wmic qfe list full
Windows Update Agent API
Not sure if this is your issue: InstallOn properties for QFEs are sometimes stored as 64-bit, hexdecimal timestamps. To use this as a date:
Check first whether it is a hexadecimal value. If not, it is likely a regular date value.
Then, (in C#) use this to convert it to a DateTime:
DateTime.FromFileTimeUtc( Int64.Parse(<InstallOn>, System.Globalization.NumberStyles.AllowHexSpecifier));
try looking here:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages]

Resources