Thursday, January 29, 2015

Remove Windows 8.1 Enterprise Evaluation watermark

This tutorial has been tested just on these Windows 8.1 Enterprise iso images.

At first you have to Take Ownership of these files:
%windir%\Branding\Basebrd\en-US\basebrd.dll.mui
%windir%\System32\en-US\shell32.dll.mui
Install Recource Hacker from:
http://www.angusj.com/resourcehacker/

Versions 3.6 setup file checksum:
a513eacd766673290f1204f467590b7c
bf461d7f5978336ce52b76ec55b53a61bdc68a59

Open Recource Hacker in "Run as administrator" mode:

Open
%windir%\Branding\Basebrd\en-US\basebrd.dll.mui
1. Go for String Table -> 1 -> 1033
2. Replace "Windows 8.1 Enterprise Evaluation" with " " (one space)
3. Click "Compile Script"
Replace text Windows 8.1 Enterprise Evaluation with one space
Remember to save the file with "File -> Save"!

Now open
%windir%\System32\en-US\shell32.dll.mui
Search 2070 under String Table
Replace %ws Build %ws and Windows License valid for %d %ws with one space!
Click "Compile Script"
Remember to save the file with "File -> Save"!

Now open Windows Command Prompt in "Run As Administrator" mode and type:
mcbuilder
This command usually takes 5-10 seconds.
Restart computer and the watermark is gone :)

Troubleshooting:
In case if you cannot overwrite shell32.dll.mui you have to run mcbuilder.
Restart computer and then try again.

Install [Take Ownership] menu, command line

Right mouse click -> Take Ownership

To install this option open command prompt in "Run As Administrator" mode:
Go for Start -%gt; All Programs -> Accessories. Right click on Command Prompt and select Run As Administrator

Paste these commnads:
reg add "HKCR\*\shell\runas" /ve /t REG_SZ /d "Take Ownership" /f
reg add "HKCR\*\shell\runas" /v NoWorkingDirectory /t REG_SZ /d "" /f
reg add "HKCR\*\shell\runas\command" /v IsolatedCommand /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f
reg add "HKCR\*\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f
reg add "HKCR\Directory\shell\runas" /ve /t REG_SZ /d "Take Ownership" /f
reg add "HKCR\Directory\shell\runas" /v NoWorkingDirectory /t REG_SZ /d "" /f
reg add "HKCR\Directory\shell\runas\command" /v IsolatedCommand /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f
reg add "HKCR\Directory\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f
To remove this customization paste these commands:
reg delete "HKCR\*\shell\runas" /f
reg delete "HKCR\Directory\shell\runas" /f

Monday, January 26, 2015

MySQL select last hour, count entries in database

It is possible to count entries without wc commnad. Just use count(*):
mysql -h hostname -u mysqlusername -p -P 3306 -s <<< \
'SELECT count(*) FROM databasename.logs \
where `createDate`>=DATE_SUB(NOW(),INTERVAL 60 MINUTE) and \
`statuss`=8 and `function`="ThisIsGonnaBeLegendary"' | wc -l
But if there are not entries at all then no number will be returned and it is bad for zabbix cause it always wait to recieve some decimal value. It is better to use with wc -l

mysql -h hostname -u mysqlusername -p -P 3306 -s <<< \
'SELECT CreateDate FROM databasename.logs \
where `createDate`>=DATE_SUB(NOW(),INTERVAL 60 MINUTE) and \
`statuss`=8 and `function`="ThisIsGonnaBeLegendary"' | wc -l
You can use INTERVAL 1 HOUR instead of INTERVAL 60 MINUTE

It is possibe to use variables in zabbix
EnableRemoteCommands=1
UserParameter=CountStatussMethod[*],mysql -h hostname -u mysqlusername -p -P 3306 -s <<< 'SELECT CreateDate FROM databasename.logs where `createDate`>=DATE_SUB(NOW(),INTERVAL $3 MINUTE) and `statuss`=$1 and `function`="$2"' | wc -l
$1 - number which stands for status code
"$2" - string - the name of function
$3 - number - how much minutes?

Item configuration at server side:

And the trigger if the function with status code 8 was found more than two times per hour

Sunday, January 25, 2015

Friday, January 23, 2015

.NET 4.5.2 flexible silent install, Windows 7, x64, x86

