Monday, March 30, 2015

Quite impressive way to change configuration file settings, sed -i

sed -i - this is magic command which can be used to swap setting in configuration file.

Since i know this command i have to remaster such post as Raspberry Pi as torrent downloading machine

For example i have these two lines:
cp ~/.config/deluge/{core.conf,core.conf.1}
cat ~/.config/deluge/core.conf.1 | sed -re s/\"allow_remote\"\:\ false,/\"allow_remote\"\:\ true,/ > ~/.config/deluge/core.conf
The first line is creating a backup file which will be used in next command as source file.
In second line it will replace some content from source file and put the result to the original file:
I thought this was the quickest way to get result but i was wrong.

The quickest way is to use sed -i instead of those two lines
sed -rei s/\"allow_remote\"\:\ false,/\"allow_remote\"\:\ true,/ ~/.config/deluge/core.conf
The idea in example above is to replace "allow_remote": false, with "allow_remote": true,!
sed -r just allow to define symbols in a special way:
double quotes - \"
colon - \:
space character- \

There are another must have information related to sed -i and that is ^.* and .*$.
^.* stands for pattern from begining of line + none or more characters.
.*$ stands for pattern which match none or some character till end of line.

Let's create some example file example.cfg which will contain:
# option1=true
option2=false
#option3=yes
First example will take option2 and change value false to true
sed -i "s/^.*option2=false/option2=true/" example.cfg
Output will be
# option1=true
option2=true
#option3=yes
Let's change the option2 to inactive:
sed -i "s/^.*option2/#option2/" example.cfg
The output will be
# option1=true
#option2=true
#option3=yes
In last example let's change option3 to active and force the value to no.
sed -i "s/^.*option3.*$/option3=no/" example.cfg
The command above do not care what value option3 already has.
It will just change option3 to no and set it active.

Output will be:
# option1=true
#option2=true
option3=no

Sunday, March 29, 2015

Thursday, March 26, 2015

Remove [Windows Driver Package] entries under installed programs

dpinst_x86.exe and dpinst_x64.exe is utilities which can be used to automatically install drivers for device which currently exists on computer. These two binaries by default read configuration settings from DPinst.xml file.

This can be recommended driver install configuration file:
DPinst.xml
<?xml version="1.0" ?>
<dpinst>

<search>
<subDirectory>*</subDirectory>
</search>
<enableNotListedLanguages/>
<suppressEulaPage/>
<suppressAddRemovePrograms/>
<quietInstall/>

<!-- Only install drivers for online hardware -->
<scanHardware/>

<!-- No driver signature required -->
<legacyMode/>

</dpinst>
However if you miss <suppressAddRemovePrograms/> parameter then you have lot of entries under add remove programs. Easy way how to remove installed drivers is to analise C:\Windows\DPINST.LOG file. There are lines such as:
INFO:   Created entry in Add or Remove Programs for 'C:\Windows\System32\DriverStore\FileRepository\netrtwlanu.inf_amd64_neutral_2014603ebe8897cd\netrtwlanu.inf'.
Based on these lines it is possible to remove these entries.
At first we strike out unnecessary content from begining and end with this command:
sed "s/^.*FileRepository\\//g;s/inf\d039.*$/inf/g;"
The result will be
INFO:   Created entry in Add or Remove Programs for 'C:\Windows\System32\DriverStore\FileRepository\netrtwlanu.inf_amd64_neutral_2014603ebe8897cd\netrtwlanu.inf'.
Based on this result we search under registry UninstallString

