Dev Team Assemble

Evil beware!
Add to Technorati Favorites

Archive

Tag: Windows

Heres a neat little snippit that comes in handy for running commands against the operating system.

Sourced directly from here: http://stackoverflow.com/questions/691716/running-cmd-commands-via-net ...but I like having the code here as well.

 
// Kills a process
<span> </span> private static void ExecuteCommand(string command)
{
try
{
// create the ProcessStartInfo using "cmd" as the program to be run,
// and "/c " as the parameters. &gt; tell the command to execute the command that follows
System.Diagnostics.ProcessStartInfo procStartUpInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
// The following commands are needed to redirect the standard output.
// This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartUpInfo.RedirectStandardOutput = true;
procStartUpInfo.UseShellExecute = false;
// Do not create a window.
procStartUpInfo.CreateNoWindow = true;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartUpInfo;
proc.Start();
// Get the output into a string
string result = proc.StandardOutput.ReadToEnd();
// Display the command output.
Console.WriteLine(result);
}
catch (Exception objException)
{
Console.WriteLine(objException);
}
}
 

Technorati Tags: , , , ,

Here is some useful information that I always seem to forget when developing windows services.

  • To install/uninstall manually, which i find helpful to do from the bin folder of your project use the following commands:
    • INSTALL: %windir%\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe [the name of the executable]
    • UNINSTALL: %windir%\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe -u [the name of the executable]
  • To Debug a windows service add the following code to your Main method

    static void Main(string[] args)
    {
    #if DEBUG
    System.Diagnostics.Debugger.Break();
    #endif

    ServiceBase.Run(new Service());

    }

  • To create an installation package for a service: ....I will come back to that - no time to put it together today :)

Technorati Tags: , , ,

Neat thing I figured out today...which I am 100% certain I will forget...to force allow remote desktop connections on a windows 2008 domain you need to set the following

  1. Set windows Firewall to have a exception for the remote connection : computer >> admin templates >> network >> network connections >> windows firewall >> domain profile >> windows firewall: allow inbound remote desktop exceptions
  2. Set the remote desktop services to allow connections: : computer >> admin templates >> windows components >> remote desktop services >> remote desktop session host >> connections >> Allow users to connect remotely using remote desktop services

Technorati Tags: , , , , , ,

I came across a great post today that talks about ASP.NET caching (applies to SharePoint) and what to look for.  Thanks to Gunnar Peipman for the great insight.

http://weblogs.asp.net/gunnarpeipman/archive/2010/04/02/measuring-asp-net-and-sharepoint-output-cache.aspx

Basically you need to setup the following performance counters in windows:

  • Total number of objects added
  • Total object discards
  • Cache hit count
  • Cache hit ratio

Technorati Tags: , , ,

I was trying to install install SharePoint 2007 onto Windows 2008 r2 and was getting a strange error referencing KB article 962935. Funny enough this article is not live yet so it left me a little unhappy. Apprarently Microsoft does not support the distributed SP1 installation package of SharePoint for this version of the OS. Turns out Jei Li posting on his msdn blog detailing how to go about creating a slipstreamed installation for SP2 on this server Click here for the article. Basically the steps are (pretty much word for word from Jei Li's blog):

  • Install .Net Framework 3.5 SP1 in the features applet
  • Copy the installtion media contents to a folder on the computer (c:\install)
  • Download the WSS x64 SP package and the MOSS 2007 SP2 x64
  • Delete everything inside Updates folder in the install folder you setup.
  • Open a command prompt,  change directory to the folder you put the downloaded patches, and run the following two commands: 
    • wssv3sp2-kb953338-x64-fullfile-en-us.exe /extract:[Path to installation bits]\Updates /quiet
    • officeserver2007sp2-kb953334-x64-fullfile-en-us.exe /extract: [Path to installation bits]\Updates /quiet
  • Delete the wsssetup.dll filein the updates dir. This is a very important step so please don’t miss it.
  • If you also need the Cumulative Updates to be applied when install SharePoint, download the latest Windows SharePoint Services 3.0 and SharePoint Server 2007 Cumulative Update packages and extract them into Updates folder like step 4.
  • Your slipstream build of SharePoint Server 2007 is done!
  • Go and install it on your Windows Server 2008 R2 box, after the installation, the site version will show 12.0.0.6421 or possibly a higher version.

Please reference Jei Li's post for furthur instuctions.  I only posted all the steps here because things have a mysterious way of dissappearing or not appearing at all on Microsofts site.

After doing all of this everything seems to be fine...seems to be :)  

Links

Technorati Tags: , , , , ,

Recently I acquired some server class hardware (Dell PowerEdge 2950)  and I thought, hey this is a great opportunity for me to setup a virtual environment at home so I can test out some beta products and do some tinkering with Linux. I have VMWare Workstation installed inside of Windows Vista machine at home and I have ubuntu 8.10 running in it and this seems to work ok but I have come across some issues with it that annoy me.

