Friday, July 29, 2016

Mozilla Maintenance Service silent uninstall

Mozilla Maintenance Service is responsible for Firefox updates.

This is how I uninstall it on 32-bit or 64-bit machine:
@echo off
for /f delims^=^"^ tokens^=2 %%a in ('^
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService" /v UninstallString ^|
find "UninstallString"') do (
echo "%%a"
"%%a" /S
)

Thursday, July 28, 2016

VCHI initialization failed, vcgencmd measure_temp

I am trying to run vcgencmd measure_temp command with user zabbix but it gives me an error. Here is how I can illustrate the problem:
pi@rpi95e3e8 ~ $ sudo su
root@rpi95e3e8:/home/pi# su - zabbix
No directory, logging in with HOME=/
zabbix@rpi95e3e8:/$ vcgencmd measure_temp
VCHI initialization failed
I solved this case I added user zabbix to group video
usermod -a -G video zabbix

Add users to group, PowerShell

Show all group members:
Get-ADGroupMember "Office 365 Users"

Show all group members in readable format:
Get-ADGroupMember "Office 365 Users" | % { $_.name }

Show all group members in alphabetical order:
Get-ADGroupMember "Office 365 Users" | sort name | % { $_.name }

How much members is in group:
Get-ADGroupMember "Office 365 Users" | Measure-Object

Show full path of user object:
Get-ADuser usernamegoeshere | ft Name, DistinguishedName -Autosize

Add user John to group "Office 365 Users":
Get-ADuser john | % { Add-ADGroupMember -identity "Office 365 Users" -Member $_.DistinguishedName }

Show accounts which has some timestamp:
Get-ADUser -Filter {( lastlogontimestamp -like "*")} -Properties "LastLogonDate" | sort-object -property lastlogondate -descending | % { $_.name }

Show all used and active user accounts:
Get-ADUser -Filter {( lastlogontimestamp -like "*") -and (Enabled -eq $True)} -Properties "LastLogonDate" | sort name | % { $_.name }

Add all active user accounts to group "Office 365 Users":
Get-ADUser -Filter {( lastlogontimestamp -like "*") -and (Enabled -eq $True)} -Properties "LastLogonDate" | sort name | % { Add-ADGroupMember -identity "Office 365 Users" -Member $_.DistinguishedName }

Wednesday, July 27, 2016

Cisco VPN Client silent install for Windows 10 x64

Download DNE Update:
ftp://ftpsupport.citrix.com/dneupdate64.msi

Install DNE Update:
@echo off
setlocal EnableDelayedExpansion

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E4EC6A71-6B83-4F2A-A6F5-A54430564FE4}" > nul 2>&1
if not !errorlevel!==0 (
echo Installing DNE update..
%systemroot%\system32\msiexec.exe /i "%~dp0dneupdate64.msi" /qb /norestart
) else echo DNE update is already installed

endlocal

Download Global VPN Client:
http://help.mysonicwall.com/applications/vpnclient/GVCSetup64_4.9.9.1016_EN.exe
fb9437f623c1aa8f096cde6deee0eb41
b4e2f45d2a36428b232578656c3509f7c3ffc78a

Use 7-zip to unpack GVCSetup64_4.9.9.1016_EN.exe and get GVCInstall64.msi.
e710b5eb3387dcf053a5d9f574d6a7e5
8985bd27e6df07591b59c8036aeff05c4e3a44b4

Install Global VPN Client:
@echo off
setlocal EnableDelayedExpansion

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3D3AD380-2DFE-4ACA-A014-4D12D4E9CE84}" > nul 2>&1
if not !errorlevel!==0 (
echo Installing Global VPN Client..
%systemroot%\system32\msiexec.exe /i "%~dp0GVCInstall64.msi" /qb /norestart
) else echo Global VPN Client is already installed

endlocal

Download Cisco VPN Client:
http://www.asc.edu/downloads/CiscoVPN/Windows/vpnclient-winx64-msi-5.0.07.0440-k9.exe
8d10a9d6dd25793d600a08389a56825c
b186f2bbab0f36b17fba0c13e537447fc200d24c

Unpack vpnclient-winx64-msi-5.0.07.0440-k9.exe

Install Cisco VPN Client:
@echo off
setlocal EnableDelayedExpansion

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1CE60928-8325-49A8-8B06-633E48DD2B67}" > nul 2>&1
if not !errorlevel!==0 (
echo Installing Cisco VPN Client..
%systemroot%\system32\msiexec.exe /i "%~dp0vpnclient_setup.msi" /qb /norestart
) else echo Cisco VPN Client is already installed

endlocal

Open command prompt in "Run As Administrator" mode and paste command
reg add "HKLM\SYSTEM\CurrentControlSet\Services\CVirtA" /v DisplayName /t REG_SZ  /d "Cisco Systems VPN Adapter for 64-bit Windows" /f

