Quicktip: Recoloring Images In Publisher

I had to recolor an image today, but now didn’t have Macromedia Fireworks (the graphics package I’m familiar with), or expression designer – which i haven’t yet installed (shame on me).

Fortunately, i was able to recolor the image using MS publisher. To do so, i simply followed these steps.

  1. Create a new blank publication in publisher
  2. Paste you image into it (i originally opened and copied the image from MS Paint).
  3. Right click the image and select “Format Picture”
  4. Select the “Picture” tab
  5. Press the recolor button
  6. Adjust the colour accordingly.
  7. Close all dialog
  8. Right click the image again and this time select “save as picture”

kpi_icon

SharePoint Antivirus

Some quick notes regarding SharePoint antivirus – i just had a little play with Forefront today (as part of my infrastructure ramp) — http://www.microsoft.com/forefront/en/us/default.aspx.

It was a lot easier to install than i thought it would be – just stepped through the installer and confirmed the antivirus settings in SharePoint central admin.

I was then able to test uploading of viruses using by using a test virus file from http://www.eicar.org/anti_virus_test_file.htm 

image_2

Related links:

http://blogs.vertigosoftware.com/ericc/archive/2006/10/09/3909.aspx

General Windows: Allowing Ping (ICMP) Requests

On windows server 2008, Vista and Windows 7. Ping requests are blocked by the firewall by default. To enable ping requests (icmp), you can either run the following command “netsh firewall set icmpsetting 8″ as an administrator or open control panel -> administrative tools ->  windows firewall with advanced security. Once loaded, select inbound rules from the left hand pane. From this, select “File and Printer Sharing (Echo Requests – ICMPv4-In)” and click “enable” from the right hand actions pane. Note that you may have multiple of these rules here, e.g. for the domain and private profiles. Select the relevant one, depending on where your requests will come from.

firewall_2

Note, as security recommended practices, you should only enable ping requests when required, and shouldn’t leave open.

Infrastructure Ramp: VM Network

In the past, i have either developed on a standalone SharePoint box, or have had a sysadmin create a dc etc for me to develop against. I am trying to ramp up my infrastructure skills atm, so am setting up a vm based farm containing a dc, sql and SharePoint (note that initially i will have one vm for the sql and dc, and one for SharePoint, due to memory considerations). Each vm will have access to the internet, using the host as the gateway (via ICS / Loopback Adapter) and external machines will be able to access http sites on the web server.

Note this article does not go up to the installation of SharePoint – it just talks about setting up the domain, and network infrastructure, although iis is set up at the the end for testing purposes.

Below are my rough notes for future reference…

 

Network Overview

First off, I set up two new server 2008 vms, one to be a SQL / DC box, and one to eventually be a SharePoint box (referred to as Web in this article). The VMs NICs were assigned IP addresses in the 192.168.0.X range.

I also wanted to allow the vms to see the internet, and each other, as well as for external machines to see them. Ideally the VMs should be externally accessible through host headers. To permit this, the host machine containing the VMs needed to be set up with a loopback adapter and internet connection sharing (ICS) with port forwarding.

The network settings on the host, sql/dc vm and the web vm will be as follows:

Host (loopback adapter)

IP Address: 192.168.0.1
Subnet Mask: 255.255.255.0
Default Gateway: (left blank)
DNS Server: 192.168.0.2

SQL / DC VM
IP Address: 192.168.0.2
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.0.1
DNS Server: 127.0.0.1

Web Front End:
IP Address: 192.168.0.3
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.0.1
DNS Server: 192.168.0.1

 

Domain Creation

I then followed this article to set up a dc, and then joined my Web box to this newly created domain.

http://www.windowsreference.com/windows-server-2008/step-by-step-guide-for-windows-server-2008-domain-controller-and-dns-server-setup/

Note that i disabled ipv6 on the network adapter, to facilitate less complex setting up of the domain.

 

Host Machine – Loopback adapter

A loopback adapter was set up on the host machine to allow the host to have an ip on the VM network, and also act as the gateway.

  • To add the loopback adapter in vista, go to start -> control panel -> add hardware. A dialog will appear.
  • Select “Install the hardware that I manually select from a list (Advanced)” and click next.
  • Select “Network Adapters” from the subsequent list and click next
  • Select “Microsoft” from the list of manufacturers, and the “Microsoft Loopback Adapter” from the subsequent list of network adapters. Click next
  • Click next on the “wizard is ready” dialog. This will install the loopback adapter.

Once installed, the loopback adapter is assigned an ip of 192.168.0.1 that cannot be changed – hence vms in my virtual network also need to use this ip range. I set the dns server as follows, so that we can resolve the machine names on the virtual network from the host (note that this is not required, but gave me an extra option for testing).

IP Address: 192.168.0.1
Subnet Mask: 255.255.255.0
Default Gateway: (left blank)
DNS Server: 192.168.0.2

To set this, navigate to Control Panel\Network Connections and select the newly added loopback adapter. Double click it, then click properties, then select Internet Protocol Version 4 (TCP/IPv4) and click the properties button.