It is possible to remove these antries based on log with:
remove-windows-driver-package-based-on-log.cmd
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
for /f "tokens=*" %%l in ('type "%systemroot%\DPINST.LOG" ^|
grep "Created entry in Add or Remove Programs for" ^|
sed "s/^.*FileRepository\\//g;s/inf\d039.*$/inf/g;"') do (
for /f "tokens=*" %%a in ('^
reg query "%sw%\%u%" /s ^|
grep "Windows.*CurrentVersion.*Uninstall" ^|
sed "s/.*\\Uninstall\\//g"') do (
reg query "%sw%\%u%\%%a" /v UninstallString > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%u%\%%a" /v UninstallString | find "%%l" > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%u%\%%a" /v DisplayName |^
grep "Windows Driver Package" |^
sed "s/^.*Package - //g;"
reg delete "%sw%\%u%\%%a" /f
)
)
)
)
endlocal
pause
Or you can just remove based on name which contains "Windows Driver Package".
remove-windows-driver-package-based-on-name.cmd
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
for /f "tokens=*" %%a in ('^
reg query "%sw%\%u%" /s ^|
grep "Windows.*CurrentVersion.*Uninstall" ^|
sed "s/.*\\Uninstall\\//g"') do (
reg query "%sw%\%u%\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%u%\%%a" /v DisplayName |^
find "Windows Driver Package" > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%u%\%%a" /v DisplayName |^
grep "Windows Driver Package" |^
sed "s/^.*Package - //g;"
reg delete "%sw%\%u%\%%a" /f
)
)
)
endlocal
pause
All batch files to work needs:
http://gnu.catonrug.net/grep.exe
http://gnu.catonrug.net/sed.exe
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/regex2.dll

Related:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff553383%28v=vs.85%29.aspx

Sunday, March 22, 2015

RetroPie, PSX, L2, R2, EmulationStation, Raspberry Pi 2


PlayStation 1 console is one of my biggest childhood memories.
Raspberry Pi 2 and EmulationStation solution is good as long as you can live with 320x240 resolusion of the game ;)
The audio quality is almost perfect if the BIOS file is used.

To create a RetroPie station you have to push RetroPie image to micro SD card and use it in your Raspberry Pi 2:

I use scph1001.bin BIOS file which is needed to be copied to /home/pi/RetroPie/BIOS
b9d9a0286c33dc6b7237bb13cd46fdee
8d5de56a79954f29e9006929ba3fed9b6a418c1d

To play some games you have to convert cd image to .bin format and copy this file to:
/home/pi/RetroPi/roms/psx
The main problem to work with PlayStation emulator is L2 and R2 button configuration.

To configure L2 and R2 buttons exit EmulationStation

Move to directory:
cd /opt/retropie/emulators/retroarch
Execute joypad configuration utility:
sudo ./retroarch-joyconfig | grep "index\|l2\|r2"> /opt/retropie/configs/psx/retroarch.cfg
grep "index\|l2\|r2" will just add missing buttons.

If you have jostick with analog option then use:
sudo ./retroarch-joyconfig > /opt/retropie/configs/psx/retroarch.cfg
At the end whole config file has only three lines. It includes only joypad index and two buttons.
This config will be used as an addition rules just for PSX emulation.
input_player1_joypad_index = "0"
input_player1_l2_btn = "6"
input_player1_r2_btn = "7"
All other basic configuration for playstation controller are taken from default config:
/opt/retropie/configs/all/retroarch.cfg
To add second joystick I increase joypad_index and write player2 instead of player1:
pi@retropie ~ $ cat /opt/retropie/configs/psx/retroarch.cfg
input_player1_joypad_index = "0"
input_player1_l2_btn = "6"
input_player1_r2_btn = "7"
input_player2_joypad_index = "1"
input_player2_l2_btn = "6"
input_player2_r2_btn = "7"
Now all buttons can be used!

Check for latest RetroPie version at:
http://blog.petrockblock.com/retropie/retropie-downloads/

RetroPie image v2.6.0 for Raspberry Pi 1
4b656de2dbd2c2bc693fd9fb64ed8a1d
1c8e49c26337d2ab173e33d01bc969fe97551f1c

RetroPie image v2.6.0 for Raspberry Pi 2
c86e6c11e9e14a8221fd5c8b6f8aa596
7fc44fc18af4c3b3e089507e1bfbea00ff9e0d60

Thursday, March 19, 2015

Windows Movie Maker silent install and uninstall


Windows Movie Maker is included in Windows Essentials 2012 package.

Here comes offline installer:
http://g.live.com/1rewlive5-all/en/wlsetup-all.exe
906689a666d3d9ab4cc951ed6354d0b1
14e848bd6b69c4c94c65dd87c1cf70bf8f00992d

