Tuesday, May 26, 2015

Install Zabbix Agent on FreeBSD 8.2

Check FreeBSD version:
uname -a
Check if gcc compiler is installed:
pkg_info | grep gcc
gcc-4.6.3.20111111  GNU Compiler Collection 4.6
add zabbix user:
# adduser
 Username: zabbix
 Full name: zabbix agent
 Uid (Leave empty for default):
 Login group [zabbix]:
 Login group is zabbix. Invite zabbix into other groups? []:
 Login class [default]:
 Shell (sh csh tcsh bash rbash nologin) [sh]: bash
 Home directory [/home/zabbix]:
 Home directory permissions (Leave empty for default):
 Use password-based authentication? [yes]:
 Use an empty password? (yes/no) [no]:
 Use a random password? (yes/no) [no]:
 Enter password:
 Enter password again:
 Lock out the account after creation? [no]:
 Username   : zabbix
 Password   : *****
 Full Name  : zabbix agent
 Uid        : 1002
 Class      :
 Groups     : zabbix
 Home       : /home/zabbix
 Home Mode  :
 Shell      : /usr/local/bin/bash
 Locked     : no
 OK? (yes/no): yes
 adduser: INFO: Successfully added (zabbix) to the user database.
 Add another user? (yes/no): no
 Goodbye!
Download zabbix package from:
http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/

Use WinSCP to push package from windows to FreeBSD /root

Unpack archive:
tar zxvf zabbix-2.4.5.tar.gz
Move to source
cd zabbix-2.4.5
Set zabbix-agent component as neccessary (this will take minute to complete)
./configure --enable-agent
At the end the output will say:
Configuration:

  Detected OS:           freebsd8.2
  Install path:          /usr/local
  Compilation arch:      freebsd

  Compiler:              gcc
  Compiler flags:        -g -O2   -I/usr/local/include

  Enable server:         no

  Enable proxy:          no

  Enable agent:          yes
  Agent details:
    Linker flags:           -L/usr/local/lib
    Libraries:             -lkvm -lm -ldevstat   -liconv

  Enable Java gateway:   no

  LDAP support:          no
  IPv6 support:          no

***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************
Compile agent (this will take two minutes or so)
make
Install agent
make install
Copy startup service
cp ./misc/init.d/freebsd/zabbix_agentd /usr/local/etc/rc.d/zabbix_agentd
Set startup service executable
chmod 755 /usr/local/etc/rc.d/zabbix_agentd
Modify few lines in zabbix_agentd.conf
vi /usr/local/etc/zabbix_agentd.conf
PidFile=/var/run/zabbix_agentd.pid
LogFile=/var/log/zabbix_agentd.log
Server=here.goes.server.name
Enable zabbix agent
vi /etc/rc.conf
zabbix_agentd_enable="YES"
Set up firewall rules
vi /etc/services
zabbix_agent 10050/tcp
zabbix_trap 10051/tcp
Create pid and log file and assign permissions to zabbix:
touch /var/run/zabbix_agentd.pid
chown zabbix /var/run/zabbix_agentd.pid
touch /var/log/zabbix_agentd.log
chown zabbix /var/log/zabbix_agentd.log
Start zabbix agent:
/usr/local/etc/rc.d/zabbix_agentd start
Check if zabbix agent is running
/usr/local/etc/rc.d/zabbix_agentd status
zabbix_agentd is running as pid 19288 19289 19290 19291 19292.
or
ps aux | grep zabbix
zabbix 19288  0.0  0.0  4680  1812  ??  I     2:48PM   0:00.00 /usr/local/sbin/zabbix_agentd
zabbix 19289  0.0  0.0  4680  2060  ??  S     2:48PM   0:00.18 zabbix_agentd: collector [idle 1 sec] (zabbix_agentd)
zabbix 19290  0.0  0.0  4680  2080  ??  S     2:48PM   0:00.07 zabbix_agentd: listener #1 [waiting for connection] (zabbix_agentd)
zabbix 19291  0.0  0.0  4680  2036  ??  S     2:48PM   0:00.08 zabbix_agentd: listener #2 [waiting for connection] (zabbix_agentd)
zabbix 19292  0.0  0.0  4680  2048  ??  S     2:48PM   0:00.07 zabbix_agentd: listener #3 [waiting for connection] (zabbix_agentd)
Check is log is normal:
cat /var/log/zabbix_agentd.log
 19288:20150526:144832.655 Starting Zabbix Agent [www.catonrug.net]. Zabbix 2.4.5 (revision 53282).
 19288:20150526:144832.655 using configuration file: /usr/local/etc/zabbix_agentd.conf
 19288:20150526:144832.655 agent #0 started [main process]
 19289:20150526:144832.655 agent #1 started [collector]
 19290:20150526:144832.655 agent #2 started [listener #1]
 19291:20150526:144832.655 agent #3 started [listener #2]
 19292:20150526:144832.656 agent #4 started [listener #3]
