michsens |
Friday 15 June 2012 at 11:57
|
michsens
|
Hello everybody,
for those who are working with MS Office for example in a company that provides a volume licence should have noticed that it is not possible to activate the product with the "cscript <whatever>" solution.
I analysed this visual basic script and found a solution for this issue:
There are three different registry entries that have to be added:
Use regedit for this task. It is very important that you do not close this the whole time.
[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\OfficeSoftwareProtectionPlatform] Insert: "KeyManagementServiceName REG_SZ <Licence server>" "KeyManagementServicePort REG_SZ <Port of licence server>"
Start MS Office (i.e. Word). Then an additional entry will be automatically created: Update "regedit" for example by pushing "F5"-key to see this change. Go to
[HKEY_USERS\\S-1-5-20\\Software\\Microsoft\\OfficeSoftwareProtectionPlatform]
and insert: "VLRenewalSchedule REG_BINARY <any value>"
It might be possible to copy the value of "VLRenewalSchedule" from [HKEY_USERS\\S-1-5-21-0-0-0-1000\\Software\\Microsoft\\OfficeSoftwareProtectionPlatform]
It is possible that you have to start MS Office, close it completely and restart it.
In the menu of Word go to "File - Help". You should now see that MS Office was successfully activated.
I do not know why the change in the registry by MS Office has to be done. The step with inserting "VLRenewalSchedule REG_BINARY <any value>" might not be necessary if MS Office would directly grep the key from [HKEY_USERS\\S-1-5-21-0-0-0-1000\\Software\\Microsoft\\OfficeSoftwareProtectionPlatform]
Maybe some has a solution for this.
By the way would someone need a POL-Script for this activation procedure? Maybe we together can then develop one.
Greetings,
Robert.
Edited by michsens
|
michsens |
Monday 18 June 2012 at 10:09
|
michsens
|
Since MS Office deletes the key "[HKEY_USERS\\S-1-5-20\\Software\\Microsoft\\OfficeSoftwareProtectionPlatform]" after every shutdown I modified the Shortcut of each Office 2010 Product that can be run under Wine: #!/bin/bash [ "$PLAYONLINUX" = "" ] && exit 0 source "$PLAYONLINUX/lib/sources" export WINEPREFIX="/home/paulo/.PlayOnLinux//wineprefix/Office2010" export WINEDEBUG="-all" #POL_Log=Microsoft Office 2010 cd "/home/paulo/.PlayOnLinux//wineprefix/Office2010/" echo "[HKEY_USERS\\\\S-1-5-20\\\\Software\\\\Microsoft\\\\OfficeSoftwareProtection]" > VLRenew.regedit sed -n -e '/VLRenewalSchedule/,/^$/p' user.reg >> VLRenew.reg echo "\\"Enable\\"=\\"Y\\"" >> VLRenew.reg POL_Wine regedit.exe VLRenew.reg sleep 2 cd "/home/paulo/.PlayOnLinux//wineprefix/Office2010/drive_c/./Program Files/Microsoft Office/Office14" if [ -z "$@" ]; then POL_Wine "WINWORD.EXE" else POL_Wine "WINWORD.EXE" z:"${@//\\//\\\\}" fi For running Excel, Outlook, OneNote, and Powerpoint change the last lines to the specific executables. By the way, the last lines are very helpful when you want to start Office files out of any linux file browser. Otherwise in my case some errors were prompted by MS Office 2010. Edited by michsens
|
michsens |
Friday 22 June 2012 at 11:38
|
michsens
|
Maybe I should mention that this activation is only possible for KMS volume activation. MAK volume activation can not be done with this approach!
|
Quentin PÂRIS |
Friday 22 June 2012 at 11:57
|
Quentin PÂRIS
|
Thank you for your post. For the moment, it's quite hard to integrate this directly into PlayOnLinux. It would be possible though, but you need to make a separate bash script for the activation process, and call it with bash command. So I suppose we could make a script called Activation (for example) You could insert that into Office 2010 script mkdir -p "$POL_USER_ROOT/configurations/extra/Office 2010/"
cat << EOF > "$POL_USER_ROOT/configurations/extra/Office 2010/Activation"
# Create your .reg file here
POL_Wine regedit File.reg
sleep 2
EOF
POL_Shortcut_InsertBeforeWine "Word 2010" 'bash $POL_USER_ROOT/configurations/extra/Office 2010/Activation' It is just a short example. What do you think about this?
|
michsens |
Friday 22 June 2012 at 14:06
|
michsens
|
All right. I try that this weekend. I can do it as a bash script or I can prepare it for the integration into the installation script of Office2010 by creating a POL-Script in which you can choose a certain activation procedure. This could then be extended with deferent other activation/registration procedures. How about this?
|
Quentin PÂRIS |
Friday 22 June 2012 at 15:05
|
Quentin PÂRIS
|
That a good idea. We would ask the user at the end of the install process for example
|
michsens |
Saturday 23 June 2012 at 7:18
|
michsens
|
How can I make permanent changes in [HKEY_USERS]. It seems that wine automatically reset this complete key. Maybe I can overcome the corresponding part in my above start script.
What exactly does the command "POL_Shortcut_InsertBeforeWine"?
|
Quentin PÂRIS |
Saturday 23 June 2012 at 10:24
|
Quentin PÂRIS
|
POL_Shortcut_InsertBeforeWine insert a command before running wine in PoL
|
michsens |
Sunday 24 June 2012 at 11:10
|
michsens
|
Well, I wrote the script as mentioned. I hope it works. At the moment I have no chance to test it with an MS Office 2010. I am going to do this on monday. Here is the script:
#!/bin/sh
# Created by Robert Paulo on 24.06.12.
[ "$PLAYONLINUX" = "" ] && exit source "$PLAYONLINUX/lib/sources" POL_SetupWindow_Init
POL_SetupWindow_question "Do you want to activate your MS Office 2010?" "$TITLE" if [ "$APP_ANSWER" == "TRUE" ]; then
POL_SetupWindow_menu "Which type of activation?" "$TITLE" "Volume Activation (KMS)~Room for other activation procedures" "~" if [ "$APP_ANSWER" == "Volume Activation (KMS)" ]; then licenseServerName="" while [ -z "$licenseServerName" ]; do POL_SetupWindow_textbox "Insert address of license server!" "$TITLE" licenseServerName=$APP_ANSWER done POL_SetupWindow_textbox "Insert port of license server!" "$TITLE" licenseServerPort=$APP_ANSWER
POL_SetupWindow_message "The data for the license server are added into the registry\\n\\nLicense server name: $licenseServerName\\nLicense server port: $licenseServerPort" "$TITLE"
cd "$POL_USER_ROOT//wineprefix/Office2010/" # copy registry value from user.reg echo "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\OfficeSoftwareProtectionPlatform]" > VLKMSServ.reg echo "KeyManagementServiceName REG_SZ $licenseServerName" >> VLKMSServ.reg echo "KeyManagementServicePort REG_SZ $licenseServerPort" >> VLKMSServ.reg echo "\\"Enable\\"=\\"Y\\"" >> VLKMSServ.reg
#POL_Wine regedit VLKMSServ.reg #sleep 2 #rm VLKMSServ.reg #elif [ "$APP_ANSWER" == "Volume Activation (MAK)" ]; then fi else echo fi
mkdir -p "$POL_USER_ROOT/configurations/extra/Office 2010/" cat << EOF > "$POL_USER_ROOT/configurations/extra/Office 2010/Activation"
cd "$POL_USER_ROOT//wineprefix/Office2010/" # copy registry value from user.reg echo "[HKEY_USERS\\\\S-1-5-20\\\\Software\\\\Microsoft\\\\OfficeSoftwareProtection]" > VLRenew.reg sed -n -e '/VLRenewalSchedule/,/^$/p' user.reg >> VLRenew.reg echo "\\"Enable\\"=\\"Y\\"" >> VLRenew.reg
POL_Wine regedit File.reg sleep 2
EOF
POL_Shortcut_InsertBeforeWine "Microsoft Word 2010" 'bash $POL_USER_ROOT/configurations/extra/Office 2010/Activation' POL_Shortcut_InsertBeforeWine "Microsoft Excel 2010" 'bash $POL_USER_ROOT/configurations/extra/Office 2010/Activation' POL_Shortcut_InsertBeforeWine "Microsoft PowerPoint 2010" 'bash $POL_USER_ROOT/configurations/extra/Office 2010/Activation' POL_Shortcut_InsertBeforeWine "Microsoft Outlook 2010" 'bash $POL_USER_ROOT/configurations/extra/Office 2010/Activation' POL_Shortcut_InsertBeforeWine "Microsoft OneNote 2010" 'bash $POL_USER_ROOT/configurations/extra/Office 2010/Activation'
POL_SetupWindow_Close
Greetings,
Robert. Edited by michsens
|
Quentin PÂRIS |
Sunday 24 June 2012 at 11:24
|
Quentin PÂRIS
|
Test and tell me if it is ok
|
michsens |
Monday 25 June 2012 at 14:07
|
michsens
|
Well, now I finished the script. Everythings worked for me. I also already added everything to the MS Office 2010 installation script. Here it is:
[code language=playonlinux]
#!/bin/bash # Author : Tinou
## CHANGELOG # (2012-05-05 - 14:45) Quentin PÂRIS - Wine version set to 1.5.3, Outlook 2010 compatiblity # (2012-05-05 - 15:05) Quentin PÂRIS # Check winbind presence on Linux, required to install # Adding gettext support # (2012-05-12 - 18:36) Quentin PÂRIS # Requires 4.0.18 # (2012-06-25 - 17:56) Robert Paulo # Adding activation procedure # Adding KMS activation
[ "$PLAYONLINUX" = "" ] && exit 0 source "$PLAYONLINUX/lib/sources"
PREFIX="Office2010" WINEVERSION="1.5.3" TITLE="Microsoft Office 2010"
shortcutWord="Microsoft Word 2010" shortcutExcel="Microsoft Excel 2010" shortcutPowerpoint="Microsoft Powerpoint 2010" shortcutOneNote="Microsoft OneNote 2010" shortcutOutlook="Microsoft Outlook 2010"
POL_GetSetupImages "http://files.playonlinux.com/resources/setups/Office/top.jpg" "http://files.playonlinux.com/resources/setups/Office/left.png" "$TITLE"
POL_SetupWindow_Init
POL_SetupWindow_presentation "$TITLE" "Microsoft" "http://www.microsoft.com" "Quentin PÂRIS" "$PREFIX"
POL_RequiredVersion 4.0.18 || POL_Debug_Fatal "$TITLE won't work with $APPLICATION_TITLE $VERSION\\nPlease update"
if [ "$POL_OS" = "Linux" ]; then wbinfo -V || POL_Debug_Fatal "Please install winbind before installing $TITLE" fi POL_Debug_Init POL_System_SetArch "x86" POL_Wine_SelectPrefix "$PREFIX"
if [ "$(POL_Wine_PrefixExists "$PREFIX")" == "True" ]; then POL_SetupWindow_menu "The default wineprefix already exists!!!\\n\\nWhat would you prefer to do?" "$TITLE" "Reinstall Microsoft Office 2010~~~Install Microsoft Office 2010 in new wineprefix~~~Activate installed Microsoft Office 2010" "~~~" performAction="$APP_ANSWER" else performAction="Install Microsoft Office 2010 in new wineprefix" fi
if [ "$performAction" != "Activate installed Microsoft Office 2010" ]; then
if [ "$performAction" == "Reinstall Microsoft Office 2010" ]; then POL_SetupWindow_question "Do you really want to delete wineprefix $PREFIX?\\n" "$TITLE" if [ "$APP_ANSWER" == "TRUE"]; then rm -Rf "$POL_USER_ROOT//wineprefix/$PREFIX/" fi fi
countVar=1 newPREFIX="$PREFIX""_""$countVar" while [ "$(POL_Wine_PrefixExists "$newPREFIX")" == "True" ]; do ((countVar++)) newPREFIX="$PREFIX""_""$countVar" done
if [ "$(POL_Wine_PrefixExists "$PREFIX")" == "True" ]; then shortcutWord="Microsoft Word 2010 - $countVar" shortcutExcel="Microsoft Excel 2010 - $countVar" shortcutPowerpoint="Microsoft Powerpoint 2010 - $countVar" shortcutOneNote="Microsoft OneNote 2010 - $countVar" shortcutOutlook="Microsoft Outlook 2010 - $countVar" fi
while [ "$(POL_Wine_PrefixExists "$PREFIX")" == "True" ]; do POL_SetupWindow_textbox "Insert name of new wineprefix!" "$TITLE" "$newPREFIX" PREFIX="$APP_ANSWER" POL_Wine_SelectPrefix "$PREFIX" done
POL_SetupWindow_message "Word=$shortcutWord\\nExcel=$shortcutExcel\\nPowerpoint=$shortcutPowerpoint\\nOneNote=$shortcutOneNote\\nOutlook=$shortcutOutlook" "$TITLE"
POL_Wine_PrefixCreate "$WINEVERSION" POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup.exe"
cd "$CDROM"
Set_OS win7
POL_Call POL_Install_dotnet20
POL_Wine_WaitBefore "$TITLE" cd "$CDROM" POL_Wine "setup.exe" POL_Wine_WaitExit "$TITLE" sleep 10
POL_Call POL_Install_msxml6 POL_Call POL_Function_OverrideDLL native riched20 msxml6 POL_Call POL_Function_OverrideDLL native,builtin urlmon
cd "$POL_USER_ROOT//wineprefix/$PREFIX/" # copy registry value from user.reg echo "[HKEY_USERS\\\\S-1-5-20\\\\Software\\\\Microsoft\\\\OfficeSoftwareProtectionPlatform]" > VLRenew.reg sed -n -e '/VLRenewalSchedule/,/^$/p' user.reg >> VLRenew.reg
POL_Shortcut "WINWORD.EXE" "$shortcutWord" POL_Shortcut "EXCEL.EXE" "$shortcutExcel" POL_Shortcut "POWERPNT.EXE" "$shortcutPowerpoint" POL_Shortcut "ONENOTE.EXE" "$shortcutOneNote" POL_Shortcut "OUTLOOK.EXE" "$shortcutOutlook"
POL_Shortcut_InsertBeforeWine "$shortcutWord" 'POL_Wine regedit $WINEPREFIX/VLRenew.reg ; sleep 1' POL_Shortcut_InsertBeforeWine "$shortcutExcel" 'POL_Wine regedit $WINEPREFIX/VLRenew.reg ; sleep 1' POL_Shortcut_InsertBeforeWine "$shortcutPowerpoint" 'POL_Wine regedit $WINEPREFIX/VLRenew.reg ; sleep 1' POL_Shortcut_InsertBeforeWine "$shortcutOneNote" 'POL_Wine regedit $WINEPREFIX/VLRenew.reg ; sleep 1' POL_Shortcut_InsertBeforeWine "$shortcutOutlook" 'POL_Wine regedit $WINEPREFIX/VLRenew.reg ; sleep 1'
POL_Extension_Write doc "$shortcutWord" POL_Extension_Write docx "$shortcutWord" POL_Extension_Write xls "$shortcutExcel" POL_Extension_Write xlsx "$shortcutExcel" POL_Extension_Write ppt "$shortcutPowerpoint" POL_Extension_Write pptx "$shortcutPowerpoint"
POL_SetupWindow_message "$(eval_gettext '$TITLE has been installed successfully\\n\\nIf an installation Windows prevent your programs from running, you must remove and reinstall $TITLE')" "$TITLE"
POL_SetupWindow_question "Do you want to activate your MS Office 2010?\\n\\nYou can also skip this step and activate MS Office 2010\\nlater by restarting this script." "$TITLE" [ "$APP_ANSWER" == "TRUE" ] && activateMSOffice="TRUE" else activateMSOffice="TRUE" fi
if [ "$activateMSOffice" == "TRUE" ]; then listOfWinePrefixes="$(echo $(ls -1F "$POL_USER_ROOT//wineprefix/" | sed -e '/[^\\/]$/d') | sed -e 's/\\/\\s*/\\//g')" while [ ! -e "$POL_USER_ROOT//wineprefix/$PREFIX/" ]; do POL_SetupWindow_menu "Please select wineprefix of MS Office 2010 installation?" "$TITLE" "$listOfWinePrefixes" "/" PREFIX="$APP_ANSWER" done POL_Wine_SelectPrefix "$PREFIX" POL_SetupWindow_menu "Which type of activation?" "$TITLE" "Volume Activation (KMS)~Skip activation" "~" if [ "$APP_ANSWER" == "Volume Activation (KMS)" ]; then dataCorrect="FALSE" while [ "$dataCorrect" != "TRUE" ]; do licenseServerName="" POL_SetupWindow_textbox "Insert address of license server!" "$TITLE" licenseServerName=$APP_ANSWER POL_SetupWindow_textbox "Insert port of license server!" "$TITLE" licenseServerPort=$APP_ANSWER
POL_SetupWindow_question "Are the data for the license server correct?\\nCan these values be added to the registry?\\n\\nLicense server name: $licenseServerName\\nLicense server port: $licenseServerPort" "$TITLE" dataCorrect=$APP_ANSWER done cd "$POL_USER_ROOT//wineprefix/$PREFIX/" # copy registry value from user.reg echo "[HKEY_LOCAL_MACHINE\\\\Software\\\\Microsoft\\\\OfficeSoftwareProtectionPlatform]" > VLKMSServ.reg echo "\\"KeyManagementServiceName\\"=\\"$licenseServerName\\"" >> VLKMSServ.reg echo "\\"KeyManagementServicePort\\"=\\"$licenseServerPort\\"" >> VLKMSServ.reg
POL_Wine regedit VLKMSServ.reg sleep 2 rm VLKMSServ.reg elif [ "$APP_ANSWER" == "Volume Activation (MAK)" ]; then echo fi
POL_SetupWindow_message "$(eval_gettext '$TITLE should be activated now $TITLE')" "$TITLE"
else echo fi
POL_SetupWindow_Close exit
[/code]
Please check out wether it works for you, too.
Greetings. Edited by michsens
|
Quentin PÂRIS |
Monday 25 June 2012 at 14:17
|
Quentin PÂRIS
|
I would prefer the following things instead of the initial menu: - If Microsoft Office 2010 is already installed : ask for activation (don't propose to install it, anyway it won't work if the virtual drive exists, but maybe we could propose to uninstall it and reinstall it) - If Microsoft Office 2010 is not installed : Install it and ask for activation at the end I think it's more user-friendly Anyway thank you :-) Edited by Tinou
|
michsens |
Monday 25 June 2012 at 15:20
|
michsens
|
|
michsens |
Monday 25 June 2012 at 18:18
|
michsens
|
I changed the above script. What do you think? Edited by michsens
|
michsens |
Tuesday 26 June 2012 at 8:33
|
michsens
|
Last changes due errors with shortcutnames were addad above.
|
Quentin PÂRIS |
Tuesday 26 June 2012 at 13:06
|
Quentin PÂRIS
|
What is
else echo fi
for?
|
michsens |
Tuesday 26 June 2012 at 13:36
|
michsens
|
I added this at the beginning for optionally giving an alternative. At the end I did not need it. So "else" and "echo" can be deleted easily.
I also have a question. The "$@" in the shortcut can not be replaced as a normal variable, i.e. "PARAMETER"? Then you would have more opportunities of manipulating this variable with "POL_Shortcut_InsertBeforeWine".
Before POL_Wine starts the executable I would like to insert:
POL_Shortcut_InsertBeforeWine "$shortcutWord" 'PARAMETER="" ; [ -n "$@" ] && PARAMETER="z:""${@//\\//\\\\}"'
But then I get a problem since
POL_Wine "WINWORD.EXE" "$@"
would not work with the new variable.
For this I have to add:
POL_Shortcut_InsertBeforeWine "$shortcutWord" 'POL_Wine "WINWORD.EXE" "$PARAMETER" ; exit'
But this is not very elegant.
Is there an other way?
|
Quentin PÂRIS |
Tuesday 26 June 2012 at 13:49
|
Quentin PÂRIS
|
No, we do not accept this kind of dirty hack (POL_Shortcut_InsertBeforeWine "$shortcutWord" 'PARAMETER="" ; [ -n "$@" ] && PARAMETER="z:""${@//\\//\\\\}"')
PlayOnLinux has its own system to manage file extensions, you must use it : just run playonlinux file.docx and it works
|
michsens |
Tuesday 26 June 2012 at 14:15
|
michsens
|
Thanks for the hint. I had no clue that there is such a nice solution. Sorry.
|
Quentin PÂRIS |
Tuesday 26 June 2012 at 15:38
|
Quentin PÂRIS
|
Ok, few things :
- I don't like the idea to propose user to install twice Office 2010 in different prefix. It could confuse him so we will forget that. - All english text must use eval_gettext method
- The following code is very dirty and likely to bug :
echo "[HKEY_USERS\\\\S-1-5-20\\\\Software\\\\Microsoft\\\\OfficeSoftwareProtectionPlatform]" > VLRenew.reg sed -n -e '/VLRenewalSchedule/,/^$/p' user.reg >> VLRenew.reg
Why not making a .reg file and applying it?
|