topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday June 12, 2025, 12:49 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ristst [ switch to compact view ]

Pages: [1]
1
Hello all,

I'm updating this entire thread for brevity, as I've been researching this situation and I've learned a few things. 

- The Detection Script will check for a condition, in my case if a MAK license is installed on a device (a laptop). No output is required other than the value of 0 for an unlicensed device.
- If a license is not detected, it should output that value which should in turn refer this device to the Remediation Script (if refer is the right word)
- The Remediation Script should then activate the device with a valid MAK license using slmgr.
- I've added 5 pilot devices to a group in Intune to test.

Questions - What conditions must be present for this custom script to run and activate the device?
- Is any kind of credential required to run the script?
- How is the script run, would it be when the device is restarted or should it run on some kind of schedule?

And more importantly:
- Must the device be joined to Azure AD before the script will run against it?     
      - These are workgroup devices that have not been joined to the on-prem AD.
      - They have been onboarded to Intune.

The Detection script is simple:

$license = get-ciminstance softwarelicensingproduct | where-object {$_.PartialProductKey}
# check if the license object is a MAK license
if ($license.description -like "*MAK*") {
    # if it is a MAK license, exit with error code 1
 exit 1
} else {
    # if it is not a MAK license, exit with error code 0
 exit 0
}

Thanks in advance.

Pages: [1]