Windows Movie Maker and Photo Gallery can not be separated.
You need to install both of them to work with movie maker.

To install Movie Maker silently use this command:
"%~dp0wlsetup-all.exe" /AppSelect:MovieMaker /NoHomepage /NoLaunch /NoSearch /NoMU /NoCEIP /NoToolbarCEIP /Silent
To unisnstall all Windows Essential products including Movie Maker use:
"%ProgramFiles(x86)%\Windows Live\Installer\wlarp.exe" /Cleanup:All /q
When the Movie maker is installed the first annoying screen is EULA screen:

This screen can be removed by adding to user logon script:
reg add "HKCU\Software\Microsoft\Windows Live\Common" /v TOUVersion /t REG_SZ /d "16.0.0.0" /f
First time you open Photo Galery the application will ask you generously to sign in:
You can skip this procees by adding to user logon script:
reg add "HKCU\Software\Microsoft\Windows Live\Photo Gallery" /v SignInRemindersLeft /t REG_DWORD /d 0 /f
All offline installers for Windows Essential 2012
Arabic http://g.live.com/1rewlive5-all/ar/wlsetup-all.exe
Bulgarian http://g.live.com/1rewlive5-all/bg/wlsetup-all.exe
Catalan http://g.live.com/1rewlive5-all/ca/wlsetup-all.exe
Czech http://g.live.com/1rewlive5-all/cs/wlsetup-all.exe
Danish http://g.live.com/1rewlive5-all/da/wlsetup-all.exe
German http://g.live.com/1rewlive5-all/de/wlsetup-all.exe
Greek http://g.live.com/1rewlive5-all/el/wlsetup-all.exe
English http://g.live.com/1rewlive5-all/en/wlsetup-all.exe
Spanish http://g.live.com/1rewlive5-all/es/wlsetup-all.exe
Estonian http://g.live.com/1rewlive5-all/et/wlsetup-all.exe
Basque http://g.live.com/1rewlive5-all/eu/wlsetup-all.exe
Finnish http://g.live.com/1rewlive5-all/fi/wlsetup-all.exe
French http://g.live.com/1rewlive5-all/fr/wlsetup-all.exe
Gujarati http://g.live.com/1rewlive5-all/gu/wlsetup-all.exe
Hebrew http://g.live.com/1rewlive5-all/he/wlsetup-all.exe
Hindi http://g.live.com/1rewlive5-all/hi/wlsetup-all.exe
Croatian http://g.live.com/1rewlive5-all/hr/wlsetup-all.exe
Hungarian http://g.live.com/1rewlive5-all/hu/wlsetup-all.exe
Indonesian http://g.live.com/1rewlive5-all/id/wlsetup-all.exe
Italian http://g.live.com/1rewlive5-all/it/wlsetup-all.exe
Japanese http://g.live.com/1rewlive5-all/ja/wlsetup-all.exe
Canada http://g.live.com/1rewlive5-all/kn/wlsetup-all.exe
Korean http://g.live.com/1rewlive5-all/ko/wlsetup-all.exe
Lithuanian http://g.live.com/1rewlive5-all/lt/wlsetup-all.exe
Latvian http://g.live.com/1rewlive5-all/lv/wlsetup-all.exe
Malayalam http://g.live.com/1rewlive5-all/ml-in/wlsetup-all.exe
Marathi http://g.live.com/1rewlive5-all/mr/wlsetup-all.exe
Malay http://g.live.com/1rewlive5-all/ms/wlsetup-all.exe
Dutch http://g.live.com/1rewlive5-all/nl/wlsetup-all.exe
Norwegian (Bokmal) http://g.live.com/1rewlive5-all/no/wlsetup-all.exe
Polish http://g.live.com/1rewlive5-all/pl/wlsetup-all.exe
Portuguese (Brazil) http://g.live.com/1rewlive5-all/pt-br/wlsetup-all.exe
Portuguese (Portugal) http://g.live.com/1rewlive5-all/pt-pt/wlsetup-all.exe
Romanian http://g.live.com/1rewlive5-all/ro/wlsetup-all.exe
Russian http://g.live.com/1rewlive5-all/ru/wlsetup-all.exe
Slovak http://g.live.com/1rewlive5-all/sk/wlsetup-all.exe
Slovenian http://g.live.com/1rewlive5-all/sl/wlsetup-all.exe
Serbian-Cyrillic http://g.live.com/1rewlive5-all/sr-cyrl-cs/wlsetup-all.exe
Serbian-Latin http://g.live.com/1rewlive5-all/sr-latn-cs/wlsetup-all.exe
Swedish http://g.live.com/1rewlive5-all/sv/wlsetup-all.exe
Tamil http://g.live.com/1rewlive5-all/ta/wlsetup-all.exe
Telugu http://g.live.com/1rewlive5-all/te/wlsetup-all.exe
Thai http://g.live.com/1rewlive5-all/th/wlsetup-all.exe
Turkish http://g.live.com/1rewlive5-all/tr/wlsetup-all.exe
Ukrainian http://g.live.com/1rewlive5-all/uk/wlsetup-all.exe
Vietnamese http://g.live.com/1rewlive5-all/vi/wlsetup-all.exe
Chinese (Simplified) http://g.live.com/1rewlive5-all/zh-cn/wlsetup-all.exe
Chinese (Traditional) http://g.live.com/1rewlive5-all/zh-tw/wlsetup-all.exe

