Archive for June, 2009

x64 Bit sysprep.xml Answer File

Monday, June 29th, 2009

Note to self……..when imaging a x64 bit system, you need to create and use a x64 bit answer file using the windows system image manager (SIM) and a x64 bit install.wim file to generate the catalog !!

Very important, do not forget this again :os

x64 bit

x64 bit

iBroken !!….

Sunday, June 28th, 2009

So the title of this post should be something like ‘iphone will not sync with itunes on vista with roaming profile folders’, but I couldn’t resist, ibroken sums it up so well :o)

Yep, my iphone won’t work with my office PC. Well, mine does obviously as I am an administrator with god like powers on our office network. But for my poorer cousins, the standard user, they have their environment subtley controlled for them via the use of microsoft group policies.

The policies in place are not restrictive in nature. They are  simply there to help make certain things transparent to them or make my life easier as an admin and give me some peace of mind about my users data.

The one causing the breakage of the iphone sync is the roaming user profile folder(s). We use roaming profiles to allow people in the office to be able to login to any desktop and have their personal settings follow them around. We also redirect the ‘documents’ folder to a network location so that all their files are in one place and backed up for security.

Under Windows Vista, the user profile folder(s) structure changed a bit. in  Windows XP, user profiles were stored in”C:\Documents and Settings”, but in Windows Vista they are now stored in “C:\Users\”. in order to maintain backwards compatibilty with earlier windows software, Windows Vista has a junction point for ‘C:\Documents and Settings” that points it to “C:\Users” (a junction point is a bit like a shortcut but it will also work in DOS). The junction point makes sure that any application trying to access “C:\Documents and Settings” gets directed to “C:\Users”

Microsoft also changed the structure of the folders that make up the user profile under Windows Vista

\Documents and Settings\<user>\Application Data

now points to

\Users\<user>\AppData\Roaming

and

\Documents and Settings\<user>\Local Settings\Application Data

now points to

\Users\<user>\AppData\Local

And I *think* this may be where the problem is. NTFS juntion points can only point to another location on the local file system, not a netwok location. itunes will be trying to access “C:\Documents and Settings\scottb\Local Settings\Application Data”, and will be hitting the junction point that redirects it to “C:\Users\scottb\AppData\Romaing”. With folder redirection turned off the story ends here, the location is still on the local filesystem, itunes simply follows the new file path and backups up the iphone in the correct location.

But we have this folder redirected to a network share using a group policy, the “C:\Users\scottb\AppData\Romaing” gets further redirected to a network share file path……and it all just fails.

At this time however, this is only a theory as I cannot understand why only itunes is affected like this and not any other apps (who must also be getting the network redirect for the AppData folder !).

More on this [as|when|if] I figure it out………

ibroken

ibroken

Mothers 1 Fathers 0 – The Injustice Of It All…..

Thursday, June 25th, 2009

I had a quick conversation with my father over the weekend. I rang him quite early on father day (sunday) as owning a restaurant I assumed he would be somewhat swamped with bookings for doting children taking Dad out for a meal to reward him for all his efforts over the years.

Apparantly not. He had just over x40 covers booked in for the whole day (1 cover = 1 family I am assuming here). When I tried to ring him on mothers day (unrelated call, it just happend to be mothers day when I rang him) he explained he loved me very much but had over x240 covers booked in for mothers day and could I call him some other time and hung up !

240 to 40, or 6 to 1 ratio for mums to dads. I mentioned this to a friend who confirmed a similar pattern of inequality in his family. “Yeah, my dad rings before mothers day and has a mini panic attack checking I got her card and some chocs or flowers or something and that I will be visiting her on the day……it’s like he’s scared or something”.

“and what does your mother do about fathers day ?” I ask.

“oh she just rings on the day and asks if I got him a card and if not did I want to say hello to him quickly !!”.

the equality also stretches to the amounts people spend on each parent. these reports for spending on mothers and fathers day show that mum clearly gets a bigger slice.

2009 mothers day spend

2009 fathers day spend

Possibly this difference can be attributed to there being a greater range of gifts for mum to choose from on the day ? I must confess that I was never quite sure what to do about fathers day in my youth. Was it a day I was supposed to do more with dad or a day to give him a break from me ? He is also not the easiest person to buy gifts for, he always seems to be working and his only hobby that I can recall is fishing, not an area where I have any kind of expertise.

Oh well, socks again I guess !

dad

Just Plain Weird !!!……

Wednesday, June 24th, 2009

I wracked my brain to come up with a title for this one, but I was simply stumped for how to describe this event

I decided I would allow the MS updates tool to download and install IE8, after all I am running Vista and should really try and keep up with all MS mainstream product versions.

The download kicked off ok and then it installed and required a reboot, which I agreed to…….then I entered the MS twlight zone ?!!

