Side Topics: Windows PIDs and SharePoint Code

While we’re getting ready for our first SharePoint 2010 project in Visual Studio 2010, I ran into a couple of rich resources that I hope you find interesting.

First, even robots need to know why their computer is running slow and it’s always stuff running that we’d prefer not run. You see these on your task manager where you see a  list of gobbledygook and a column for Memory. There’s always a couple of items taking tens or even hundreds of thousands of Kbs and it’s aways hard to figure out if it’s a good thing or a bad thing.

So, what this robot does is click on the Memory column header twice to sort descending. That brings the fat pigs to the top. Then I look at the Image Name for a given pig and see what it is. If I don’t recognize it, I look it up on Google. Google always returns a load of sites that want to sell me anti-malware garbage so I try to stick to bleeping-computer.com and a small number of others.

One thing I didn’t know was that you can add columns to the Process list using the Select Columns option on the View menu. Two of the columns I like are the PID and the Memory Delta (Working Set Delta). The former gives you a key to learning more and the latter gives you a real-time value of memory grabbed or released by the given process as it runs.

One probelm is, often, the image name is undecipherable such as svchost.exe or conhost.exe. This is where the PID comes in handy.

Our friends at www.howtogeek.com have clued us into converting the PID to an actual program. They told us to open a command prompt and run:

 >Tasklist .svc

This gives us a list of the processes and their PIDs but also any services supported by the process. This, too, can be gobbledygook but at least it’s gobbledygook you can look up on Google. For example, I have a svchost.ese running on PID 160 and it’s supporting by AudioEndpointBuilder service.

Whatever.

And, yet, I find this and this and it seems like that’s one service to which I might not mind allowing access to a bit of my precious 8Gb of RAM.

Repeat the process for all your images, PIDs and services and you’ve got a pretty good idea of what you might not want to run, like the IIS Admin Service on my Pentium 3 Windows ME box.

Then, I got to thinking that the command prompt is so last week, we really ought to have a sweet little PowerShell command to do the same but better, and, of course, we do but it’s a little more complicated than that. Out friends at monadsblog.blogspot.com outline it here.

Our second topic today is a nice little series by our new friend, Dan, who write for SharePointStories.com. He’s alot like us in that he’s stubborn enough to try to squeeze the maximum functionality out of OOTB SharePoint and then, consider custom code. His post from last week sets up a good look at this process regarding the use of dates in list views. Another recent post looks at customer service as a business process. both of these are topics we’ve covered here at SharePoint from Scratch. Take a look and let us know what you think.

Finally, we’re still planning on having our VS2010 SharePoint Project completed by the end of the week. Let’s see what the rest of the week brings us.

hth

-robot

Installing Visual Studio on Win7x64 VM w\SharePoint

Using the VMWare Player console, we were able to get SharePoint Foundation running on a Windows 7 x64 VM. So let’s add VisualStudio and get our development environment running.

I insert the VS 2010 Ultimate Edition DVD they gave away at the Launch Event last week. It autoruns and I click Install Microsoft Visual Studio 2010. There’s a wizard welcome screen. The license agreement page warns to exit all applications and tells me I’m going to need about 8Gb hard drive space. I was listening to Pandora so I quit that, click Accept and Next. I select a Full install.

The wizard runs through about two dozen components including .Net 4, Microsoft F# Runtime, the Silverlight SDK, SharePoint developer tools and a bunch of SQL Server stuff.

After the .Net 4 install, it wants to reboot. It configures on the way down and more setup on the way up. Then the wizard resumes where it left off.

The 11th item in the list is actually called Microsoft Visual Studio 2010 Ultimate. Once the little blue arrow gets to this guy, the green status bar at the bottom seems to stop. Yeah, this might take a few minutes, I suppose but this seems to be turning into trouble.

But no, after about 12 minutes, the green bar starts to move and we start getting directories and files listed at the bottom.

The last item is Visual Studio Help 1.0 x64 and it takes about a tenth of a second and Success.  The wizard suggests updates, Visual Studio Gallery tools and the Help Library Manager.

Since this is a 90 day trial on a 90 day OS, I’m going to pass on updates. The gallery is a user populated set of development tools I may look at later; if any of you have any favorites, I’d be glad to take a look. And, Help Schmelp, I’m clicking Finish.