All files unpacked and prepared for install can be found by extracting this archive:
https://drive.google.com/file/d/0B6XjkIrefxmZb3dUTFU2RXllWFE/view?usp=sharing

Monday, July 25, 2016

Office 2016 first impressions. How users react?

I have deployed Office 2016 on my organization.
These are common questions my users ask:
  1. My email is missing. I had Outlook icon on my desktop, but it is not there anymore. Please help!
  2. I can not find email. I was right there on quick launch. Can you help me?
  3. There are window which ask for [Accept]. What should I do?
  4. I can not recognize unread email message in Outlook 2016. This blue font color is unnoticeable
  5. Email list is awful. there are so much lines in it
  6. In previous version of Outlook I can hold down Ctrl and select attachments which I want to save. Now I can not do it in Outlook 2016. Give me back the old version!
  7. Outlook 2016 attachment icons are too big. I want it smaller
  8. "Send as mail Recipient" is missing in Outlook 2016
  9. The top of blue Outlook 2016 windows is depressing. How can I change color?
  10. The green Excel 2016 is disgusting. Is it possible to change color?
  11. I have no preview panel in the Outlook 2016. It was on the right side before!
  12. I had preview panel at the bottom of Outlook. It is not there anymore!
  13. How can I set bigger fonts in email list?
  14. Excel windows is separated. I can not merge two excel workbooks into one excel instance
  15. Watermark function (for one file) do not work in Word 2016. Same document works fine on Word 2013
  16. I can only see date in yesterdays emails. I wanna see exact time (not only date) when the email was received in yesterdays email
  17. There are yellow line on the to which says [Activate]. What should I do?
  18. When I press attach button in Outlook 2016 it will not put me on place where it usually does. Where can I find My Pictures directory?

Sunday, July 24, 2016

Install Office 365 via computer shut down script

I am deploying office 365 via computer startup script and for some computers this is not working. Now I try to find solution which do not involve user to wait a long time for the office to be installed. I want to control situation more and know when exactly when the office is installing so I do not use complete native SCCM solution.

My plan is to download office 365 setup files locally via SCCM. Then I manually make sure the workstation pretty clean from other office products like language packs. Then I click restart and now the new office installations happens.

I am using SCCM cache folder c:\windows\ccmcache as a repository which includes office installation somewhere in random folder.

The computer shut down script is looking for setup files inside it:
@echo off
setlocal EnableDelayedExpansion

for /f "tokens=*" %%a in ('dir /b "%systemroot%\ccmcache"') do (
if exist "%systemroot%\ccmcache\%%a\4jyhrfb4.cmd" (
echo office 365 installation found
call "%systemroot%\ccmcache\%%a\4jyhrfb4.cmd"
goto exit
)

)


:exit
endlocal

Now the script is checking if the system is really clear and if not then nothing happens:
@echo off

setlocal EnableDelayedExpansion

date /t
time /t

net stop wuauserv > nul 2>&1

net stop CcmExec > nul 2>&1

if "%ProgramFiles(x86)%"=="" goto only32bit

:only64bit

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Office14.OMUI.lv-lv" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Office14.OMUI.lv-lv" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Office14.PROPLUS" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Office14.PROPLUS" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{90150000-001F-0426-0000-0000000FF1CE}" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90150000-001F-0426-0000-0000000FF1CE}" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Office15.PROPLUS" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Office15.PROPLUS" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail - en-us" > nul 2>&1
if not !errorlevel!==0 (

:INSTALL_OFFICE_365_ON_64_BIT
start /wait %~dp0o16x32\setup.exe /configure %~dp0o16x32\setup.xml
echo !errorlevel!

) 

goto exit

:only32bit

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Office14.OMUI.lv-lv" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Office14.PROPLUS" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90150000-001F-0426-0000-0000000FF1CE}" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Office15.PROPLUS" > nul 2>&1
if !errorlevel!==0 goto exit

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail - en-us" > nul 2>&1
if not !errorlevel!==0 (

:INSTALL_OFFICE_365_ON_32_BIT
start /wait %~dp0o16x32\setup.exe /configure %~dp0o16x32\setup.xml
echo !errorlevel!

)

:exit

date /t
time /t
echo ===============================================================================

endlocal

setup.xml contains:
<Configuration>
    <Add OfficeClientEdition="32" Channel="Current" OfficeMgmtCOM="TRUE">
        <Product ID="O365ProPlusRetail">
            <Language ID="en-us"/>
            <ExcludeApp ID="OneDrive"/>
            <ExcludeApp ID="OneNote"/>
            <ExcludeApp ID="Publisher"/>
            <ExcludeApp ID="Lync"/>
            <ExcludeApp ID="Groove"/>
        </Product>
    </Add>
    <Display Level="None" AcceptEULA="TRUE"/>
    <Updates Enabled="TRUE"/>
    <Logging Level="Standard" Path="\\path\log\Office365"/>
    <Property Name="AUTOACTIVATE" Value="1"/>
    <Property Name="FORCEAPPSHUTDOWN" Value="TRUE"/>
    <Property Name="SharedComputerLicensing" Value="0"/>
    <Property Name="PinIconsToTaskbar" Value="TRUE"/>
