ConfigMgr 1906 Technical Preview – Testing CMPivot over CMG using AdminService

ConfigMgr 1906 Technical Preview was released last week and I immediately upgraded one of my tech preview labs I have running in Hyper-V on my laptop. As you may know, I’m a huge fan of the new AdminService functionality which will allow you to interact with the SMS Provider over HTTPS. With each release, it has had more features added. With Tech preview 1906, I noticed that you can run CMPivot using the AdminService. In 1905 you could use RunScript, though the functionality for that has been disabled in the frontend for 1906. With both of these tools, you can extend your reach to all of your devices, no matter where they are, or how they are connected (within reason I suppose).

As I was experimenting with CMPivot over AdminService, I wrote a quick PowerShell to test it and ended up Tweeting about it. David James responded with a challenge that I couldn’t pass up:

A Square Dozen Image

Since I was working in my disposable Technical Preview lab, I’ve never set up any cloud services for it. I have to say, the process (and documentation) to configure Azure Active Directory, Intune, AutoPilot, Co-Management, Cloud Management Gateway, etc has gotten much better. I think that I spent more time waiting for NameCheap to replicate my DNS entries than I did for anything else.

The Setup

Each of these bullets represents quite a few steps that are required to configure the features required to access and manage devices over the internet. For the sake of this blog, I’m just listing them, otherwise I doubt I’d ever get this post out the door!

  • Azure Active Directory Pay-As-You-Go subscription (apparently you can’t just keep signing up for free trials!)
  • Intune Trial with AutoPilot with Azure AD Join Profile Deployed
  • Microsoft 365 E5 30-day Trial
  • Azure AD Connect
    • Hybrid Azure AD Join (not used for the test device)
    • Password Hash Sync with Seamless Single Sign-On
  • ConfigMgr 1906 TP on Hyper-V and Widows Server 2016
    • Co-Management Cloud Service Configured
    • Cloud Management Gateway with wildcard cert from SSLforFree
    • External facing Domain name added to local AD as an alias and assigned to user accounts (my lab uses a non-routable .lab extension)
  • Windows 10 1809 Hyper-V VM
    • Autopiloted using Azure AD user account (non AD sync’d account)
    • ConfigMgr client deployed from Intune as a Line of Business App
    • Connected to External Ethernet adapter for direct internet access

With this setup I was able to build a new Windows 10 device and deploy it as an Azure AD Joined device with AutoPilot, provision it with an Azure AD User account over the internet and auto install the ConfigMgr client configured to use AAD for authentication.

Testing CMPivot over HTTPS

The first step was to confirm that everything was communicating properly by checking CcmNotificationAgent.log on my internet client. See the logs section below for more info on what to look for. In the console, I verified that BGB was working by looking for the green check on the device’s icon on the console. So, I knew right away that the client was communicating with the console just fine.

CMPivot in the Console

My first test was just opening the ConfigMgr console and launching CMPivot from my All Systems collection (I only have 3 devices in my lab, you may want to use a different collection). Inside CMPivot, I submitted a few queries and got results back from the client.

A Square Dozen Image
Inside CMPivot, I submitted a few queries and got results back from the client.

Postman Chrome Extension

Next I used the Google Chrome Postman extension to test using the AdminService.


A quick note about Postman - the standalone version of Postman doesn’t handle Kerberos properly, but the Chrome extension does. In 1906 TP, NTLM is no longer supported and you can’t pass credentials to the AdminService, so I had to switch to the Chrome version.


In order to run CMPivot, you need a CollectionId and a QueryString. Also, AdminService is CaSe SeNsEtIvE, so be careful! Run these commands in Postman to query. Don’t forget to change the request type to POST since you have to submit a request body.

1
2
3
4
https://<YourServerName>/AdminService/v1.0/Collections('SMS00001')/AdminService.RunCmpivot

Request Body
{"InputQuery":"OperatingSystem"}

A Square Dozen Image

PowerShell

After Postman, I tested with Powershell and had similar results. Each time I ran CMPivot using AdminService, I would see the the CMPivot script payload on the client then I could view the results in the database OR with AdminService using the SMS_CMPivotStatus method. (You can obviously run these in Postman as well).