I get one last look at the wizard that asks me do I want to Change or Remove VS2010 or check for serivce releases. I click Exit.

I click the start bubble and select Programs | VS 2010. The default environment settings selector comes up and I select Visual C# Development Settings and click Start Visual Studio.

Now if this is anything like the Lauch Event last week, we’re only about five clicks away from deploying our first web part.

That will follow later.

hth
-robot

SharePoint Foundation on Virtual Windows 7 – Part 2

If you’re following along, you know we’re running VMWare Player to support a guest Windows 7 x64 on my host Windows 7 x64.

I’ve added the guest to my work domain while my host is still in my personal workgroup. Also, I’ve logged into the Win7 guest with my own credentials and I’m in the guest’s administrators group.

On the guest, I map a drive to the host’s folder where I have the SharePointFoundation.exe that I downloaded from here and copied the executable onto the guest.

Let’s click it.

I click Yes on the User Access Control and now, it’s extracting files and I get the SharePoint Foundation 2010 splash dialog.

So, bound for frustration, I click the Install Prerequisites option and it barfs immediately saying There was an Error During the Installation adding that This tool does not support the current operating system. Looking around, I find this great resource where Microsoft tries to explain all the intracacies of the SPF deployment on Win7.

One of the things it says is:

You must install the WCF Hotfix for Microsoft Windows (KB971831). The hotfix is available for Windows Server 2008 Service Pack 2, Windows Vista Service Pack 1, and Windows Vista Service Pack 2 and for Windows Server 2008 R2 and Windows 7.

Which I download and install. It also says the Prerequisite Installer is not an option for Win7.

Now the MSDN page is not exactly clear regarding the commands for extracting the files. It says to copy the file locally and then, at a command prompt, extract the files using:

<path>\SharePoint /extract:<target path>

In the command above, the word SharePoint should be SharePointFoundation.exe though, I presume the .exe part is optional.

Once I’ve figured that out, it extracts the files and gives me a nice Files Extracted Successfully dialog box where I can click OK.

Also, remember if your paths have blank spaces in the folder names, be sure to surround the whole path in “c:\quotation marks\…”

Now, per the instructions, we edit the:

\Files\Setup\config.xml

file. Next, we’re installing the filterpack (beta) using:

\PrerequisiteInstallerFiles\FilterPack\filterpack.msi

Agree to the license and defeat the user access control dialog. That install gives me an installed successfully dialog box as well.

Next it wants me to install the Sync Framework which I can install from the web. Download, Install, Agree, done. 

Same with the SQlServer Native Client. This will take 20+ Gb so I passed on the SDK.

Then the Windows Identity Framework. Windows 7 requires the file named:

Windows6.1-KB974405-x64.msu

So I download and install that.

Then there’s an epistle of DOS code to enable and activate a bunch of features. The code has to be copied into Notepad to remove the line breaks and pasted into a command window. It seems to be setting up IIS and some other details.  That runs and returns me to prompt. The MSDN page gives you a screenshot of the proper Window Features configuration and mine match just right.

At this point they tell us to reboot.

The MSDN page tells us to run setup.exe in our extracted folder. I click it and get the install wizard. I agree to the terms and click Continue.

The install runs and completes and asks me to run the configuration wizard. I click Close.

The MSDN page says to install SQL Server 2008 KB 970315 x64 before running the wizard. So I close it and refer to SQL Server update. It’s an email roundtrip so now I’m sitting here waiting for an email and “duh-ding” there it is.

It’s a 225Mb download so I’m taking a break.

When it gets done, and you run it, it will require a password that’s contained in the email they sent. The files extract and that’s it? Well, there’s an executable in the extract file location so I run that and defeat the user access control dialog. Then I get the big SQL Server install dialog wizard.

It checks some rules and I pass 8 of 8 so I click Next agree to the terms, install the default components, and get Ready to Update so I click Update.

It runs through the update and tells me Success. I love that. Next, Close, Done.

Now run the SPPT Config Wizard.

It warns me about production content and then tell me it will reset services. I click Yes. It wants to run through 10 tasks.

1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Configuration Successful!

I love that too.

I click Close and, there they are, the SPF 2010 dorks, which are much prettier than the old 2007 dorks.