</Configuration>

Wednesday, July 20, 2016

Java Destroy 4 Windows - list uninstall, product keys

This will:
* Show/Remove 32-bit Java uninstall keys under 64-bit windows
* Show/Remove 64-bit Java uninstall keys under 64-bit windows
* Show/Remove 32-bit Java uninstall keys under 32-bit windows
* Show/Remove registry key which is responsible about Java icon from Control Panel
* Show/Remove all Java product keys
* Show/Remove JavaSoft base registry key
* Show/Kill existing java processes
* Show/Remove JavaQuickStarterService
* Show/Remove Java directory from Program Files
* Show/Remove Java directory from ProgramData

Project files:
https://github.com/catonrug/java-remove/archive/master.zip

Main program:
@echo off
setlocal EnableDelayedExpansion

date /t
time /t

rem Java destroy do not happen on computernames listed in whitelist
if exist "%~dp0whitelist\%computername%.txt" goto exit

echo.
rem detect if this is 32-bit operaing system
if "%ProgramFiles(x86)%"=="" goto FIND_NATIVE_JAVA_UNINSTALL_KEYS

:FIND_32_BIT_JAVA_UNINSTALL_KEYS_UNDER_64_BIT_SYSTEM
echo FINDING 32-BIT JAVA UNINSTALL KEYS UNDER 64-BIT SYSTEM:
echo.
rem list all 32-bit uninstall keys on 64-bit system
for /f "tokens=8 delims=\" %%a in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"') do (

rem work only with keys which have DisplayName
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (

rem if the uninstall key has "Java" inside then remember the uninstall key 
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /v DisplayName | find "Java" > nul 2>&1
if !errorlevel!==0 (

rem show the key which included word "Java"
echo %%a;

rem show which exact Java version is under this key
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /v DisplayName | find "Java"

rem delete uninstall key
if "%1"=="destroy" reg delete "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /f
echo.
)
)
)
echo.


:FIND_32_BIT_JAVA_CONTROL_PANEL_UNDER_64_BIT_SYSTEM
echo FINDING 32-BIT JAVA CONTROL PANEL ICON UNDER 64-BIT SYSTEM:
echo.
for /f "tokens=4 delims=\" %%a in ('reg query "HKCR\Wow6432Node\CLSID"') do (

rem look for keys which inlude InfoTip
reg query "HKCR\Wow6432Node\CLSID\%%a" /v InfoTip > nul 2>&1
if !errorlevel!==0 (

rem check inf InfoTip key included javacpl
reg query "HKCR\Wow6432Node\CLSID\%%a" /v InfoTip  | find "javacpl" > nul 2>&1

rem if found javacpl then this key is responsible for Java control panel icon
if !errorlevel!==0 (
echo %%a;
reg query "HKCR\Wow6432Node\CLSID\%%a" /v InfoTip  | find "javacpl"

if "%1"=="destroy" reg delete "HKCR\Wow6432Node\CLSID\%%a" /f
echo.
)
)
)
echo.


:FIND_NATIVE_JAVA_UNINSTALL_KEYS
echo FINDING NATIVE JAVA UNINSTALL KEYS:
echo.
rem list all native uninstall keys
for /f "tokens=7 delims=\" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"') do (

rem work only with keys which have DisplayName
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (

rem if the uninstall key has "Java" inside then remeber the uninstall key 
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /v DisplayName | find "Java" > nul 2>&1
if !errorlevel!==0 (

rem show the key which included word "Java"
echo %%a;

rem show which exact Java version is under this key
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /v DisplayName | find "Java"

rem delete the key
if "%1"=="destroy" reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%a" /f
echo.
)
)
)
echo.

:REMOVE_NATIVE_JAVA_ICON_FROM_CONTROL_PANEL
echo FINDING NATIVE JAVA CONTROL PANEL ICON:
echo.
for /f "tokens=3 delims=\" %%a in ('reg query "HKCR\CLSID"') do (

rem look for keys which inlude InfoTip
reg query "HKCR\CLSID\%%a" /v InfoTip > nul 2>&1
if !errorlevel!==0 (

rem check inf InfoTip key included javacpl
reg query "HKCR\CLSID\%%a" /v InfoTip  | find "javacpl" > nul 2>&1

rem if found javacpl then this key is responsible for Java control panel icon
if !errorlevel!==0 (
echo %%a;
reg query "HKCR\CLSID\%%a" /v InfoTip  | find "javacpl"

if "%1"=="destroy" reg delete "HKCR\CLSID\%%a" /f
echo.
)
)
)
echo.


