Saturday, October 31, 2015

Unsupported item Zabbix, vfs.file.time, Windows server 2008 R2

Turns out that zabbix service is running my user SYSTEM.
This also means if the file permissions contains hight permission like local administrator group but do not contain SYSTEM then it will be unable to retrieve item value.
vfs.file.time[c:\custom\direcotry\file.dll]
Please add SYSTEM user with full control to c:\custom\direcotry\file.dll

Friday, October 30, 2015

Thursday, October 29, 2015

Detect if machine is online, zabbix

By default this is how zabbix indicate the offline machine:
{Template ICMP Ping:icmpping.max(#3)}=0
If you want to detect online machine use:
{Template ICMP Ping:icmpping.max(#3)}#0

Wednesday, October 28, 2015

Template ICMP Ping do not work, OpenSuse Appliance

I am using "Zabbix 2.2 LTS" Appliance which has builded on the top of OpenSUSE

I have get into trouble by using simple "Template ICMP Ping" template:
fping failed: "/usr/sbin/fping6: can't create raw socket (must run as root?) : Operation not permitted":

Chech fping permissions:
# ls -l /usr/sbin/fping*
-rws--x--- 1 root zabbix 31400 Jan 31  2013 /usr/sbin/fping
-rwxr-xr-x 1 root root   31408 Jan 31  2013 /usr/sbin/fping6
To solve this case let zabbix user execute fping command:
chown root.root /usr/sbin/fping*
Let others to use fping
# chmod -v 6755 /usr/sbin/fping*
mode of '/usr/sbin/fping' changed from 0710 (rwx--x---) to 6755 (rwsr-sr-x)
mode of '/usr/sbin/fping6' changed from 0755 (rwxr-xr-x) to 6755 (rwsr-sr-x)
Now i get another message:
At least one of '/usr/sbin/fping', '/usr/sbin/fping6' must exist. Both are missing in the system:

Check the status of fping in config file:
grep Fping /etc/zabbix_server.conf
This will output something like this:
### Option: FpingLocation
# FpingLocation=/usr/sbin/fping
### Option: Fping6Location
# Fping6Location=/usr/sbin/fping6
Now we enable these options
sed -i "s/^.*FpingLocation=/FpingLocation=/" /etc/zabbix_server.conf
sed -i "s/^.*Fping6Location=/Fping6Location=/" /etc/zabbix_server.conf
Check again settings.
grep Fping /etc/zabbix_server.conf
This will report:
### Option: FpingLocation
FpingLocation=/usr/sbin/fping
### Option: Fping6Location
Fping6Location=/usr/sbin/fping6
Reboot server or restart zabbix server service!
Recreate host!

After doing some stuff i found second step useless cause if the lines are commented zabbix still can found libraries in this location cause it is the default path.

Tuesday, October 27, 2015

Monday, October 26, 2015

Detect if windows task is running to long, zabbix

Item by itself:
system.run[tasklist | grep "calc.exe" | wc -l]
Trigger:
{computer:system.run[tasklist | grep "calc.exe" | wc -l].avg(1m)}>0
To work with this solution you have to add some gnu libraries like ls.exe, grep.exe to windows %path% variable and restart zabbix agent.

Friday, October 23, 2015

SCCM, Task sequence, country, region

echo set working dir
set w=%temp%
if not exist "%w%\mount" md "%w%\mount"
dism /Mount-wim /WimFile:install.wim /index:1 /MountDir:"%w%\mount"
dism /image:"%w%\mount" /Set-Syslocale:lv-LV
dism /image:"%w%\mount" /Set-UserLocale:lv-LV
dism /image:"%w%\mount" /Set-TimeZone:"FLE Standard Time"
dism /image:"%w%\mount" /Get-Intl
dism /unmount-wim /mountdir:"%w%\mount" /commit
if exist "%w%\mount" rd "%w%\mount" /Q /S
dism /image:"%w%\mount" /Get-Intl just list the settings active.
You can see all available languages with command
tzutil /l
This will list content like:
(UTC-12:00) International Date Line West 
Dateline Standard Time

(UTC-11:00) Coordinated Universal Time-11 
UTC-11

(UTC-10:00) Hawaii 
Hawaiian Standard Time

(UTC-09:00) Alaska 
Alaskan Standard Time

(UTC-08:00) Baja California 
Pacific Standard Time (Mexico)

(UTC-08:00) Pacific Time (US & Canada) 
Pacific Standard Time

(UTC-07:00) Arizona 
US Mountain Standard Time

(UTC-07:00) Chihuahua, La Paz, Mazatlan 
Mountain Standard Time (Mexico)

(UTC-07:00) Mountain Time (US & Canada) 
Mountain Standard Time

(UTC-06:00) Central America 
Central America Standard Time

(UTC-06:00) Central Time (US & Canada) 
Central Standard Time

(UTC-06:00) Guadalajara, Mexico City, Monterrey 
Central Standard Time (Mexico)

(UTC-06:00) Saskatchewan 
Canada Central Standard Time

(UTC-05:00) Bogota, Lima, Quito, Rio Branco 
SA Pacific Standard Time

(UTC-05:00) Chetumal 
Eastern Standard Time (Mexico)

(UTC-05:00) Eastern Time (US & Canada) 
Eastern Standard Time

(UTC-05:00) Indiana (East) 
US Eastern Standard Time

(UTC-04:30) Caracas 
Venezuela Standard Time

(UTC-04:00) Asuncion 
Paraguay Standard Time

(UTC-04:00) Atlantic Time (Canada) 
Atlantic Standard Time

(UTC-04:00) Cuiaba 
Central Brazilian Standard Time

(UTC-04:00) Georgetown, La Paz, Manaus, San Juan 
SA Western Standard Time

(UTC-03:30) Newfoundland 
Newfoundland Standard Time

(UTC-03:00) Brasilia 
E. South America Standard Time

(UTC-03:00) Buenos Aires 
Argentina Standard Time

(UTC-03:00) Cayenne, Fortaleza 
SA Eastern Standard Time

(UTC-03:00) Greenland 
Greenland Standard Time

(UTC-03:00) Montevideo 
Montevideo Standard Time

(UTC-03:00) Salvador 
Bahia Standard Time

(UTC-03:00) Santiago 
Pacific SA Standard Time

(UTC-02:00) Coordinated Universal Time-02 
UTC-02

(UTC-01:00) Azores 
Azores Standard Time

(UTC-01:00) Cabo Verde Is. 
Cape Verde Standard Time

(UTC) Casablanca 
Morocco Standard Time

(UTC) Coordinated Universal Time 
UTC

(UTC) Dublin, Edinburgh, Lisbon, London 
GMT Standard Time

(UTC) Monrovia, Reykjavik 
Greenwich Standard Time

(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna 
W. Europe Standard Time

(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague 
Central Europe Standard Time

(UTC+01:00) Brussels, Copenhagen, Madrid, Paris 
Romance Standard Time

(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb 
Central European Standard Time

(UTC+01:00) West Central Africa 
W. Central Africa Standard Time

(UTC+01:00) Windhoek 
Namibia Standard Time

(UTC+02:00) Amman 
Jordan Standard Time

(UTC+02:00) Athens, Bucharest 
GTB Standard Time

(UTC+02:00) Beirut 
Middle East Standard Time

(UTC+02:00) Cairo 
Egypt Standard Time

(UTC+02:00) Damascus 
Syria Standard Time

(UTC+02:00) E. Europe 
E. Europe Standard Time

(UTC+02:00) Harare, Pretoria 
South Africa Standard Time

(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius 
FLE Standard Time

(UTC+02:00) Istanbul 
Turkey Standard Time

(UTC+02:00) Jerusalem 
Israel Standard Time

(UTC+02:00) Kaliningrad (RTZ 1) 
Kaliningrad Standard Time

(UTC+02:00) Tripoli 
Libya Standard Time

(UTC+03:00) Baghdad 
Arabic Standard Time

(UTC+03:00) Kuwait, Riyadh 
Arab Standard Time

(UTC+03:00) Minsk 
Belarus Standard Time

(UTC+03:00) Moscow, St. Petersburg, Volgograd (RTZ 2) 
Russian Standard Time

(UTC+03:00) Nairobi 
E. Africa Standard Time

(UTC+03:30) Tehran 
Iran Standard Time

(UTC+04:00) Abu Dhabi, Muscat 
Arabian Standard Time

(UTC+04:00) Baku 
Azerbaijan Standard Time

(UTC+04:00) Izhevsk, Samara (RTZ 3) 
Russia Time Zone 3

(UTC+04:00) Port Louis 
Mauritius Standard Time

(UTC+04:00) Tbilisi 
Georgian Standard Time

(UTC+04:00) Yerevan 
Caucasus Standard Time

(UTC+04:30) Kabul 
Afghanistan Standard Time

(UTC+05:00) Ashgabat, Tashkent 
West Asia Standard Time

(UTC+05:00) Ekaterinburg (RTZ 4) 
Ekaterinburg Standard Time

(UTC+05:00) Islamabad, Karachi 
Pakistan Standard Time

(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi 
India Standard Time

(UTC+05:30) Sri Jayawardenepura 
Sri Lanka Standard Time

(UTC+05:45) Kathmandu 
Nepal Standard Time

(UTC+06:00) Astana 
Central Asia Standard Time

(UTC+06:00) Dhaka 
Bangladesh Standard Time

(UTC+06:00) Novosibirsk (RTZ 5) 
N. Central Asia Standard Time

(UTC+06:30) Yangon (Rangoon) 
Myanmar Standard Time

(UTC+07:00) Bangkok, Hanoi, Jakarta 
SE Asia Standard Time

(UTC+07:00) Krasnoyarsk (RTZ 6) 
North Asia Standard Time

(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi 
China Standard Time

(UTC+08:00) Irkutsk (RTZ 7) 
North Asia East Standard Time

(UTC+08:00) Kuala Lumpur, Singapore 
Singapore Standard Time

(UTC+08:00) Perth 
W. Australia Standard Time

(UTC+08:00) Taipei 
Taipei Standard Time

(UTC+08:00) Ulaanbaatar 
Ulaanbaatar Standard Time

(UTC+09:00) Osaka, Sapporo, Tokyo 
Tokyo Standard Time

(UTC+09:00) Seoul 
Korea Standard Time

(UTC+09:00) Yakutsk (RTZ 8) 
Yakutsk Standard Time

(UTC+09:30) Adelaide 
Cen. Australia Standard Time

(UTC+09:30) Darwin 
AUS Central Standard Time

(UTC+10:00) Brisbane 
E. Australia Standard Time

(UTC+10:00) Canberra, Melbourne, Sydney 
AUS Eastern Standard Time

(UTC+10:00) Guam, Port Moresby 
West Pacific Standard Time

(UTC+10:00) Hobart 
Tasmania Standard Time

(UTC+10:00) Magadan 
Magadan Standard Time

(UTC+10:00) Vladivostok, Magadan (RTZ 9) 
Vladivostok Standard Time

(UTC+11:00) Chokurdakh (RTZ 10) 
Russia Time Zone 10

(UTC+11:00) Solomon Is., New Caledonia 
Central Pacific Standard Time

(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky (RTZ 11) 
Russia Time Zone 11

(UTC+12:00) Auckland, Wellington 
New Zealand Standard Time

(UTC+12:00) Coordinated Universal Time+12 
UTC+12

(UTC+12:00) Fiji 
Fiji Standard Time

(UTC+13:00) Nuku'alofa 
Tonga Standard Time

(UTC+13:00) Samoa 
Samoa Standard Time

(UTC+14:00) Kiritimati Island 
Line Islands Standard Time
Source:
https://technet.microsoft.com/en-us/library/dd744360(v=ws.10).aspx

Language codes:
https://technet.microsoft.com/en-us/library/dd744369(v=ws.10).aspx

Thursday, October 22, 2015

Office 2013 silent install with cd-key

Just create ProPlusR.xml file with content:
<Configuration Product="ProPlusR">
<Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />
<Setting Id="SETUP_REBOOT" Value="Never" />
<PIDKEY Value="AAAAABBBBBCCCCCDDDDDEEEEE" />
</Configuration>
Run command
start /wait "" "%~dp0setup.exe" /config "%~dp0ProPlusR.xml"

Wednesday, October 21, 2015

Office 2013 x86 silent install-uninstall, detection rule

Office 2013 silent install with detection rule

@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set n=Microsoft Office Professional Plus 2013
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
for /f "tokens=*" %%a in ('^
reg query "%sw%\%x%%u%" /s ^|
grep "Windows.*CurrentVersion.*Uninstall" ^|
sed "s/.*\\Uninstall\\//g"') do (
reg query "%sw%\%x%%u%\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%x%%u%\%%a" /v DisplayName | find "%n%" > nul 2>&1
if !errorlevel!==0 (
echo %n% already installed at version:
reg query "%sw%\%x%%u%\%%a" /v DisplayVersion | find "DisplayVersion"
goto exist
)
)
)
echo Office 2013
start /wait "" "%~dp0setup.exe" /config "%~dp0ProPlusR.xml"
reg add "HKCU\Software\Microsoft\Office\15.0\Common\General" ^
/v shownfirstrunoptin /t REG_DWORD /d 1 /f > nul 2>&1
reg add "HKCU\Software\Microsoft\Office\15.0\FirstRun" ^
/v BootedRTM /t REG_DWORD /d 1 /f > nul 2>&1
reg add "HKCU\Software\Microsoft\Office\15.0\FirstRun" ^
/v disablemovie /t REG_DWORD /d 1 /f > nul 2>&1
reg add "HKCU\Software\Microsoft\Office\15.0\Common\PTWatson" ^
/v PTWOptIn /t REG_DWORD /d 1 /f > nul 2>&1
reg add "HKCU\Software\Microsoft\Office\15.0\Common" ^
/v qmenable /t REG_DWORD /d 1 /f > nul 2>&1
:exist
endlocal

Office 2013 silent uninstall

@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set n=Google Drive
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
for /f "tokens=*" %%a in ('^
reg query "%sw%\%x%%u%" /s ^|
grep "Windows.*CurrentVersion.*Uninstall" ^|
sed "s/.*\\Uninstall\\//g"') do (
reg query "%sw%\%x%%u%\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%x%%u%\%%a" /v DisplayName | find "%n%" > nul 2>&1
if !errorlevel!==0 (
echo found Skype version:
reg query "%sw%\%x%%u%\%%a" /v DisplayVersion | find "DisplayVersion"
echo Uninstalling..
%systemroot%\system32\msiexec.exe /X %%a /qn
)
)
)
endlocal
ProPlusR.xml
<Configuration Product="ProPlusR">
<Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />
<Setting Id="SETUP_REBOOT" Value="Never" />
</Configuration>
https://technet.microsoft.com/en-us/library/cc179195.aspx

Tuesday, October 20, 2015

Opera silent install-uninstall, detection method

Opera silent install with detection rule:
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set n=Opera
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
for /f "tokens=*" %%a in ('^
reg query "%sw%\%x%%u%" /s ^|
grep "Windows.*CurrentVersion.*Uninstall" ^|
sed "s/.*\\Uninstall\\//g"') do (
reg query "%sw%\%x%%u%\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%x%%u%\%%a" /v DisplayName | find "%n%" > nul 2>&1
if !errorlevel!==0 (
echo %n% already installed at version:
reg query "%sw%\%x%%u%\%%a" /v DisplayVersion | find "DisplayVersion"
goto exist
)
)
)
for /f "tokens=*" %%a in ('dir /b "%~dp0Opera*Setup.exe"') do (
echo %n%
start /wait "" "%~dp0%%a" /SILENT /allusers=yes /launchopera=no /desktopshortcut=no /setdefaultbrowser=no /pintotaskbar=no /startmenushortcut=yes /language=en-us
)
:exist
endlocal
Opera silent uninstall:
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set n=Opera
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
for /f "tokens=*" %%a in ('^
reg query "%sw%\%x%%u%" /s ^|
grep "Windows.*CurrentVersion.*Uninstall" ^|
sed "s/.*\\Uninstall\\//g"') do (
reg query "%sw%\%x%%u%\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%x%%u%\%%a" /v DisplayName | find "%n%" > nul 2>&1
if !errorlevel!==0 (
echo found %n% version:
reg query "%sw%\%x%%u%\%%a" /v DisplayVersion | find "DisplayVersion"
echo Uninstalling..

for /f "tokens=*" %%b in ('^
reg query "%sw%\%x%%u%\%%a" /v UninstallString ^|
findstr "UninstallString" ^|
sed "s/UninstallString\|REG_SZ//g" ^|
sed "s/^[ \t]*//g"') do (
echo %%b
start /wait "" %%b /silent
)


)
)
)
endlocal
Files needed to successfully detect uninstall string:
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/regex2.dll
http://gnu.catonrug.net/sed.exe
http://gnu.catonrug.net/grep.exe

Latest Opera offline installer:
http://www.opera.com/download/get/?partner=www&opsys=Windows

Monday, October 19, 2015

Backup Microsoft Exchange 2010 user account, PowerShell

Open Exchange Management Shell

Assign your administrative user permission to do the import/export thing:
New-ManagementRoleAssignment -Role "Mailbox Import Export" -User yourusername
Backup mailbox:
New-MailboxExportRequest -Mailbox username -FilePath \\server\share\user.pst
Do not backup on the same server - \\exchange\share
Do not backup to \\computername\c$\
Do not backup to c:\username.pst


Take completely another server,
create shared forder,
assign "Exchange Trusted Subsystem" group or Everyone to make it work.
.

At the end:
\\anotherserver\share
To see the status execute:
Get-MailboxExportRequest
or:
Get-MailboxExportRequestStatistics

Sunday, October 18, 2015

no pg_hba.conf entry for host "[local]", user "postgres", database "template1"

I have this message:
vacuumdb: could not connect to database template1: FATAL:  no pg_hba.conf entry for host "[local]", user "postgres", database "template1", SSL off
Solution is to open file:
/var/lib/pgsql/data/pg_hba.conf
Add these lines:
local all all md5
host all all 127.0.0.1 255.255.255.255 md5
Restart Postgres service:
service postgresql restart
And of cource leave a comment if this solve your case ;)

Out of Office do not work, Outlook 2010

Solution:
1. Delete all rules.
2. Open "Automatic Replies" section.
3. Click the "Rules" button at the Out of Office managment screen.
This will refresh whole rule management algorithm!

cannot send list of active checks to [x.y.w.z]: host [localhost.localdomain] not found, zabbix_server.log

This happens when you set up ServerActive parameter in zabbix_agentd.conf at the client side configuration file.
If you want to force this option you probably need to put:
ServerActive=127.0.0.1
But most of the time you just do not need this parameter so comment just it:
#ServerActive=127.0.0.1
Restart zabbix agent on CentOS 7:
systemctl restart zabbix-agent
Restart zabbix agent on CentOS 6:
service zabbix-agent restart

Friday, October 16, 2015

Google Chrome silent install-uninstall, detection method

To install latest Google Chrome I use this offline installers:
googlechromestandaloneenterprise64.msi
googlechromestandaloneenterprise.msi

And now the..
silent-install.cmd
@echo off

if exist "%programfiles%\Google\Chrome" goto installed
if exist "%programfiles(x86)%\Google\Chrome" goto installed

if not "%ProgramFiles(x86)%"=="" (
echo installing Google Chrome 64-bit version
for /f "tokens=*" %%a in ('dir /b "%~dp0*enterprise64.msi"') do (
%systemroot%\system32\msiexec.exe /i "%~dp0%%a" /qb
)
)

if "%ProgramFiles(x86)%"=="" (
echo installing Google Chrome 32-bit version
for /f "tokens=*" %%a in ('dir /b "%~dp0*enterprise.msi"') do (
%systemroot%\system32\msiexec.exe /i "%~dp0%%a" /qb
)
)

:installed
For silent uninstall i need additional libraries:
libiconv2.dll libintl3.dll regex2.dll sed.exe grep.exe

and this uninstall script:
silent-uninstall.cmd
@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set n=Google Chrome
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
for /f "tokens=*" %%a in ('^
reg query "%sw%\%x%%u%" /s ^|
grep "Windows.*CurrentVersion.*Uninstall" ^|
sed "s/.*\\Uninstall\\//g"') do (
reg query "%sw%\%x%%u%\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%x%%u%\%%a" /v DisplayName | find "%n%" > nul 2>&1
if !errorlevel!==0 (
echo Found %n% version:
reg query "%sw%\%x%%u%\%%a" /v DisplayVersion | find "DisplayVersion"
echo Now uninstalling..
%systemroot%\system32\msiexec.exe /X %%a /qn
)
)
)
endlocal

Thursday, October 15, 2015

Intro of PowerShell 4

#Get version
$psversiontable.psversion

#Show module path
$env:psmodulepath

#Install WinRM service on system. This will allow execute PowerShell commands on this system from another station:
winrm qc -force

#Search for commands that starts with
get-command -verb resolve

#Search for commands that ends with
get-command -noun service
get-command -noun computer

#Show all string properties and methods
"1"|gm

#Show all number properties and methods
1|gm

#Show all wmi and cim related commands:
get-command *wmi*
get-command *cim*

#Create array, add item, count size
$array=@{"first"="value1";"second"="value2"}
$array.add("third","value3")
"Now " +($array.Count) +" elements in array"

#Start a loop
$choice=""
do {
$choice=read-host "enter q to quit"
} while ($choice -ne 'q')

#Look for all classes which includes "Disk" in name:
get-cimclass -ClassName "*disk*"

#Show few classes which i can work with:
get-wmiObject -namespace "root/cimv2" -list

#Search all classes which include system in the name:
get-wmiObject -namespace "root/cimv2" -list | ? name -Like "*system*"

Tuesday, October 13, 2015

WinDjView silent install-uninstall with detection method

WinDjView silent install with detection rule

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=WinDjView
reg query "%sw%\%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
for /f "tokens=*" %%a in ('dir /b "%~dp0WinDjView*.exe"') do (
"%~dp0%%a" /S
)
) else echo %k% already installed!
endlocal

WinDjView silent uninstall

@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=WinDjView
reg query "%sw%\%u%\%k%" > nul 2>&1
if !errorlevel!==0 (
for /f "tokens=*" %%a in ('^
reg query "%sw%\%u%\%k%" /v UninstallString ^|
findstr "UninstallString" ^|
sed "s/UninstallString\|REG_SZ//g" ^|
sed "s/^[ \t]*//g" ^|
sed "s/\d034//g"') do (
start /wait "" "%%a" /S
)
) else echo %k% already uninstalled!
:CheckUninstallKey
reg query "%sw%\%u%\%k%" > nul 2>&1
if !errorlevel!==0 goto CheckUninstallKey
endlocal
Files needed to successfully detect uninstall string:
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/regex2.dll
http://gnu.catonrug.net/sed.exe
http://gnu.catonrug.net/grep.exe

Monday, October 12, 2015

autounattend.xml time zone

To integrate Time Zone setting you have to use:
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <OEMInformation>
                <HelpCustomized>false</HelpCustomized>
            </OEMInformation>
            <ComputerName />
            <TimeZone>(GMT+02:00) Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius</TimeZone>
            <RegisteredOwner></RegisteredOwner>
        </component>
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <OEMInformation>
                <HelpCustomized>false</HelpCustomized>
            </OEMInformation>
            <ComputerName />
            <TimeZone>(GMT+02:00) Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius</TimeZone>
            <RegisteredOwner></RegisteredOwner>
        </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>
        <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>
For another language look:
http://technet.microsoft.com/en-us/library/cc749073(v=ws.10).aspx

Generate new SSL certificate for nginx

Make sure this SSL certificate do not exist in domain controller.

Make sure the nginx is running before you do some stuff:
systemctl status nginx.service
systemctl restart nginx.service
SSH into your linux server.

Remove any previous generated key:
rm /etc/pki/tls/private/localhost.key
Move to the certs directory:
cd /etc/pki/tls/certs
Create a new key:
make genkey
Enter some content which you can really remember in future:
Verifying - Enter pass phrase:
Check if new key has been generated:
ls /etc/pki/tls/private/localhost.key
Enter a lot of information
Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Output certificate content on screen on copy to the clipboard:
cat localhost.csr
Go to your Windows Server 2012 R2 certificate service
http://dc.domain.net/certsrv/
Click [Request a certificate]
Click [advanced certificate request]
Click [Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file, or submit a renewal request by using a base-64-encoded PKCS #7 file.]

Copy the content from clipboard. Make sure you have no spaces at the end or at the beginning.

Select [Web Server]

Click [Submit]

Click on the [Base 64 encoded] ball

Now [Download certificate]

Write full certificate domain at the file name.

Upload your certificate to linux server.

Go to the certs direcotry
cd /etc/pki/tls/certs
Copy certificate from uploaded directory:
cp ~/servername.catonrug.net.cer .
Do some renaming:
cd /etc/pki/tls/certs
mv localhost.csr servername.catonrug.net.csr
cd /etc/pki/tls/private/
mv localhost.key servername.catonrug.net.key
Create a backup of key file:
cp servername.catonrug.net.key servername.catonrug.net.key.org
Remove password from key file:
openssl rsa -in servername.catonrug.net.key.org -out servername.catonrug.net.key
Enter same password which you used at beginning:
Enter pass phrase for servername.catonrug.net.key.org:
At success you will get:
writing RSA key
Check existing certificates in nginx.conf
grep ssl /etc/nginx/nginx.conf
Do some replace:
sed -i "s/replace/with/g" /etc/nginx/nginx.conf
Restart nginx:
systemctl status nginx.service
systemctl restart nginx.service

Sunday, October 11, 2015

audit2allow, unable to open (null): Bad address

This happens when SELinux is completely disabled:

YOu can enable selinux by:
sed -i "s/^SELINUX=.*$/SELINUX=enforcing/" /etc/selinux/config
And restart machine:
reboot
Check selinux status with:
sestatus

Friday, October 9, 2015

DNE Update Setup. Unable to manage network component. The condition can be transient.

Unable to manage network component.
The condition can be transient.
If it persists, it maybe because you're a member of the 
Network Configuration Operators group on this computer.
Members of this group cannot install network filter driver.
More at http://support.microsoft.com/kb/975608/de

To solve this message you have to use latest installers:
ftp://ftpsupport.citrix.com/dneupdate64.msi
ftp://ftpsupport.citrix.com/dneupdate.msi

Thursday, October 8, 2015

Secure VPN Connection terminated locally by the Client. Reason 442: Failed to enable Virtual Adapter. Cisco VPN Client


To fix this message you must overwrite registry value.

Open command prompt in "Run as administrator" mode.

Make a quick backup:
reg export HKLM\SYSTEM\CurrentControlSet\Services\CVirtA "%userprofile%\Desktop\CVirtA.reg"
On 64-bit windows execute:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\CVirtA" /v DisplayName /t REG_SZ  /d "Cisco Systems VPN Adapter for 64-bit Windows" /f
On 32-bit windows execute:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\CVirtA" /v DisplayName /t REG_SZ  /d "Cisco Systems VPN Adapter" /f

Wednesday, October 7, 2015

KMSpico silent install-uninstall, detection method

KMSpico silent install with detection rule

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=KMSpico_is1
if "%ProgramFiles(x86)%"=="" goto x86
:x64
echo 64-bit windows detected!
reg query "%sw%\%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
echo installing 64-bit version..
for /f "tokens=*" %%a in ('^
dir /b "%~dp0KMSpico*.exe"') do (
"%~dp0%%a" /SILENT
)
) else echo KMSpico 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 "%~dp0KMSpico*.exe"') do (
"%~dp0%%a" /SILENT
)
) else echo KMSpico already exists!
:exit
endlocal

KMSpico silent uninstall

@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=KMSpico_is1
reg query "%sw%\%u%\%k%" > nul 2>&1
if !errorlevel!==0 (
for /f "tokens=*" %%a in ('^
reg query "%sw%\%u%\%k%" /v UninstallString ^|
findstr "UninstallString" ^|
sed "s/UninstallString\|REG_SZ//g" ^|
sed "s/^[ \t]*//g" ^|
sed "s/\d034//g"') do (
%%a /SILENT
)
)
:CheckUninstallKey
reg query "%sw%\%u%\%k%" > nul 2>&1
if !errorlevel!==0 goto CheckUninstallKey
endlocal
Files needed to successfully detect uninstall string:
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/regex2.dll
http://gnu.catonrug.net/sed.exe

Setup file:
1fadee024cbe8396538cfa2c8d412629
b554c22f5c32bd884277f2e2e91716cb4fcfe7de

Tuesday, October 6, 2015

Install KB890830 in first run script

Use Internet Explorer and got to link:
https://catalog.update.microsoft.com/v7/site/Search.aspx?q=KB890830

Look for latest date for your operating system. In this example I choose windows 8.1.

Add these two packages to cart and then download it!

At the end the boot packages looks similar to this:
AMD64_X86-all-windows-kb890830-x64-v5.28_30c3e46fa8038beb00e0c3223af5c2a4cb12a7cb.exe
X86_AMD64-all-windows-kb890830-v5.28_bd039817b409a1a4777c560b1720fc66bf443ee9.exe
Use this silent-install.cmd
@echo off
setlocal EnableDelayedExpansion
if not "%ProgramFiles(x86)%"=="" (
:x64
echo 64-bit windows detected!
for /f "tokens=*" %%a in ('dir /b "%~dp0*kb890830*.exe" ^|
find "x64"') do (
start /wait "" "%~dp0%%a" /Q /F:Y
)
goto exit
)
:x86
echo 32-bit windows detected!
for /f "tokens=*" %%a in ('dir /b "%~dp0*kb890830*.exe" ^|
find /v "x64"') do (
start /wait "" "%~dp0%%a" /Q /F:Y
)
:exit
endlocal
This usually installs about in 30 minutes or something.

Monday, October 5, 2015

VLC media player silent install-uninstall, detection rule

VLC silent install with detection rule

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=VLC media player
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 "%~dp0vlc*win32.exe"') do (
echo %k%
start /wait "" "%~dp0%%a" /S
reg import "%~dp0disable-update-check.reg" > nul 2>&1
)
) else echo %k% already installed!
endlocal

