Categories
Geeky/Programming

Using Windows Performance Toolkit to find System Issues in Vista/Win2k8/Win7

Windows 7 RC1 just came out. I am a TechNet subscriber, so I wanted to try it out. I have an old (2005) Dell desktop, 2.8 GHz, 2 GB ram, 160 GB drive box. 3.7 rating for Vista (because of the Graphics card mostly, would be 4.4 otherwise – not too bad, even for being kind of an old box). It has been sitting in the basement since I moved into my new place in October, doing nothing really. I use Mac full time at home, so it just sits.

A few times I have tried to get Windows Vista running smooth on it, Media Center, or just a file server,etc. Thing is, it was just flaking out. I knew it was a hardware issue, but figured it might be the CPU fan, or overheating, etc. Vista installed fine, but as I was using it, I would see just hang-ups, lockups. Not BSOD’s, but it would just hang, for 30 seconds, 1 minute, and then come back. WTF?

Nothing in the Reliability monitor, nothing I could see in event logs, etc. I rebooted, did Windows Memory test, nothing there. If you go into Computer Management, you will see Performance, then Data Collector Sets and Reports, Monitoring Tools. You can set it up to run a test on metrics of your system and it will give you a report

image

I did this, and everything was ok. BUT… Avg Disk Length Queue was > 2 – red flag. Disk issues. But I wanted to know more. So I started digging around, and there is a Windows Performance Toolkit you can download. Here is another good site going into detail about the WPT.

So I fire up cmd line (as admin! – start->run, cmd ctrl+shift+enter), and run

xperf -providers K

to see what providers are available for the Kernel flags. IOTrace looks like something I want, so I then run

xperf -on IOTrace

and let it run. I go and open/close things, play around, see if I can replicate the issue. Once I feel I have, I want to stop and analyze the trace. You need to stop it and output to a file using this command:

xperf -d iotrace.etl

Side note: Files are named ETL. Coming from a BI background, this makes my world explode, since it has nothing to do with Extract, Transform, and Load

Now that my trace is done, time to analyze:

xperfview iotrace.etl

And you get some awesome stats like this:
image

Although I didn’t save my stats from my tests that showed the bad IO, what I saw were just gaps in the graphs, glitches in The Matrix. Time missing. Something is really bad here. So I did the drive error checking in Vista:

image

And when that ran, after reboot, it got to 11% and croaked. Bad drive. So I went and bought a new 500 GB SATA drive and loaded it up, and I am running Windows 7 now. Pretty sweet.

After all this fun spelunking into Windows performance, it also got me thinking about things, like running these detailed traces on SQL Server boxes or other servers on intervals, and saving them somehow, reporting on the data. The IOTrace is just one of hundreds of traces, that you can then auto analyze. I know that there are perfmon tools but there are some added benefits to xperf that you can you utilize, and I am glad I learned more about it and put it to use, just another tool for the sysadmin tool belt.

Categories
Geeky/Programming

Technology Hypocrites?

Why do IT Departments, SysAdmins, and techno geeks love to push the latest and greatest server products, use the latest technologies in hardware, etc, yet they are scared out of their boots about Vista?

(Side Note: Testing out the QuickPress feature of WordPress 2.7)

Categories
Geeky/Programming

Ubuntu 8.04 Hardy Heron – Second Chance, Wireless Works and was Easy!

So, last night I decided to give Ubuntu 8.04 Hardy Heron another try. I blogged previously about setting it up and getting wireless to work, and what a nightmare it was

What I did this time was this. First off, I have computers everywhere, a MacBook, MacBook Pro, Dell Desktop and Dell Laptop. I have Vista on the desktop, and the Dell laptop I wasn’t doing much with, so I decided to load up Ubuntu on it. After installing, I connected it to a wired connection, downloaded the OS updates and let is sit for a while. After a few minutes it popped up with an alert telling my that there were updated drivers for the BroadCom wireless nic card. Wha?!? I open the alert, hit enable, and it downloads new drivers and fwcutter and lo and behold, wireless starts working with no hassles. I am on Ubuntu right now dinking around. So what is the first thing I do? Well make it look like a Mac of course.

So now I have Mac OS 10.5, Vista, and Ubuntu 8.04 all running on different machines. I would say right now though I do like the Mac the best. I use Vista for anything that really needs Windows. I will probably setup VMWare Fusion again on the MBP, but a smaller partition. I moved all my music there (80+ GB) and had to free up some space, my Vista partition was 60 GB.

Categories
Geeky/Programming

Ruby on Rails and MySql .. on Windows Vista