Source:
http://nakoruru.jp/?p=1349
http://www.knd.com.au/installing-zabbix-agent-164-on-free-bsd-71/

Monday, May 25, 2015

Responsive design, not wasting adSense impression


Implementation:
<script type='text/javascript'>

function addo() {
var scrollTop = $(window).scrollTop();
var scrollLeft = $(window).scrollLeft();
var tbelow = $('#below_the_fold').offset().top;
var tdistance = (tbelow - scrollTop);
var lbelow = $('#below_the_fold').offset().left;
var ldistance = (lbelow - scrollLeft);

if ( document.documentElement.clientWidth &lt; 1198  ) {
document.getElementById('below_the_fold').style.height = '250px';
document.getElementById('a300x250_1').style.padding = '0 0 0 0';
document.getElementById('a300x250_1').style.position = 'fixed';
document.getElementById('a300x250_1').style.left = ldistance + 'px';
document.getElementById('a300x250_1').style.top = tdistance + 'px';
document.getElementById('a300x250_1').style.display = 'block';
document.getElementById('a300x250_2').style.padding = '0 0 0 0';
document.getElementById('a300x250_2').style.position = 'fixed';
document.getElementById('a300x250_2').style.left = ldistance + 405 + 'px';
document.getElementById('a300x250_2').style.top = tdistance + 'px';
document.getElementById('a300x250_2').style.display = 'block';
}

if ( document.documentElement.clientWidth &gt; 1197  ) {
document.getElementById('below_the_fold').style.height = '0px';
document.getElementById('a300x250_1').style.padding = '0 0 100px 10px';
document.getElementById('a300x250_1').style.position = 'static';
document.getElementById('a300x250_1').style.left = '0px';
document.getElementById('a300x250_1').style.top = '0px';
document.getElementById('a300x250_1').style.display = 'block';
document.getElementById('a300x250_2').style.padding = '0 0 350px 10px';
document.getElementById('a300x250_2').style.position = 'static';
document.getElementById('a300x250_2').style.left = '0px';
document.getElementById('a300x250_2').style.top = '0px';
document.getElementById('a300x250_2').style.display = 'block';
}

}


$(window).on('scroll', function () {
addo();
});

window.onresize = function() {
addo();
}

</script>

Sunday, May 24, 2015

Get latest JRE offline installer for windows

As always i am trying to figure out some automation process to download latest version of JRE. In this scenario i analyse https://www.java.com/en/download/manual.jsp and look for all links that contains "BundleId". Now i use wget spider to look what filename the link actually retrieve. I do not download anything. I just look for filename. I am only interested in files which ends with i586.exe or x64.exe and if it is then download it!

To work with this method save these files:
http://gnu.catonrug.net/wget.exe
http://gnu.catonrug.net/grep.exe
http://gnu.catonrug.net/uniq.exe
http://gnu.catonrug.net/sed.exe
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/gnusort.exe
http://gnu.catonrug.net/regex2.dll

In directory where all those libraries is having a good time create get-latest-JRE.cmd with content:
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0