When this is complete, the host machine is effectively on the same network as the vms, in addition to any other networks that it may belong to. To allow vms in this virtual network to now use the host machine as a gateway, we must configure Internet Connection Sharing (ICS).

 

Host Machine – Internet Connection Sharing (ICS)

To allow the virtual network to connect to the internet, ICS must be set up on host machine network adapter that provides the internet connection. To do this, select this network adapter (from Control Panel\Network Connections) and click properties. On the subsequent dialog box, click the “Sharing” tab, and ensure that the “Allow other network users to connect through this computers internet connection” is checked. Also, if there are multiple networks present, select the “home networking connection” to be whatever the name of your loopback adapter is (e.g Local Area Connection 2).

 image

Optional: configure port 80 to forward to webserver vm
In addition to allowing my vms to connect to the internet, i also external requests to the host machine on port 80, to be forward to my webserver vm. To do this, i clicked the “settings” button from the above dialog.

I then selected “Web Server (HTTP)” and clicked the add button

 ics2_2

I then set the ip address to be that of my vm webserver (e.g. 192.168.0.3).

 ics3_2

 

Configure Virtual Machines to use Loopback Adapter

Each VM was then configured to use the new loopback adapter from the virtual machine settings dialog (note that each vm needs to be rebooted for the loopback adapter to show, and for the vms to see each other they must all use the same adapter).

 vm_networkadapter_2

Note that the network adapters in the VMs were set with the settings described in the network overview.

 

DNS Setup for Testing / Host Headers

I had a test machine on my home network, namely 192.168.1.67. I wanted this to access http sites on my vm network (as an external test box). To facilitate this, i set the host  file on that box at C:\windows\system32\drivers\etc\hosts to point to the ip address of the host machine – e.g. 192.168.1.69. for the domain sp.rnowik.com. I did not make any other changes to this, but ideally it would lookup dns from my vm network dns server (although i think i would need to configure ics on the vm host box to forward dns requests). Anyway, with it set up as above, it allowed me to test my network externally.

As a dns server was also installed when the virtual domain was set up, I added a new zone and host to this to allow the vms and host to be able to resolve the host header (e.g. sp.rnowik.com) see the screenshot below.

 dns_2

Note that I will probably come back and revisit the dns setup as another learning exercise.

I also installed iis onto the virtual webserver and added a site to port 5000. I configured a host header for this site to accept sp.rnowik.com on port 80.

Following this, I was able to view the site through each vm, the host machine and the test machine (describe above), proving that the setup worked.

 

Related Links

Hyper-V: Copying files from host to VM

When a VM is not on the same network as the host machine, you can setup a virtual adapter to facilitate copying of files from the host to the VM and vice-versa.

Go to hyper-v manager and click "Virtual Network Manager" from the right hand pane. With the subsequent dialog, select "New Virtual Network" –> "Internal" and click add.

Give the new network a suitable name and click ok.

This will create a new network adapter on the host machine that you can assign a static ip (quick and dirty method to get this working). Select start –> settings –> network connections and select your newly created network adapter. Right click in and select properties. From this, highlight Internet Protocol (TCP-IP) on the General tab and click

Set the IP address to something like 10.10.13.1 and the subnet mask to 255.0.0.0.

You now need to add a virtual adapter for your VM to connect to this newly created network. To do this, you must first shut down your VM. Once down, right click to select it in Hyper-V manager and select Settings from the context menu.

In the settings, select "Add Hardware", then select "Network Adapter" and click the add button. From the subsequent network dropdown, select the name of your newly created internal network. Click ok.

Start you VM. Within your Virtual Machine, select start –> settings –> network connections and select your newly created network adapter. Right click in and select properties. From this, highlight Internet Protocol (TCP-IP) on the General tab and click

Set the IP address to something in the same ip range as the one you have just configured on the host machine (e.g. 10.10.13.2). Set the subnet mask to the same as above – e.g. 255.0.0.0

Click ok if you are prompted that dns entry is empty.

You should now be able to connection to the host machine from the VM by typing \\10.10.13.1\C$ into explorer.

Quicknote: Hiding "Narrow The Search" from advanced search

I had to hide the “narrow the search” box from the advanced search, due to it only containing one field. I could not do this via the standard webpart properties, due to needing to see specific criteria below. To do this, I wrote a (pretty horrible) bit of JS, and added it to a content editor webpart with no chrome below the advance search webpart
<script language=”javascript”>
var arr = document.getElementsByTagName(“h3″);
for (i = 0; i < arr.length; i++)
{
   if (arr[i].className == ‘ms-standardheader’ && arr[i].innerText == ‘Narrow the search…’)
   {
var parentRow = arr[i].parentNode.parentNode;
        // Hide this row and next three rows
        parentRow.style.display = ‘none';
        parentRow.nextSibling.style.display = ‘none';
        parentRow.nextSibling.nextSibling.style.display = ‘none';
        parentRow.nextSibling.nextSibling.nextSibling.style.display = ‘none';
   }
}
</script>