-
Notifications
You must be signed in to change notification settings - Fork 13
Intune Deploy PowerShell Scripts with Reporting Capabilities
Matthew Novitsch edited this page Oct 11, 2021
·
8 revisions
Deploying Custom Inventory PowerShell scripts via Intune. We will walk through deploying the custominventory script and how to get reporting data off of it. Most of the script came from Jan Ketil Skanke but I modified it to add some additional security settings I was looking for on the devices.
The scripts need to be deployed under Endpoint Analytics so they are continuously ran, the scripts only run once until successful otherwise.
- CustomInventory.ps1
- Active Azure Subscription
- Deployed Log Analytics environment
- Navigate to Azure Portal.
- Select Analytics on the left side then select Log Analytics Workspaces.
- Select your workspace, then select Agents Management. Copy the Workspace ID and Primary Key to a notepad.
- Download CustomInventory.ps1
- Open CustomInventory.ps1 in PowerShell ISE as an administrator.
- Go to line 25 where it has $CustomerID = "", paste your customer ID there. Past your Primary Key on line 28: $SharedKey = ""
- Save CustomInventory.ps1
- Navigate to Microsoft Endpoint Manager
- Navigate to Reports > Endpoint Analytics.
- Click on Proactive remediations > Create Script Package.
- Provide the script a name, for example CustomInventory then click Next.
- Upload your customerinventory.ps1 script and make sure Run Script as 64-Bit is set to yes, then click Next.
- Assign any Scope Tags then click next.
- Assign the groups you want the scripts to deploy to, I'm deploying to all devices for this example. Change the schedule to your desire, daily is fine. Click next to continue.
- Review your remediation for errors then click create to complete the setup.
Please give this a couple of hours before trying to pull data, it could take longer depending on your environment size. You can validate there is data by navigating back to Log Analytics Workspace > "YourWorkplace" > Logs. You should see Custom Logs AppInventory_CL and DeviceInventory_CL.