topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Sunday May 19, 2024, 4:28 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

Author Topic: Update: Intune - question about custom script to apply Windows MAK licenses  (Read 470 times)

ristst

  • Participant
  • Joined in 2024
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
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.
« Last Edit: May 13, 2024, 04:11 PM by ristst, Reason: post just wasn\'t correct »