That’s two cycles through the SP2010 install and now, on a VM on Windows 7.

Tomorrow, we’ll install VS2010 and blow it all up.

hth

-robot

Windows 7 x64 on the VMWare Player

I went with the VMWare Player option first since I’m waiting on some clarification on the VirtualBox install on Intel x64.

The install was quick and it needed a reboot. When it came back up, I had a VMWare Player option in my Start Programs. It opened and gave me an option to Create a New Virtual Machine. When I clicked it, it found the installation disk in the DVD drive and asked if I wanted to use it. There was no Duh! button so I clicked Next.

It asked for a product key and a password. My trial version disk did not have a product key so I left that blank. After about fifteen tries to get my passwords to match, it told me where it was going to build the new machine. I clicked Next.

I specified an 80Gb hard drive in a single file and clicked Next.

It said it was ready but it only listed 1024Mb RAM. There’s a Customize Hardware button so I clicked it and inflated the RAM to 2048 Mb. I clicked OK and then Finish.

It explained that removable devices can be connected to the guest machine. It was informational so I clicked OK.

Then it wants to download VMWare Tools. At this point it’s a little confusing but I click OK.

Windows appears to be installing in the VMWare window while VMWare tools are downloading on my host. Then, the VMWare tools wanted to run so I clicked OK and it ran and went away. In the VMWare window, it says it’s expanding files and it’s at 1%. This looks good.

The virtual machine reboots and says it’s loading Windows and then that it’s completing the installation.

It’s all done and Windows asks me to select a network so I select the work network even though the VMWare Player license is strictly for non-commericial uses.

The VM installs the VMWare tools previously installed on the host and reboots itself. It comes up saying Welcome. Then it chimes using my host’s audio. I’m looking at the Win7EE desktop. Internet Explorer works so it seems like I’m good to go.

I select my desktop icons and the landscapes theme to help me distinguish it from the host.

Now to add it to the domain…

It’s connected to the internet using the host as a proxy. I go into the network properties and edit the IPv4 properties to agree with my local domain. Then, in Computer Management I try to add it to the domain.

No luck.

At the top of my VM window, there’s a Virtual Machine pull down with a Virtual Machine Settings option. There, we find a Network Adapter option that exposes a set of Network Connection options. I change it to Bridged and check the Replicate Physical Connection option. When I try to add it to my domain, it promts me for user name and password. I enter the domain admin credentials and I’m in.

Reboot.

I log in as domain admin, put my domain acccount in the local adminstrators group and the remote desktop users group and log off. Then I log in as me and I get the new desktop.

Windows 7 x64 EE running as a VM on my Win7 host.

Not a bad day for a robot.

-robot   

 

 

The VM Install on Windows 7

So, I built the VM in the last post. When I double-click the new .vmcx file, it tries to start and goes looking for a DHCP server. That takes a few seconds. When it fails, it says to load the bootable install disk in the DVD drive which I do and press enter. Then the window gets bigger and it says Windows is loading files.

That seem like a good thing.

Then barf:

Windows failed to start. A recent hardware or software blah blah blah…

Attempting to load a 64-bit application, however this CPU is not compatible with 64 bit mode.

Rats.

Now it seems there’s some diagreement about what to do here. I search for the error message in Google and I find two courses of action. The first is that VPC won’t run 64 bit guests, i.e. I’m screwed. The other is to check the virtualization option in the BIOS settings. I’ve done that before with some success so I’m rebooting and will open the BIOS with the machine starts to come back up.

And thanks for reminding me to take the Win7 DVD out of the player so it doesn’t try to reinstall my OS when it comes back up.

So I turned on the VM options in the BIOS and no luck. Are we looking at a technical constraint running a 64 bit VM on Windows VPC? I’m beginning to believe these guys.

So, for a robot on a budget, our options are limited to the free VMWare Player or VirtualBox.

The VMWare Player will allow us to create and install VM’s so let’s try that first. Looking at VirtualBox, it’s a little confusing re: Intel x64 with it says it supports but the download just says AMD64. If we have any friends with cycles through VirtualBox, now would be a good time to hear from them. The VirtualBox site registration and forums authentication process is hateful so that took about ten times longer than it should have but I got both options downloaded. The VMWare Player download is 106Mb and the VirtualBox download is 75.

