Thursday 24 November 2011

Fixing Automatic update clients those not appear in WSUS console

It is very common issue that some Automatic Update clients don't show up in WSUS console or intermittently appears/disappears.

Main cause of the this problem is generally duplicate SUSClientID on clients having problems, and it is very easy to fix by renewing the value.

You can use a batch file like below to fix it easily. You should turn of echo and remove Pause commands if you will run this with GPO or other deployment tool like SMS/SCCM.

 
@echo on
Echo 1. Stopping the wuauserv service
net stop wuauserv
Pause
Echo 2. Deleting the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\AccountDomainSid registry key (if it exists)
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
Echo 3. Deleting the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\PingID registry key (if it exists)
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
Echo 4. Deleting the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SusClientId registry key (if it exists)
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f
Echo 5. Deleting the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SusClientIDValidation registry key (if it exists)
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientIDValidation /f
Echo 5. Restarting the wuauserv service
net start wuauserv
Pause
Echo 6. Resetting the Authorization Cookie (Wait 10 minutes for a detection cycle to finish)
wuauclt /resetauthorization /detectnow
Pause

Wednesday 16 November 2011

WPAD interpreting issue with Firefox v8

If you are experiencing WPAD related proxy access problems via Firefox v8 and if you use a Windows that supports IPv6 your problem's cause can be Firefox's weird behaviour when it comes to detect client's IP address.
  1png

 

In my case Firefox v8 was always trying to detect and return an IPv6 address even whilst IPv6 was disabled or not configured. It was returning ::1 when IPv6 was disabled. So these behaviour causes problem during interpreting a WPAD file created by IPv4 addresses.

To test it and be ensure your problem is same as above; create a simple WPAD.dat file with the command lines below.
function FindProxyForURL(url, host)
{
client_ip = myIpAddress();
alert(client_ip);
}

Our goal here is returning detected IP adress by Firefox to user by using alert(myIpAddress()); command. Run Firefox when your new wpad.dat is ready, configure options to use it and try to browse any url.

Press Shift + Ctrl + J to open Error Console when you get the error again.
  Image3

The Error console will show you the detected IP address by the browser , if it IPv6 or ::1 go to your address field and browse about:config
Write IPv6 to filter area, it will list network.dns.disableIPv6 and highly possibly you've got false for the value.

Image4

Change value to True by double clicking, this change will force Firefox to get IPv4 addresses from the client and will fix WPAD interpreting issue.

Image5

You can also use the batch file below if you'd like to do this change by a batch file.

cd /D "%APPDATA%MozillaFirefoxProfiles"
cd *.default
set ffxpath=%cd%
echo user_pref("network.dns.disableIPv6", true);>>"%ffxpath%prefs.js"
set ffxpath=

Firefox v8 de WPAD problemini gidermek

Eger Firefox versiyon 8'i IPv6 destekleyen bir Windows surumu uzerinde kullaniyorsaniz ve kullaci dogrulama kaynakl sorunlar yasiyorsaniz sorunun sebebi FFox 8 de bulunan WPAD yorumlama hatasindan kaynaklaniyor olabilir.
  1png

 

Sorun benim gordugum kadari ile IPv6 ag kartinda iptal edilmis olsa bile Firefox 8 in Windows 7 isletim sisteminde illaki IPv6 adresi bulmaya calismasindan kaynaklaniyor, servis iptal olsa bile ::1 adresi donduruyor bu da WPAD iceriginin yanlis yorumlanmasina yol aciyor, ve siz eger bir Proxy belirtmisseniz bu kriterlere uymadigindan Direct degerini alabiliyor.

Basitce test etmek icin baska bir WPAD.dat dosyasi yaratarak icine sadece asagidaki komutlari ekleyin


function FindProxyForURL(url, host)
{
client_ip = myIpAddress();
alert(client_ip);
}



Burada amacimiz alert(myIpAddress()); ile kullaniciya browserin aldigi IP adresini gostermek.

Firefox u acip hatayi altiginizda Shift + Ctrl + J ile Error console u aciniz

  Image3

 