Use Internet Explorer and go to catalog.update.microsoft.com and download
kb2901983
kb2972107
kb2972216
kb2978128
kb2979578
Or download directly from other browser:
For 64-bit system:
http://download.windowsupdate.com/c/msdownload/update/software/ftpk/2015/01/ndp452-kb2901983-x86-x64-enu_0350e593835125031f36e846ff3b936c09b8d479.exe
http://download.windowsupdate.com/c/msdownload/update/software/secu/2014/08/ndp45-kb2972216-x64_7d8cd1e4729a566ac04e93d97decda963905cf0c.exe
http://download.windowsupdate.com/c/msdownload/update/software/secu/2014/09/ndp45-kb2972107-x64_338bd55ed27b6897c6bcaa2a6ef9c57e77b95910.exe
http://download.windowsupdate.com/c/msdownload/update/software/secu/2014/10/ndp45-kb2978128-x64_a096b6d82ac8255f7d4e8dbacdae4864efe5e4f9.exe
http://download.windowsupdate.com/d/msdownload/update/software/secu/2014/10/ndp45-kb2979578-v2-x64_8572841fc55ccf101c01f87ebfa4ec7be0911ebf.exe
For 32-bit system:
http://download.windowsupdate.com/c/msdownload/update/software/ftpk/2015/01/ndp452-kb2901983-x86-x64-enu_0350e593835125031f36e846ff3b936c09b8d479.exe
http://download.windowsupdate.com/c/msdownload/update/software/secu/2014/08/ndp45-kb2972216-x86_dd3aeeb09ecc22abcacf313734d17613bf1149c5.exe
http://download.windowsupdate.com/c/msdownload/update/software/secu/2014/09/ndp45-kb2972107-x86_1ff2e8e02ed7ff97457a85eaddea125beaed428c.exe
http://download.windowsupdate.com/c/msdownload/update/software/secu/2014/10/ndp45-kb2978128-x86_83563136390cf80c714dc0733906555adb2bace4.exe
http://download.windowsupdate.com/d/msdownload/update/software/secu/2014/10/ndp45-kb2979578-v2-x86_abd805b4503234edf7a3d0ee32ee5ba1a72c6ac1.exe
Download:
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

In directory where all those libraries is having a good time place .NET installer and all patches.
Create this batch file:
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set u=%~dp0
echo sorting updates..
for /f "tokens=*" %%i in ('^
dir /b "%u%*kb*.exe" ^|
sed "s/^.*KB\|^.*kb//g" ^|
sed "s/[ \t]*$//" ^|
gnusort -n ^|
sed "/^$/d"') do (
for /f "tokens=*" %%d in ('dir /b "%u%" ^| grep "%%i"') do (
echo %%d
start /wait "" "%~dp0%%d" /passive /norestart
)
)
endlocal

Thursday, January 22, 2015

Host is not allowed to connect to MySQL server, 1130, zabbix


Database error: Error connecting database
[Host 'my.IP.address.here' is not allowed to connect to this MySQL server]
My OS is CentOS 6.5 and it can be checked with:
cat /etc/*-release
When check zabbix server log file with tail -2 /var/log/zabbix/zabbix_server.log it says:
1862:20150122:162217.270 [Z3001] connection to database 'zabbix' failed: [1130] Host 'my.IP.address.here' is not allowed to connect to this MySQL server
1862:20150122:162217.270 Cannot connect to the database. Exiting...
So we have error code 1130

To solve this case i need to authentificate into MySQL with root access and set permisions to zabbix user to operate from IP address in message box.

Since i do not have this password i want to reset it to new one.
I got a new MySQL root password by folowing this instructions:
https://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

Now with root password we can see all database permisiions with command
mysql -u root -pMyNewPass -P 3306 -s <<< 'SELECT CONCAT("SHOW GRANTS FOR ",user,"@",host,";") FROM mysql.user;' | sed -e "s/FOR /&'/" -e "s/@/'&'"/ -e "s/;/'&/" | mysql -u root -pMyNewPass -P 3306 -s
This will report something like this:
Everything looks fine but it will be much better if the IP address also will be there!

To reset access for zabbix user for current ip address login in MySQL with root
mysql -uroot -p
Execute
GRANT ALL ON zabbix.* TO zabbix@'my.IP.address.here' IDENTIFIED BY 'mypasswordhere';
Password for zabbix MySQL database user can be found with
cat /etc/zabbix/zabbix_server.conf | grep ^DBPassword
Source:
https://www.zabbix.com/forum/showthread.php?t=28298

Display unused computers from SCCM adsysdis.log into zabbix

This is based on SCCM system discovery component SMS_AD_SYSTEM_DISCOVERY_AGENT.

This component keeps log file in
c:\Program Files\Microsoft Configuration Manager\Logs\adsysdis.log
The string which we are interested looks something like:
ERROR: Machine COMPUTERNAME is offline or invalid..
To implement the rule at first you need to add cat, grep, sed, tail support to windows operating %path% variable. I usualy keep these all libraries in c:\gnu

Now i add new UserParameter object in C:\Program Files\Zabbix Agent\zabbix_agentd.conf
EnableRemoteCommands=1 
UserParameter=MachineIsInvalid,if exist "C:\Program Files\Microsoft Configuration Manager\Logs\adsysdis.log" cat "C:\Program Files\Microsoft Configuration Manager\Logs\adsysdis.log" | grep -e "is offline or invalid" | sed "s/^.*Machine/Machine/g;s/invalid.*/invalid/g;s/\d039//g" | tail -1