del "%~dp0*i586.exe" /Q /F
del "%~dp0*x64.exe" /Q /F

set lnk=https://www.java.com/en/download/manual.jsp
for /f "tokens=*" %%l in ('^
wget --no-cookies --no-check-certificate %lnk% -qO- ^|
grep BundleId ^|
sed "s/\d034/\n/g" ^|
grep "^http" ^|
gnusort ^|
uniq') do (
echo looking for exe installer under %%l
wget %%l -S --spider -o "%~dp0jretmp.log"
sed "s/http/\nhttp/g;s/exe/exe\n/g" "%~dp0jretmp.log" |^
grep "^http.*x64.exe$\|^http.*i586.exe$" |^
gnusort | uniq | grep "^http.*x64.exe$\|^http.*i586.exe$"
if !errorlevel!==0 (
for /f "tokens=*" %%f in ('^
sed "s/http/\nhttp/g;s/exe/exe\n/g" "%~dp0jretmp.log" ^|
grep "^http.*x64.exe$\|^http.*i586.exe$" ^|
gnusort ^|
uniq ^|
sed "s/^.*\///g"') do (
wget --no-cookies --no-check-certificate %%l -O "%~dp0%%f"
)
)
)
endlocal
pause
%%l stands for link
%%f stands for filename

Saturday, May 23, 2015

Create system which act like plugged in router


If you want to create a system which act just exactly like plugged in same router or switch you can use VirtaulBox and at the settings tab point attached to "Bridged Adapter"

Friday, May 22, 2015

WinSCP cheat sheet

Silent installation with progress bar

winscp573setup.exe /SILENT

Silent installation without progress bar

winscp573setup.exe /VERYSILENT

Flexible silent installation (do not have to change setup script anymore)

for /f "tokens=*" %%a in ('dir /b "%~dp0winscp*.exe"') do "%~dp0%%a" /VERYSILENT

Silent install with detection rule

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=winscp3_is1
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
for /f "tokens=*" %%a in ('dir /b "%~dp0winscp*.exe"') do "%~dp0%%a" /VERYSILENT
:recheck
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if not !errorlevel!==0 goto recheck
) else (
echo WinSCP already installed at version:
reg query "%sw%\%x%%u%\%k%" /v DisplayVersion | find "DisplayVersion"
)
endlocal

Silent install (overwrite) with version detection rule

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=winscp3_is1
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%x%%u%\%k%" /v DisplayVersion | find "5.7.3" > nul 2>&1
if not !errorlevel!==0 (
for /f "tokens=*" %%a in ('dir /b "%~dp0winscp*.exe"') do "%~dp0%%a" /VERYSILENT
:recheck
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if not !errorlevel!==0 goto recheck
) else (
echo WinSCP already installed at version:
reg query "%sw%\%x%%u%\%k%" /v DisplayVersion | find "DisplayVersion"
)
)
endlocal

Latest version automatic update/upgrade via online installation

https://ninite.com/winscp/

Backup all settings and saved profiles for non-portable version

reg export "HKCU\Software\Martin Prikryl" "%userprofile%\Desktop\%computername%_%username%_winscp.reg.log"

Restore settings for current user for non-portable version

reg import winscp.reg

Manually check download latest version

http://winscp.net/eng/download.php

Wednesday, May 20, 2015

Slipstream updates into Windows 8.1 like a Pro (practical part)


This is most practical part of Slipstream updates into Windows 8.1 like a Pro.
You can read theoretical part to start from begining

Deployment tools must be installed.
http://download.microsoft.com/download/6/A/E/6AEA92B0-A412-4622-983E-5B305D2EBE56/adk/adksetup.exe

Windows installation ISO file must be stored in c:\g\w
Name it like en_windows_8.1_pro_ir5_x64_dvd.iso
You can prepare this iso file by downloading ESD file and converting ESD to ISO file.