But the first thing this robot is going to do is get rid of Virtual PC. It’s not a program, it’s a Windows Feature so you just have to turn it off and reboot.

 -robot

SharePoint Foundation on Windows 7

This, my friends, is the answer. Yesterday, at the Hyatt in Philadelphia, they launched SharePoint 2010 and Visual Studio 2010. Now you guys know me and know how much I like blowing up new gear with new software so the time has come to make good on Microsoft’s promise:

SharePoint Foundation 2010 can also be installed for development purposes on Windows 7

My understanding is that it will work on any 64 bit Windows OS and it says it won’t support a production environment, whatever that means.

So to find out, I’ve loaded up in some new Dell gear. I got the Latitude 6510 that the sales lady was trying to give away. She balked when I said I needed Windows 7 x 64 Professional with 8Gb RAM and it ended up running the price up to about $1500. But it’s sweet and it is going to let me do a couple of important things.

First, I’ve downloaded Windows Virtual PC from here. It’s a little confusing when they talk about Windows VPC and Microsoft VPC and Windows XP mode but, if you select Windows 7 x64 Pro in the first pulldown and English in the second, you’ll get buttons to download either Windows XP Mode or Windows VPC. I didn’t want XP, I wanted VPC so I click it and got the files downloaded and installed.

So I have a Windows  Virtual PC program on my start menu. I start it and I get what looks like a Windows folder except that it’s got a Create Virtaul Machine link at the top. I clicked it and got a dialog where I can give the new machine a name and a location for the files. There will be two files, a configuration file and virtual hard drive file. I name mine Jeffrey after the sweet little robot in the Intel ad.

Then it asks how much RAM to give it. Since I have 8Gb to work with, I said 2Gb. That’s cool thing number one I can do with the new Dell. And I leave the network connections options checked.

On the next page, it asks about the hard drive file. I check to create a new one and, on the next page, give it 80Gb. With a 500Gb hard drive; that’s cool thing number 2.

Then, I click Create. This takes a bit but eventually, I land back at the VM folder with my new machine, Jefferey sitting there. It says it’s Powered Down.

I double click on it and it opens up a little command Window and starts to boot giving me a DHCP command with a twirling cursor. Eventually it gets tired of doing that and it tells me:

Reboot and select proper boot device or insert boot media in selected boot device.

This is where the Launch Event will pay off because they gave us free Windows 7 Enterprise Edition install DVD. Since the VM is connected to my laptop’s DVD player, I insert the DVD and restart the VM. It boots and starts to install the OS.

That’s a start, but it’s weekend and me and Jeffery got a thing going on this weekend so we’ll talk to you on Monday.

-robot

Help with IIS7 Log Files

You guys and your log files…

Everytime there’s a headache in SharePoint or IIS the first response is always “Check the log files” and I’m sitting here saying… well never mind what I say but obviously there’s some gaps in our understanding of how our log files can contribute to a smooth operation.

Lucky for us, our new best friend Chris helps get us started here.

Being new to IIS7, I’m still struggling to find the new way to do the things I already knew how to do. The problem I was having was that my homepage.html had not been included in the list of default documents. Consequently, the browser was landing on the root folder and attempting to browse the directory, which, by default in IIS7, is disabled. So I’m getting a 403 Forbidden error. That was not much help so I set about trying to figure out what permissions I had to set where to allow my web user see my hopepage.

Now, I found the log files all by myself in c:\inetpub\logs where there’s a \FailedReqLogFiles folder and a \logs folder. Since the former was empty, I looked in the latter and was able to sort by modified date and figure out my log entries we getting written to:

\W3SVC5\u_ex100506.log file

I’m thinking the 5 is a serial number for the fifth web site on the server. I also like the 100506 number at the end of the file name. This is the create date in YYMMDD format. I love this format since it keeps dates in alphabetical order and dispenses with the 20.. verbosity allowing us to regain the efficiencies that we all lost in fear of the Y2K bug.

Just as Chris described, in that log file I found something that looked like this:

#Software: Microsoft Internet Information Services 5.1
#Version: 1.0
#Date: 2005-08-26 18:19:49
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes
2005-08-26 18:33:30 W3SVC68783193 SBS2003 192.168.2.2 GET /images/ – 80 – 192.168.2.1 HTTP/1.1 403 14 5 412 433