Create new item in zabbix:
Name: MachineIsInvalid
Type: Zabbix Agent
Key: MachineIsInvalid
Host interface: IP: 10050
Type of information: Text

Create trigger:
Name: {ITEM.LASTVALUE}
Expression: {computername:MachineIsInvalid.regexp(invalid)}=1

Wednesday, January 21, 2015

Set up secure wifi connection, command line, Raspberry Pi

Open network configurations:
nano /etc/network/interfaces
Set ssid and password:
auto lo
 
iface lo inet loopback
iface eth0 inet dhcp
 
allow-hotplug wlan0
auto wlan0
 
iface wlan0 inet dhcp
        wpa-ssid "ssid"
        wpa-psk "password"
You can also prepare interfaces file from windows on copy to boot partition.

Then on the pi side overwrite the configuration:
sudo cp /boot/interfaces /etc/network/interfaces

Inventory Data Loader failed to process the file H18U8MB6.MIF because it is larger than the defined maximum allowable size of 5000000.

Inventory Data Loader failed to process the file C:\Program Files\Microsoft Configuration Manager\inboxes\auth\dataldr.box\Process\H18U8MB6.MIF because it is larger than the defined maximum allowable size of 5000000.
On SCCM server open regedit and go to
HKLM\SOFTWARE\Microsoft\SMS\Components\SMS_INVENTORY_DATA_LOADER
Change "Max MIF Size" from 4c4b40 (hex) to 3200000 (hex)

Now clear all the warnings for SMS_INVENTORY_DATA_LOADER

Windows restart is pending, zabbix detection rule