1
2
3
https://<YourServerName>/AdminService/v1.0/SMS_CMPivotStatus
OR
https://<YourServerName>/AdminService/wmi/SMS_CMPivotStatus

If you want to see the status of a specific job, you can filter the results. The easiest option is to grab the OperationId from the json returned when you submit the CMPivot job. It should look like this. The OperationId is just below the script blob 16777270.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
{
    "ScriptParams": "<ScriptParameters><ScriptParameter ParameterGroupGuid=\"\" ParameterGroupName=\"PG_\" ParameterName=\"select\" ParameterDataType=\"System.String\" ParameterVisibility=\"0\" ParameterType=\"0\" ParameterValue=\"E:RABlAHYAaQBjAGUAOgBEAGUAdgBpAGMAZQAsAEIAbwBvAHQARABlAHYAaQBjAGUAOgBTAHQAcgBpAG4AZwAsAEIAdQBpAGwAZABOAHUAbQBiAGUAcgA6AFMAdAByAGkAbgBnACwAQgB1AGkAbABkAFQAeQBwAGUAOgBTAHQAcgBpAG4AZwAsAEMAYQBwAHQAaQBvAG4AOgBTAHQAcgBpAG4AZwAsAEMAbwBkAGUAUwBlAHQAOgBTAHQAcgBpAG4AZwAsAEMAbwB1AG4AdAByAHkAQwBvAGQAZQA6AFMAdAByAGkAbgBnACwAQwBTAEQAVgBlAHIAcw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rAE0AaQBuAG8AcgBWAGUAcgBzAGkAbwBuADoATgB1AG0AYgBlAHIALABTAGkAegBlAFMAdABvAHIAZQBkAEkAbgBQAGEAZwBpAG4AZwBGAGkAbABlAHMAOgBOAHUAbQBiAGUAcgA6AEsAaQBsAG8AQgB5AHQAZQBzACwAUwB0AGEAdAB1AHMAOgBTAHQAcgBpAG4AZwAsAFMAeQBzAHQAZQBtAEQAZQB2AGkAYwBlADoAUwB0AHIAaQBuAGcALABTAHkAcwB0AGUAbQBEAGkAcgBlAGMAdABvAHIAeQA6AFMAdAByAGkAbgBnACwAVABvAHQAYQBsAFMAdwBhAHAAUwBwAGEAYwBlAFMAaQB6AGUAOgBOAHUAbQBiAGUAcgA6AEsAaQBsAG8AQgB5AHQAZQBzACwAVABvAHQAYQBsAFYAaQByAHQAdQBhAGwATQBlAG0AbwByAHkAUwBpAHoAZQA6AE4AdQBtAGIAZQByADoASwBpAGwAbwBCAHkAdABlAHMALABUAG8AdABhAGwAVgBpAHMAaQBiAGwAZQBNAGUAbQBvAHIAeQBTAGkAegBlADoATgB1AG0AYgBlAHIAOgBLAGkAbABvAEIAeQB0AGUAcwAsAFYAZQByAHMAaQBvAG4AOgBTAHQAcgBpAG4AZwAsAFcAaQBuAGQAbwB3AHMARABpAHIAZQBjAHQAbwByAHkAOgBTAHQAcgBpAG4AZwA=\"/><ScriptParameter ParameterGroupGuid=\"\" ParameterGroupName=\"PG_\" ParameterName=\"wmiquery\" GroupClass=\"MICROSOFT|OPERATING_SYSTEM|1.0\" ParameterDataType=\"System.String\" ParameterVisibility=\"0\" ParameterType=\"0\" ParameterValue=\"E:cgBvAG8AdAAvAGMAaQBtAHYAMgA6AFMARQBMAEUAQwBUACAAQgBvAG8AdABEAGUAdgBpAGMAZQAsAEIAdQBpAGwAZABOAHUAbQBiAGUAcgAsAEIAdQBpAGwAZABUAHkAcABlACwAQwBhAHAAdABpAG8AbgAsAEMAbwBkAGUAUwBlAHQALABDAG8AdQBuAHQAcgB5AE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AbwBuACwAUABsAHUAcwBQAHIAbwBkAHUAYwB0AEkARAAsAFAAbAB1AHMAVgBlAHIAcwBpAG8AbgBOAHUAbQBiAGUAcgAsAFAAcgBpAG0AYQByAHkALABQAHIAbwBkAHUAYwB0AFQAeQBwAGUALABSAGUAZwBpAHMAdABlAHIAZQBkAFUAcwBlAHIALABTAGUAcgBpAGEAbABOAHUAbQBiAGUAcgAsAFMAZQByAHYAaQBjAGUAUABhAGMAawBNAGEAagBvAHIAVgBlAHIAcwBpAG8AbgAsAFMAZQByAHYAaQBjAGUAUABhAGMAawBNAGkAbgBvAHIAVgBlAHIAcwBpAG8AbgAsAFMAaQB6AGUAUwB0AG8AcgBlAGQASQBuAFAAYQBnAGkAbgBnAEYAaQBsAGUAcwAsAFMAdABhAHQAdQBzACwAUwB5AHMAdABlAG0ARABlAHYAaQBjAGUALABTAHkAcwB0AGUAbQBEAGkAcgBlAGMAdABvAHIAeQAsAFQAbwB0AGEAbABTAHcAYQBwAFMAcABhAGMAZQBTAGkAegBlACwAVABvAHQAYQBsAFYAaQByAHQAdQBhAGwATQBlAG0AbwByAHkAUwBpAHoAZQAsAFQAbwB0AGEAbABWAGkAcwBpAGIAbABlAE0AZQBtAG8AcgB5AFMAaQB6AGUALABWAGUAcgBzAGkAbwBuACwAVwBpAG4AZABvAHcAcwBEAGkAcgBlAGMAdABvAHIAeQAgAEYAUgBPAE0AIABXAGkAbgAzADIAXwBPAHAAZQByAGEAdABpAG4AZwBTAHkAcwB0AGUAbQA=\"/></ScriptParameters>",
    "OperationId": 16777270,
    "Properties": [
        {
            "Name": "Device",
            "Units": 0,
            "Type": 0,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "BootDevice",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "BuildNumber",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "BuildType",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Caption",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "CodeSet",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "CountryCode",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "CSDVersion",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "CurrentTimeZone",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Debug",
            "Units": 0,
            "Type": 3,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Description",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Distributed",
            "Units": 0,
            "Type": 3,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "ForegroundApplicationBoost",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "FreePhysicalMemory",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "FreeSpaceInPagingFiles",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "FreeVirtualMemory",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "InstallDate",
            "Units": 0,
            "Type": 4,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "LastBootUpTime",
            "Units": 0,
            "Type": 4,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "LocalDateTime",
            "Units": 0,
            "Type": 4,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Locale",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Manufacturer",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "MaxNumberOfProcesses",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "MaxProcessMemorySize",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Name",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "NumberOfLicensedUsers",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "NumberOfProcesses",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "NumberOfUsers",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "OperatingSystemSKU",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Organization",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "OSArchitecture",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "OSLanguage",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "OSProductSuite",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "OSType",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "OtherTypeDescription",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "PlusProductID",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "PlusVersionNumber",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Primary",
            "Units": 0,
            "Type": 3,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "ProductType",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "RegisteredUser",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "SerialNumber",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "ServicePackMajorVersion",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "ServicePackMinorVersion",
            "Units": 0,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "SizeStoredInPagingFiles",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Status",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "SystemDevice",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "SystemDirectory",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "TotalSwapSpaceSize",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "TotalVirtualMemorySize",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "TotalVisibleMemorySize",
            "Units": 1,
            "Type": 2,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "Version",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        },
        {
            "Name": "WindowsDirectory",
            "Units": 0,
            "Type": 1,
            "Source": 1,
            "CalculatedTableOperator": null
        }
    ]
}

