Trying to write a script (eventually turn into a report) that shows me if any computers are not activated. I found a command that will display activation info --> slmgr /dli
but the command wont let me export this to text file. If i could export to text file i can just parse it for "License Status: Licensed"
Here is our script create a custom field called "Windows Activation" then run this script it will update the field.
cscript.exe //Nologo %WINDIR%\system32\slmgr.vbs /dli | find "License Status:"
Yessss. Use danielk's method. Much better.
I have a handful of endpoints that came back with "FIX 'Audit - Windows Activation Status'"
If the user didnt have local admin rights could that be the cause? Any other reason this might happen?
FYI - The WMIC command in use by Daniel's script also returns other Microsoft products that require activation. That could skew results if you're only looking for Windows. We can get around that by adding another WHERE clause like so...
wmic PATH SoftwareLicensingProduct WHERE "ProductKeyID like '%-%' AND Description like '%Windows%'" get LicenseStatus
I know this is a very old thread, but wondering if anyone knows how to add Windows 10 Pro/Enterprise into the mix? All other OS seem to be showing.
If you are using the script I'm guessing some of the script steps are specifying which OS they should run on (and don't include Windows 10). Anyway I think SMason's approach above works regardless of OS:
cscript //nologo slmgr.vbs /dli | find "License Status:"
Execute that as shell command to variable, then check if the variable contains 'License Status: Licensed' and update a custom field accordingly (if you really want to keep this info) or write to the agent procedure log and run a report (my preference).