For windows it is posible to create batch to check the status:
@echo off
setlocal EnableDelayedExpansion
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" > nul 2>&1
if !errorlevel!==0 (
echo please restart me
) else echo i am good
endlocal
Add new item at Template OS Windows
Name: RebootRequired
Type: Zabbix agent
Key:
system.run[reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" | find /C "RebootRequired"]
Type of information: Text

Create trigger:
{Template OS Windows:system.run[reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" | find /C "RebootRequired"].last(0)}#0

Warning:
EnableRemoteCommands=1 must be enabled on client side at zabbix_agentd.conf

Related:
http://technet.microsoft.com/en-us/library/cc164360(v=exchg.80).aspx
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired"
reg query "HKLM\SYSTEM\CurrentControlSet001\Control\Session Manager" /v PendingFileRenameOperations
reg query "HKLM\SOFTWARE\Microsoft\Updates" /v UpdateExeVolatile

Tuesday, January 20, 2015

WinRAR silent install with detection method

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=WinRAR archiver
if not "%ProgramFiles(x86)%"=="" (
:x64
echo 64-bit windows detected!
echo looking for 64-bit version..
reg query "%sw%\%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
echo looking for 32-bit version..
reg query "%sw%\Wow6432Node\%u%\%k%" > nul 2>&1
if !errorlevel!==0 (
echo 32-bit version on 64-bit windows found! Now uninstalling..
"%programfiles(x86)%\WinRAR\Uninstall.exe" /S
:CheckUninstallKey
reg query "%sw%\Wow6432Node\%u%\%k%" > nul 2>&1
if !errorlevel!==0 goto CheckUninstallKey
rd "%programfiles(x86)%\WinRAR" /Q /S
)
echo installing 64-bit version..
for /f "tokens=*" %%a in ('dir /b "%~dp0*rar*.exe" ^| find "x64"') do "%~dp0%%a" /S
) else echo winrar already exists!
goto exit
)
:x86
echo 32-bit windows detected!
reg query "%sw%\%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
echo installing 32-bit version
for /f "tokens=*" %%a in ('dir /b "%~dp0*rar*.exe" ^| find /v "x64"') do "%~dp0%%a" /S
) else echo winrar already exists!
:exit
endlocal

Sunday, January 18, 2015

Thursday, January 15, 2015

Convert doc to txt, command line, windows

Install LibreOffice
http://downloadarchive.documentfoundation.org/libreoffice/old/latest/win/x86/

You can install LibreOffice on windows silently with:
for /f %%a in ('dir /b "%~dp0LibreOffice*.msi"') do ^
%systemroot%\system32\msiexec.exe /i "%~dp0%%a" /qb /norestart
Install silently with detection rule:
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k={662935B3-592B-48F7-AFFD-1EBC1BD84AE3}
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
for /f %%a in ('dir /b "%~dp0LibreOffice*.msi"') do (
%systemroot%\system32\msiexec.exe /i "%~dp0%%a" /qb /norestart
)
) else echo LibreOffice already installed!
endlocal
{662935B3-592B-48F7-AFFD-1EBC1BD84AE3} stands just for version 4.4.0.2
For another verison look in
HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
To convert doc to txt launch the command:
set path=%path%;C:\Program Files (x86)\LibreOffice 4\program
soffice --headless --convert-to "txt:Text (encoded):UTF8" example.doc
Before you do the convert all instance of LibreOffice must be closed!
You can use nircmd utility to kill all instances
nircmd killprocess soffice.exe
Kill soffice.exe with detection rule:
@echo off
setlocal EnableDelayedExpansion
tasklist | find "soffice.exe"
if !errorlevel!==0 nircmd killprocess soffice.exe
endlocal
Different solution is run the convert in another profile
soffice --headless --convert-to "txt:Text (encoded):UTF8" example.doc "-env:UserInstallation=$SYSUSERCONFIG/LibreOffice/another"
To create a batch file which will convert all files in direcotry use:
set path=%path%;C:\Program Files (x86)\LibreOffice 4\program
for /f %%a in ('dir /b "%~dp0*.doc"') do (
start /wait soffice --headless --convert-to "txt:Text (encoded):UTF8" "%~dp0%%a" "-env:UserInstallation=$SYSUSERCONFIG/LibreOffice/another"
)
Somehow this batch file will not proceed filename with space characters :(

Sunday, January 11, 2015

Saturday, January 10, 2015

Move local Google Drive data without re-syncing content

Install Firefox:
https://www.mozilla.org/en-US/firefox/all/

Add Firefox "SQLite Manager" extension:
https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/

Quit Google Drive applicaiton:

Open SQLite Manager

Open snapshot.db database located in "AppData\Local\Google\Drive"

Go to "Tables" -> "local_entry" and hit "Search" button

Search for fields which begins with \\?\

It should report only one result:

Replace field

OK

Use "Cancel" to exit this window:

Do similar thing with sync_config.db database. Only this time go to "Tables" -> "data":


All done. Now you can turn on Google Drive :)

Wednesday, January 7, 2015

Set max performance, command line


reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ListviewAlphaSelect /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ListviewShadow /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ListviewWatermark /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v TaskbarAnimations /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v WebView /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects /v VisualFXSetting /t REG_DWORD /d 2 /f
reg add "HKCU\Control Panel\Desktop" /v FontSmoothing /t REG_SZ /d 2 /f
reg add "HKCU\Control Panel\Desktop" /v MenuShowDelay /t REG_SZ /d 0 /f
reg add "HKCU\Control Panel\Desktop" /v PaintDesktopVersion /t REG_DWORD /d 0 /f
reg add "HKCU\Control Panel\Desktop" /v SmoothScroll /t REG_DWORD /d 0 /f
reg add "HKCU\Control Panel\Desktop" /v UserPreferencesMask /t REG_BINARY /d 10000180 /f
reg add "HKCU\Control Panel\Desktop" /v DragFullWindows /t REG_SZ /d 1 /f
reg add "HKCU\Control Panel\Desktop\WindowMetrics" /v MinAnimate /t REG_SZ /d 0 /f
Once you have executed these command you need to log of user to take effect.

Set up Classic Shell first launch settings for current user


Classic 1
reg add HKCU\Software\IvoSoft\ClassicStartMenu /v ShowedStyle2 /t REG_DWORD /d 1 /f
reg add HKCU\Software\IvoSoft\ClassicStartMenu\Settings /v MenuStyle /t REG_SZ /d Classic1 /f
Classic 2
reg add HKCU\Software\IvoSoft\ClassicStartMenu /v ShowedStyle2 /t REG_DWORD /d 1 /f
reg add HKCU\Software\IvoSoft\ClassicStartMenu\Settings /v MenuStyle /t REG_SZ /d Classic2 /f
Win 7
reg add HKCU\Software\IvoSoft\ClassicStartMenu /v ShowedStyle2 /t REG_DWORD /d 1 /f
reg add HKCU\Software\IvoSoft\ClassicStartMenu\Settings /v MenuStyle /t REG_SZ /d Win7 /f