Save all these libraries in c:\g\w:
http://gnu.catonrug.net/7z.dll
http://gnu.catonrug.net/7z.exe
http://gnu.catonrug.net/date.exe
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

Create C:\g\w\w81pro\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
)
Save autounattend.xml in c:\g\w\w81pro

Use Internet Explorer and download all necessary updates from catalog.update.microsoft.com. Then move all update directories to c:\g\w\u81x64pro

Open "Deployment and Imaging Tools Environment" in "Run as Administrator" mode and run the code:

cd c:\g\w
win81x64pro-slipstream.cmd
content of c:\g\w\win81x64pro-slipstream.cmd
@echo off
cls
setlocal EnableDelayedExpansion
set path=%path%;%~dp0

for /f "tokens=*" %%d in ('time /t') do echo Slipstream started at: %%d
echo.

set v=Win81x64
echo Label for DVD will be: %v%
echo.

set u=%~dp0u81x64pro
echo Looking for updates in directory:
echo %u%
echo.

set i=%~dp0en_windows_8.1_pro_ir5_x64_dvd.iso
echo Name for ISO file:
echo %i%
echo.

set m=1
rem index Win81x64pro=1, Win81x86pro=1, Win7x64pro=3, Win7x86pro=4
echo Updates will be slipstreamed into install.wim index(es): %m%
echo.

set r=%~dp0w81pro
echo Additional files like autounattend.xml will be overwrited from:
echo %r%
echo.

set w=%temp%
echo Working directory is:
echo %w%
echo.

set d=%userprofile%\Desktop
echo Destination output for new ISO is:
echo %d%
echo.

for /f "tokens=*" %%d in ('"%~dp0date.exe" +%%Y-%%m-%%d') do set yyyymmdd=%%d

set l=%d%\%v%-%yyyymmdd%.iso.log
if exist "%l%" del "%l%" /Q /F
echo Existing errors will be writed on:
echo %l%
echo.

for /f "tokens=*" %%d in ('dir /b "%u%" ^| sed -n "$="') do echo Total number of updates to slipstream: %%d
echo.

echo Extracting iso..
if exist "%w%\iso" rd "%w%\iso" /Q /S
7z x "%i%" -o"%w%\iso" > nul 2>&1

cd "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM"
if not exist "%w%\mount" md "%w%\mount"
for %%a in (%m%) do (
echo mounting install.wim index %%a..
dism /mount-wim /wimfile:"%w%\iso\sources\install.wim" /index:%%a /mountdir:"%w%\mount" > nul 2>&1
echo integrating .NET 2.0, 3.0 and 3.5..
dism /image:"%w%\mount" /enable-feature /featurename:NetFx3 /all /limitaccess /source:"%w%\iso\sources\sxs" > nul 2>&1
rem echo integrating drivers..
rem dism /image:"%w%\mount" /add-driver /driver:"%~dp0d81x64" /recurse
for /f "tokens=*" %%i in ('dir /b "%u%" ^| sed "s/^.*(KB//g;s/).*$//g" ^| gnusort -n') do (
for /f "tokens=*" %%d in ('dir /b "%u%" ^| grep "%%i"') do (
echo slipstreaming KB%%i
for /f "tokens=*" %%z in ('dir /b "%u%\%%d\*.msu" "%u%\%%d\*.cab"') do (
dism /image:"%w%\mount" /add-package /packagepath:"%u%\%%d\%%z" | grep "The operation completed successfully" > nul 2>&1
if not !errorlevel!==0 (
echo %%z not OK
echo %%z not OK >> "%l%"
)
)
)
)
dism /unmount-wim /mountdir:"%w%\mount" /commit
)
if exist "%w%\mount" rd "%w%\mount" /Q /S
echo.
echo Adding autounattend.xml or something..
xcopy "%r%" "%w%\iso" /Y /S /F /Q
if not exist "%w%\iso\FirstRun" md "%w%\iso\FirstRun"
xcopy "%r%\..\..\FirstRun" "%w%\iso\FirstRun" /Y /S /F /Q
"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe" -b"%w%\iso\boot\etfsboot.com" -h -u2 -m -l%v% "%w%\iso" "%d%\%v%-%yyyymmdd%.iso"
if exist "%w%\iso" rd "%w%\iso" /Q /S
endlocal
echo.
echo This is it!
time /t
If you want to execute another custom application silent installation just place it into c:\g\FirstRun\FirstRun.bat