:FIND_ALL_JAVA_UNINSTALL_KEYS
echo FINDING JAVA PRODUCT CODES:
echo.
rem list all keys under "HKLM\SOFTWARE\Classes\Installer\Products"
for /f "tokens=6 delims=\" %%a in ('reg query "HKLM\SOFTWARE\Classes\Installer\Products"') do (

rem look which keys have name "Java"
reg query "HKLM\SOFTWARE\Classes\Installer\Products\%%a" /v ProductName | find "Java" > nul 2>&1

rem if there is "Java" keyword in ProductName then put the product code into the file
if !errorlevel!==0 (

echo %%a;
reg query "HKLM\SOFTWARE\Classes\Installer\Products\%%a" /v "ProductName" | find "ProductName"

rem removing this key
if "%1"=="destroy" reg delete "HKLM\SOFTWARE\Classes\Installer\Products\%%a" /f
echo.
)
)
echo.

:KILL_JAVA_PROCESSES
"%~dp0sleep.exe" 1
rem kill existing java instances
tasklist | find "javaw.exe"
if !errorlevel!==0 if "%1"=="destroy" "%~dp0nircmd.exe" killprocess "javaw.exe"
"%~dp0sleep.exe" 1
tasklist | find "javaws.exe"
if !errorlevel!==0 if "%1"=="destroy" "%~dp0nircmd.exe" killprocess "javaws.exe"
"%~dp0sleep.exe" 1
tasklist | find "java.exe"
if !errorlevel!==0 if "%1"=="destroy" "%~dp0nircmd.exe" killprocess "java.exe"


:REMOVE_JAVA_SERVICES
sc query JavaQuickStarterService > nul 2>&1
if !errorlevel!==0 (
if "%1"=="destroy" (
net stop JavaQuickStarterService
"%~dp0sleep.exe" 2
sc delete JavaQuickStarterService
) else sc query JavaQuickStarterService
echo.
)

rem double check if service do not exist
sc query JavaQuickStarterService > nul 2>&1
if not !errorlevel!==1060 goto REMOVE_JAVA_SERVICES


:REMOVE_JAVA_REGISTRY_BASE
rem removing java master keys under registry
reg query "HKLM\SOFTWARE\JavaSoft" > nul 2>&1
if !errorlevel!==0 (
if "%1"=="destroy" (
echo Found HKLM\SOFTWARE\JavaSoft key, deleting now..
reg delete "HKLM\SOFTWARE\JavaSoft" /f
) else echo Found "HKLM\SOFTWARE\JavaSoft" registry key!
echo.
)

reg query "HKLM\SOFTWARE\Wow6432Node\JavaSoft" > nul 2>&1
if !errorlevel!==0 (
if "%1"=="destroy" (
echo Found HKLM\SOFTWARE\Wow6432Node\JavaSoft key, deleting now..
reg delete "HKLM\SOFTWARE\Wow6432Node\JavaSoft" /f
) else echo Found "HKLM\SOFTWARE\Wow6432Node\JavaSoft" registry key!
echo.
)


:REMOVE_JAVA_DIRECTORIES
rem removing Java catalog from native system
if exist "%programfiles%\Java" (
if "%1"=="destroy" (
echo "%programfiles%\Java" found, removing now..
rd "%programfiles%\Java" /Q /S
) else echo Found "%programfiles%\Java" directory!
echo.
)

if exist "%programfiles(x86)%\Java" (
if "%1"=="destroy" (
echo "%programfiles(x86)%\Java" found, removing now..
rd "%programfiles(x86)%\Java" /Q /S
) else echo Found "%programfiles(x86)%\Java" directory!
echo.
)

if exist "%programdata%\Oracle\Java" (
if "%1"=="destroy" (
echo "%programdata%\Oracle\Java" found, removing now..
rd "%programdata%\Oracle\Java" /Q /S
) else echo Found "%programdata%\Oracle\Java" directory!
echo.
)


rem final check 
if "%1"=="destroy" if exist "%programfiles%\Java" goto KILL_JAVA_PROCESSES
if "%1"=="destroy" if exist "%programfiles(x86)%\Java" goto KILL_JAVA_PROCESSES

:exit
if exist "%~dp0whitelist\%computername%.txt" echo this computer is listed in whitelist

date /t
time /t

endlocal

To detect situation use:
java-remove.cmd
To remove java from computer without undo:
java-remove.cmd destroy

Tuesday, July 19, 2016

Connect 2 CentOS 7 machines without DHCP server

vi /etc/sysconfig/network-scripts/ipcfg-enp0s3
Modify lines:
ONBOOT=yes
BOOTPROTO=static
Add lines:
IPADDR=10.0.2.16
NETMASK=255.255.255.0
NM_CONTROLLED=no
restart network interface:
systemctl restart network