FirstLogonCommands, Windows 8.1, autounattend.xml

This is have to set up windows 8.1 first logon commands.

First you need to create one file:
%cdrom%:\sources\$OEM$\$$\Setup\Scripts\FirstRun.cmd
with content:
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
)
Then you need to create %cdrom%:\FirstRun\FirstRun.bat witch will include all commands at first startup.

and of course finally you need %cdrom%:\autounattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <servicing></servicing>
    <settings pass="windowsPE">
        <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="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Type>Primary</Type>
                            <Size>24576</Size>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Extend>false</Extend>
                            <Format>NTFS</Format>
                            <Letter>C</Letter>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                            <Label>Windows 8</Label>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
            <UserData>
              <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
                <ProductKey>MHF9N-XY6XB-WVXMC-BTDCT-MKKG7
                    <WillShowUI>Never</WillShowUI>
                </ProductKey>

                <AcceptEula>true</AcceptEula>
                <FullName>Full Name</FullName>
                <Organization>Organization</Organization>
            </UserData>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/NAME</Key>
                            <Value>Windows 8.1 Enterprise Evaluation</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>
        </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="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Type>Primary</Type>
                            <Size>24576</Size>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Extend>false</Extend>
                            <Format>NTFS</Format>
                            <Letter>C</Letter>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                            <Label>Windows 8</Label>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
            <UserData>
              <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
                <ProductKey>MHF9N-XY6XB-WVXMC-BTDCT-MKKG7
                    <WillShowUI>Never</WillShowUI>
                </ProductKey>

                <AcceptEula>true</AcceptEula>
                <FullName>Full Name</FullName>
                <Organization>Organization</Organization>
            </UserData>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/NAME</Key>
                            <Value>Windows 8.1 Enterprise Evaluation</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>
        </component>

        <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>
            <UILanguageFallback>en-US</UILanguageFallback>
            <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>
            <UILanguageFallback>en-US</UILanguageFallback>
            <UserLocale>en-US</UserLocale>
        </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">
            <UserAccounts>
                <AdministratorPassword>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
    <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>perfect</Value>
                            <PlainText>true</PlainText>
                        </Password>
                        <Description>perfect user</Description>
                        <DisplayName>perfect</DisplayName>
                        <Group>administrators</Group>
                        <Name>perfect</Name>
     </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>1</ProtectYourPC>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <SkipUserOOBE>true</SkipUserOOBE>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
            </OOBE>
            <AutoLogon>
                <Password>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </Password>
                <Username>administrator</Username>
                <Enabled>true</Enabled>
            </AutoLogon>
 <FirstLogonCommands>
            <SynchronousCommand wcm:action="add">
            <Order>1</Order>
            <Description>Run FirstRun.cmd</Description>
            <CommandLine>%WINDIR%\Setup\Scripts\FirstRun.cmd</CommandLine>
            </SynchronousCommand>
 </FirstLogonCommands>
            <ShowWindowsLive>false</ShowWindowsLive>
        </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">
            <UserAccounts>
                <AdministratorPassword>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
    <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>perfect</Value>
                            <PlainText>true</PlainText>
                        </Password>
                        <Description>perfect user</Description>
                        <DisplayName>perfect</DisplayName>
                        <Group>administrators</Group>
                        <Name>perfect</Name>
     </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>1</ProtectYourPC>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <SkipUserOOBE>true</SkipUserOOBE>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
            </OOBE>
            <AutoLogon>
                <Password>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </Password>
                <Username>administrator</Username>
                <Enabled>true</Enabled>
            </AutoLogon>
    <FirstLogonCommands>
            <SynchronousCommand wcm:action="add">
            <Order>1</Order>
            <Description>Run FirstRun.cmd</Description>
            <CommandLine>%WINDIR%\Setup\Scripts\FirstRun.cmd</CommandLine>
            </SynchronousCommand>
 </FirstLogonCommands>
            <ShowWindowsLive>false</ShowWindowsLive>
        </component>
  
    </settings>
    <settings pass="specialize">
 <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" >
                            <OEMInformation>
                <HelpCustomized>false</HelpCustomized>
            </OEMInformation>                        
            <ComputerName />
            <TimeZone>Pacific Standard Time</TimeZone>
            <RegisteredOwner></RegisteredOwner>

 </component>
 
 <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" >
                            <OEMInformation>
                <HelpCustomized>false</HelpCustomized>
            </OEMInformation>                        
            <ComputerName />
            <TimeZone>Pacific Standard Time</TimeZone>
            <RegisteredOwner></RegisteredOwner>

 </component>
 
    <component name="Microsoft-Windows-Security-SPP-UX" 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">
            <SkipAutoActivation>true</SkipAutoActivation>
    </component>
 
 <component name="Microsoft-Windows-Security-SPP-UX" 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">
            <SkipAutoActivation>true</SkipAutoActivation>
    </component>
 
    </settings>