Saturday, May 16, 2015

Automatic deployment rules, Last Error Code, 0x800701F7


To solve this case i reset the windows update on local sccm server which has updates service point installed
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
net stop wuauserv
rd %systemroot%\SoftwareDistribution /Q /S
SC sdshow wuauserv
SC sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
wuauclt.exe /detectnow
Then i open windows update in SCCM server where also the WSUS server is installed and press "Check for update":

Code 80072EFD usually means that you have WSUS server isolated from internet:

In this case you need to double check Lan settings:

Tuesday, May 12, 2015

How to re-install Office 2010 KMS server

If neccessary set up proxy settings to access internet on destination server.

Launch Key Management Service Host Wizard:
http://download.microsoft.com/download/E/4/E/E4EF2B72-9F16-4D5F-9A1D-D9BE39A1C127/KeyManagementServiceHost_en-us.exe
9e25ad896bf7092514edba4b50c83f10
87032c452933c7ddaf1795e1268e419e8303ce4b


Also open DNS server, go under _tcp and create/edit _VLMCS value to satisfy your needs.

Source:
https://technet.microsoft.com/en-us/library/ff923247%28v=office.14%29.aspx

Monday, May 11, 2015

Headless raspbian-wheezy

OMFG! I was looking for ages to configure network interfaces using only fat partition from windows.

So here is what I do

Download fresh raspbian image:
https://downloads.raspberrypi.org/raspbian/images/raspbian-2015-05-07/2015-05-05-raspbian-wheezy.zip
7db16829ff3208c2235c0bef65b06201
cb799af077930ff7cbcfaa251b4c6e25b11483de
Open and extract archive

Use Win32DiskImager and push extracted IMG file to SD card:
Win32DiskImager-0.9.5-install.exe

Use something like notepad++ and open config.txt for editing. At the end of file add this line:
initramfs initrd.img followkernel
Remember to save changes!

Save initrd.img
into the boot partition.

Save setup.sh into the boot partition.

Use something like notepad++ and open setup.sh for edition and set WIFISSID and WIFIKEY to satisfy your needs.

content of setup.sh:
#! /bin/bash
WIFISSID=0000000000
WIFIKEY=1111111111

reset_autostart() {
  echo "Cleanup autostart ..."
  if [ -e /etc/arch-release ]; then
    sed -i 's:--autologin root ::g'  /etc/systemd/system/getty.target.wants/getty\@tty1.service || { echo "Unable to edit systemd service to remove autologon (Arch)"; exit 1; }
    rm /root/.bash_profile || { echo "Unable to remove .bash_profile"; exit 1; }
  elif [ -e /etc/debian_version  ]; then
    if [ -e /etc/profile.d/pi-setup.sh ]; then
      rm /etc/profile.d/pi-setup.sh
      sed -i 's/#1:234/1:234/' /etc/inittab
      sed -i 's/^\(.*#\s*PISETUP\)/#\1/' /etc/inittab || { echo "Unable to edit inittab to remove autologin (Raspbian)"; exit 1; }
    else
      sed -i 's:(/boot/setup.sh:#(/boot/setup.sh:' /etc/profile.d/raspi-config.sh || { echo "Unable to edit raspi-config.sh to remove reference to startup script"; exit 1; }
    fi
  fi
}