Error console size browserin gordugu adresi gosterecektir. Yukaridaki gibi bir adres veya ::1 donuyorsa bu sorunu gidermek icin Firefox'ta adres kismina about:config yazin. sonra filter kismna ipv6 yazinca asagidaki degeri goreceksiniz (network.dns.disableIPv6) ,

 
  Image4

 

bu degeri cift tiklayip True yaparsaniz Firefox IPv6 adresleri yerine IPv4 adreslerine oncelik verecek ve WPAD dosyanizi dogru yorumlayabilecektir.

  Image5

 

Eger bu islemi bir batch yardimi ile otomatiklestirmek isterseniz. Asagidaki sekilde bir batch dosyasi olusturabilirsiniz.


cd /D "%APPDATA%MozillaFirefoxProfiles"
cd *.default
set ffxpath=%cd%
echo user_pref("network.dns.disableIPv6", true);>>"%ffxpath%prefs.js"
set ffxpath=



Friday 11 November 2011

Create Desktop Shortcut with Script

Hi all

Today, I have received an application to deploy with SMS Server 2003, I had to create a MSI Package and some scripts to make that application installation most user friendly, actualy something doesn't need user interaction. So I have needed a script that can find logged user profile folder and create a desktop shortcut to the configuration file in user profile folder.

I have found an article about how to create desktop shortcuts at Technet http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_aytf.mspx?mfr=true , it is detailed enough to understand how to do it,

Technet Script :
Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFolder = objShell.SpecialFolders("AllUsersDesktop")
Set objShortCut = objShell.CreateShortcut(strDesktopFolder & "\IIS Manager.lnk")
objShortCut.TargetPath = "%SystemRoot%\System32\Inetsrv\iis.msc"
objShortCut.Save

 

As you see above script creates WshShortcut object by calling CreateOBject, than it defines Desktop folder path with strDesktopFolder by AllUsersDesktop value. But we will change this script to locate and crete a desktop shortcut of a file that unique for every user.

First of all we need to find logged users profile path, to do this we will get USERSPROFILE value from Windows Environment Settings by adding this line

UsersProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")

now we know logged users profile path has defined in UsersProfile (e.g. C:\Documents and Settings\OShener)

*Tip : You can get another Windows Environment variables values by using objShell.ExpandEnvironmentStrings by changing variable name in (%%) , you can check your existing environment variables by running set command in command promt too.

So where is our user specific target file for shortcut ? Let assume it is located in DW folder and the DW folder is in the the logged users profile folder. Now we are going to define a variable to fix the target file path with this line:

objShortCut.TargetPath = UsersProfile & "\DW\DW.conf"

and to find and define logged users desktop path to a variable we add this line to the script too

strDesktopFolder = objShell.SpecialFolders("Desktop")

and we have to define the Desktop Shortcut location before create it

Set objShortCut = objShell.CreateShortcut(strDesktopFolder & "\DWConf.lnk")

Ok, let tidy up the script and see what we have now ?
Set objShell = WScript.CreateObject("WScript.Shell")
UsersProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")
strDesktopFolder = objShell.SpecialFolders("Desktop")
Set objShortCut = objShell.CreateShortcut(strDesktopFolder & "\DWConf.lnk")
objShortCut.TargetPath = UsersProfile & "\DW\DW.conf"
objShortCut.Save

If you wish you can add different properties to your shortcut too, like Windows HotKey, Description, Working Folder, only thing you need to do that add ObjShortcut properties as : objShortCut.HotKey = "Ctrl+Shift+D" and refer to the link : http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_aytf.mspx?mfr=true

 

Script ile masaustune kisayol yaratmak

Merhaba

SCCM ile dagitmam gereken bir uygulama gecti elime, uygulamanin konfigurasyon dosyasini ise script ile kurulum sirasinda oturum acan kullaniciya gore otomatik olarak duzenlemek ve olusutulan konfigurasyon dosyasina ait bir kisayolu yine oturum acan kullanicinin masaustune yerlestirmem gerekti.
Technet sayfalarinda yeterince detayli bir script bulunmakta simdi bu scripti nasil bu amaca uygun hale getirebildigimize bakalim.

Mevcut script :
Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFolder = objShell.SpecialFolders("AllUsersDesktop")
Set objShortCut = objShell.CreateShortcut(strDesktopFolder & "\IIS Manager.lnk")
objShortCut.TargetPath = "%SystemRoot%\System32\Inetsrv\iis.msc"
objShortCut.Save

 