</unattend>

Tuesday, January 6, 2015

autounattend.xml, Windows Technical Preview for Enterprise, x86

For 64-bit verison use:
autounattend.xml, Windows Technical Preview for Enterprise, x64

This is tested and work for
http://care.dlservice.microsoft.com/dl/download/F/5/7/F574727C-B145-4A7D-B85B-11C4E8DC894B/9841.0.140912-1613.FBL_RELEASE_CLIENTENTERPRISE_VOL_X86FRE_EN-US.ISO
e0dd1b7c087b3495074e0fd4a6eb4afe
bf225e38826ae2196bcb33cb194904081c987dd4

This autounattend.xml is pretty cool to use in VirtualBox environment
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <servicing></servicing>
    <settings pass="windowsPE">
        <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="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Type>Primary</Type>
                            <Size>24576</Size>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Extend>false</Extend>
                            <Format>NTFS</Format>
                            <Letter>C</Letter>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                            <Label>Windows 10</Label>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
            <UserData>
              <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
                <ProductKey>PBHCJ-Q2NYD-2PX34-T2TD6-233PK
                    <WillShowUI>Never</WillShowUI>
                </ProductKey>

                <AcceptEula>true</AcceptEula>
                <FullName>Full Name</FullName>
                <Organization>Organization</Organization>
            </UserData>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/NAME</Key>
                            <Value>Windows Technical Preview for Enterprise</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>
        </component>

        <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>
            <UILanguageFallback>en-US</UILanguageFallback>
            <UserLocale>en-US</UserLocale>
        </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">
            <UserAccounts>
                <AdministratorPassword>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
    <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>perfect</Value>
                            <PlainText>true</PlainText>
                        </Password>
                        <Description>perfect user</Description>
                        <DisplayName>perfect</DisplayName>
                        <Group>administrators</Group>
                        <Name>perfect</Name>
     </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>1</ProtectYourPC>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <SkipUserOOBE>true</SkipUserOOBE>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
            </OOBE>
            <AutoLogon>
                <Password>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </Password>
                <Username>administrator</Username>
                <Enabled>true</Enabled>
            </AutoLogon>
            <ShowWindowsLive>false</ShowWindowsLive>
        </component>
    </settings>
    <settings pass="specialize">
   <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" >
                            <OEMInformation>
                <HelpCustomized>false</HelpCustomized>
            </OEMInformation>                        
            <ComputerName />
            <TimeZone>Pacific Standard Time</TimeZone>
            <RegisteredOwner></RegisteredOwner>
 </component>
        <component name="Microsoft-Windows-Security-SPP-UX" 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">
            <SkipAutoActivation>true</SkipAutoActivation>
        </component>
    </settings>
</unattend>

Monday, January 5, 2015

Slipstream .NET 3.5 in Windows 8.1 install source

This is like a fifth part of slipstreaming updates into windows 8 installation source!

To integrate .NET Framework 3.5 you need to install "Deployment tools" from:
http://download.microsoft.com/download/6/A/E/6AEA92B0-A412-4622-983E-5B305D2EBE56/adk/adksetup.exe

Extract your windows installation iso to c:\iso

Run the code:
@echo off
cd "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM"
if not exist c:\offline md c:\offline
dism /mount-wim /wimfile:c:\iso\sources\install.wim /index:1 /mountdir:c:\offline
dism /image:c:\offline /enable-feature /featurename:NetFx3 /all /limitaccess /source:c:\iso\sources\sxs
dism /unmount-wim /mountdir:c:\offline /commit
if exist c:\offline rd c:\offline /Q /S

To is a appendix to my old script which is suposed to run on large ramdisk:
@echo off
for /f "tokens=*" %%d in ('"%~dp0date.exe" +%%Y-%%m-%%d') do set yyyymmdd=%%d
cd "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM"
if not exist %~dp0mount md %~dp0mount
for %%a in (1) do (
dism /mount-wim /wimfile:%~dp0iso\sources\install.wim /index:%%a /mountdir:%~dp0mount
DISM /Image:%~dp0mount /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:%~dp0iso\sources\sxs
dism /unmount-wim /mountdir:%~dp0mount /commit
)
if exist %~dp0mount rd %~dp0mount /Q /S
xcopy "%~dp0autounattend.xml" "%~dp0iso" /Y
"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe" -b%~dp0ISO\boot\etfsboot.com -h -u2 -m -lwin81x64 %~dp0ISO\ %~dp0win81x64-%yyyymmdd%.iso
pause