Wednesday, March 18, 2015

Free QuizMaker silent install, uninstall


fqm-silent-install.cmd
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k={829BBFCB-DC13-4C3A-8681-F44E54BBD2F5}
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
%systemroot%\System32\msiexec.exe /i "%~dp0free_quizmaker_6_2_0.msi" /qb
) else echo FreeQuiz Maker already installed!
endlocal
fqm-silent-uninstall.cmd
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k={829BBFCB-DC13-4C3A-8681-F44E54BBD2F5}
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if !errorlevel!==0 (
%systemroot%\System32\msiexec.exe /X "%~dp0free_quizmaker_6_2_0.msi" /qb
) else echo FreeQuiz Maker already uninstalled!
endlocal
Source file:
http://cdn2.ispringsolutions.com/download/free_quizmaker_6_2_0.msi
de1551aff700ce45b3aa30ba8d35faf8
3356d9320c99571ed82c2834c7d701730c9cdf2b

Home page:
http://www.ispringsolutions.com/free-quiz-maker

Monday, March 16, 2015

Format SD card from windows, colorful tutorial for girlfriend

My girlfriend wants to use my SD card with photo camera.
Not luckily for her the SD card has Raspbian operating system installed in. It has only 56mb of fat32 system.

Solution is delete all partitions and create one big and fat partition.

At first it is necessary to install Partition Wizard.
Downlod the link below and install it with Next, Next, Finish:
https://googledrive.com/host/0BxmEiwnrWfmmS0VTZ1NHZzNNWjA/pwfree9.exe

Open Partition Wizard by typing in search "partition wizard"

Click on big "MiniTool Partition Wizard Free" icon:

Note all existing partitions:

Plug in your USB flash drive, click refresh. Select your new disk and delete all partitions.

Apply your selection:

And the last step is to select unallocated space on your flash drive and create new primary fat32 partition:
Folow numbers 1., 2., 3., 4., 5., 6.:

Hit the apply button and close partition wizard application.

Change windows wallpaper, command line

Download:
http://sg20.com/wallpaperchanger/wallpaperchanger.zip
bac1b8e6c9661fb26c81dee11c556e2d
8b7388425728601916208dbe94703d4ecedf1dd3

Extract WallpaperChanger.exe to
C:\Windows\
Example of usage:
WallpaperChanger C:\Windows\Web\Wallpaper\Theme2\img12.jpg 1
Meaning of extra number:
    0 for Tiled
    1 for Centered
    2 for Stretched
    3 for Fit (Windows 7 or later)
    4 for Fill (Windows 7 or later)
Source:
http://sg20.com/techblog/2011/06/23/wallpaper-changer-command-line-utility/