So, this evening I got the urge to get Ruby on Rails working on Vista, with MySql. I haven’t done much with RoR, but figured I would give it a go. I have this test hosting account that has RoR hosting, so that is what got me somewhat motivated…anyway’s, on with the show.

 

Install Ruby

Installing Ruby is pretty easy. You can follow the tutorial pretty much step by step from the rubyonrails.org site, except it is tailored to *nix machines (Mac, Linux) as far as paths and stuff..

1) Download and install ruby..(http://www.rubyonrails.org/down)

2) get RubyGems, run ruby setup.rb

3) Get rails:…. gem install rails –include-dependencies

Create Application

At the command prompt:

rails c:railsblog

cd railsblog

ruby script/server

test it on http://localhost:3000

if all is well, you will see a cool welcome screen..

Now.. lets actually start making our blog app by generating a controller..(remember , you need to call “ruby” before executing these scripts.. in Mac, etc you don’t have to)

ruby script/generate controller Blog

Then edit your blog_controller.rb and add some code:

class BlogController < ApplicationController
    def index
        render :text => “Hello World!”
    end
end

try it (http://localhost:3000/blog).. whoops.. error?

no such file to load — sqlite3

check under your app dir (c:railsblog) your configdatabase.yml

it is set to sqllite.. we need to get MySql installed and configured

Install MySql (5.0.51a)

This is a whole nother debacle. MySql doesn’t really work right on Vista.

download MySql (http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-essential-5.0.51a-win32.msi/from/pick#mirrors), install it

you will notice.. the config assistant doesn’t run at the end..

Configure It, Hack It, Swear At It

First, in the MySql/bin directory, set both the MySql config assistant and the mysqld-nt.exe to run in XP Sp2 compatibility mode, and run as administrator (this will
allow the service to start once the config assistant is done, once we hack to run anyway’s)

In your application logs in event viewer you will see

Activation context generation failed for “C:Program FilesMySQLMySQL Server 5.0binMySQLInstanceConfig.exe”.
Error in manifest or policy file “C:Program FilesMySQLMySQL Server 5.0binMySQLInstanceConfig.exe” on line 6.
The value “asAdministrator” of attribute “level” in element “urn:schemas-microsoft-com:asm.v1^requestedPrivileges” is invalid.

Nice..

I guess older version work, but 5.0.51a doesn’t. You can see in the error, “asAdminstrator”, it should be “requireAdministrator”, we need to hack the exe..

download resource hacker – http://www.angusj.com/resourcehacker/

Open the MySqlInstanceConfig.exe in Reshack, ctrl+f, search for “asAdministrator”, change to “requireAdministrator” save and compile the exe over the old one..

Whoo hoo! The config assistant runs!

Basically the defaults, except I chose

“multilingual” on the character set screen,

and checked the “Include Bin Directory in Windows PATH” box on the Windows Options Screen

and – setup a root password on the security screen!

after it is all done, I like to secure my local machine, go to the my.ini in your MySql directory, and under the [mysqld] add

bind-address=127.0.0.1

so only local apps can connect..

Test MySql by opening a cmd prompt,

mysql -h localhost -u root -p

hit enter, it will ask for a password , and you should be able to login

Configure MySql For Our App

login to MySql using the cmd above..then

CREATE DATABASE blog;
CREATE USER ‘blog’@’localhost’ IDENTIFIED BY ‘blog’;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON blog.* TO ‘blog’@’localhost’;
FLUSH PRIVILEGES;

quit

Now we have a database called “blog” a user called “blog” with password “blog”

We need to tie Ruby to MySql now…

run..

gem install mysql

now, you probably have your mysql directory in your path, but since you need to restart your machine or explorer for new paths to show up, it doesn’t work yet..
so we need to make sure we do that, otherwise, if you try hitting http://localhost:3000/blog you will get a libmysql.dll error popup. I just killed explorer.exe and
start->run explorer in task manager, and then hit http://localhost:3000/blog again and saw the “hello world”

Yesssss… it works. Now , for the fun stuff, actually coding and creating tables, and more!!!!

Categories
Geeky/Programming Ramblings

Windows Vista vs. Windows XP Debate. Who Wins?

I have been using Microsoft’s Windows Vista since it came out RTM, Oct 30 2006. I had it on a Dell desktop, which worked fine. Some driver issues before January 2007, but it still worked. I have had it on my main Dell laptop since May 2007. I use this laptop for work (read: Visual Studio 2005, 2008, SQL Server, Office 2007 etc, etc)

I started using XP the same way since it came out in 2001. Even though, at work, I was forced to use 98/2000 for a while, but I had XP running at home, and ran it all they way up till I installed Vista fresh.

Now XP SP0, was very buggy, driver issues. Same with Windows 2000, SP1 came out and a lot of issues were fixed and it was more stable, yet insecure. SP2 fixed most of the big problems and it was very stable, mature OS, and now SP3 is RTM which adds a few hidden features, as well as all the security patches since SP2. Good deal, yeah, XP is stable, mature and works. Guess what? So is UNIX. It doesn’t mean we want to use it on our machines.

Vista is the new OS in town from Microsoft, and it works just fine. Great almost. Yeah, you heard me right. It works, it doesn’t suck, and yeah, it is better than XP.

Anyone who says otherwise either

a) Doesn’t know how to setup and work Windows

b) has hardware that they can’t get working