Yukarida goruldugu gibi WshShortcut objesi CreateObject ile cagrilarak yaratildiktan sonra strDesktopFolder'a AllUsersDesktop degeri atanmakta objShortCut.TargetPath ile de kisayolun cagiracagi obje tanimlanmakta , ancak biz her kullanicinin kendi profil klasorunde duran bir dosya icin kisayol yaratacagimiz icin, hem masaustu hem de cagirilacak dosyanin diskteki yerini oturum acan kullaniciya gore dinamik olarak belirlemek zorundayiz , bu amaca ulasmak icin basit bir sekilde sisteme oturum acan kullanicinin profil klasorunu belirleyecegiz.

UsersProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")

satiri ile sisteme oturum acmis olan kullanicininin profil klasoru adresini UsersProfile degiskenine atiyoruz. Bunun sonucunda UsersProfile oturum acan kullanicinin profil klasorune yani ornek vermek gerekirse C:\Documents and Settings\oshener degerini aliyor.

*Ipucu : objShell.ExpandEnvironmentStrings ile Command Prompt da Set komutunu calistirdigimizda gelen listeden farkli obje ve degerlerinide (%...%) kismini degistirerek cekebilirsiniz.

Simdi objShortCut.TargetPath ile kurulum ile yerlestirilen konfigurasyon dosyasinin yerini belirleyelim. Diyelim ki cagiracagimiz dosya kullanici profili klasoru icinde bulunan DW klasoru altinda ki DW.Conf dosyasi olsun,

ConfFile = UsersProfile & "\DW\DW.conf"

ile dosyamizi kaynak adresi ile beraber ConfFile degiskenine atamis,

objShortCut.TargetPath = ConfFile

ile ise yaratacagimiz kisayolun cagiracagi dosyayi gosterdik.

Simdi kisayolumuzun yaratilacagi yeri oturum kullanicinin masaustu bilgisini kullanarak tanimlayalim

strDesktopFolder = objShell.SpecialFolders("Desktop")

komutu ile oturum acan kullanicinin masaustu klasoru adresini cekebiliyoruz , eger bu imkan olmasa idi , daha once yarattigimiz UsersProfile degerine & "\Desktop" metnini ekleyerek ayni bilgiyi yaratabilirdik.

Set objShortCut = objShell.CreateShortcut(strDesktopFolder & "\DWConf.lnk")+

komutu ile de yaratacagimiz kisayolun tam hedefini tanimliyoruz.

Simdi degisiklikleri toparlayarak nasil bir scriptimiz oldu kontrol edelim.
Set objShell = WScript.CreateObject("WScript.Shell")
UsersProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")
strDesktopFolder = objShell.SpecialFolders("Desktop")
Set objShortCut = objShell.CreateShortcut(strDesktopFolder & "\DWConf.lnk")
objShortCut.TargetPath = UsersProfile & "\DW\DW.conf"
objShortCut.Save

Eger arzu ederseniz yine yukarida adreste bulabileceginiz degerler ile kisayolunuz Kisayol tusu, aciklama, calisma klasoru belirleyebilirsiniz bunun icin tek yapmaniz gereken objShortCut. ile degeri tanimlamak olacaktir. (Ornek : objShortCut.HotKey = "Ctrl+Shift+D")

Wednesday 2 November 2011

MDT Unable to find SETUP Hatası

Merhaba

Eger MDT ile bir isletim sistemi imajini capture edip, sonrasinda kurarken asagidaki gibi bir hata aliyorsaniz kurulum SETUP dosyalarina sahip degil demektir bu durumda capture ettiginiz imaji MDT ye import ederken asagidaki sekilde isletim sistemi kurulum kaynagini gostererek SETUP icin gerekli dosyalarinda import edilmesini saglamaniz gerekmektedir.

Ornek Hata:
ERROR-Unable to find SETUP, needed to install the image
\servershareOperating Systemsfolderimage.wim
ZTI ERROR - Non-zero return code by LTIApply. rc=1
Non-zero return code rc=-2147467259 0x80004005

SETUP dosyalarinin gosterilmesi
2010-01-21 11.41-01