Once you have the OperationId, you can just pass it to the status query as a filter.

1
https://<YourServerName>/AdminService/v1.0//SMS_CMPivotStatus?$filter=ClientOperationId eq 16777270

And the results will looks like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
    "@odata.context": "https://cmtp3-cm1.asd.lab/AdminService/v1.0/$metadata#SMS_CMPivotStatus",
    "value": [
        {
            "ScriptGuid": "7DC6B6F1-E7F6-43C1-96E0-E1D16BC25C14",
            "TaskID": "{D63636F1-2B39-465B-AE75-4C550270A44B}",
            "ScriptVersion": "1",
            "ScriptName": "CMPivot",
            "ScriptLastModifiedDate": "2019-06-13T05:48:18.86-05:00",
            "ResourceId": 16777219,
            "SiteNumber": 1,
            "DeviceName": "CMTP3-CM1",
            "ClientOperationId": 16777270,
            "CollectionId": "SMS00001",
            "LastUpdateTime": "2019-06-18T22:56:05.977-05:00",
            "ScriptExecutionState": 1,
            "ReturnCode": 0,
            "ErrorMessage": null,
            "ScriptExitCode": 0,
            "ScriptOutput": "<result ResultCode=\"0\"><e _i=\"0\" BootDevice=\"\\Device\\HarddiskVolume2\" BuildNumber=\"14393\" BuildType=\"Multiprocessor Free\" Caption=\"Microsoft Windows Server 2016 Standard\" CodeSet=\"1252\" CountryCode=\"1\" CurrentTimeZone=\"-300\" Debug=\"False\" Description=\"\" Distributed=\"False\" ForegroundApplicationBoost=\"2\" FreePhysicalMemory=\"3219208\" FreeSpaceInPagingFiles=\"2182648\" FreeVirtualMemory=\"4445240\" InstallDate=\"2019-02-10 07:08:28\" LastBootUpTime=\"2019-06-18 16:26:32\" LocalDateTime=\"2019-06-18 22:56:02\" Locale=\"0409\" Manufacturer=\"Microsoft Corporation\" MaxNumberOfProcesses=\"4294967295\" MaxProcessMemorySize=\"137438953344\" Name=\"Microsoft Windows Server 2016 Standard|C:\\Windows|\\Device\\Harddisk0\\Partition3\" NumberOfLicensedUsers=\"0\" NumberOfProcesses=\"134\" NumberOfUsers=\"11\" OperatingSystemSKU=\"7\" OSArchitecture=\"64-bit\" OSLanguage=\"1033\" OSProductSuite=\"272\" OSType=\"18\" Primary=\"True\" ProductType=\"2\" SerialNumber=\"00376-30000-00299-AA408\" ServicePackMajorVersion=\"0\" ServicePackMinorVersion=\"0\" SizeStoredInPagingFiles=\"2490368\" Status=\"OK\" SystemDevice=\"\\Device\\HarddiskVolume3\" SystemDirectory=\"C:\\Windows\\system32\" TotalVirtualMemorySize=\"14936948\" TotalVisibleMemorySize=\"12446580\" Version=\"10.0.14393\" WindowsDirectory=\"C:\\Windows\" /></result>",
            "State": 1,
            "TotalClients": 0,
            "UnknownClients": 0,
            "NotApplicableClients": 0,
            "FailedClients": 0,
            "CompletedClients": 0,
            "OfflineClients": 0,
            "OutputLength": 1254
        },
        {
            "ScriptGuid": "7DC6B6F1-E7F6-43C1-96E0-E1D16BC25C14",
            "TaskID": "{D63636F1-2B39-465B-AE75-4C550270A44B}",
            "ScriptVersion": "1",
            "ScriptName": "CMPivot",
            "ScriptLastModifiedDate": "2019-06-13T05:48:18.86-05:00",
            "ResourceId": 16777222,
            "SiteNumber": 1,
            "DeviceName": "DESKTOP-L1S47VD",
            "ClientOperationId": 16777270,
            "CollectionId": "SMS00001",
            "LastUpdateTime": "2019-06-18T23:04:37.47-05:00",
            "ScriptExecutionState": 1,
            "ReturnCode": 0,
            "ErrorMessage": null,
            "ScriptExitCode": 0,
            "ScriptOutput": "<result ResultCode=\"0\"><e _i=\"0\" BootDevice=\"\\Device\\HarddiskVolume2\" BuildNumber=\"17763\" BuildType=\"Multiprocessor Free\" Caption=\"Microsoft Windows 10 Enterprise\" CodeSet=\"1252\" CountryCode=\"1\" CurrentTimeZone=\"-300\" Debug=\"False\" Description=\"\" Distributed=\"False\" ForegroundApplicationBoost=\"2\" FreePhysicalMemory=\"708060\" FreeSpaceInPagingFiles=\"1401120\" FreeVirtualMemory=\"1728432\" InstallDate=\"2019-06-17 02:28:33\" LastBootUpTime=\"2019-06-18 16:38:12\" LocalDateTime=\"2019-06-18 23:04:31\" Locale=\"0409\" Manufacturer=\"Microsoft Corporation\" MaxNumberOfProcesses=\"4294967295\" MaxProcessMemorySize=\"137438953344\" Name=\"Microsoft Windows 10 Enterprise|C:\\Windows|\\Device\\Harddisk0\\Partition3\" NumberOfLicensedUsers=\"0\" NumberOfProcesses=\"166\" NumberOfUsers=\"2\" OperatingSystemSKU=\"4\" OSArchitecture=\"64-bit\" OSLanguage=\"1033\" OSProductSuite=\"256\" OSType=\"18\" Primary=\"True\" ProductType=\"1\" SerialNumber=\"00329-00000-00003-AA945\" ServicePackMajorVersion=\"0\" ServicePackMinorVersion=\"0\" SizeStoredInPagingFiles=\"1441792\" Status=\"OK\" SystemDevice=\"\\Device\\HarddiskVolume3\" SystemDirectory=\"C:\\Windows\\system32\" TotalVirtualMemorySize=\"4109136\" TotalVisibleMemorySize=\"2667344\" Version=\"10.0.17763\" WindowsDirectory=\"C:\\Windows\" /></result>",
            "State": 1,
            "TotalClients": 0,
            "UnknownClients": 0,
            "NotApplicableClients": 0,
            "FailedClients": 0,
            "CompletedClients": 0,
            "OfflineClients": 0,
            "OutputLength": 1236
        }
    ]
}