Set Hostname on CentOS 6

Open /etc/sysconfig/network
vi /etc/sysconfig/network
I write down new hostname:
NETWORKING=yes
HOSTNAME=newHostName.GoesHere
Also I open hosts file:
vi /etc/hosts
I have to insert new line at the top of it:
127.0.0.1 newHostName.GoesHere
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
Restart system:
reboot

Office 2013 all proofing tools silent uninstall

Same as Uninstall Office 2010 language pack project which also include proofing tools now I have generated to uninstall Office 2013 proofing tools.

The structure this time is:
\msoffice-maintenance\uninstall-all-office-2013-language-packs.cmd
\msoffice-maintenance\x86\{90150000-001F-0407-0000-0000000FF1CE}\proof.msi
\msoffice-maintenance\x64\{90150000-001F-0407-0000-0000000FF1CE}\proof.msi
Source of Office 2013 language pack can obtain under Office 2013 proofing tools.

The directory name {90150000-001F-0407-0000-0000000FF1CE} is exact registry key under HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
or HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

The main script looks like:
@echo off
rem list of errorlevel codes
rem https://support.microsoft.com/en-us/kb/304888

setlocal EnableDelayedExpansion

date /t
time /t
echo.

rem this sleep is very important. it will complete remove software from previsous restart
echo sleeping for 2 minutes
"%~dp0sleep.exe" 120
echo.

rem is this windo is 64-bit or 32-bit
if "%ProgramFiles(x86)%"=="" goto UNINSTALL_32_BIT_OFFICE_2013_LANGUAGE_PACKS_FROM_32_BIT_SYSTEM

rem this happens only on 64-bit windows
echo This is 64-bit operating system
echo.


:UNINSTALL_32_BIT_OFFICE_2013_LANGUAGE_PACKS_FROM_64_BIT_SYSTEM
"%~dp0sleep.exe" 10
rem check if some Office 2013 x86 language packs source exists
for /f "tokens=*" %%a in ('dir /b "%~dp0x86" ^| findstr "{90150000*"') do if "%%a" NEQ "" (
rem if the source exists then check if the product is really installed
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\%%a" > nul 2>&1
if !errorlevel!==0 (
echo 32-bit %%a detected. uninstalling now..
%systemroot%\system32\msiexec.exe /X "%~dp0x86\%%a\proof.msi" /qb
echo setup has completed with code !errorlevel!, lets restart computer now..
rem if uninstall was successful then restart computer
if !errorlevel!==0 %systemroot%\system32\shutdown.exe -r -t 10
goto exit
) else echo no 32-bit %%a installed
) else echo no language packs sources detected for office 2013 x86 in %~dp0x86


:UNINSTALL_64_BIT_OFFICE_2013_LANGUAGE_PACKS_FROM_64_BIT_SYSTEM
"%~dp0sleep.exe" 10
rem check if some Office 2013 x64 language packs source exists
for /f "tokens=*" %%a in ('dir /b "%~dp0x64" ^| findstr "{90150000*"') do if "%%a" NEQ "" (
rem if the source exists then check if the product is really installed
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%a" > nul 2>&1
if !errorlevel!==0 (
echo 64-bit %%a detected. uninstalling now..
%systemroot%\system32\msiexec.exe /X "%~dp0x64\%%a\proof.msi" /qb
echo setup has completed with code !errorlevel!, lets restart computer now..
rem if uninstall was successful then restart computer
if !errorlevel!==0 %systemroot%\system32\shutdown.exe -r -t 10
goto exit
) else echo no 64-bit %%a installed
) else echo no language packs sources detected for office 2013 x64 in %~dp0x64
goto exit


:UNINSTALL_32_BIT_OFFICE_2013_LANGUAGE_PACKS_FROM_32_BIT_SYSTEM
"%~dp0sleep.exe" 10
rem check if some Office 2013 x86 language packs source exists
for /f "tokens=*" %%a in ('dir /b "%~dp0x86" ^| findstr "{90150000*"') do if "%%a" NEQ "" (
rem if the source exists then check if the product is really installed
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\%%a" > nul 2>&1
if !errorlevel!==0 (
echo 32-bit %%a detected. uninstalling now..
%systemroot%\system32\msiexec.exe /X "%~dp0x86\%%a\proof.msi" /qb
echo setup has completed with code !errorlevel!, lets restart computer now..
rem if uninstall was successful then restart computer
if !errorlevel!==0 %systemroot%\system32\shutdown.exe -r -t 10
goto exit
) else echo no 32-bit %%a installed
) else echo no language packs sources detected for office 2013 x86 in %~dp0x86


:exit

echo.

date /t
time /t
echo ===============================================================================

endlocal
Optional files:
http://gnu.catonrug.net/sleep.exe