if [ ! -f /boot/firststage ]; then
  echo "Starting first stage setup ..."
  if [ -e /etc/arch-release ]; then\
 echo "Detected Arch Linux. Configuring..."
    echo -e "d\n2\nn\ne\n\n\n\nn\nl\n\n\nw\n" | fdisk /dev/mmcblk0
 cp /etc/netctl/examples/wireless-wpa /etc/netctl/
    sed -i "s/MyNetwork/${WIFISSID}/" /etc/netctl/wireless-wpa
    sed -i "s/'WirelessKey'/${WIFIKEY}/" /etc/netctl/wireless-wpa
    tee -a /etc/netctl/wireless-wpa <<HDHD

ExecUpPost='/usr/bin/ntpd -gq || true'
HDHD
    timedatectl set-timezone GMT
    netctl enable wireless-wpa
  elif [ -e /etc/debian_version  ]; then
    echo "Detected Raspbian. Configuring..."
    tee /etc/wpa_supplicant/wpa_supplicant.conf <<HDHD
network={
 ssid="${WIFISSID}"
 psk="${WIFIKEY}"
}
HDHD
    PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^2" | cut -f 2 -d:)
    echo -e "d\n2\nn\np\n\n${PART_START}\n\nw\n" | fdisk /dev/mmcblk0

  else
    echo "Could not work out which distro we are on - this tools only supports Arch and Raspbian"; exit 1
  fi
  touch /boot/firststage
  reboot
fi

if [ -f /boot/secondstage ]; then
  echo "It appears that the first and second stages have already been run - exiting"; exit 0
fi

if [ ! -f /boot/secondstage ]; then
  echo "Starting second stage setup ..." 
  if [ -e /etc/arch-release ]; then
    echo "Detected Arch Linux. Resizing..."
    resize2fs /dev/mmcblk0p5 || { echo "Unable to resize SD card. Exiting"; exit 1; }
  elif [ -e /etc/debian_version  ]; then
    echo "Detected Raspbian. Resizing..."
    resize2fs /dev/mmcblk0p2 || { echo "Unable to resize SD card. Exiting"; exit 1; }
  fi
  reset_autostart
  touch /boot/secondstage
fi 
Save to boot partition this file for instant ssh access:
boot_enable_ssh.rc

Source:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=75762

How to use remote desktop connection on high resolution laptop


To use terminal on high resolution laptop on 64-bit windows extract http://www.nirsoft.net/utils/nircmd-x64.zip in %systemroot%
On 32-bit windows extract http://www.nirsoft.net/utils/nircmd.zip in %systemroot%

Open notepad in "Run As Administrator" mode and paste content similar to this:
nircmdc setdisplay 1280 800 32
mstsc /v:here.goes.ip.address
nircmdc setdisplay 1920 1080 32
Save this file on
c:\users\public\desktop\custom.cmd
Now use new "custom.cmd" on Desktop.

Friday, May 8, 2015

CcmSetup failed with error code 0x80070643, ExitCode: 1603

C:\Windows\ccmsetup\Logs\ccmsetup.log says:
<![LOG[File C:\windows\ccmsetup\MicrosoftPolicyPlatformSetup.msi installation failed. Error text: ExitCode: 1603
Action: 
ErrorMessages:
]LOG]!><time="13:37:33.802-180" date="05-08-2015" component="ccmsetup" context="" type="3" thread="3976" file="msiutil.cpp:872">
<![LOG[InstallFromManifest failed 0x80070643]LOG]!><time="13:37:33.802-180" date="05-08-2015" component="ccmsetup" context="" type="3" thread="3976" file="ccmsetup.cpp:7086">
<![LOG[A Fallback Status Point has not been specified.  Message with STATEID='311' will not be sent.]LOG]!><time="13:37:33.802-180" date="05-08-2015" component="ccmsetup" context="" type="1" thread="3976" file="ccmsetup.cpp:9428">
<![LOG[CcmSetup failed with error code 0x80070643]LOG]!><time="13:37:33.802-180" date="05-08-2015" component="ccmsetup" context="" type="1" thread="2132" file="ccmsetup.cpp:10544">
C:\Windows\ccmsetup\Logs\MicrosoftPolicyPlatformSetup.msi.log says:
Property(S): SOURCEDIR = C:\windows\ccmsetup\
Property(S): SourcedirProduct = {90D295B8-BA08-487E-B904-0E624209A410}
Property(S): ProductToBeRegistered = 1
MSI (s) (8C:F0) [13:37:33:787]: Note: 1: 1708 
MSI (s) (8C:F0) [13:37:33:787]: Product: Microsoft Policy Platform -- Installation failed.

