-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheck-Activation-Status.cmd
132 lines (125 loc) · 4.67 KB
/
Check-Activation-Status.cmd
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
@echo off
color 07
title Status - VBS
set "SysPath=%Windir%\System32"
if exist "%Windir%\Sysnative\reg.exe" (set "SysPath=%Windir%\Sysnative")
set "Path=%SysPath%;%Windir%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\"
set "_tempdir=%SystemRoot%\Temp"
set bit=64&set wow=1
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" (if "%PROCESSOR_ARCHITEW6432%"=="" set bit=32&set wow=0)
set "line=************************************************************"
setlocal EnableDelayedExpansion
echo %line%
echo *** Windows Status ***
echo %line%
copy /y %Windir%\System32\slmgr.vbs "!_tempdir!\slmgr.vbs" >nul 2>&1
cscript //nologo "!_tempdir!\slmgr.vbs" /dli || (echo Error executing slmgr.vbs&del /f /q "!_tempdir!\slmgr.vbs"&goto :End)
cscript //nologo "!_tempdir!\slmgr.vbs" /xpr
del /f /q "!_tempdir!\slmgr.vbs" >nul 2>&1
echo ____________________________________________________________________________
:office2016
set office=
for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2016 %bit%-bit Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
if %wow%==0 goto :office2013
set office=
for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2016 32-bit Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
:office2013
set office=
for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2013 %bit%-bit Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
if %wow%==0 goto :office2010
set office=
for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2013 32-bit Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
:office2010
set office=
for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2010 %bit%-bit Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
if %wow%==0 goto :office2016C2R
set office=
for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2010 32-bit Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
:office2016C2R
reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath >nul 2>&1 || goto :office2013C2R
set office=
for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" 2^>nul') do (set "office=%%b\Office16")
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2016/2019 C2R Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
:office2013C2R
reg query HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun /v InstallPath >nul 2>&1 || goto :office2010C2R
set office=
if exist "%ProgramFiles%\Microsoft Office\Office15\OSPP.VBS" (
set "office=%ProgramFiles%\Microsoft Office\Office15"
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office15\OSPP.VBS" (
set "office=%ProgramFiles(x86)%\Microsoft Office\Office15"
)
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2013 C2R Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
:office2010C2R
reg query HKLM\SOFTWARE\Microsoft\Office\14.0\ClickToRun /v InstallPath >nul 2>&1 || goto :End
set office=
if exist "%ProgramFiles%\Microsoft Office\Office14\OSPP.VBS" (
set "office=%ProgramFiles%\Microsoft Office\Office14"
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office14\OSPP.VBS" (
set "office=%ProgramFiles(x86)%\Microsoft Office\Office14"
)
if exist "!office!\OSPP.VBS" (
echo.
echo %line%
echo *** Office 2010 C2R Status ***
echo %line%
cscript //nologo "!office!\OSPP.VBS" /dstatus
)
:End
echo.
echo Press any key to exit...
PAUSE >NUL
EXIT /B