Monday, July 18, 2016

postgresql-95-rhel-7-x86_64

Create a new Channel:

Fill the fields!

Channel Name:
postgresql-95-rhel-7-x86_64
Channel Label:
postgresql-95-rhel-7-x86_64
Parent Channel:
CentOS 7 Base x86_64
Architecture:
x86_64
Channel Summary:
postgresql-95-rhel-7-x86_64
Scroll down the page and enter:
GPG key URL:
http://repo.zabbix.com/zabbix-official-repo.key
GPG key ID:
442DF0F8
GPG key Fingerprint:
68C9 E2B9 1A37 D136 FE74  D176 1F16 D2E1 442D F0F8
Open [Channels] section, go for [Manage Software Channels],
go for [Manage Repositories], click [Create Repository]

Fill down:
Repository Label:
postgresql-95-rhel-7-x86_64
Repository URL:
http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64
Click [Create Repository]

Now open your child channel:

Assign child repository to child channel and press [Update Repositories] button:

Now at the command line execute:
spacewalk-repo-sync -c postgresql-95-rhel-7-x86_64
Install channel key locally:
curl http://apt.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-95 > /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95
cp /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95 /var/www/html/pub/RPM-GPG-KEY-PGDG-95
gpg --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95

Uninstall all Office 2010 language packs silently

Warning. The following sample is not fully tested yet.
I will remove this message when its tested.


I have this environment where the office 2010 versions has been installed and so as language packs. Some computers has even multiple language packs installed.
Another story is that I am kind of addicted now with directory based scripts.

This is my next directory based script.

Base structure I work with:
\msoffice-maintence\uninstall-all-office-2010-language-packs.cmd
\msoffice-maintence\x86\Office14.OMUI.lv-lv\setup.exe
\msoffice-maintence\x86\Office14.OMUI.lv-lv\setup.xml
\msoffice-maintence\x64\Office14.OMUI.lv-lv\setup.exe
\msoffice-maintence\x64\Office14.OMUI.lv-lv\setup.xml
directory name Office14.OMUI.lv-lv will be used to indicate the programs existence under HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
or HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

The content of setup.xml is:
<Configuration Product="OMUI.lv-lv">
<Display Level="basic" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />
<Setting Id="SETUP_REBOOT" Value="AutoAlways" />
</Configuration>
Content of uninstall-all-office-2010-language-packs.cmd is:
@echo off
rem list of errorlevel codes
rem https://support.microsoft.com/en-us/kb/304888

setlocal EnableDelayedExpansion

date /t
time /t
echo.

rem this sleep is very important. it will complete remove software from previsous restart
echo sleeping for 2 minutes
"%~dp0sleep.exe" 120

rem is this windo is 64-bit or 32-bit
if "%ProgramFiles(x86)%"=="" goto UNINSTALL_32_BIT_OFFICE_2010_LANGUAGE_PACKS_FROM_32_BIT_SYSTEM

rem this happens only on 64-bit windows
echo This is 64-bit operating system
echo.


:UNINSTALL_32_BIT_OFFICE_2010_LANGUAGE_PACKS_FROM_64_BIT_SYSTEM
"%~dp0sleep.exe" 30
rem check if some Office 2010 x86 language packs source exists
for /f "tokens=*" %%a in ('dir /b "%~dp0x86" ^| find "Office14.OMUI"') do if "%%a" NEQ "" (
rem if the source exists then check if the product is really installed
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\%%a" > nul 2>&1
if !errorlevel!==0 (
echo 32-bit %%a detected. uninstalling now..
rem lets extract language code from directory name
for /f "tokens=3 delims=." %%l in ('echo %%a') do (
start /wait %~dp0x86\%%a\setup.exe /uninstall OMUI.%%l /config %~dp0x86\%%a\setup.xml
echo setup has completed with code !errorlevel!, lets restart computer now..
rem if another installation process is in use then show all processes
if !errorlevel!==1618 tasklist
if !errorlevel!==1618 goto UNINSTALL_32_BIT_OFFICE_2010_LANGUAGE_PACKS_FROM_64_BIT_SYSTEM
rem skip any other uninstall maintenance because computer restart is needed
goto exit
)
) else echo no 32-bit %%a installed
) else echo no language packs sources detected for office 2010 x86 in %~dp0x86