Mirror of WallpaperChanger.exe:
https://googledrive.com/host/0BxmEiwnrWfmmRmdCQl9iRkZxNHM
206bb1ad8931622edcf165f2844f30f8
67875161c1f5877282ade5fd2f19489ddae20077

Sunday, March 15, 2015

Thursday, March 12, 2015

Received value [Permission denied] is not suitable for value type


In this example i have defined item which are supposed to retrieve numeric value.
It is good to also try out text type to see if zabbix agent can realy send the value to zabbix server:

If you success to retrieve text value with statuss in zabbix server then you can keep reading..

To solve the case with "Permission denied" at first you need to try execute same command in linux terminal with zabbix user. This is necessary cause zabbix agent underneath the hood execute all command with zabbix user.

To do it so navigate to zabbix user shell with
su - zabbix --shell=/bin/bash
If you recieve:

su: warning: cannot change directory to /var/lib/zabbix: No such file or directory

then with root permissions execute:
mkdir /var/lib/zabbix && chown zabbix /var/lib/zabbix && chgrp zabbix /var/lib/zabbix
Now inside the zabbix user shell test the command defined in zabbix server:
cat /var/log/squid/access.log | wc -l
If you success this step then celebrate!

You can exit from "zabbix" user shell with exit

Next you should need to temporary turn off SE Linux policy. This can be done with command:
setenforce 0
Now wait a few minutes. Re-create item in zabbix server.
Wait five minutes or so. The error of returned item value should be gone.
Returned value now should be correct and usable.

If the returned value are still not usable then you can stop reading this article.

If you completely see the success then this is a sign that SE Linux policy is blocking some commands from zabbix user/agent/servise.

To solve this situation in right way you need to turn on SE linux security:
setenforce 1
Now let zabbix agent execute the command few times. Wait a few minutes.
This will let selinux policy to capture blocked commands.

Save all restricted zabbix policies to a file/profile
grep zabbix /var/log/audit/audit.log | audit2allow -M zabbix.policies
Install blocked policies. Add .pp to previsous file name
semodule -i zabbix.policies.pp
Sometimes you need to do these steps multiple times to capture again bloced policies cause in second or third time it may show completely another commands.
Check for current selinux status with
audit2allow -a
Watch the lines after #============= zabbix_agent_t ==============
By defalt it only includes:
#!!!! This avc is allowed in the current policy
allow zabbix_agent_t proc_net_t:file { read getattr open };
allow zabbix_agent_t var_t:file read;
After some upgrades it can contain whole bunch of stuff:
#============= zabbix_agent_t ==============

#!!!! This avc is allowed in the current policy
allow zabbix_agent_t ldap_port_t:tcp_socket name_connect;

#!!!! This avc is allowed in the current policy
allow zabbix_agent_t proc_net_t:file { read getattr open };

#!!!! This avc is allowed in the current policy
allow zabbix_agent_t self:capability audit_write;

#!!!! This avc is allowed in the current policy
allow zabbix_agent_t self:netlink_audit_socket { nlmsg_relay create };

#!!!! This avc is allowed in the current policy
allow zabbix_agent_t sudo_exec_t:file { execute execute_no_trans };

#!!!! This avc is allowed in the current policy
allow zabbix_agent_t var_t:file { read open };
By default there is one or two exeptions.
Ofter installing some "zabbix" policies there should be six or more exeptions.

For troubleshooting please remember to look at
/var/log/zabbix/zabbix.log

Tuesday, March 10, 2015

Install kb2533552, kb2952664 in first run script

KB2533552 and KB2952664 is legendary updates that can not be slipstreamed in offline mode.
Now i will create flexible workaround how to install these updates in "First Run" script.

I downloaded these updates using Internet Explorer and this site:
http://catalog.update.microsoft.com/v7/site/Home.aspx

All default directory names has been keeped!

