
137431
26.01.2022
M365 Aktivierungsproblem
Hi,
wir habe auf diversen PC folgendes Problem:
Das Klicken auf Reaktivieren ruft den M365 Anmeldescreen hervor, aber selbst nach richtiger Eingabe der Daten verschwindet das "Reaktivieren" nicht.
Auf einigen PCs hat folgende Lösung geholfen.
1. Komplettes Deinstallieren aller Office Produkte
2. In der Registry alle Einträge unter Identity löschen ( Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Identity\Identities )
3.) dieses Script laufen lassen
Danach erneute Installation via ODT.
Obige Vorgehensweise hilft aber leider nicht bei allen PCs dauerhaft. Auf Vielen erscheint nach einer gewissen Zeit, meist am Montag", wieder der "Reaktivieren" Knopf.
Ich habe keine Ahnung wie das Problem noch zu lösen ist. Lizenzierung ist für alle User korrekt ( M365 Business Standard im Admin Center)
wir habe auf diversen PC folgendes Problem:
Das Klicken auf Reaktivieren ruft den M365 Anmeldescreen hervor, aber selbst nach richtiger Eingabe der Daten verschwindet das "Reaktivieren" nicht.
Auf einigen PCs hat folgende Lösung geholfen.
1. Komplettes Deinstallieren aller Office Produkte
2. In der Registry alle Einträge unter Identity löschen ( Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Identity\Identities )
3.) dieses Script laufen lassen
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
'*******************************************************************************
' Name: OLicenseCleanup.vbs - v 1.15
' Author: Microsoft Customer Support Services
' Copyright (c) Microsoft Corporation
'
' Removes all licenses for Office 2013 and 2016
' from the (Office) Software Protection Platform
'*******************************************************************************
'Option Explicit
Dim oProductInstances, oWmiLocal, oReg, oWShell, oFso
Dim sQuery, sTemp, sLogDir, sOSinfo
Dim f64, fO64, fCScript, fQuiet, fClearO15, fClearO16, fSafeForRoamingUsers
Dim LogStream
'Const SKUFILTER = "" 'Removes all licenses
Const SKUFILTER = "O365" 'Removes all licenses that contain O365 in their name
'Const SKUFILTER = "2013" 'Removes all licenses that contain 2013 in their name
'Const SKUFILTER = "2016" 'Removes all licenses that contain 2016 in their name
fQuiet = True
fClearO15 = True
fClearO16 = True
sLogDir = "" 'Custom log folder/directory. No trailing "\" in the path!
'Set this to False if the script needs to run more than once and you don't
'have roaming profile users
fSafeForRoamingUsers = True
'*******************************************************************************
Const OfficeAppId = "0ff1ce15-a989-479d-af46-f275c6370663" 'Office 2013/2016
Const HKLM = &H80000002
Const SCRIPTVERSION = "1.15"
' MAIN
On Error Resume Next
Set oWShell = CreateObject("WScript.Shell")
Initialize
LogH2 "Cleanup start"
CleanOSPP SKUFILTER
ResetOfficeIdentityKey
ResetOfficeUserRegistrationKey
ResetUserLicensingKey
ClearCredmanCache
ClearSCALicCache
ClearConfigUser
LogH2 "Cleanup end"
' END
'-------------------------------------------------------------------------------
' Initialize
'
' Initialize script settings
'-------------------------------------------------------------------------------
Sub Initialize
Dim ComputerItem, Item
Dim sOsVersion
'Check if we're running as 32 bit process on a 64 bit OS
If InStr(LCase(wscript.path), "syswow64") > 0 Then RelaunchAs64Host
Set oWmiLocal = GetObject("winmgmts:\\.\root\cimv2")
Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
Set oFso = CreateObject("Scripting.FileSystemObject")
sTemp = oWShell.ExpandEnvironmentStrings("%TEMP%")
fCScript = (UCase(Mid(Wscript.FullName, Len(Wscript.Path) + 2, 1)) = "C")
' get Win32_OperatingSystem details
'----------------------------------
Set ComputerItem = oWmiLocal.ExecQuery("Select * from Win32_OperatingSystem")
For Each Item in ComputerItem
sOSinfo = sOSinfo & Item.Caption
sOSinfo = sOSinfo & Item.OtherTypeDescription
sOSinfo = sOSinfo & ", " & "SP " & Item.ServicePackMajorVersion
sOSinfo = sOSinfo & ", " & "Version: " & Item.Version
sOsVersion = Item.Version
sOSinfo = sOSinfo & ", " & "Codepage: " & Item.CodeSet
sOSinfo = sOSinfo & ", " & "Country Code: " & Item.CountryCode
sOSinfo = sOSinfo & ", " & "Language: " & Item.OSLanguage
Next
DetectOSBitness
DetectOfficeBitness
CreateLog
LogOnly "Remove O15 Lic: " & fClearO15
LogOnly "Remove O16 Lic: " & fClearO16
LogOnly "Quiet mode: " & fQuiet
End Sub
'-------------------------------------------------------------------------------
' ResetUserLicensingKey
'
' clear HKCU cached user license registry
'-------------------------------------------------------------------------------
Sub ResetUserLicensingKey ()
Dim sSettingsKey, sCount, sRetVal, sCmd
Dim iCount
Dim oExec
If fClearO15 Then
'remove current user key
Log "Remove key HKCU\Software\Microsoft\Office\15.0\Common\Licensing"
sRetVal = oWShell.Run("REG DELETE HKCU\Software\Microsoft\Office\15.0\Common\Licensing /f", 0, True)
'create user settings key to cover other profiles
sSettingsKey = "SOFTWARE\Wow6432Node\Microsoft\Office\15.0\User Settings"
If (f64 And fO64) Or (Not f64) Then sSettingsKey = "SOFTWARE\Microsoft\Office\15.0\User Settings"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\15.0"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\15.0\Common"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\15.0\Common\Licensing"
iCount = 1
If Not fSafeForRoamingUsers Then
If RegReadDWordValue(HKLM, sSettingsKey & "\ResetUserLicense", "Count", sCount) Then iCount = CInt(sCount) + 1
End If
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserLicense", "Count", iCount
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserLicense", "Order", 1
LogOnly "Add SettingsKey: HKLM\" & sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\15.0\Common\Licensing"
LogOnly "Count: " & iCount
End If
'O16
If fClearO16 Then
'remove current user key
Log "Remove key HKCU\Software\Microsoft\Office\16.0\Common\Licensing"
sRetVal = oWShell.Run("REG DELETE HKCU\Software\Microsoft\Office\16.0\Common\Licensing /f", 0, True)
'create user settings key to cover other profiles
sSettingsKey = "SOFTWARE\Wow6432Node\Microsoft\Office\16.0\User Settings"
If (f64 And fO64) Or (Not f64) Then sSettingsKey = "SOFTWARE\Microsoft\Office\16.0\User Settings"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\16.0"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\16.0\Common"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\16.0\Common\Licensing"
iCount = 1
If Not fSafeForRoamingUsers Then
If RegReadDWordValue(HKLM, sSettingsKey & "\ResetUserLicense", "Count", sCount) Then iCount = CInt(sCount) + 1
End If
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserLicense", "Count", iCount
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserLicense", "Order", 1
LogOnly "Add SettingsKey: HKLM\" & sSettingsKey & "\ResetUserLicense\Delete\Software\Microsoft\Office\16.0\Common\Licensing"
LogOnly "Count: " & iCount
End If
End Sub 'ResetUserLicensingKey
'-------------------------------------------------------------------------------
' ClearConfigUser
'
' clear HKLM cached user license id
'-------------------------------------------------------------------------------
Sub ClearConfigUser
Dim value
Dim sConfigKey, sRetVal, sCmd
Dim arrNames, arrTypes
If NOT fClearO16 Then Exit Sub
sConfigKey = "SOFTWARE\Microsoft\Office\ClickToRun\Configuration"
If RegEnumValues(HKLM, sConfigKey, arrNames, arrTypes) Then
For Each value in arrNames
If (InStr(LCase(value), LCase(".EmailAddress")) > 0) Or (InStr(LCase(value), LCase(".TenantId")) > 0) Or (LCase(value) = "productkeys") Then
sCmd = "REG DELETE HKLM\" & sConfigKey & " /v " & value & " /f"
sRetVal = oWShell.Run(sCmd, 0, True)
Log "Remove entry: HKLM\" & sConfigKey & "\" & value
End If
Next
End If
End Sub 'ClearConfigUser
'-------------------------------------------------------------------------------
' ClearSCALicCache
'
' clear local license cache for SharedComputerActivation
'-------------------------------------------------------------------------------
Sub ClearSCALicCache
Dim attr, fld
Dim sLocalAppData, sCmd, sDelFld
sLocalAppData = oWShell.ExpandEnvironmentStrings("%localappdata%")
If fClearO15 Then
sDelFld = sLocalAppData & "\Microsoft\Office\15.0\Licensing"
If oFso.FolderExists(sDelFld) Then
Set fld = oFso.GetFolder(sDelFld)
'ensure to remove read only flag
attr = fld.Attributes
If CBool(attr And 1) Then fld.Attributes = attr And (attr - 1)
'delete folder
fld.Delete True
Set fld = Nothing
'check if removal succeeded. If not try to RD
If oFso.FolderExists(sDelFld) Then
sCmd = "cmd.exe /c rd /s " & chr(34) & sDelFld & chr(34) & " /q"
Log "Remove folder: " & sDelFld
oWShell.Run sCmd, 0, True
End If
End If
End If
If fClearO16 Then
sDelFld = sLocalAppData & "\Microsoft\Office\16.0\Licensing"
If oFso.FolderExists(sDelFld) Then
Set fld = oFso.GetFolder(sDelFld)
'ensure to remove read only flag
attr = fld.Attributes
If CBool(attr And 1) Then fld.Attributes = attr And (attr - 1)
'delete folder
fld.Delete True
Set fld = Nothing
'check if removal succeeded. If not try to RD
If oFso.FolderExists(sDelFld) Then
sCmd = "cmd.exe /c rd /s " & chr(34) & sDelFld & chr(34) & " /q"
Log "Remove folder: " & sDelFld
oWShell.Run sCmd, 0, True
End If
End If
End If
End Sub 'ClearSCALicCache
'-------------------------------------------------------------------------------
' ClearCredmanCache
'
' clear Office credentials from Windows Credentials Manager Cache
'-------------------------------------------------------------------------------
Sub ClearCredmanCache
Dim oExec, line
Dim sCmd, sRetVal, sCmdOut, sLine
Dim arrLines
sCmd = "cmdkey.exe /list:MicrosoftOffice1*"
Set oExec = oWShell.Exec(sCmd)
sCmdOut = oExec.StdOut.ReadAll()
Do While oExec.Status = 0
WScript.Sleep 100
Loop
arrLines = Split(sCmdOut)
For Each line In arrLines
If InStr(line, "MicrosoftOffice1") > 0 And Not InStr(line, "MicrosoftOffice1*") > 0 Then
sLine = Replace(line, vbCrLf, "")
sCmd = "cmdkey.exe /delete:" & Trim(sLine)
Log "Remove from CredmanCache: " & sLine
sRetVal = oWShell.Run(sCmd, 0, True)
End If
Next
End Sub 'ClearCredmanCache
'-------------------------------------------------------------------------------
' ResetOfficeIdentityKey
'
' configures the Office Identity key to be reset on next application launch
'-------------------------------------------------------------------------------
Sub ResetOfficeIdentityKey ()
Dim sSettingsKey, sCount, sRetVal, sCmd
Dim iCount
Dim oExec
If fClearO15 Then
'remove current user key
Log "Remove key HKCU\Software\Microsoft\Office\15.0\Common\Identity"
sRetVal = oWShell.Run("REG DELETE HKCU\Software\Microsoft\Office\15.0\Common\Identity /f", 0, True)
'create user settings key to cover other profiles
sSettingsKey = "SOFTWARE\Wow6432Node\Microsoft\Office\15.0\User Settings"
If (f64 And fO64) Or (Not f64) Then sSettingsKey = "SOFTWARE\Microsoft\Office\15.0\User Settings"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\15.0"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\15.0\Common"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\15.0\Common\Identity"
iCount = 1
If Not fSafeForRoamingUsers Then
If RegReadDWordValue(HKLM, sSettingsKey & "\ResetIdentity", "Count", sCount) Then iCount = CInt(sCount) + 1
End If
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetIdentity", "Count", iCount
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetIdentity", "Order", 1
LogOnly "Add SettingsKey: HKLM\" & sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\15.0\Common\Identity"
LogOnly "Count: " & iCount
End If
If fClearO16 Then
'remove current user key
Log "Remove key HKCU\Software\Microsoft\Office\16.0\Common\Identity"
sRetVal = oWShell.Run("REG DELETE HKCU\Software\Microsoft\Office\16.0\Common\Identity /f", 0, True)
'create user settings key to cover other profiles
sSettingsKey = "SOFTWARE\Wow6432Node\Microsoft\Office\16.0\User Settings"
If (f64 And fO64) Or (Not f64) Then sSettingsKey = "SOFTWARE\Microsoft\Office\16.0\User Settings"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\16.0"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\16.0\Common"
oReg.CreateKey HKLM, sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\16.0\Common\Identity"
iCount = 1
If Not fSafeForRoamingUsers Then
If RegReadDWordValue(HKLM, sSettingsKey & "\ResetIdentity", "Count", sCount) Then iCount = CInt(sCount) + 1
End If
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetIdentity", "Count", iCount
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetIdentity", "Order", 1
LogOnly "Add SettingsKey: HKLM\" & sSettingsKey & "\ResetIdentity\Delete\Software\Microsoft\Office\16.0\Common\Identity"
LogOnly "Count: " & iCount
End If
End Sub 'ResetOfficeIdentityKey
'-------------------------------------------------------------------------------
' ResetOfficeUserRegistrationKey
'
' configures the Office Identity key to be reset on next application launch
'-------------------------------------------------------------------------------
Sub ResetOfficeUserRegistrationKey ()
Dim sSettingsKey, sCount, sRetVal, sCmd
Dim iCount
Dim oExec
If fClearO15 Then
'remove current user key
Log "Remove key HKCU\Software\Microsoft\Office\15.0\Registration"
sRetVal = oWShell.Run("REG DELETE HKCU\Software\Microsoft\Office\15.0\Registration /f", 0, True)
'create user settings key to cover other profiles
sSettingsKey = "SOFTWARE\Wow6432Node\Microsoft\Office\15.0\User Settings"
If (f64 And fO64) Or (Not f64) Then sSettingsKey = "SOFTWARE\Microsoft\Office\15.0\User Settings"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office\15.0"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office\15.0\Registration"
iCount = 1
If Not fSafeForRoamingUsers Then
If RegReadDWordValue(HKLM, sSettingsKey & "\ResetUserRegistration", "Count", sCount) Then iCount = CInt(sCount) + 1
End If
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserRegistration", "Count", iCount
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserRegistration", "Order", 1
LogOnly "Add SettingsKey: HKLM\" & sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office\15.0\Registration"
LogOnly "Count: " & iCount
End If
If fClearO16 Then
'remove current user key
Log "Remove key HKCU\Software\Microsoft\Office\16.0\Registration"
sRetVal = oWShell.Run("REG DELETE HKCU\Software\Microsoft\Office\16.0\Registration /f", 0, True)
'create user settings key to cover other profiles
sSettingsKey = "SOFTWARE\Wow6432Node\Microsoft\Office\16.0\User Settings"
If (f64 And fO64) Or (Not f64) Then sSettingsKey = "SOFTWARE\Microsoft\Office\16.0\User Settings"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office\16.0"
oReg.CreateKey HKLM, sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office\16.0\Registration"
iCount = 1
If Not fSafeForRoamingUsers Then
If RegReadDWordValue(HKLM, sSettingsKey & "\ResetUserRegistration", "Count", sCount) Then iCount = CInt(sCount) + 1
End If
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserRegistration", "Count", iCount
oReg.SetDWordValue HKLM, sSettingsKey & "\ResetUserRegistration", "Order", 1
LogOnly "Add SettingsKey: HKLM\" & sSettingsKey & "\ResetUserRegistration\Delete\Software\Microsoft\Office\16.0\Registration"
LogOnly "Count: " & iCount
End If
End Sub 'ResetOfficeUserRegistrationKey
'-------------------------------------------------------------------------------
' CleanOSPP
'
' unpkeys the licenses from OSPP
'-------------------------------------------------------------------------------
Sub CleanOSPP (sFilter)
Dim pi
Dim oProductInstances
' Initialize the software protection platform object with a filter on Office 2013/2016 products
If GetVersionNT > 601 Then
Set oProductInstances = oWmiLocal.ExecQuery("SELECT ID, ApplicationId, PartialProductKey, Description, Name, ProductKeyID FROM SoftwareLicensingProduct WHERE ApplicationId = '" & OfficeAppId & "' " & "AND PartialProductKey <> NULL")
Else
Set oProductInstances = oWmiLocal.ExecQuery("SELECT ID, ApplicationId, PartialProductKey, Description, Name, ProductKeyID FROM OfficeSoftwareProtectionProduct WHERE ApplicationId = '" & OfficeAppId & "' " & "AND PartialProductKey <> NULL")
End If
' Remove all licenses
For Each pi in oProductInstances
Log "License: " & pi.Name
If NOT IsNull(pi) Then
If InStr(pi.Name, sFilter) > 0 Or sFilter = "" Then
Log "Uninstall ProductKey: " & pi.Name & " - Key: " & pi.ProductKeyID
pi.UninstallProductKey(pi.ProductKeyID)
End If
End If
Next 'pi
End Sub 'CleanOSPP
'-------------------------------------------------------------------------------
' DetectOfficeBitness
'
' detect bitness of Office
'-------------------------------------------------------------------------------
Sub DetectOfficeBitness ()
Dim sOPlatform, sInstallRootPath
fO64 = False
If Not f64 Then Exit Sub
If RegReadStringValue(HKLM, "SOFTWARE\Microsoft\Office\ClickToRun\Configuration", "platform", sOPlatform) Then
fO64 = (sOPlatform = "x64")
Exit Sub
End If
If RegReadStringValue(HKLM, "SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration", "platform", sOPlatform) Then
fO64 = (sOPlatform = "x64")
Exit Sub
End If
If RegReadStringValue(HKLM, "SOFTWARE\Microsoft\Office\ClickToRun\propertyBag", "Platform", sOPlatform) Then
fO64 = (sOPlatform = "x64")
Exit Sub
End If
If RegReadStringValue(HKLM, "SOFTWARE\Microsoft\Office\15.0\ClickToRun\propertyBag", "Platform", sOPlatform) Then
fO64 = (sOPlatform = "x64")
Exit Sub
End If
If RegReadStringValue(HKLM, "SOFTWARE\Wow6432Node\Microsoft\Office\Common\InstallRoot", "Path", sInstallRootPath) Then
'fO64 = Not (InStr(sInstallRootPath,"(x86)") > 0)
fO64 = False
Exit Sub
End If
If RegReadStringValue(HKLM, "SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot", "Path", sInstallRootPath) Then
'fO64 = Not (InStr(sInstallRootPath,"(x86)") > 0)
fO64 = False
Exit Sub
End If
If RegReadStringValue(HKLM, "SOFTWARE\Microsoft\Office\Common\InstallRoot", "Path", sInstallRootPath) Then
'fO64 = Not (InStr(sInstallRootPath,"(x86)") > 0)
fO64 = True
Exit Sub
End If
If RegReadStringValue(HKLM, "SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot", "Path", sInstallRootPath) Then
'fO64 = Not (InStr(sInstallRootPath,"(x86)") > 0)
fO64 = True
Exit Sub
End If
End Sub 'DetectOfficeBitness
'-------------------------------------------------------------------------------
' DetectOSBitness
'
' detect bitness of the operating system
'-------------------------------------------------------------------------------
Sub DetectOSBitness ()
Dim ComputerItem, item
Set ComputerItem = oWmiLocal.ExecQuery("Select * from Win32_ComputerSystem")
For Each item In ComputerItem
f64 = Instr(Left(item.SystemType, 3), "64") > 0
Next
End Sub 'DetectOSBitness
'-------------------------------------------------------------------------------
' GetVersionNT
'
' Calculate the VerionNT number as integer
'-------------------------------------------------------------------------------
Function GetVersionNT ()
Dim sOsVersion
Dim arrVersion
Dim qOS
Dim oOsItem
Set qOS = oWmiLocal.ExecQuery( "Select * from Win32_OperatingSystem")
For Each oOsItem in qOS
sOsVersion = oOsItem.Version
Next
arrVersion = Split( sOsVersion, GetDelimiter( sOsVersion))
GetVersionNT = CInt( arrVersion( 0)) * 100 + CInt( arrVersion( 1))
End Function
'-------------------------------------------------------------------------------
' GetDelimiter
'
' Returns the delimiter in a version string
'-------------------------------------------------------------------------------
Function GetDelimiter (sVersion)
Dim iCnt, iAsc
GetDelimiter = " "
For iCnt = 1 To Len(sVersion)
iAsc = Asc(Mid(sVersion, iCnt, 1))
If Not (iASC >= 48 And iASC <= 57) Then
GetDelimiter = Mid(sVersion, iCnt, 1)
Exit Function
End If
Next 'iCnt
End Function
'-------------------------------------------------------------------------------
' RegReadDWordValue
'
' Check if a string value exists and return on zero if not
'-------------------------------------------------------------------------------
Function RegReadDWordValue(hDefKey, sSubKeyName, sName, sValue)
Dim RetVal
RetVal = oReg.GetDWORDValue(hDefKey, sSubKeyName, sName, sValue)
RegReadDWordValue = (RetVal = 0)
End Function 'RegReadDWordValue
'-------------------------------------------------------------------------------
' RegReadStringValue
'
' Check if a string value exists and return on zero if not
'-------------------------------------------------------------------------------
Function RegReadStringValue(hDefKey, sSubKeyName, sName, sValue)
Dim RetVal
RetVal = oReg.GetStringValue(hDefKey, sSubKeyName, sName, sValue)
RegReadStringValue = (RetVal = 0)
End Function 'RegReadSringValue
'-------------------------------------------------------------------------------
' RegEnumValues
'
' Enumerate a registry key to return all values
'-------------------------------------------------------------------------------
Function RegEnumValues(hDefKey, sSubKeyName, arrNames, arrTypes)
Dim RetVal
RetVal = oReg.EnumValues(hDefKey, sSubKeyName, arrNames, arrTypes)
RegEnumValues = (RetVal = 0) AND IsArray(arrNames) AND IsArray(arrTypes)
End Function 'RegEnumValues
'-------------------------------------------------------------------------------
' RelaunchAs64Host
'
' Relaunch self with 64 bit CScript host
'-------------------------------------------------------------------------------
Sub RelaunchAs64Host
Dim Argument, sCmd
Dim fQuietRelaunch
fQuietRelaunch = False
sCmd = Replace(LCase(wscript.Path), "syswow64", "sysnative") & "\cscript.exe " & Chr(34) & WScript.scriptFullName & Chr(34)
If fQuiet Then fQuietRelaunch = True
If Wscript.Arguments.Count > 0 Then
For Each Argument in Wscript.Arguments
sCmd = sCmd & " " & chr(34) & Argument & chr(34)
Select Case UCase(Argument)
Case "/Q", "/QUIET"
fQuietRelaunch = True
End Select
Next 'Argument
End If
sCmd = sCmd & " /ChangedHostBitness"
If fQuietRelaunch Then
sCmd = Replace (sCmd, "\cscript.exe", "\wscript.exe")
Wscript.Quit CLng(oWShell.Run (sCmd, 0, True))
Else
Wscript.Quit CLng(oWShell.Run (sCmd, 1, True))
End If
End Sub 'RelaunchAs64Host
'-------------------------------------------------------------------------------
' CreateLog
'
' Create the removal log file
'-------------------------------------------------------------------------------
Sub CreateLog
Dim DateTime
Dim sLogName
On Error Resume Next
' create the log file
Set DateTime = CreateObject("WbemScripting.SWbemDateTime")
DateTime.SetVarDate Now, True
If sLogDir = "" Then sLogDir = sTemp
sLogName = sLogDir & "\" & oWShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
sLogName = sLogName & "_" & Left(DateTime.Value, 14)
sLogName = sLogName & "_OLicenseClean.txt"
Err.Clear
Set LogStream = oFso.CreateTextFile(sLogName, True, True)
If Err <> 0 Then
Err.Clear
sLogDir = sTemp
sLogName = sLogDir & "\" & oWShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
sLogName = sLogName & "_" & Left(DateTime.Value, 14)
sLogName = sLogName & "_oLicenseClean.txt"
Set LogStream = oFso.CreateTextFile(sLogName, True, True)
End If
On Error Goto 0
LogH2 "Microsoft Customer Support Services - Office License Reset Utility" & vbCrLf & vbCrLf & _
"Version: " & vbTab & SCRIPTVERSION & vbCrLf & _
"64 bit OS: " & vbTab & f64 & vbCrLf & _
"64 bit Office: " & vbTab & fO64 & vbCrLf & _
"Cleanup start: " & vbTab & Time
LogH2 "OS Details: " & sOSinfo & vbCrLf
End Sub 'CreateLog
'-------------------------------------------------------------------------------
' LogH
'
' Write a header log string to the log file
'-------------------------------------------------------------------------------
Sub LogH (sLog)
LogStream.WriteLine ""
sLog = sLog & vbCrLf & String(Len(sLog), "=")
If NOT fQuiet AND fCScript Then wscript.echo ""
If NOT fQuiet AND fCScript Then wscript.echo sLog
LogStream.WriteLine sLog
End Sub 'Logh
'-------------------------------------------------------------------------------
' LogH1
'
' Write a header log string to the log file
'-------------------------------------------------------------------------------
Sub LogH1 (sLog)
LogStream.WriteLine ""
sLog = sLog & vbCrLf & String(Len(sLog), "-")
If NOT fQuiet AND fCScript Then wscript.echo ""
If NOT fQuiet AND fCScript Then wscript.echo sLog
LogStream.WriteLine sLog
End Sub 'LogH1
'-------------------------------------------------------------------------------
' LogH2
'
' Write w/o indent Cmd window and the log file
'-------------------------------------------------------------------------------
Sub LogH2 (sLog)
If NOT fQuiet AND fCScript Then wscript.echo sLog
LogStream.WriteLine ""
LogStream.WriteLine sLog
End Sub 'LogH2
'-------------------------------------------------------------------------------
' Log
'
' Echos the log string to the Cmd window and the log file
'-------------------------------------------------------------------------------
Sub Log (sLog)
If NOT fQuiet AND fCScript Then wscript.echo sLog
If sLog = "" Then
LogStream.WriteLine
Else
LogStream.WriteLine " " & Time & ": " & sLog
End If
End Sub 'Log
'-------------------------------------------------------------------------------
' LogOnly
'
' Commits the log string to the log file
'-------------------------------------------------------------------------------
Sub LogOnly (sLog)
If sLog = "" Then
LogStream.WriteLine
Else
LogStream.WriteLine " " & Time & ": " & sLog
End If
End Sub 'Log
Danach erneute Installation via ODT.
Obige Vorgehensweise hilft aber leider nicht bei allen PCs dauerhaft. Auf Vielen erscheint nach einer gewissen Zeit, meist am Montag", wieder der "Reaktivieren" Knopf.
Ich habe keine Ahnung wie das Problem noch zu lösen ist. Lizenzierung ist für alle User korrekt ( M365 Business Standard im Admin Center)
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 1763326494
Url: https://administrator.de/forum/m365-aktivierungsproblem-1763326494.html
Ausgedruckt am: 10.04.2025 um 14:04 Uhr
2 Kommentare
Neuester Kommentar