:UNINSTALL_64_BIT_OFFICE_2010_LANGUAGE_PACKS_FROM_64_BIT_SYSTEM
"%~dp0sleep.exe" 30
rem check if some Office 2010 x64 language packs source exists
for /f "tokens=*" %%a in ('dir /b "%~dp0x64" ^| find "Office14.OMUI"') do if "%%a" NEQ "" (
rem if the source exists then check if the product is really installed
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%a" > nul 2>&1
if !errorlevel!==0 (
echo 64-bit %%a detected. uninstalling now..
rem lets extract language code from directory name
for /f "tokens=3 delims=." %%l in ('echo %%a') do (
start /wait %~dp0x64\%%a\setup.exe /uninstall OMUI.%%l /config %~dp0x64\%%a\setup.xml
echo setup has completed with code !errorlevel!, lets restart computer now..
rem if another installation process is in use then show all processes
if !errorlevel!==1618 tasklist
if !errorlevel!==1618 goto UNINSTALL_64_BIT_OFFICE_2010_LANGUAGE_PACKS_FROM_64_BIT_SYSTEM
rem skip any other uninstall maintenance because computer restart is needed
goto exit
)
) else echo no 64-bit %%a installed
) else echo no language packs sources detected for office 2010 x64 in %~dp0x64
goto exit


:UNINSTALL_32_BIT_OFFICE_2010_LANGUAGE_PACKS_FROM_32_BIT_SYSTEM
"%~dp0sleep.exe" 30
rem check if some Office 2010 x86 language packs source exists
for /f "tokens=*" %%a in ('dir /b "%~dp0x86" ^| find "Office14.OMUI"') do if "%%a" NEQ "" (
rem if the source exists then check if the product is really installed
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%a" > nul 2>&1
if !errorlevel!==0 (
echo 32-bit %%a detected. uninstalling now..
rem lets extract language code from directory name
for /f "tokens=3 delims=." %%l in ('echo %%a') do (
start /wait %~dp0x86\%%a\setup.exe /uninstall OMUI.%%l /config %~dp0x86\%%a\setup.xml
echo setup has completed with code !errorlevel!, lets restart computer now..
rem if another installation process is in use then show all processes
if !errorlevel!==1618 tasklist
if !errorlevel!==1618 goto UNINSTALL_32_BIT_OFFICE_2010_LANGUAGE_PACKS_FROM_32_BIT_SYSTEM
rem skip any other uninstall maintenance because computer restart is needed
goto exit
)
) else echo no 32-bit %%a installed
) else echo no language packs sources detected for office 2010 x86 in %~dp0x86


:exit

echo.

date /t
time /t
echo ===============================================================================

endlocal
For example if I want to add another language then i create directory:
Office14.OMUI.ru-ru
and set up setup.xml with content:
<Configuration Product="OMUI.ru-ru">
<Display Level="basic" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />
<Setting Id="SETUP_REBOOT" Value="AutoAlways" />
</Configuration>
No need to change any content to the main script :)

Optional files:
http://gnu.catonrug.net/sleep.exe

Sunday, July 17, 2016

Zabbix proxy sample

Zabbix server have IP: 192.168.88.55.
192.168.88.55:10051 is NATed to outside with static alias xxxxxxxxxxxx.sn.mynetname.net:10051
See 192-168-88-1-10051.png
This is only necessary for zabbix proxy to receive instructions what to do and send back data to zabbix server.

Zabbix proxy IP has 192.168.99.55.
192.168.99.55:10050 is NATed to the outside world so the zabbix server can look for zabbix agent on proxy server.
See 192-168-99-1-10050.png
This is only necessary to detect when the zabbix server is dead. This is very, very important.

Configuration of zabbix proxy on 192.168.99.55:
grep -v "^#\|^$" /usr/local/etc/zabbix_proxy.conf
Server=xxxxxxxxxxxx.sn.mynetname.net
Hostname=Broceni
LogFile=/tmp/zabbix_proxy.log
DBName=/var/lib/sqlite/zabbix.db
DBUser=root
FpingLocation=/usr/bin/fping
One of zabbix agent on Broceni:
cat /etc/zabbix/zabbix_agentd.conf
LogFile=/var/log/zabbix-agent/zabbix_agentd.log
Server=192.168.99.55
EnableRemoteCommands=1
Hostname=rpi8b923a
Set Up proxy server on zabbix server:

Set up host on zabbix server:

Install Spacewalk 2.5 on CentOS 7

#!/bin/sh

#install spacewalk repository
wget http://yum.spacewalkproject.org/RPM-GPG-KEY-spacewalk-2015 -P /etc/pki/rpm-gpg
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-spacewalk-2015
rpm -Uvh http://yum.spacewalkproject.org/2.5/RHEL/7/x86_64/spacewalk-repo-2.5-3.el7.noarch.rpm

#install epel repository
wget https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 -P /etc/pki/rpm-gpg
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

#install jpackage repository
cat > /etc/yum.repos.d/jpackage-generic.repo << EOF
[jpackage-generic]
name=JPackage (free), generic
mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0
failovermethod=priority
gpgcheck=0
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=1
EOF

#update system
yum update -y

#install postgresql database server
yum install spacewalk-setup-postgresql -y

#install spacewalk using postgresql as database server
yum install spacewalk-postgresql -y