Here is my disk structure:
additional file sources\$OEM$\$$\Setup\Scripts\FirstRun.cmd which contains:
for %%i in (b c d e f g h i j k l m n o p q r s t u v w x y z) do (
if exist %%i:\FirstRun\FirstRun.bat %%i:\FirstRun\FirstRun.bat
)
autounattend.xml which contains:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        
 <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SetupUILanguage>
                <UILanguage>en-US</UILanguage>
            </SetupUILanguage>
            <InputLocale>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UserLocale>en-US</UserLocale>
        </component>
  
 <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SetupUILanguage>
                <UILanguage>en-US</UILanguage>
            </SetupUILanguage>
            <InputLocale>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UserLocale>en-US</UserLocale>
        </component>
  
        <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <DiskConfiguration>
                <Disk wcm:action="modify">
                    <CreatePartitions>
                        <CreatePartition wcm:action="modify">
                            <Order>1</Order>
                            <Type>Primary</Type>
                            <Size>24576</Size>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="modify">
                            <Active>true</Active>
                            <Format>NTFS</Format>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                            <Extend>false</Extend>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/NAME</Key>
                            <Value>Windows 7 PROFESSIONAL</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>
            <UserData>
                <AcceptEula>true</AcceptEula>
                <FullName></FullName>
                <Organization></Organization>
                <ProductKey>
                    <WillShowUI>OnError</WillShowUI>
                    <Key>HYF8J-CVRMY-CM74G-RPHKF-PW487</Key>
                </ProductKey>
            </UserData>
        </component>
  
 <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <DiskConfiguration>
                <Disk wcm:action="modify">
                    <CreatePartitions>
                        <CreatePartition wcm:action="modify">
                            <Order>1</Order>
                            <Type>Primary</Type>
                            <Size>24576</Size>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="modify">
                            <Active>true</Active>
                            <Format>NTFS</Format>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                            <Extend>false</Extend>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/NAME</Key>
                            <Value>Windows 7 PROFESSIONAL</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>
            <UserData>
                <AcceptEula>true</AcceptEula>
                <FullName></FullName>
                <Organization></Organization>
                <ProductKey>
                    <WillShowUI>OnError</WillShowUI>
                    <Key>HYF8J-CVRMY-CM74G-RPHKF-PW487</Key>
                </ProductKey>
            </UserData>
        </component>  
  
    </settings>
 
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <RegisteredOrganization></RegisteredOrganization>
            <TimeZone>Pacific Standard Time</TimeZone>
            <RegisteredOwner></RegisteredOwner>
            <AutoLogon>
                <Password>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </Password>
                <Username>administrator</Username>
                <LogonCount>3</LogonCount>
                <Enabled>true</Enabled>
            </AutoLogon>
            <ProductKey>HYF8J-CVRMY-CM74G-RPHKF-PW487</ProductKey>
            <ComputerName />
        </component>
  
 <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <RegisteredOrganization></RegisteredOrganization>
            <TimeZone>Pacific Standard Time</TimeZone>
            <RegisteredOwner></RegisteredOwner>
            <AutoLogon>
                <Password>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </Password>
                <Username>administrator</Username>
                <LogonCount>3</LogonCount>
                <Enabled>true</Enabled>
            </AutoLogon>
            <ProductKey>HYF8J-CVRMY-CM74G-RPHKF-PW487</ProductKey>
            <ComputerName />
        </component>
  
    </settings>
 
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <OOBE>
                <ProtectYourPC>1</ProtectYourPC>
                <NetworkLocation>Work</NetworkLocation>
            </OOBE>
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value></Value>
                            <PlainText>true</PlainText>
                        </Password>
                        <Name>administrator</Name>
                        <Group>Administrators</Group>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <AutoLogon>
                <Enabled>true</Enabled>
                <Username>Administrator</Username>
                <LogonCount>3</LogonCount>
            </AutoLogon>
            <RegisteredOrganization></RegisteredOrganization>
            <RegisteredOwner></RegisteredOwner>
   <FirstLogonCommands>
            <SynchronousCommand wcm:action="add">
            <Order>1</Order>
            <Description>Run FirstRun.cmd</Description>
            <CommandLine>%WINDIR%\Setup\Scripts\FirstRun.cmd</CommandLine>
            </SynchronousCommand>
   </FirstLogonCommands>
        </component>
  
 <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <OOBE>
                <ProtectYourPC>1</ProtectYourPC>
                <NetworkLocation>Work</NetworkLocation>
            </OOBE>
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value></Value>
                            <PlainText>true</PlainText>
                        </Password>
                        <Name>administrator</Name>
                        <Group>Administrators</Group>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <AutoLogon>
                <Enabled>true</Enabled>
                <Username>Administrator</Username>
                <LogonCount>3</LogonCount>
            </AutoLogon>
            <RegisteredOrganization></RegisteredOrganization>
            <RegisteredOwner></RegisteredOwner>
   <FirstLogonCommands>
            <SynchronousCommand wcm:action="add">
            <Order>1</Order>
            <Description>Run FirstRun.cmd</Description>
            <CommandLine>%WINDIR%\Setup\Scripts\FirstRun.cmd</CommandLine>
            </SynchronousCommand>
   </FirstLogonCommands>
        </component>  
  
    </settings>