Additional files to script:
http://gnu.catonrug.net/date.exe
autounattend.xml

Sunday, January 4, 2015

.NET 3.5 silent offline install for Windows 8 or 8.1

An app on your PC needs the following Windows feature:
.NET Framework 3.5 (includes .NET 2.0 and 3.0)
What is this?
This is dotnet framework request! Your pretty latest windows need old framework version to be happy and satisfied ;)

To Install .NET Framework 3.5 and all other old versions you need just windows installation DVD.
If you have the media then it is postible to done in offline mode.
In the DVD there is directory x:\source\sxs which already includes source files for .NET 2.0, 3.0 and 3.5

If you do not have the DVD you can download one of these iso files:

If you already have the installation source you can install with simple command:
dism /online /enable-feature /featurename:NetFX3 /Source:%cdrom%\sources\sxs /LimitAccess
replace %cdrom% with cd rom letter.

It is possible to exted the script with searching where the drive is:
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:\sources\sxs (
dism /online /enable-feature /featurename:NetFX3 /Source:%%i:\sources\sxs /LimitAccess
)
)
You can add future to detect Windows 8 or 8.1.
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set cv=Microsoft\Windows NT\CurrentVersion
set npd=Microsoft\NET Framework Setup\NDP
reg query "%sw%\%cv%" /v ProductName | find "Windows 8" > nul 2>&1
if !errorlevel!==0 (
echo Windows 8 or 8.1 detected
reg query "%sw%\%npd%" > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%npd%\v3.5" > nul 2>&1
if not !errorlevel!==0 (
echo it is time for install
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:\sources\sxs (
dism /online /enable-feature /featurename:NetFX3 /Source:%%i:\sources\sxs /LimitAccess
)
)
endlocal
Also you can install from network. Just set the sxs variable to windows installation source:
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set cv=Microsoft\Windows NT\CurrentVersion
set npd=Microsoft\NET Framework Setup\NDP
set sxs=\\network\path\to\win81x64\sources\sxs
reg query "%sw%\%cv%" /v ProductName | find "Windows 8" > nul 2>&1
if !errorlevel!==0 (
echo Windows 8 or 8.1 detected
reg query "%sw%\%npd%" > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%npd%\v3.5" > nul 2>&1
if not !errorlevel!==0 (
echo it is time for install
dism /online /enable-feature /featurename:NetFX3 /Source:%sxs% /LimitAccess
)
endlocal

Disable all repositories in CentOS

create new file:
vi disable-repos.sh
Paste content:
# create and array of all files listed in /etc/yum.repos.d/
repos=$(find /etc/yum.repos.d/ -maxdepth 1 -type f -name "*.repo" -printf '%f\n')

# create temporary working directory
mkdir /tmp/yum.repos.d

# take every file and comment each line in the file
for i in $repos
do
mv /etc/yum.repos.d/$i /tmp/yum.repos.d/
sed -e 's/^/#/g' /tmp/yum.repos.d/$i > /etc/yum.repos.d/$i
done

# remove working directory
rm /tmp/yum.repos.d -rf
Set the file executable:
chmod +x disable-repos.sh
Run the code:
./disable-repos.sh
For example if you have:
cat /etc/yum.repos.d/CentOS-CR.repo
# CentOS-CR.repo
#
# The Continuous Release ( CR )  repository contains rpms that are due in the next
# release for a specific CentOS Version ( eg. next release in CentOS-7 ); these rpms
# are far less tested, with no integration checking or update path testing having
# taken place. They are still built from the upstream sources, but might not map
# to an exact upstream distro release.
#
# These packages are made available soon after they are built, for people willing
# to test their environments, provide feedback on content for the next release, and
# for people looking for early-access to next release content.
#
# The CR repo is shipped in a disabled state by default; its important that users
# understand the implications of turning this on.
#
# NOTE: We do not use a mirrorlist for the CR repos, to ensure content is available
#       to everyone as soon as possible, and not need to wait for the external
#       mirror network to seed first. However, many local mirrors will carry CR repos
#       and if desired you can use one of these local mirrors by editing the baseurl
#       line in the repo config below.
#

[cr]
name=CentOS-$releasever - cr
baseurl=http://mirror.centos.org/centos/$releasever/cr/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=0
After all you got:
cat /etc/yum.repos.d/CentOS-CR.repo
## CentOS-CR.repo
##
## The Continuous Release ( CR )  repository contains rpms that are due in the next
## release for a specific CentOS Version ( eg. next release in CentOS-7 ); these rpms
## are far less tested, with no integration checking or update path testing having
## taken place. They are still built from the upstream sources, but might not map
## to an exact upstream distro release.
##
## These packages are made available soon after they are built, for people willing
## to test their environments, provide feedback on content for the next release, and
## for people looking for early-access to next release content.
##
## The CR repo is shipped in a disabled state by default; its important that users
## understand the implications of turning this on.
##
## NOTE: We do not use a mirrorlist for the CR repos, to ensure content is available
##       to everyone as soon as possible, and not need to wait for the external
##       mirror network to seed first. However, many local mirrors will carry CR repos
##       and if desired you can use one of these local mirrors by editing the baseurl
##       line in the repo config below.
##
#
#[cr]
#name=CentOS-$releasever - cr
#baseurl=http://mirror.centos.org/centos/$releasever/cr/$basearch/
#gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#enabled=0
If you want to kind a undo what you did you can try to create another script:
remove-first-symbol.sh
With content:
# create and array of all files listed in /etc/yum.repos.d/
repos=$(find /etc/yum.repos.d/ -maxdepth 1 -type f -name "*.repo" -printf '%f\n')

# create temporary working directory
mkdir /tmp/yum.repos.d

# take every file and comment each line in the file
for i in $repos
do
mv /etc/yum.repos.d/$i /tmp/yum.repos.d/
sed -e 's/^.//g' /tmp/yum.repos.d/$i > /etc/yum.repos.d/$i
done

# remove working directory
rm /tmp/yum.repos.d -rf

Saturday, January 3, 2015

Detect .NET Framework versions

This is understandable script:
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set npd=Microsoft\NET Framework Setup\NDP
reg query "%sw%\%npd%" > nul 2>&1
if !errorlevel!==0 (
echo found .NET Framework versions:
reg query "%sw%\%npd%\v2.0.50727" > nul 2>&1
if !errorlevel!==0 reg query "%sw%\%npd%\v2.0.50727" /v Version | findstr Version
reg query "%sw%\%npd%\v3.0" > nul 2>&1
if !errorlevel!==0 reg query "%sw%\%npd%\v3.0" /v Version | findstr Version
reg query "%sw%\%npd%\v3.5" > nul 2>&1
if !errorlevel!==0 reg query "%sw%\%npd%\v3.5" /v Version | findstr Version
reg query "%sw%\%npd%\v4.0\Client" > nul 2>&1
if !errorlevel!==0 reg query "%sw%\%npd%\v4.0\Client" /v Version | findstr Version
reg query "%sw%\%npd%\v4\Client" > nul 2>&1
if !errorlevel!==0 reg query "%sw%\%npd%\v4\Client" /v Version | findstr Version
)
endlocal
pause
Shortened script which include all versions in array:
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set npd=Microsoft\NET Framework Setup\NDP
reg query "%sw%\%npd%" > nul 2>&1
if !errorlevel!==0 (
echo found .NET Framework versions:
for %%a in (v2.0.50727 v3.0 v3.5 v4.0\Client v4\Client) do (
reg query "%sw%\%npd%\%%a" > nul 2>&1
if !errorlevel!==0 reg query "%sw%\%npd%\%%a" /v Version | findstr Version
)
)
endlocal
pause

Make a local copy of ftp resource, lftp client

I want to create a copy of ftp://download.dosgamesarchive.com
But the server is really slow so i must use some sync tools.

Now i choose Raspberry Pi and lftp client:
sudo apt-get update && sudo apt-get install lftp -y
Lets create "dosgames" directory (in home directory) where all stuff will go in:
mkdir ~/dosgames
Lets create a new syncing profile:
nano ~/dosgames.ftp
"dosgames.ftp" is just filename.

Paste this content:
open ftp://download.dosgamesarchive.com
mirror -c / ~/dosgames
exit
ftp://download.dosgamesarchive.com/videos are filled with videos which take a lot of space in download and are not needed to test games. It is posible to take only files in root directory by setting up --no-recursion option
Paste this content:
open ftp://download.dosgamesarchive.com
mirror -c --no-recursion / ~/dosgames
exit
Now to lauch the synchronization use
lftp -f ~/dosgames.ftp
Now you can see what actually happens. Hit ctrl+c to break the process

To set synchronization in background use
lftp -f ~/dosgames.ftp &
Now you probably want to see is the process is still running
ps aux | grep lftp
If we want to stop sync in background then we can kill lftp client
pkill lftp
To see if there is free space on Raspberry use
df
Related:
http://lftp.yar.ru/lftp-man.html
https://googledrive.com/host/0B-kVNrUbcg52TTg1TmFEOFdrZkE/

Blog Archive