Okay, this is the best Microsoft can do trying to help us but it alot better than it could be. Software, Version and Date are no brainers. #Fields is a space-delimited list of the names of the fields that follow in the subsequent list. You can match the values in the following lines with the names in the #Fields line and you’ve got a real set of name-value pairs. (You know how robots love NVPs!)

Reading from the end, right to left, you can ignore the  sc-win32-status sc-bytes cs-bytes and have a look at my sc-status sc-substatus values: 403 & 14.

Well, Chris is nice enough to tell us that the sc-substatus value 14 means directory browsing is disallowed and I was able to drill into the IIS7 console and enable it. My host header dropped me on my site root directory pretty as punch which left me trying to figure out why my homepage.html wasn’t loading and so I looked at the Default Documents “feature” in IIS7 and, of course, found it missing. After all, what headbone names the homepage homepage.html when they know that IIS wants it to be called default.htm?

I added my homepage.html to my list of default document, restarted the website just for fun and site works fine, thank you very much, Chris. And, yes, I went back and disabled directory browsing.

So, like a guy that really gets the “V” in “MVP” Chris goes on to list a good number of the sc-status codes and sc-substatus codes you might encounter in your IIS log files.

All in all, less painful than a root canal and a whole lot better than a “check the log files” slap which, to be honest is less kind than a good page slap. At least, now, we know where the log files live.

hth

-robot  

Document Locked Mystery

I don’t know if our new best friend, Paul, is a meddlesome teenager but he has helped with the mysterious file locking problems with SPv3 version control.

This process is so troublesome that I’ve known may customer that simply deactivate it by default. What happens is that you try to open a document for editing and you can’t because it’s “locked.”

Paul first goes into detail here and follows up with a companion article here.

For his efforts, Scooby says he’d be glad to share his Scooby Snax.

-robot

More Help with SharePoint Management Shell

Our new best friend, Dan, has posted this that helps with anyone that trying to get to their SharePoint farm from the SharePoint Management Shell (SMS.)

We have to remember that when we’re running PowerShell, we’re given permissions according to the account that we logged into Windows with. This is a little different than in the SharePoint GUI where what we see depends on who we are but the actions we take are often executed using the application pool account. What that means is that when we’re running PowerShell and .ps1 scripts, we have to be sure we’ve got the necessary permissions to complete our tasks. Dan’s post covers most of that.

hth

-robot

Still Working Through the Codeplex Autointaller Script

We’re still trying to decode the SharePoint 2010 Autoinstaller Script from CodePlex.

We got the Throw thing figured out thanks to TechNet which offers this little demo:

function Get-XMLFiles
   {
   param ($path = $(throw "The Path parameter is required."))
   dir -path $path\* -include *.xml -recurse | sort lastwritetime
   |  ft lastwritetime, attributes, name  -auto
   }

Which is all good except trying to figure out what to do with it. I found this from our new best friend Dr. Tobias. Of course, we know saving this into a .ps1 script will make it run but, in the console, you have to learn to do multi-line entry and Dr. Tobias covers that straight away.

So looking that the function we’ll create, we see we enclose the code in {curley braces} and we have a param section. Here we drop our variable $path and we set it’s initial value to $(Throw “blah blah blah”) What this does is poke the Throw to the processor unless it’s replaced by an alternative at runtime.

Hence, get-XMLFiles (‘C:\’) will return all the .xml files on your C: drive.

You’ll also see that the -include option filters the return to .xml files, the -recurse option makes it dig down into folders and sub-folders, the  sort sorts the output and the ft formats the output into a nice table with the designated headers. Note also that the parameter is passed inside parenthesis and single quotes. I presume you’d separate multiple paramerters with a comma.

Essentially, in the Get-XMLFiles function, it’s give me a path or I’ll barf. I’ve been there.

In the AutoInstaller script, the script itself has a parameter block, so when the script is called, it better get passed a configuration file or it’s barf city. I’ve been there too.

The one thing I don’t know is how to list the function code after it’s built. I presume I can just rebuild it with new code but I don’t know how to get what I’ve got in there to make minor edits. So I turned to our new best friend Lee who talks about environment variables here. From what he says, I figured out that a get-content function:<function name> will display the code supporting a given function.

Progress. That’s good.

-robot