c) has an OEM machine full of bloatware slowing it down

d) doesn’t know how to tweak a machine for performance.

e) they haven’t used Vista (because of work reasons or whatever)

Yes, XP works, it works well, for people running Compaq Pesarios or HP machines that are 5-6+ years old. It works well for Linux geeks who really don’t know how to work Windows. It works well for Mac people that need Windows every now and then.

But Vista, just works. My desktop was purchased in Nov 2005. 2 GB of ram. Vista works like a champ. Laptop in May 2007, once again, runs like a champ. Even my MacBook with 1GB runs Vista very well using Apple’s Boot Camp.

Vista IS more secure. You can run it without added bloat of an antivirus/spyware in my opinion. And if you are behind a router, you don’t need a firewall. Now, in XP’s case.. you probably need all three, just because XP is more vulnerable, and when by chance it does get hit by malware, it makes it MUCH harder to get it off XP (I know from helping people) compared to Vista.  Vista has built in tools to identify rouge programs, processes, and things that just shouldn’t be there. It gives you more insight into what is going on – the control panel has tons of options to monitor everything, and, Vista is locked down by default.

Yes UAC is a pain. I disable it, I am a power user. You don’t even need to be a power user, just a smart user. Don’t install crazy things, use Firefox, things like that.

I have been using Mac OS 10.4 and 10.5 now for about 6 months. It is OK, it works, depending on what you want to do. If I wasn’t a Windows developer, I could get by on Mac. I could get by on Linux (I have used it on and off for 8 or so years). But could an average user get by on Linux? No. That is why Linux will never become mainstream for end users – it is too difficult. Even Mac/Windows (and pssst Linux) geek’s give up on Linux because it is just too damn non-user friendly sometimes. No, I shouldn’t have to recompile my kernel to get wireless working. No, I shouldn’t have to edit config files ANYWHERE to change settings, not as an end user. As a power user, yea, that’s fine.

Back to XP vs. Vista – the petition to keep XP alive is just like trying to keep VB6 alive – it will always fail. VB.NET is superior to VB6, Vista is superior to XP – it just is. Vista MCE is much better than MCE 2005, just a ton more options and features, and it works, I could just keep going on and on listing feature comparisons, but it isn’t worth it.

I can say from experience, that Vista wins this war with XP, and until someone can convince me, that is how I roll 🙂

Categories
Geeky/Programming

Updated to Leopard

Yesterday I picked up Apple’s latest OS, Leopard OS X 10.5. What is really cool is the boot camp feature. I am now dual booting Windows Vista and OSX on my little 13 inch MacBook. If I had the cash I would have gotten a MacBook pro, but it is just so expensive. I have 37 GB partitions for each OS, so not huge, but it works.

I do have a USB hard drive (250) that I use for OSX, and then I have one for Windows, so it is all good. Installing OSX was easy, few clicks, done. Did the updates, etc. Then ran Boot Camp assistant, rebooted, installed Vista, put in OSX DVD, installed the rest of the drivers needed, and then did the Windows updates.

Pretty slick setup. I might get some more RAM for this laptop, since it only has 1 GB, but it is performing OK.

I don’t think I will ever buy any new laptop that isn’t a MacBook (preferably a MacBook Pro). There just isn’t any other way to go IMHO.

Categories
Ramblings Random

Windows Vista Customer Experience Program – Why Do I have To Click "On" Then "Off" Again?

image

After installing Microsoft Windows Vista SP1 – This pops up, just like when you install Vista fresh.

What gets me, is that the OK button is grayed out by default. I have to first click on the “Join the Windows Customer Experience Improvement Program” radio button and then back on “I Don’t want to join the program at this time” . Why is this? I want to just hit OK with the default choice. Just irks me I guess 🙂

Categories
Geeky/Programming

Get Microsoft Windows Vista SP1 RTM NOW!