</unattend>
All updates are placed in x86 or x64 directories:
FirstRun\x64\Update for Windows 7 for x64-based Systems (KB2533552)\AMD64-all-windows6.1-kb2533552-x64_0ba5ac38d4e1c9588a1e53ad390d23c1e4ecd04d.msu
FirstRun\x64\Update for Windows 7 for x64-based Systems (KB2952664)\AMD64_X86-all-windows6.1-kb2952664-v8-x64_88cdf9d5b51ac2c6ae6c377511fb92389091a47d.msu
FirstRun\x86\Update for Windows 7 (KB2533552)\X86-all-windows6.1-kb2533552-x86_f2061d1c40b34f88efbe55adf6803d278aa67064.msu
FirstRun\x86\Update for Windows 7 (KB2952664)\AMD64_X86-all-windows6.1-kb2952664-v8-x86_e1e872129192cffdaeb97616f2fa42828211c9f7.msu
And additionl libraries:
http://gnu.catonrug.net/gnusort.exe
http://gnu.catonrug.net/grep.exe
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/regex2.dll
http://gnu.catonrug.net/sed.exe

Place is here:
FirstRun\gnusort.exe
FirstRun\grep.exe
FirstRun\libiconv2.dll
FirstRun\libintl3.dll
FirstRun\regex2.dll
FirstRun\sed.exe
And finally the script which do all the job:
FirstRun\FirstRun.bat
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
if not "%ProgramFiles(x86)%"=="" (
set u=%~dp0x64
) else set u=%~dp0x86
echo sorting updates..
for /f "tokens=*" %%i in ('^
dir /b "%u%" ^|
sed "s/^.*KB\|^.*kb//g;s/).*$//g" ^|
sed "s/[ \t]*$//" ^|
gnusort -n ^|
sed "/^$/d"') do (
for /f "tokens=*" %%d in ('dir /b "%u%" ^| grep "%%i"') do (
echo installing KB%%i
for /f "tokens=*" %%z in ('dir /b "%u%\%%d\*.msu" "%u%\%%d\*.exe"') do (
echo %%z | grep "\.exe" > nul 2>&1
if !errorlevel!==0 start /wait "" "%u%\%%d\%%z" /passive /norestart
if not !errorlevel!==0 echo %%z returns !errorlevel!
echo %%z | grep "\.msu" > nul 2>&1
if !errorlevel!==0 %systemroot%\system32\wusa.exe "%u%\%%d\%%z" /quiet /norestart
if not !errorlevel!==0 echo %%z returns !errorlevel!
)
)
)
endlocal

%systemroot%\system32\shutdown.exe -r -t 0 -f
When the kb2952664 is installed due this script it does NOT return error code 0 which is bad.
I gues the reason is that computer restart is needed.

After restart the booth updates seems to be installed. :)

Sunday, March 8, 2015

Thursday, March 5, 2015

Install .NET 3.5 for Windows 8.1 (offline mode)

Take you Windows 8.1 iso file and open with WinRAR.

Go to sources direcotry and extect sxs to c:\

Open Command prompt in "Run as Administrator" mode

Launch the command:
dism /online /enable-feature /featurename:NetFX3 /All /Source:c:\sxs /LimitAccess

Now you have .NET 3.5 installed on your Windows 8.1

Sunday, March 1, 2015

Blog Archive