x2 issues/bugs/errors/conditions/*features* seemed to occur as result of installing IE8. The first was that while IE8 would load and display a web page no problem, it would not open a link in a new tab. The tab would launch and then sit there doing nothing. This behaviour was also apparant for trying to right click and launch a link in a new IE8 window. It just did nothing. However, just clicking on a link would load the page into the current tab ok. This meant a morning of getting used to navigating backwards and forwards through my browsing history, which was cumbersome to say the least.

Then I discovered another little gem. Windows explorer would no longer open folders in the same window. Every folder I double clicked opened in a new explorer window. I checked my folder options and changed and applied some settings and then reset them back and applied them to be certain the options were being set, but Vista refused to take this onboard and continued to clutter up my desktop. Right clicking a folder and selecting explore (which was bolded as the context default option by the way) worked ok, but double click was broken :o(

Owing to a deploy of the new site being in progress while this was going on (note to self:: never upgrade your system again during critical moments. grrrrrrrr !!) I had to tolerate this behaviour for the better part of the morning, I now have mild RSI of the second finger on my hand from all the right clicking I had to do (I almost dropped to a DOS prompt to get the work done it got that bad).

Then, while trying to figure out why I had some on page controls missing on the new version of the site, I launched IE8 as administrator……..and it all went back to normal. Possibly a coincidence, but I know where I’m hedging my bets. Just annoying that if permissions was the problem at the time, UAC did not kick in and advise me so (and how come after launching IE8 as admin IE8 and explorer are working fine for me as non admin ??)

Like I said, just plain weird :oD

weird

Happy Birthday To Andrew

Thursday, June 18th, 2009

Another day, and another birthday (note to self, get back to technical writing !).

This one goes out to Andrew

Happy birthday babe, hope you had a good time (with that much gin to hand, I would say it was an a dead cert of a good time !! :op

andrew's birthday

andrew's birthday

Happy Birthday To Stu…..

Sunday, June 14th, 2009

Todays post is dedicated to the birthday of one mr Stuart Madden who has acheive the ripe old age of 25.

stu's birthday

stu's birthday

I don’t envy you your youth even slightly (he says through gritted teeth).

Have a great day buddy :oP

happy-birthday

WMI Restart Windows Services

Wednesday, June 10th, 2009

Ok

So the title for this post isn’t smart or quippy. and there is a very good reason for this. I needed a script that could restart a windows service or services. I couldn’t find any good ones :o(

I searched using various combinations of the words “wmi, windows, services, restart, start, stop”. While I found a lots of scripts, they all lacked a certain resiliancy that I like in my automation solutions. Essentially they all went something like this (the wmi has been translated into an english procedure so everyone can understand)


connect to windows using wmi
find all the services
select the one that we are interested in using a for/next loop
send it a stop signal
wait for some random amount of time (between 1 and 2 mins say !)
send the same service a start signal
move on to the next service
exit the script when we have restarted all the services we want to do

Anyone see the problem ? How long do you give a windows service to stop sucessfully ?  Or start for that matter ! These scripts all seemed to wait for a minute or two, and then procede with the assumption everything happend ok. At some point, that kind of thinking with software will bite you in the ass. Here was what I was looking for


connect to windows using wmi
find all the services
select the one that we are interested in
check it current state (running or stopped)if the service is stopped, send it a start signal
check every 10 seconds for 5 mins that the status has switched to running
if the service does not go into a running state after mins, email an smtp address advising the service is misbehaving and then exit the script
if the service is already in a running state, send it a stop signal
check every 10 seconds for 5 mins that the status has switched to stopped
if the service does not go into a stopped state after mins, email an smtp address advising the service is misbehaving and then exit the script
if the service does go into a stopped state within 5 mins, run the section of code for starting a service
again, monitor the servce to make sure it does restart, if not for any reason, send a warning email

Using this method no assumptions are made about the running state of the service, or it’s response to being told to stop/start. Worst case scenario, it fails to do what it is told and you get an email warning you the you need to intervene manually, at least the failure is known about and can be managed.

The code for this is shown below. Feel free to copy and adapt to suit your own purpose(s) :oD

‘needs be run with administrator privileges in oder to work !
‘we are doing stuff to services after all !!
‘the script gives each service x5 mins to change it’s state. if this had not occured within that time
‘the script sends a failure email and exits
‘define the computer name and the services we want to restart. use “.” for local host
‘the service names are based on their display names, not their short form/function names !

‘define the counter used to determin when 5 mins has elapsed
strComputer = “.”
arrServices = Array(“Kaspersky Administration Server”, “Kaspersky Anti-Virus”, “Kaspersky Anti-Virus Script Interceptor Dispatcher”, “Kaspersky Lab Cisco NAC Posture Validation Server”, “Kaspersky Network Agent”)
Dim Count
‘loop through each service
For each strService in arrServices
‘connect using standard monkier
Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)
‘get an array containing all services
Set objItems = objWMIService.ExecQuery (“Select * from Win32_Service”)
‘for each service compare it’s display name to the current one we are looking for
For each objService in ObjItems
‘if we get a service display name match
If objService.DisplayName = strService Then
‘display the current service along with it’s current state
wscript.echo “service name = ” & objService.DisplayName & ” currently :: ” & objService.State
‘if it is currently running, attempt to stop it
If objService.State = “Running” Then
wscript.echo “”
wscript.echo “stopping service…”
wscript.echo “”
objService.StopService()
‘wait for 10 seconds, then refresh our view of the current object state
wscript.sleep 10000
objService.Refresh_
‘if the service is still not in a stopped state, repeatedly re-check the object status every 10 seconds
‘we also check how many times we have already cheked and exit is it is greater than 29 (30*10seconds = 5mins)
‘initialise counter
Count = 1
‘start checking comparison loop for ‘stopped’ condition
‘we need to update the objService.State view using objService.Refresh_ for each iteration to make sure we are seeing the
‘current state of the service
While objService.State <> “Stopped”
objService.Refresh_
‘for testing/debuging on the console, tell the user what is going on
‘this will not show up when the script is run as a scheduled job
wscript.echo “”
wscript.echo “waiting for service to Stop :: current count = ” & Count
wscript.echo “”
‘wait 10 seconds then increase the counter by 1
wscript.sleep 10000
Count = Count + 1
‘if we have reached 30 attempts then bow out and send an email advising manual intervention
If Count > 29 then
SendFailedMsg
wscript.echo “service has taken too long to respond. aborting script”
wscript.quit
Else
End if
‘otherwise we have not reached 30, go round again
Wend
‘once the service has stopped, let us know
wscript.echo “service is now ” & objService.State
‘now attempt to restart the service, making sure it is definateley stopped first
If objService.State = “Stopped” Then
wscript.echo “”
wscript.echo “attempting to restart service ” & objService.DisplayName
wscript.echo “”
objService.StartService()
‘wait 10 seconds, the refresh our view of the current object state
wscript.sleep 10000
objService.Refresh_
‘if the service is not in a running state, repeatedly re-check the object status every 10 seconds
‘we also check how many times we have already cheked and exit is it is greater than 29 (30*10seconds = 5mins)
‘initialise counter
Count = 1
‘start checking comparison loop for ‘running’ condition
‘we need to update the objService.State view using objService.Refresh_ for each iteration to make sure we are seeing the
‘current state of the service
While objService.State <> “Running”
objService.Refresh_
‘for testing/debuging on the console, tell the user what is going on
‘this will not show up when the script is run as a scheduled job
wscript.echo “”
wscript.echo “waiting for service to Start”
wscript.echo “”
‘wait 10 seconds then increase the counter by 1
wscript.sleep 10000
Count = Count + 1
‘if we have reached 30 attempts then bow out and send an email advising manual intervention
If Count > 29 then
SendFailedMsg
wscript.echo “service has taken too long to respond. aborting script”
wscript.quit
Else
End if
‘otherwise we have not reached 30, go round again
Wend
‘once the service has started, let us know
wscript.echo “”
wscript.echo “service is now ” & objService.State
Else
‘otherwise, if the service must already stopped for some reason ? check first, and attempt to start it
If objService.State = “Stopped” Then
wscript.echo “”
wscript.echo “attempting to restart service ” & objService.DisplayName
wscript.echo “”
objService.StartService()
‘wait 10 seconds, the refresh our view of the current object state
wscript.sleep 10000
objService.Refresh_
‘if the service is not in a running state, repeatedly re-check the object status every 10 seconds
‘we also check how many times we have already cheked and exit is it is greater than 29 (30*10seconds = 5mins)
‘initialise counter
Count = 1
‘start checking comparison loop for ‘running’ condition
‘we need to update the objService.State view using objService.Refresh_ for each iteration to make sure we are seeing the
‘current state of the service
While objService.State <> “Running”
objService.Refresh_
‘for testing/debuging on the console, tell the user what is going on
‘this will not show up when the script is run as a scheduled job
wscript.echo “”
wscript.echo “waiting for service to Start”
wscript.echo “”
‘wait 10 seconds then increase the counter by 1
wscript.sleep 10000
Count = Count + 1
‘if we have reached 30 attempts then bow out and send an email advising manual intervention
If Count > 29 then
SendFailedMsg
wscript.echo “service has taken too long to respond. aborting script”
wscript.quit
Else
End if
‘otherwise we have not reached 30, go round again
Wend
‘once the service has started, let us know
wscript.echo “service is now ” & objService.State
wscript.echo “”
End If
End If
End If
End If
Next
Next
SendSucessMsg
Sub SendFailedMsg()
Set objEmail = CreateObject(“CDO.Message”)
objEmail.From = “email@yourcompany.com”
objEmail.To = “email@yourcompany.com”
objEmail.Subject = “KAV Recycle failed on objEmail.Textbody = “KAV services recycle failed on . Please check services manually”
objEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
objEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “yourmailserver.company.com”
objEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
objEmail.Configuration.Fields.Update
objEmail.Send
End Sub
Sub SendSucessMsg()
Set objEmail = CreateObject(“CDO.Message”)
objEmail.From = “email@yourcompany.com”
objEmail.To = “email@yourcompany.com”
objEmail.Subject = “KAV Recycle suceeded on . Hooray !!”
objEmail.Textbody = “KAV services recycle completed OK on :o)”
objEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
objEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “yourmailserver.company.com”
objEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
objEmail.Configuration.Fields.Update
objEmail.Send
End Sub

Once I got this script to run in an admin enabled DOS prompt window, the next step was to run it as a job via the job scheduler under windows. You need to run the job as the SYSTEM user, and tick the box to ‘run with highest available permissions’ in order for this to work. Running as a scheduled job, there is no console to display the output for the job, but you can have the services panel loaded and keep refreshing the view to see your services status changing as the script runs through them.

Overall result will be you get an email advising of a sucessful recycle of your services, or a failure one with a note to check what’s going on.

Enjoy :oD

But I Still Haven’t Found What I’m Looking For……

Saturday, June 6th, 2009

Kind of old news now, but the Microsoft new search engine went live on June 1st slightly ahead of schdule. Viral Tapara brought it up during the vista squad meeting on 27th May, and to be honest he made it seem so incidental to all the other stuff he was showing us (web accelerators in windows 7 for one thing) I kinda forgot all about it.

Initial impressions. It seems well though out and  a lot easier on the eye (and the background processes of the brain) from their previous seach effort.  It also seems to have some of the web browser accelerator features built into it, such as expanded preview information when you hover over links (this works in firefox as well, so it would seem to be the site not the browser doing this !).

binga1

One thing of note, all the predictive suggestions are displayed in lowercase, even if you are using uppercase or even block caps for the search string.  I personally am ok with this as being in tech for a career I tend to use lowercase all the time anyway, except for people names. The site also has a mapping feature which unfortunately seems to be partnered with multimap, who I just am unable to read :o(

Given the richness of the interface there are not that many configurable options just yet. Number of results to display per page, language settings, moderator filter and the ability to turn predictive text on/off are about all right now.

bingb1

I guess wether it suceeds or not will come down to them being able to offer something the others don’t. It is going to be a very hard habbit for me to break personally not to just open google for all my searches, but should bing sunddenly offer that “can’t be without” feature or functionality, I may have to force myself to make a concious switch.

Scooby Doo And The Missing Printer Objects….

Thursday, June 4th, 2009

I can’t say I’m a great fan of mysteries, I tend to either want to skip to the end real fast or know the outcome ahead of time. I guess it’s the uncertanty that I dislike, I like either solid ‘yes’ or ‘no’ type scenarios, it’s the binary in me :op

However, I must say I currently am experiencing a small but non-critical mystery to do with the companies printers.

We have a mix of network attached printers in the office from HP, Canon and Kyocera. They are all directly connected to the network via jetdirect cards or something that emulates the functionality of a JetDirect ethernet interface.

I have installed all of these printers onto the Windows Server 2008 that also serves as out main file server (file and printing go together in my book). I have installed the x64 and x86 based drivers without issue, and then have shared them out from the server. I then ticked the box to “List in the directory”

printer properties

Now, when I open my printers folder in Vista and click to “Add a printer” I can choose between a local printer or a networked one. selecting a networked one lists all of my configured network printers fine, and if I select them it installs the driver(s) and the whole thing just works. kudos Microsoft.

What I cannot do however is find the printer objects in active directory !?!?!?!? WTF ? Opening the active directory user and computers (ADUC) console I navigate to the “Printers” container…..empty ! yet if I search active directory for all printers, they are all returned in a nice little list.

Where do printer objects get placed by default when they are added to active directory ? Right clicking any of the printer objects in the ADUC console does glean a context menu with the “move” option, so I could place them where ever I like, but I want to know where I am moving them from in case anything breaks and I need to put them back again.

Scooby Dooby Doo, where are you ??……………….

[addendum] So my boss solved this one for me. It seems to have to enable the “Users, Contacts, Groups and Computers as containers” option in the “view” menu on the ADUC console. This allows you to expand computers as if they were containers themselves and there inside my file server were our printer objects <sigh>