Kaseya Community

Script to check Windows Activation status

This question is answered

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"

Any tips?

Verified Answer
All Replies
  • cscript.exe //Nologo %WINDIR%\system32\slmgr.vbs /dli | find "License Status:"

  • Procedure Audit - Windows Activation Status.txt

    Elliot,

    Here is our script create a custom field called "Windows Activation" then run this script it will update the field.



    [edited by: danielk at 5:24 PM (GMT -7) on Apr 17, 2013] Added file
  • Yessss. Use danielk's method. Much better.

  • Daniel,

    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.



    Wrong OS
    [edited by: NickT at 1:42 PM (GMT -7) on Apr 26, 2018]
  • 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).



    oops, forgot the pipe character.
    [edited by: Combo at 8:19 PM (GMT -7) on Apr 26, 2018]