@echo off
PUSHD %~dp0
SET PATH=%PATH%;%CD%;%CD%\OSPP
IF /i %PROCESSOR_ARCHITECTURE%==AMD64 (
    SET ARCH=X64
    SET SYSPath=%SystemRoot%\sysWOW64
    SET "MSharedPATH=%CommonProgramFiles(x86)%\Microsoft Shared"
) ELSE (
    SET ARCH=X86
    SET SYSPath=%SystemRoot%\system32
    SET "MSharedPATH=%CommonProgramFiles%\Microsoft Shared"
)
cls
regedit /s "ospp\unist.dat"
copy "ospp\unist.dat" "%temp%\unist.dat" /y>nul
"%~dp0ospp\fr.exe" "%temp%\unist.dat" -fic:"\Wow6432Node" -t:""
regedit /s "%temp%\unist.dat"
del /q "%temp%\unist.dat"
REGSVR32 /u /s "%MSharedPATH%\MSClientDataMgr\MSCDM.dll"
REGSVR32 /u /s "%MSharedPATH%\Office14\MSOXEV.dll"
REGSVR32 /u /s "%MSharedPATH%\Office14\msoshext.dll"
REGSVR32 /u /s "%MSharedPATH%\VBA\VBA7.1\VBE7.dll"
REGSVR32 /u /s "Office14\Addins\OTKLOADR.dll"
REGSVR32 /u /s "Office14\Addins\TCSCCONV.DLL"
REGSVR32 /u /s "Office14\ACCWIZ.dll"
REGSVR32 /u /s "Office14\IEAWSDC.dll"
REGSVR32 /u /s "Office14\MSOEURO.dll"
REGSVR32 /u /s "Office14\MSOHEV.dll"
REGSVR32 /u /s "Office14\MSOHEVI.dll"
REGSVR32 /u /s "Office14\MSRTEDIT.dll"
REGSVR32 /u /s "Office14\REFEDIT.dll"
REGSVR32 /u /s "Office14\OART.dll"
REGSVR32 /u /s "Office14\MSADDNDR.dll"
REGSVR32 /u /s %SYSPath%\FM20.DLL
rd /s /q "%MSharedPATH%\Equation"
rd /s /q "%MSharedPATH%\MSClientDataMgr"
rd /s /q "%MSharedPATH%\Office14"
rd /s /q "%MSharedPATH%\VBA"
rd /s /q "%MSharedPATH%\Filters"
rd /s /q "%MSharedPATH%\Portal"
rd /s /q "%APPDATA%\Microsoft\Access"
rd /s /q "%APPDATA%\Microsoft\PowerPoint"
rd /s /q "%APPDATA%\Microsoft\Office"
rd /s /q "%APPDATA%\Microsoft\Excel"
rd /s /q "%APPDATA%\Microsoft\Word"
rd /s /q "%APPDATA%\Microsoft\Templates"
rd /s /q "%APPDATA%\Microsoft\AddIns"
rd /s /q "%APPDATA%\Microsoft\Proof"
rd /s /q "%UserProfile%\AppData\Local\Microsoft\Office"
rd /s /q "%appdata%\Microsoft\Document Building Blocks"
rd /s /q "%appdata%\Microsoft\CLView"
rd /s /q "%appdata%\Microsoft\UProof"
rd /s /q "%appdata%\Microsoft\Bibliography"
rd /s /q "%appdata%\Microsoft\QuickStyles"
rd /s /q "%appdata%\Microsoft\Spelling"
del "%SYSPath%\fm20.dll"
del "%SYSPath%\fm20chs.dll"
del "%SYSPath%\VEN2232.OLB"
del "%USERPROFILE%\Desktop\Word 2010.lnk"
del "%USERPROFILE%\Desktop\excel 2010.lnk"
del "%USERPROFILE%\Desktop\PowerPnt2010.lnk"
del "%USERPROFILE%\Desktop\Access2010.lnk"
del "%USERPROFILE%\×ÀÃæ\Word 2010.lnk"
del "%USERPROFILE%\×ÀÃæ\excel 2010.lnk"
del "%USERPROFILE%\×ÀÃæ\PowerPnt2010.lnk"
del "%USERPROFILE%\×ÀÃæ\Access2010.lnk"
del "%windir%\ShellNew\ACCESS.MDB"
del "%windir%\ShellNew\EXCEL.XLS"
del "%windir%\ShellNew\EXCEL12.XLSX"
del "%windir%\ShellNew\PWRPNT.PPT"
For /f "delims=*" %%i in ('Reg Query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Desktop" ') do Set a=%%i
set ppath=%a:~32,256%
del "%ppath%\Word 2010.lnk"
del "%ppath%\excel 2010.lnk"
del "%ppath%\PowerPnt2010.lnk"
del "%ppath%\Access2010.lnk"
net stop osppsvc >nul 2>nul
sc delete osppsvc >nul 2>nul
net localgroup administrators "Network Service" /del >nul 2>nul
regsvr32 /u /s "%CommonProgramFiles%\OfficeSoftwareProtectionPlatform\OSPPWMI.dll"
regsvr32 /u /s "%CommonProgramFiles(x86)%\OfficeSoftwareProtectionPlatform\OSPPWMI.dll"
takeown /f "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"
icacls "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat" /grant administrators:F /t
rd /s /q "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform"
rd /s /q "%CommonProgramFiles%\Microsoft Shared\OfficeSoftwareProtectionPlatform"
rd /s /q "%CommonProgramFiles(x86)%\Microsoft Shared\OfficeSoftwareProtectionPlatform"
echo [Version]>%temp%\re.inf
echo Signature="$CHICAGO$">>%temp%\re.inf
echo [Defaultinstall]>>%temp%\re.inf
RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 128 %temp%\re.inf
del /q %temp%\re.inf
exit