I was undecided on whether to install VMWare ESXi or Windows 2008 Hyper-V server. Based on the title of this article you can probably guess which route I took. I didn't decide to do this simply because I think Microsoft's virtualization platform is superior...I chose it simply because I use VMWare ESXi and ESX at work and was interested in seeing the capabilities of this free product in comparison.

After configuring the server with RAID 0 (faster and this is test) I popped the disk in and started installing. Truth be told the installation was a breeze...so much so in fact that I started the install, watched a soccer game and when I came back it was ready for me to login. I was a little confiused at first because at no point did I provide a username and password for the admin account but it prompted me at the login screen. Didn't take long to figure out it was Administrator/-blank- to login.

This all seemed a little too good to be true and I quickly found out that it was...after downloading and installing the Hyper-V Manager MMC into my vista machine I found I could not connect to the server. found this odd as the very purpose of this server is too allow connections. Turns out there were a few steps I had to do:

  1. I had to add my user account (the vista one) to the server in order to pass my creds through.  I believe that once you have connected to it you can turn this off via the Hyper-V settings panel.
  2. I had to turn off the server's firewall (I know, I know this is a bad thing but its a test box that will never see the outside world so...).  You can use the following command netsh firewall set opmode disable
  3. I was able to connect to the server...BUT when I tried to create a machine I would get an error about Access Denied.  So I added myself to the Administrators group on the server.  At this point I can now use MMC to do most admin work on the server from my Vista client
  4. I then started getting the following when trying to connect: Hyper-V Access Denied. Unable to establish communication between ‘SERVER’ and ‘CLIENT’ .  Funny thing is it would let me create a virtual machine but I could never seem to connect to it.  This one was quite confusing so I turned to my trusty friend Google to help me resolve this...I came across a blog post of one Adrian Dimcev here and it had the solution I was looking for.   Word for word heres the instructions from his site:
    • Click Start, Run, type DCOMCNFG. Click OK.
    • Expand Component Services, expand Computers. Right-click on My Computer and click on Properties.
    • Click on COM Security.
    • In the Access Permission area, click Edit Limits.
    • Select ANONYMOUS LOGON in the Group or User Name area. Then set the Permissions for ANONYMOUS LOGON to Allow for Remote Access.
  5. After the previous breakthrough I got the following error (oh joy)  : The application encountered an error when attempting to change the state of the 'machinename'.  The hypervisor is not running....WHAT????? Ummmm yes it is......
    Ok turns out there is a very good reason for this as explained here in this Microsoft article.  All I had to do here was enable
    hardware-assisted virtualization in the BIOS.  After doing that it I was able to create my first machine in this environment == Ubuntu 9.

After reading a little further on the internet it seems that my setup at home (using a workgroup) is not the best way to do this and is partly to blame for some of mine and other peoples issues.  All in all the installation was a success but seems a little more confusing than installing ESXi.  Either way my environment is up and running.

Technorati Tags: , , , ,

Great post here with a fix/workaround. Essentially when you go to look in the windows .net framework directory that program is not there. In order to run this utility program you will need to use the Visual Studio command prompt that is in the Programs/Visual Studio menu.

Technorati Tags: , , , ,

While working on my sharepoint development machine today I was mucking about with variations and doing a proof of concept.  Now I know they worked before but for some reason when I created a new page in the source site they were not being propagated through to the variation label sites.  In Centeral Admin under the Timer Status I found that the Variations Propagate Page Job Definition and the Variations Propagate Site Job Definition were both stuck at 0% and Initialized, see below:

variations

Seeing this, I now knew that the Timer service was not creating my variation pages and sites so a quick check under the windows services control panel applet  revealed that the Windows SharePoint Services Timer Service had been shut off.  Turning this back fixed my problem.

Technorati Tags: , , ,

I came across this neat tool (well a colleague of mine did and told me about it) from Helicon called URL Rewriter. Basically it allows you to use an ISAPI filter to rewrite the url that the server uses to work with in IIS and is essentially a copy of the mod_rewrite utility available in Apache.

It uses Regular expressions...so if you are not an expert in those (as I am clearly not) then this little tidbit of code may help. It allows you to rewrite the url that comes in as subdomain.domain.com as domain.com/subdomain. The top portion is the header and sets up logging and such...the real meat is the last two lines.

Here it is

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.48
RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 200
RewriteBase
ReWriteLog C:\rewrite.log
RewriteLogLevel 9

RewriteCond %{HTTP_HOST} ^(?!www)(\w+).christiedigital\.com
RewriteRule (.*) /%1/$1 [L]

Hope this helps

Technorati Tags: , , , ,