#create spacewalk unattanded installation file into root home direcotry
cat > /root/spacewalk-answer-file << EOF
admin-email = root@localhost
ssl-set-org = Spacewalk Org
ssl-set-org-unit = spacewalk
ssl-set-city = My City
ssl-set-state = My State
ssl-set-country = US
ssl-password = spacewalk
ssl-set-email = root@localhost
ssl-config-sslvhost = Y
db-backend=postgresql
db-name=spaceschema
db-user=spaceuser
db-password=spacepw
db-host=localhost
db-port=5432
enable-tftp=Y
EOF

#spacewalk silent install
spacewalk-setup --answer-file=/root/spacewalk-answer-file

Saturday, July 16, 2016

jpackage-5-generic-free

Create a new Channel:

Fill the fields!

Channel Name:
jpackage-5-generic-free
Channel Label:
jpackage-5-generic-free
Parent Channel:
CentOS 7 Base x86_64
Architecture:
x86_64
Channel Summary:
jpackage-5-generic-free
Click [Create]

Open [Channels] section, go for [Manage Software Channels],
go for [Manage Repositories], click [Create Repository]

Fill down:
Repository Label:
jpackage-5-generic-free
Repository URL:
http://mirrors.dotsrc.org/jpackage/5.0/generic/free
Click [Create Repository]

Now open your child channel:

Assign child repository to child channel and press [Update Repositories] button:

Now at the command line execute:
spacewalk-repo-sync -c jpackage-5-generic-free
Other channel mirrors:
http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0

Thursday, July 14, 2016

trinity-r14-el7-x86_64

Create a new Channel:

Fill the fields!

Channel Name:
trinity-r14-el7-x86_64
Channel Label:
trinity-r14-el7-x86_64
Parent Channel:
CentOS 7 Base x86_64
Architecture:
x86_64
Channel Summary:
trinity-r14-el7-x86_64
Scroll down the page and enter:
GPG key URL:
http://bg1.mirror.trinitydesktop.org/trinity/trinity/rpm/el7/RPM-GPG-KEY-trinity
GPG key ID:
2AB131C6
GPG key Fingerprint:
7123 6F0F F403 B2B6 63E7  4411 1DBA A9EB 2AB1 31C6
Open [Channels] section, go for [Manage Software Channels],
go for [Manage Repositories], click [Create Repository]

Fill down:
Repository Label:
trinity-r14-el7-x86_64
Repository URL:
http://bg1.mirror.trinitydesktop.org/trinity/trinity/rpm/el7/trinity-r14/RPMS/x86_64
Click [Create Repository]

Now open your child channel:

Assign child repository to child channel and press [Update Repositories] button:

Now at the command line execute:
spacewalk-repo-sync -c trinity-r14-el7-x86_64
Appendix:
curl http://bg1.mirror.trinitydesktop.org/trinity/trinity/rpm/el7/RPM-GPG-KEY-trinity > /etc/pki/rpm-gpg/RPM-GPG-KEY-trinity
cp /etc/pki/rpm-gpg/RPM-GPG-KEY-trinity /var/www/html/pub/RPM-GPG-KEY-trinity
gpg --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-trinity

Wednesday, July 13, 2016

The parameter is incorrect, Windows 2008 R2

I have Winows 7 x64 workstation which has locally installed HP LaserJet 1020. Locally the printer works fine, but when I use Windows Server 2008 R2 as Terminal Server and print from there then printer fails really badly. It says nothing but
The parameter is incorrect
I installed another Canon printer to test if the terminal server can proceed any other printers and it does works well on other printers except HP LaserJet 1020.

Temporary I solved the case by using HP Universal Printing driver http://ftp.hp.com/pub/softlib/software13/COL40842/ds-99378-9/upd-pcl5-x64-6.1.0.20062.exe
7cc935b12a16541804eeecec3be4de66
6780d5bdce581bfe9b34cff9a9f81f1cb83e3f3b

Tuesday, July 12, 2016

List Office 2010 installed language packs

This code will list any installed language pack for all 20+ languages.
@echo off
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall

if "%ProgramFiles(x86)%"=="" goto native

:only64bit
for /f "tokens=8 delims=\" %%a in ('
reg query "%sw%\Wow6432Node\%u%" /s ^|
find "Office14.OMUI" ^|
find "HKEY_LOCAL_MACHINE"') do if not "%%a"=="" (
echo 32-bit LP found on 64-bit system: %%a
)

:native
for /f "tokens=7 delims=\" %%a in ('
reg query "%sw%\%u%" /s ^|
find "Office14.OMUI" ^|
find "HKEY_LOCAL_MACHINE"') do if not "%%a"=="" (
if not "%ProgramFiles(x86)%"=="" echo 64-bit LP found on 64-bit system: %%a
if "%ProgramFiles(x86)%"=="" echo 32-bit LP found on 32-bit system: %%a
)

Blog Archive