Saturday, April 18, 2009

Xteq GetOSVersion 3.1 available

We have just updated Xteq GetOSVersion (XQGetOSVer) to Version 3.1, now supporting also Windows 7.

XQGetOSVer returns a number for each detected OS (Windows 95 up to Windows Server 2008 and Windows 7) and can therefore easily be used for batch files where you want to execute special commands depending on the OS in use. It is released as freeware, so you can use it right away.

Thursday, April 16, 2009

Removing Live Search from Internet Explorer 8

This week, we had to prepare an Internet Explorer 8 rollout at a customers side. This customer had very strict requirements which Accelerators, Links and Search providers should be installed.

We thought this should be no problem with the Internet Explorer Administration Kit (IEAK) so we created a package with it. We added the search providers, accelerators and links the customer wanted to have and imported them with IEAK to the package we wanted to created while also activating the option that no default items should be added.

Using VMWare Workstation we then tested our package (did I mentioned which great invention Snapshots are?) and everything looked quite good except that the search box beside the address bar still showed Live Search (not as default, but anyway) like this:

After several tests we are sure this wasn't a failure inside the package, but instead some "by design" issue. Tracking this down inside the registry we found that IE8 get's the list of Search providers from
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes.
However, it also checks
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\SearchScopes
and if it finds a search provider there that is not already shown, it will simply display it as well. And Live Search did come from this HKLM key.

We resolved this issue by NOT adding any search provider inside the package and executing two batch files after the installation of IE.

IESearchProvider_UserSet.bat will remove Live Search from the HKCU SearchScopes, add Google (from IESearchProvider_GoogleSearch_User.reg) and make this the default.

IESearchProvider_ComputerSet.bat will remove Live Search from the HKLM SearchScopes, add Google (from IESearchProvider_GoogleSearch_Computer.reg) and make this the default.

Both scripts work identically, except one check HKCU and the other HKLM. Both check if the Google search provider is already installed (we have created our own GUID for this) and if not it will be added, set as the default and finally deleting the Live search provider.

We have added these commands to the Internet Explorer GPO (..UserSet.bat to the user scripts, ...ComputerSet to the computer scripts). And don't worry: This script will work even if IE8 is not rolled out, IE7 can use the Google search provider as well.

You can download all files here.

Tuesday, April 7, 2009

A script for fixing WMI problems

The last two months, I was helping a client to get his network running smoothly again. One of the topics were strange errors within various applications and problems with machines that did not received any update from the central Windows Server Update Services.

To cut a long story short, this all was caused by the WMI (Windows Management Instrumentation) service not working correctly. One very often rolled out image was broken in that area so 70% of all computers had a broken WMI installation.

After some research, I created a WMI Fixer batch file that was able to fix the WMI installation of nearly all machines (>400), except three we were forced to reinstall.

I took the idea from a script of David H. Lipman from this forum post, added some checking logic and also added some code from the WMI Isn't Working page.

Enjoy!

 

@cls
echo off
Rem
Rem Original by David H. Lipman:
http://www.pcreview.co.uk/forums/thread-1898592.php
Rem See also: http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx
Rem

SET WMIRoot=%windir%\system32\wbem
SET Rep_Bad=Repository_bad

echo WMI Fixer Batch v1.2
echo Copyright (C) 2008 Xteq Systems
echo
http://www.xteq.com/
echo.

echo Setting TEMP as current directory
cd /d %TEMP%

if exist %WMIRoot% goto Stop_Services
echo WMI doesn't seem to be installed here! Starting WMICore.exe...
wmicore /s
echo Creating folder WBEM 
mkdir %WMIROOT%

:Stop_Services
echo Trying to stop service...
net stop winmgmt /y

echo Using kill switch to make sure WMI has stopped...
winmgmt /kill

echo Switching to %WMIRoot%
cd /d %WMIRoot%

echo Checking if folder %Rep_Bad% exists and delete it if necessary
if exist %Rep_Bad% rd %Rep_Bad% /s /q

echo Moving current Repository to %Rep_Bad%..
rename Repository %Rep_Bad%

echo Registering all DLL files...
echo on
@for %%i in (*.dll) do RegSvr32 -s %%i
@echo off

echo Registering all EXE files...
for %%i in (*.exe) do call :FixSrv %%i
REM for %%i in (*.mof,*.mfl) do Mofcomp %%i
Rem not used

net start winmgmt
echo Done!
goto Ende

:FixSrv
if /I (%1) == (mofcomp.exe) goto SkipSrv
if /I (%1) == (wmic.exe) goto SkipSrv
if /I (%1) == (wbemcntl.exe) goto SkipSrv
if /I (%1) == (wbemtest.exe) goto SkipSrv

echo on
%1 /RegServer
@echo off
:SkipSrv
goto LongTail

:Ende

pause
exit 0

:LongTail