VLC silent uninstall

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=VLC media player
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 "%~dp0vlc*win32.exe"') do (
echo %k%
start /wait "" "%~dp0%%a" /S
reg import "%~dp0disable-update-check.reg" > nul 2>&1
)
) else echo %k% already installed!
endlocal
Content of disable-update-check.reg:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Applications\vlc.exe\shell\Open\command]
@="\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\" \"--no-qt-privacy-ask\" \"--no-qt-updates-notif\" --started-from-file \"%1\""
Files needed to successfully detect uninstall string:
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/regex2.dll
http://gnu.catonrug.net/sed.exe
http://gnu.catonrug.net/grep.exe

Sunday, October 4, 2015

audit2allow is missing from CentOS

If you are missing some command in CentOS you can use this tool to search for solution:
yum provides \*/audit2allow
This will outpu content similar to this:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.koyanet.lv
 * extras: centos.koyanet.lv
 * updates: centos.koyanet.lv
policycoreutils-python-2.0.83-24.el6.x86_64 : SELinux policy core python utilities
Repo        : base
Matched from:
Filename    : /usr/bin/audit2allow
And now you can install:
yum install policycoreutils-python

Thursday, October 1, 2015

TeamViewer silent install-uninstall, detection method

TeamViewer silent install with detection rule:

@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=TeamViewer
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 "%~dp0TeamViewer*.exe"') do (
start /wait "" "%~dp0%%a" /S
)
) else echo TeamViewer already installed!
endlocal

TeamViewer silent uninstall:

@echo off
setlocal EnableDelayedExpansion
set path=%path%;%~dp0
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=TeamViewer

tasklist | find "TeamViewer_Service"
if !errorlevel!==0 "%~dp0pskill.exe" /accepteula TeamViewer_Service.exe

tasklist | find "TeamViewer"
if !errorlevel!==0 "%~dp0pskill.exe" /accepteula TeamViewer.exe

if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if !errorlevel!==0 (
echo TeamViewer found at version:
reg query "%sw%\%x%%u%\%k%" /v DisplayVersion | find "DisplayVersion"
echo Now uninstalling..
for /f "tokens=*" %%a in ('^
reg query "%sw%\%x%%u%\%k%" /v UninstallString ^|
findstr "UninstallString" ^|
sed "s/UninstallString\|REG_SZ//g" ^|
sed "s/^[ \t]*//g" ^|
sed "s/\d034//g"') do (
start /wait "" "%%a" /S
)
)
:CheckUninstallKey
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if !errorlevel!==0 goto CheckUninstallKey
endlocal
Files needed to successfully detect skype existence:
http://gnu.catonrug.net/libiconv2.dll
http://gnu.catonrug.net/libintl3.dll
http://gnu.catonrug.net/regex2.dll
http://gnu.catonrug.net/sed.exe
http://live.sysinternals.com/Tools/pskill.exe

Related files:
http://download.teamviewer.com/download/TeamViewer_Setup.exe

Blog Archive