As you can see, the clients each return an a block of json with an XML blob in the ScriptOutput node. If you expand this out, it contains the results row that you are used to seeing when you run CMPivot from the app in the console.

Additionally, if you use the wmi controller vs the v1.0 controller in the request URI to view the script status, you will get a few extra WMI fields, but overall the status is the same. Also each client block contains overall information about the script including the total devices (completed, failed, etc - populated once the job has timed out attempting to contact clients) as well as a the script results for each device. (You can also see these results in the database if you want yet another option).

I attempted to do some cool stuff with it in PowerShell but I was just reinventing the wheel since the CMPivot console already does what we need. If you want to do some cool automation though, learning how to execute and view results with AdminService will be worthwhile. Anyway, here’s the Powershell that I wrote. It will output the results to gridview. When you close it, it will prompt you to reload the grid for new results since we have to wait for machines to report back. It’s a proof of concept, not production code!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
################
#Sample script for running CMPivot using ConfigMgr AdminService
# By: Adam Gross
# @AdamGrossTX
# https://www.asquaredozen.com
###############

Param (
    $SiteServer = "YourServerName"
)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$BaseUri = "https://$($SiteServer)/AdminService/v1.0/"

$Query = "OperatingSystem"

$Params = @{
    Method = "Post"
    Uri = "$($BaseUri)/Collections('SMS00001')/AdminService.RunCmpivot"
    Body = @{"InputQuery"="$($Query)"} | ConvertTo-Json
    ContentType = "application/json"
    UseDefaultCredentials = $true
}

    $Result = Invoke-RestMethod @Params
    $OperationID = $Result.OperationId

    Function Get-Status
    {
        If ($OperationID) {
            #start-sleep -seconds 30
            $uri = '{0}SMS_CMPivotStatus?$filter=ClientOperationId eq {1}' -f $BaseUri, $OperationID

            $Params = @{
                Method = "Get"
                Uri = [System.Web.HTTPUtility]::UrlEncode($uri)
                ContentType = "application/json"
                UseDefaultCredentials = $true
            }

            $agentsquery = New-Object System.Net.WebClient
            $agentsquery.UseDefaultCredentials =$true
            [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
            $Result = $agentsquery.DownloadString($uri)
        }

        $obj = @()
        $XML = ($Result | ConvertFrom-Json).value.ScriptOutput
        ForEach($ResultObj in $XML)
        {
            $Obj += @(([XML]$ResultObj).ChildNodes.e)
        }

        $ClickResult = $Obj | Out-GridView -OutputMode Single

        $GetResults = Read-Host -Prompt "Do you want to check for results? [y]es or [n]o"
        If ($GetResults = 'Y') {Get-Status}

    }

    Get-Status

Logs And Such

As is the case with ConfigMgr, logs are the first stop for most troubleshooting. Here are a few that had useful bits.

AdminService.log (server-side)

Each time an AdminService command is run, you will see it logged in AdminService.log in your logs folder on the site server where your SMS Provider is running from. This result is from running SMS_CMPivotStatus.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Processing incoming request for resource [https://cmtp3-cm1.asd.lab/AdminService/v1.0/SMS_CMPivotStatus?$filter=ClientOperationId eq 16777277], method: [GET], User - [ASD\adam]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Header: [Authorization]=[**************]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Header: [Host]=[cmtp3-cm1.asd.lab]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Context: [RemoteIpAddress]=[fe80::a0c9:edca:30b0:c2f9%12]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Context: [RemotePort]=[60594]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Context: [ContentType]=[]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Context: [Accept]=[]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Database connection successfully created	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Successfully validated windows user.	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Provider authentication level and exception list up to date.	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
User ASD\adam is allowed because it is validated with current authentication level Default.	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Get all instances of SMS_CMPivotStatus.	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)
Completing request with response code [200] reason [OK]	Microsoft.ConfigurationManager.AdminService	6/18/2019 6:45:27 PM	11 (0x000B)

CcmNotificationAgent.Log (Client-Side)

On your clients, you can watch CcmNotificationAgent.log for the client to communicate over the client fast channel (BGB). This action is what gives you the green checkmark on clients in the console indicating they are currently online. Since CMPivot uses the fast channel to drop the query script on the device when you run CMPivot, this log will show the encrypted script payload as it gets dropped on the client. It will look something like this. You can see that the first line contains the encrypted script blob from the CMPivot job.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<![LOG[Receive task from server with pushid=79, taskid=1074, taskguid=AF02D4B5-F392-400A-8BA4-FE7D68E4381C, tasktype=15 and taskParam=PFNjcmlwdENvbnRlbnQgU2NyaXB0R3VpZD0nN0RDNkI2RjEtRTdGNi00M0MxLTk2RTAtRTFEMTZCQzI1QzE0Jz48U2NyaXB0VmVyc2lvbj4xPC9TY3JpcHRWZXJzaW9uPjxTY3JpcHRUeXBlPjA8L1NjcmlwdFR5cGU+PFNjcmlwdEhhc2ggU2NyaXB0SGFzaEFsZz0nU0hBMjU2Jz4xMDgzMmFiYzA5NmY5NjJmZTViYWYyNjE5YmI1NDE2ZjUwMzA0YTFkOGFmZDIxN2ZiY2U2ZmNhYWVlNjI4YjQ3PC9TY3JpcHRIYXNoPjxTY3JpcHRQYXJhbWV0ZXJzPjxTY3JpcHRQYXJhbWV0ZXIgUGFyYW1ldGVyR3JvdXBHdWlkPSIiIFBhcmFtZXRlckdyb3VwTmFtZT0iUEdfIiBQYXJhbWV0ZXJOYW1lPSJzZWxlY3QiIFBhcmFtZXRlckRhdGFUeXBlPSJTeXN0ZW0uU3RyaW5nIiBQYXJhbWV0ZXJWaXNpYmlsaXR5PSIwIiBQYXJhbWV0ZXJUeXBlPSIwIiBQYXJhbWV0ZXJWYWx1ZT0iRTpSQUJsQUhZQWFRQmpBR1VBT2dCRUFHVUFkZ0JwQUdNQVpRQXNBRUlBYndCdkFIUUFSQUJsQUhZQWFRQmpBR1VBT2dCVEFIUUFjZ0JwQUc0QVp3QXNBRUlBZFFCcEFHd0FaQUJPQUhVQWJRQmlBR1VBY2dBNkFGTUFkQUJ5QUdrQWJnQm5BQ3dBUWdCMUFHa0FiQUJrQUZRQWVRQndBR1VBT2dCVEFIUUFjZ0JwQUc0QVp3QXNB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YXNoIFBhcmFtZXRlckhhc2hBbGc9J1NIQTI1Nic+MDBmOWE0Y	 	1/1/1601 12:00:00 AM	2618294400 (0x9C100080)
Raising event:
instance of CCM_CcmHttp_Status
{
	ClientID = "GUID:EAA95C77-34AC-4D28-959F-FA61E46AF7CD";
	DateTime = "20190618235039.719000+000";
	HostName = "ASDCMTP1906CMG.ASDCMTP1906.SITE";
	HRESULT = "0x00000000";
	ProcessID = 4268;
	StatusCode = 0;
	ThreadID = 4732;
};
	BgbAgent	6/18/2019 6:50:39 PM	4732 (0x127C)
Currently logged on user is a cloud user.	BgbAgent	6/18/2019 6:50:39 PM	4732 (0x127C)
sIpAddress: 192.168.1.20,2002:2FDD:07B7:0001:0000:0000:0000:0107,	BgbAgent	6/18/2019 6:50:39 PM	4732 (0x127C)
sIpSubnet: 192.168.1.0,2002:2FDD:07B7:0001,	BgbAgent	6/18/2019 6:50:39 PM	4732 (0x127C)
Successfully sent keep-alive message.	BgbAgent	6/18/2019 6:50:39 PM	4732 (0x127C)
Updating MDM_ConfigSetting.ClientHealthLastSyncTime with value 2019-06-18T23:50:39Z	BgbAgent	6/18/2019 6:50:39 PM	4732 (0x127C)

Run Scripts over CMG

I didn’t cover using Scripts in this post, but I did test the over the Cloud Management Gateway as well and they worked the same way as CMPivot, in fact, if you look at the Scripts table in the database, you will see the CMPivot master script listed along with any of your other scripts. While the AdminService can’t run scripts in 1906 (as far as I can tell), it can in 1905 and I believe the guts are still in the AdminService just not exposed this time. So in a real world situation, you would be able to run CMPivot then use Scripts to take immediate action - all through the Cloud Managemen Gateway on internet connected clients.

A Square Dozen Image
This is a terrible screenshot. Just go query your DB `SELECT * FROM Scripts`

A note about CMG

I feel like CMG may need it’s own post. Just a quick note about it. When an internet-only client checks in, it uses an internet facing proxy address that points to the CMG server in your Azure tenant. Here’s a snippet from StatusAgent.log showing the internet-facing CMG address ASDCMTP1906CMG.ASDCMTP1906.SITE. This is the same way that Email Approvals work when you click the approval link while connected to the internet.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Raising event (#1 of 1):
instance of CCM_CcmHttp_Status
{
	ClientID = "GUID:EAA95C77-34AC-4D28-959F-FA61E46AF7CD";
	DateTime = "20190619000349.777000+000";
	HostName = "ASDCMTP1906CMG.ASDCMTP1906.SITE";
	HRESULT = "0x00000000";
	ProcessID = 4268;
	StatusCode = 0;
	ThreadID = 4732;
};

Here’s where that address is configured in the console on your Cloud Management Gateway. Additionally, you have to set up a CName record to point the url to the cloudapp.net address listed below it.

A Square Dozen Image

Summary

So, thanks for the challenge David! The scenario you described is not only a common scenario to encounter, but can easily be accomplished using ConfigMgr integrated with Intune using Co-Management and a Cloud Management Gateway. Quick Scenario - A user with an internet-only, Azure AD joined, co-managed device calls in because they need to get on VPN for something but the VPN client isn’t working. Use CMPivot to query the offending registry setting. Run a script to remediate - all from the ConfigMgr console, all through the Cloud Management Gateway, just like you would do for any other device you manage. Truly #ITWithoutBorders.

Anyone who says they don’t need Intune today must not have any remote users (like that one dude from MMSMOA!). I can’t wait to see what 1906 CB has in store for us!