Ok, so I wasn’t sure about this, but tried. it.

Create a batch file with this in it and execute:

@echo off

reg delete HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateVistaSp1 /f > NUL 2>&1
reg delete HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionWindowsUpdateVistaSP1 /f > NUL 2>&1

reg add HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateVistaSp1 /v Beta1 /t REG_SZ /d dcf99ef8-d784-414e-b411-81a910d2761d /f
IF NOT %errorlevel% == 0 ( goto ERROR)

:SUCCESS
@echo.
echo ===========================================================
echo  Windows Vista SP1 registry key has been set successfully.
echo  Please check for updates in Windows Update.
echo ===========================================================
@echo.
goto END

:ERROR
@echo.
echo ===========================================================
echo  FAILED to set Windows Vista SP1 registry keys.
echo  Please run this script by right clicking and selecting
echo  "Run as Administrator".
echo ===========================================================
@echo.
goto END

:END
pause

Then run windows update. I had to install and reboot twice with two updates first before I got the SP1 download. In Windows Update it says it is the RC1 version, but after install my build is 6001.18000.x86fre.longhorn_rtm.080118-1840

which I have read in various forums is the RTM version that matches Windows Server 2008 RTM

Works for me. If it isn’t RTM, I will just update when it comes out.

Categories
Geeky/Programming

Cisco VPN Client on Microsoft Vista – Connection Issues?

If you are using the Cisco VPN Client on Vista (if you can even get it installed, you need one of the latest versions) Then you probably have ran into connection issues. "Connection Reset By Peer" or "Failed to Enable Virtual Adapter" or "User Authentication Failed" etc etc. I recently redid my Vista box and was just having major issues with the Cisco VPN Client. It would connect for 3 minutes, disconnect. 8 minutes, disconnect. 2 Hours, disconnect. I couldn’t stay connected for any period of time. A possible fix?

Set up a constant ping. To a server or device on the network you are connecting to. I have been connected non-stop for 2-3 days now without issue. This was just not happening before.

start->run->cmd> ping <ip or server name> -t

and just let it run in the background, it seems to keep the VPN Client connected!

cisco

Technorati Tags: ,,,,,,,,
Categories
Geeky/Programming

How To: Connect to SQL Server, VS TFS, etc using Windows Authentication when computer is not on Active Directory Domain (XP and Vista!)

Whew, long title, amazing results!

Problem: You have a laptop or computer and you are working remotely for a company. You VPN in. Your computer is not on their Active Directory (AD) domain. You try to connect to SQL Server using SSMS or Analysis Services using Excel, but it doesn’t work because it is using your user, not a domain user. How do you get around this?

Answer: Well, this is what I have found (tested on XP only) – start->run: computernamec$ – then it prompts you to login. Use your AD username and password, so

domainusername and password, and check the box to save password.

Seems that XP will save that in your authentication list somewhere, and then you can use SSMS or Excel to connect to the SQL Server via Windows Authentication!

This trick also works for TFS Build Servers/Team Explorer (tested with VS2005 Team Explorer) ..

Now for the fun part – Vista. The tricks above don’t work on Vista, but you can still get it to work. Here is what you do…create some shortcuts…

C:WindowsSystem32runas.exe /netonly /user:domainusername “C:Program FilesMicrosoft OfficeOffice12excel.exe”

C:WindowsSystem32runas.exe /netonly /user:domainusername “C:Program FilesMicrosoft Visual Studio 8Common7IDEdevenv.exe”

C:WindowsSystem32runas.exe /netonly /user:domainusername “C:Program FilesMicrosoft SQL Server90ToolsBinnVSShellCommon7IDESqlWb.exe”

 

Replace “domainusername” with your info. So if your domain is mycompany then it would be mycompanysteve.novoselac for example.

What happens is that then when you run those apps from those shortcuts it will prompt you for your domain password, you put it in, and it runs the app in the context of your domain user. You can then change the icon for each of these pretty easy, just browse to the exe in the second part when clicking the change icon button on the shortcut properties (the shortcuts are actually links to runas.exe which is a generic icon)

In Vista, for instance, if you are testing SQL (SSMS), you might get this error:

Login failed for user ''. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)

The shortcuts above will get you around it in the situation where your computer is not not on the domain or you are not logged in as a domain user..

These tricks above are especially good if you need to connect to SSAS (Analysis Services) since it is only Windows Authentication. And also, the IT department doesn’t really need to have consultant machines on the domain, or VM’s set up, etc, instead they can use these workarounds

Technorati tags: , , , , , , , , , , , , , , , , , ,