MSI (s) (8C:F0) [13:37:33:787]: Windows Installer installed the product. Product Name: Microsoft Policy Platform. Product Version: 1.2.3602.0. Product Language: 1033. Manufacturer: Microsoft Corporation. Installation success or error status: 1603.

MSI (s) (8C:F0) [13:37:33:787]: Deferring clean up of packages/files, if any exist
MSI (s) (8C:F0) [13:37:33:787]: MainEngineThread is returning 1603
MSI (s) (8C:20) [13:37:33:787]: No System Restore sequence number for this installation.
=== Logging stopped: 08.05.2015.  13:37:33 ===
MSI (s) (8C:20) [13:37:33:787]: User policy value 'DisableRollback' is 0
MSI (s) (8C:20) [13:37:33:787]: Machine policy value 'DisableRollback' is 0
MSI (s) (8C:20) [13:37:33:787]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (8C:20) [13:37:33:787]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (8C:20) [13:37:33:787]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (8C:20) [13:37:33:787]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (s) (8C:20) [13:37:33:787]: Restoring environment variables
MSI (s) (8C:20) [13:37:33:787]: Destroying RemoteAPI object.
MSI (s) (8C:40) [13:37:33:787]: Custom Action Manager thread ending.
MSI (c) (D8:08) [13:37:33:802]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (D8:08) [13:37:33:802]: MainEngineThread is returning 1603
=== Verbose logging stopped: 08.05.2015.  13:37:33 ===
Challenge accepted!

First i turn off antiviruss.

I tried this hotfix:
https://support.microsoft.com/en-us/kb/976982

I tried install SCCM agent and failed.

Then i use dotnet repair tool:
http://download.microsoft.com/download/2/B/D/2BDE5459-2225-48B8-830C-AE19CAF038F1/NetFxRepairTool.exe

I tried install SCCM agent and failed.

Then i install again .NET 4.5.2
http://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/NDP452-KB2901907-x86-x64-AllOS-ENU.exe

I tried install SCCM agent and failed.

Then i run batch file in "Run as Administrator" mode (do not paste just into cmd windows!):
@echo off
sc config winmgmt start= disabled
net stop winmgmt /y
%systemdrive%
cd %windir%\system32\wbem
For /f %%s in ('dir /b *.dll') do regsvr32 /s %%s
wmiprvse /regserver
winmgmt /regserver
net start winmgmt
for /f %%s in ('dir /b *.mof *.mfl') do mofcomp %%s
pause
I tried install SCCM agent and failed.

Then i decided to run windows update and get:
Code 80072EFD
Then i clear whole update cache:
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
net stop wuauserv
rd %systemroot%\SoftwareDistribution /Q /S
SC sdshow wuauserv
SC sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
wuauclt.exe /detectnow
pause
Then get error again and i also get angry.

Then i retry windows updates:

Then i play with network and proxy settings:

Now i re-check windows updates.

Then i get happy cause windows shows that there is hunred of updates which needed to be install.
I installed all these updates via standart update interface.

Now after restarting computer i am able to install SCCM agent.

Wednesday, May 6, 2015

Your system drive has a GUID partition table (GPT). Currently, only drives with MBR partition table are supported.


If you are using laptop and you are not gone take out your drive then solution is:
1) Backup installed windows key

2) Turn on Legacy mode in BIOS. This will turn off UEFI mode

3) Download legacy windows 8.1 image and convert to iso.

4) Boot Windows setup and press Shift+F10

5) Launch diskpart utility and enter commands:
list disk
select disk 0
clean
convert mbr
create partition primary
format fs=ntfs quick
active
exit
6) Install windows with same key as before