Top Banner
Using Fog to Deploy and Manage Windows Computers
31

Using_Fog

Dec 26, 2015

Download

Documents

MarcosSerna

Manual para la utilizacion e implemetnacion de FOG.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Using_Fog

Using Fog to Deploy and Manage

Windows Computers

Page 2: Using_Fog

Table Of Contents

Introduction _______________________________________________________________ 1

Installing Fog ______________________________________________________________ 2

Virtual Machine Setup ____________________________________________________________ 2

Tarball Setup ____________________________________________________________________ 3

Fog Installer _____________________________________________________________________ 3

Fog Management Portal _____________________________________________________ 5

Configuring Fog ____________________________________________________________ 7

DHCP __________________________________________________________________________ 7

MySQL _________________________________________________________________________ 7

PXE Menu ______________________________________________________________________ 8

Image Storage __________________________________________________________________ 10

Preparing For Imaging ______________________________________________________ 13

Image Registration ______________________________________________________________ 13

BIOS Settings ___________________________________________________________________ 13

Host Registration________________________________________________________________ 14

Uploading A Windows Image ________________________________________________ 16

Master Image Creation ___________________________________________________________ 16

Image Upload __________________________________________________________________ 18

Deploying Images __________________________________________________________ 19

Using Fog Snap-ins _________________________________________________________ 20

Snap-in Creation ________________________________________________________________ 20

Snap-in Deployment _____________________________________________________________ 22

Other Fog Services _________________________________________________________ 24

Hostname Changer ______________________________________________________________ 24

Printer Management ____________________________________________________________ 24

Active Directory Registration ______________________________________________________ 24

Green Fog______________________________________________________________________ 26

Auto Log Out ___________________________________________________________________ 26

User Cleanup ___________________________________________________________________ 26

Glossary _________________________________________________________________ 28

Page 3: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 1 of 29

Introduction

Fog is Linux-based open-source software for imaging and deploying Windows computers. Fog also

provides tools for such tasks as installing additional software and printers after deployment.

Features of Fog:

Free

Written in PHP

Browser-based portal for managing images

No portable media are required as images as deployed and uploaded over the network.

Supports multicasting which reduces the bandwidth required to simultaneously image

multiple computers.

More information about Fog can be found on the Fog Project web-site (www.fogproject.org).

Image deployment with Fog takes place as follows:

1. The operating system and applications are installed on a "master" computer.

2. The "master" image is uploaded to the Fog server.

3. The "master" image is deployed to other computers.

The remainder of this document will describe how to:

Install and configure Fog

Upload a master image

Deploy the image to other computers

Use Fog snap-ins to install additional software, run scripts or copy files

The information contained in this document is based on my experience of using Fog to install

Windows 7 on 13 desktop computers and 4 laptops. It is not intended to be a comprehensive Fog

manual.

Page 4: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 2 of 29

Installing Fog

Fog is available either as a VMWare virtual machine or a tarball (zipped tar file). Download links for

both options are shown below:

Fog virtual machine - http://sourceforge.net/projects/freeghost/files/FOG_VM/

Fog tarball - http://sourceforge.net/projects/freeghost/files/FOG/

As of the time of writing this document, the latest VM Fog version is 0.27, and the latest tarball

version is 0.32.

The Fog server can only run on Linux. Ubuntu and Fedora are the recommended operating systems.

Fog requirements:

Static IP address

Internet connection during installation

SELinux – disabled

Firewall - disabled

PHP 5.2.1+ – installed by Fog installer

Apache 2+ – installed by Fog installer

MySQL 5+ – installed by Fog installer

DHCP server – optionally installed by Fog installer. There must be a DHCP server on the local

network.

The commands in this section require root privileges.

Virtual Machine Setup

The Fog virtual machine is a Ubuntu server with 512 MB RAM and a 40 GB hard disk. Additional disk

space may need to be allocated for storing disk images.

To set up the Fog virtual machine:

1. Extract the contents of the FOGVM zip file to VMWare server.

2. Add the FogServer.vmx file to the virtual machine inventory.

3. Start the FogServer virtual machine.

4. Open the FogServer console and log in as root. The root password is displayed on the

console.

5. Enter the IP, netmask, gateway and DNS addresses of the fog server when prompted.

Page 5: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 3 of 29

Once the network has been configured, the Fog installer will run. The installer will be described in a

subsequent section.

Tarball Setup

The instructions in this section pertain to installing Fog on Ubuntu 10.04.

To install from tarball:

1. Extract the fog tarball to a temporary folder, e.g. /tmp

cd /tmp

tar xvzf fog_0.32.tgz

2. Change to the fog installer bin directory

cd /tmp/fog_0.32/bin

3. Run foginstall.sh

./foginstall.sh

The Fog installer will be described in the next section.

Fog Installer

The Fog installer guides the installation process through a series of prompts as follows:

1. Version of Linux

Enter 1 if using Fedora or CentOS; 2 if using Ubuntu.

2. Installation mode

Enter N for a full Fog installation. Enter S if installing the Fog server as a secondary storage

node for an existing Fog installation.

3. IP address

4. Router address for DHCP

If the Fog server will be running DHCP, enter Y when prompted whether or not the enter

router address, then enter the address of the default gateway.

5. DNS address for DHCP

If the Fog server will be running DHCP, enter Y when prompted whether or not to enter the

DNS server address, then enter the address.

Page 6: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 4 of 29

6. Default network interface

Enter N, unless the server has more than one network card and you want to bind the Fog

server to a specific card.

7. Use Fog for DHCP

Enter N if there is already a DHCP server on the network. Enter Y to install a DHCP server on

the Fog server.

8. Install additional language packs.

9. The installer then displays the configuration options and prompts for the user to enter Y to

continue.

10. The installer then downloads and installs Apache, MySQL and, if necessary, the DHCP server.

The MySQL root password should be left blank initially. Changes to the MySQL root

password must be recorded in the Fog configuration file - /var/www/fog/commons

/config.php. See Configuring Fog - MySQL for more information.

11. When the installer has finished, open a web browser to http://<fog server

address>/fog/management, and click the Install/Upgrade Now button to build the fog

database schema.

Fog uses the following directories:

/opt/fog

Scripts and configuration files for fog services.

/var/www/fog

Fog management portal PHP scripts.

/tftpboot

PXE boot image and menu scripts.

/images

Storage of computer images.

See also:

Fog virtual machine setup

[http://www.fogproject.org/wiki/index.php?title=Installation_on_VMWare_0.27]

Fog installation on Ubuntu [http://www.fogproject.org/wiki/index.php?title=Ubuntu_10.04]

Page 7: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 5 of 29

Fog Management Portal

The Fog management portal is used for tasks such as system configuration, image and host

management. To use the portal:

1. Open http://<fog server address>/fog/management in a web browser

2. Type in the credentials: username – fog; password – password and click Login.

At this point the Fog dashboard is displayed.

Figure 1: Fog Dashboard

The icons along the top of the screen perform the following functions:

Home - display the home page / dashboard.

User Management - change usernames and/or passwords of existing portal users or add new users.

Host Management - manage computers in Fog database. Options include:

maintaining information such as operating system and associated image;

initiating deploying and uploading images

installing additional software or running scripts

Group Management. A computer can belong to one or more groups. Groups facilitate bulk operations, such as simultaneously imaging a number of computers.

Image Management – define image including whether it is single or multi-partition.

Storage Management. During Fog installation, there is an option to set up a storage node. The storage management section is used to record information on storage nodes and storage node groups which are used for load balancing.

Page 8: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 6 of 29

Snap-in Management. Snap-ins are scripts or software installers that can be executed as part of the imaging process or on-demand on computers managed by Fog.

Printer Management – manage information on printers that are automatically installed on computers managed by Fog.

Fog Configuration. If the Fog client application is installed on the imaged computers, options in this section control the services it can provide, such as auto log out, auto shutdown/restart and printer management.

Task Management – execute one-time tasks or schedule recurring tasks such as uploading images, deploying images or installing software.

Reports – run reports on Fog activity including images and snap-ins deployed.

Other Information – view and change Fog server configuration

Logout

See also:

Managing FOG [http://www.fogproject.org/wiki/index.php?title=Managing_FOG]

Page 9: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 7 of 29

Configuring Fog

Use of Fog may require changes to DHCP server and MySQL configuration. There are also changes

that can be made to the Fog configuration to control the network boot process and where computer

images are stored.

DHCP

The DHCP server has to be configured to tell its clients where to find the TFTP (Fog) server and the

name of the Pre-eXecution Environment (PXE) boot file. The Fog installer performs the configuration

automatically when it installs the DHCP server, but the configuration has to be done manually if the

DHCP server is on a separate computer.

To configure a Windows-based DHCP server:

1. Open the DHCP management console

2. Expand the scope that will contain the computers to be imaged

3. Right-click on the Scope Options node and select Configure Options... to open the Scope

Options dialog box.

4. Select the 066 Boot Server Host Name option, and enter the IP address of the Fog server in

the string value text box.

5. Select the 067 Bootfile Name option, and enter pxelinux.0 in the string value text box.

6. Click Ok to save the changes

For a Linux-based DHCP server:

1. Log into the DHCP server as root.

2. Edit the dhcpd.conf file, which is usually in /etc or in a sub-directory of /etc.

3. Within the curly braces of the relevant subnet section, insert the following:

next-server X.X.X.X # X.X.X.X. is Fog server IP address

filename "pxelinux.0"

4. Save and close dhcpd.conf.

5. Restart the DHCP server.

MySQL

MySQL is initially installed without a root password by the Fog installer. Fog uses the MySQL root

account to connect to the MySQL fog database in which it stores data for managing imaged

computers.

Page 10: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 8 of 29

For reasons of security, it is advisable to set a root password and to create a non-root account to be

used by Fog for connecting to the fog database. The MySQL account name and password are

defined as variables in the Fog configuration files.

Log into the Fog server as root to execute the following commands.

1. To change the MySQL root password to JasuD56V:

mysqladmin password JasuD56V

2. To create the fogadmin user with password g2r2CheF and grant all privileges in the fog

database:

mysql --user=root --password=JasuD56V << FINISHED

GRANT ALL ON fog.* TO fogadmin@localhost IDENTIFIED BY ‘g2r2CheF’;

exit

FINISHED

3. To set the new MySQL username and password in Fog, replace:

define( "MYSQL_USERNAME", "root" );

define( "MYSQL_PASSWORD", "");

with:

define( "MYSQL_USERNAME", "fogadmin" );

define( "MYSQL_PASSWORD", "g2r2CheF");

in /var/www/fog/commons/config.php and /opt/fog/service/etc/config.php.

PXE Menu

When a computer boots from its network card, the following takes place:

It gets the address of the PXE boot server, in this case the Fog server, via DHCP

It downloads the network bootstrap program, pxelinux.0, from the Fog Server.

The network bootstrap is loaded into the computer memory and executed.

At this point, the Fog PXE menu is displayed, with the following options:

Boot from hard disk

Run Memtest86+

Quick Host Registration and Inventory

Perform Full Host Registration and Inventory

Quick Image

Client System Information

Debug Mode

Page 11: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 9 of 29

Figure 2: Fog PXE Boot Menu

A menu option is selected by using the arrow keys to move up or down and hitting Enter. The

default menu option, Boot From Hard Disk, is selected automatically after a defined timeout period.

The timeout period and menu option passwords can be set via the Other Information PXE Boot

Menu option in the management portal.

More complex customisations can be done by editing the PXE Boot Menu configuration file –

/tftpboot/pxelinux.cfg/default – on the Fog server. Each line in the PXE menu configuration file

consists of a token and a value separated by a space. There are tokens for global settings and a

section for each menu item, which are defined in sections beginning with the token LABEL. Tokens in

the file include:

MENU TITLE

Text displayed at top of menu.

MENU MASTER PASSWD

Password used to protect certain menu items. A password can be also be assigned to an

individual menu items. Password can be in clear text or SHA-1 encrypted.

menu color <element> <ansi> <foreground> <background> <shadow>

Colour and style of specified menu element. The foreground and background values are

RGBA hexadecimal colour codes. For example, menu color title 1;36;44

#ffffffff #00000000 std sets the menu item with an opaque white foreground on a

transparent black background.

MENU DEFAULT

The menu item that is automatically selected if the timeout expires without user input.

MENU PASSWD

Password to protect individual menu item.

TIMEOUT

Time in tenths of a second before default menu item is selected.

Page 12: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 10 of 29

See also:

RGBA colour model [http://en.wikipedia.org/wiki/RGBA_color_space]

PXE boot menu configuration [http://www.syslinux.org/doc/menu.txt]

Advanced PXE boot menu configuration

[http://www.fogproject.org/wiki/index.php?title=Graphical_Menu_Configruation_Advanced]

Image Storage

By default Fog stores computer images in sub-directories of /images. The image store can be

mounted on another hard disk partition or remote NFS share, or moved to a different directory on

the same disk partition.

The following instructions assume that there are no existing images. Existing images will have to be

moved to the new location.

To change the image storage mount point:

1. Log into the Fog server as root.

2. Stop the Fog services.

/etc/init.d/FOGImageReplicator stop

/etc/init.d/FOGMulticastManager stop

/etc/init.d/FOGScheduler stop

3. Configure /images to be mounted automatically by adding an entry to /etc/fstab.

# Images on another hard disk partition /dev/sdb2

echo "/dev/sdb2 /images ext3 defaults 0 0" >> /etc/fstab

OR

# Images on NFS server nfs1

echo "nfs1:/images /images nfs defaults 0 0" >> /etc/fstab

4. Mount the /images directory.

mount /images

5. Create the images/dev directory.

mkdir /images/dev

6. Set permissions mask on /images to 777.

chmod –R 777 /images

7. Create the .mntcheck file in images and images/dev.

Page 13: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 11 of 29

touch /images/.mntcheck

touch /images/dev/.mntcheck

8. Restart the Fog services.

/etc/init.d/FOGImageReplicator start

/etc/init.d/FOGMulticastManager start

/etc/init.d/FOGScheduler start

To store images in a different directory, e.g. /var/images :

1. Log into the Fog server as root.

2. Stop the Fog services.

/etc/init.d/FOGImageReplicator stop

/etc/init.d/FOGMulticastManager stop

/etc/init.d/FOGScheduler stop

3. Create the dev directory.

mkdir /var/images/dev

4. Set permissions mask on new storage directories to 777.

chmod –R 777 /var/images

5. Create the .mntcheck file in images and images/dev.

touch /var/images/.mntcheck

touch /var/images/dev/.mntcheck

6. Edit /var/www/fog/commons/config.php and replace /images with the new storage

directory in the STORAGE_DATADIR and STORAGE_DATADIR_UPLOAD variables, e.g.

define( "STORAGE_DATADIR", "/var/images/" );

define( "STORAGE_DATADIR_UPLOAD", "/var/images/dev/" );

7. Edit /var/www/fog/status/freespace.php and replace /images with the new storage

directory in the SPACE_DEFAULT_STORAGE variable, e.g.

define( " SPACE_DEFAULT_STORAGE", "/var/images/" );

8. Restart the Fog services.

/etc/init.d/FOGImageReplicator start

/etc/init.d/FOGMulticastManager start

/etc/init.d/FOGScheduler start

9. Log into the Fog management portal

Page 14: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 12 of 29

10. Click Storage Management All Storage Nodes

11. Click DefaultMember in the list of storage nodes

12. In the Edit Storage Node Definition form, enter the new storage directory in the Image

Location field.

13. Click the Update button

See also:

Change Fog image storage directory

[http://www.fogproject.org/wiki/index.php?title=Change_NFS_location]

Add storage to Fog server

[http://fogproject.org/wiki/index.php?title=Adding_Storage_to_a_FOG_Server]

Page 15: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 13 of 29

Preparing For Imaging

Image Registration

An image must be registered with Fog before it can be uploaded. Registration involves defining the

image:

storage location

operating system

partition type

Image registration is done via the management portal by clicking Image Management then New

Image.

Figure 3: New Image Definition Form

BIOS Settings

In order for a computer to be imaged, it must be booted from the network. On some computers,

the boot device can be selected during the boot process by pressing a function key, e.g. F12.

However, if manual intervention is required to boot from the network then it will not be possible to

automatically image a computer.

The network card must be defined as the default boot device in the BIOS in order to automatically

boot from the network. Doing so will not prevent the computer from booting normally, since it will

Page 16: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 14 of 29

eventually execute the default option in the PXE menu - Boot from the hard disk. However, the

boot process can take significantly longer since the computer must first connect to the Fog server

and load the network bootstrap (see PXE Menu section).

The Fog server will send a Wake-on-LAN (WOL) packet to the computer to power the computer on in

order to image it. WOL must therefore be enabled in the BIOS.

Host Registration

Before a computer can be imaged or have its image uploaded to Fog, it needs to be registered in the

Fog database. A computer can be registered manually:

When it boots from the network, by selecting the third or fourth option in the PXE Menu.

Entering the information in Add new host definition form within the Host Management

module in the management portal.

A more efficient option for large numbers of computers would be to upload their details into Fog.

This is done by clicking Host Management Upload Hosts in the management portal. The file must

be in CSV format with no header row and contain the following information:

MAC address

Host name

IP address

Description

Operating system ID

Image ID

For example:

00:19:DD:69:88:99,NEWPC1,192.168.90.90,a new pc,5,2

Only the MAC address and host name are required. The IP address is not used by Fog at present.

Operating system and image ids are listed in the Add New Host Form (Host Management Add

New Host). They can also be found by querying the images and supportedOS tables in the MySQL

fog database.

The WMIC command can be used at the Windows command prompt to get the MAC addresses of all

the computers on the network. For example:

WMIC /OUTPUT:fog.csv /NODE:@names.csv NIC WHERE (name like ‘Intel%’)

GET systemname, macaddress /FORMAT:CSV.XSL

will query the computers listed in names.csv, and save a comma-delimited list of computer

names and the MAC addresses of their Intel network cards to fog.csv.

Page 17: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 15 of 29

See also:

WMIC command syntax

[http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-

us/formal_syntax.mspx?mfr=true]

WMIC command syntax [http://ss64.com/nt/wmic.html]

Note: There appears to be a bug on Fog v0.32 which prevents the image id being saved to the

database during the host file upload process. I was able to correct this by editing

/var/www/fog/management /includes/hosts.upload.include.php, and inserting:

$host->setImage($img);

before

if ( $core->getHostManager()->addHost( $host, $currentUser ) )

which is near line 55

Page 18: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 16 of 29

Uploading A Windows Image

It is recommended that the "master" image be a completely clean Windows installation. The image

needs to be defined and the computer registered in Fog before image upload. See the Image

Registration and Host Registration sections for more information.

Master Image Creation

The instructions in this section are specifically for Windows 7, but should be applicable to other

Windows versions.

Do the following to create a "master image":

1. Partition hard disk, if necessary

2. Install Windows

3. Disable virtual memory (page file) using the System applet in Control Panel.

4. Disable hibernation using the Power Options applet in Control Panel or by entering the

following command:

POWERCFG /HIBERNATE OFF

5. Disable system protection (restore points)

6. Install virus software

7. Install applications

8. Install all Windows updates

9. Disable automatic update of applications, if you intend to update applications only when

the image is refreshed.

10. Create user account(s)

11. Create desktop and start menu shortcuts, browser home pages etc.

12. Download and install the Fog client service from http://<fog server address>/fog/client.

The Fog client is required to run snap-ins, manage printers, auto log out users etc.

13. Scan and defragment the disk

14. Clear the event logs

15. (Windows 7 only) Download FogPrep from http://<fog server address>/fog/client.

Page 19: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 17 of 29

16. (Windows 7 only) Right-click on the FogPrep icon, and click Run as administrator to run

FogPrep.

17. Create unattended setup answer file – unattend.xml.

18. Run SYSPREP

C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /shutdown

/unattend:unattend.xml

The computer will shut down automatically. If it reboots into Windows before the image is

uploaded, steps 15, 16 and 18 will have to be repeated.

It is advisable to create a separate image before running SYSPREP, which can be used to restore the

master computer if there any problems.

The master and imaged computers will run the Windows mini-setup on reboot. If no unattended

setup answer file is used, you will be prompted for the following during this process:

Accept EULA

Computer Name

New user account name and password

Automatic update settings

The Windows Automated Installation Kit can be used to generate an unattended answer file to

automate this process. See below for a link to a sample unattended setup answer file.

See also:

Fog client setup [http://www.fogproject.org/wiki/index.php?title=Client_Setup]

Disable Flash Player auto-update [http://kb2.adobe.com/cps/167/16701594.html]

Disable Java auto-update [http://neverblog.net/disable-annoying-java-update-notification/]

Disable Google updates [http://googlesystem.blogspot.com/2009/05/customize-or-disable-

google-update.html]

Flash Player Admin Guide

[http://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html]

Automate Windows Welcome

[http://technet.microsoft.com/en-us/library/dd744547(v=ws.10).aspx]

Unattended Setup Answer File

[http://wiki.rscwmsystems.org.uk/images/4/4e/Sample_unattend.zip]

Windows Automated Installation Kit (AIK) download

[http://www.microsoft.com/download/en/details.aspx?id=10333]

Page 20: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 18 of 29

Image Upload

The image upload is initiated via the Fog management portal as follows:

1. Click List All Hosts in the Task Management module.

2. In the row corresponding to the computer whose image is to be uploaded, click Upload (up-

arrow image) to open the Confirm Task form.

3. Optionally check Schedule Single Task Execution and enter a date to upload the image at a

future time.

4. Click Upload Image to initiate the upload.

Fog will send a WOL packet to the computer whose image is to be uploaded. If the computer is

configured to boot from the network, it will automatically boot from the Fog server and upload

its disk image.

Note: Imaging will fail if the master computer has an extended partition. This can be

corrected by adding /sbin/sfdisk and its dependent libraries to the Fog boot image –

/tftboot/fog/images/init.gz – and editing the bin/fog script in the boot image. More

information can be found at:

http://sourceforge.net/projects/freeghost/forums/forum/716418/topic/4039406

http://www.fogproject.org/wiki/index.php?title=Modifying_the_Init_Image

Page 21: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 19 of 29

Deploying Images

Computers to be imaged must be registered with Fog and associated with a disk image beforehand.

Registration and imaging can be done in a single step by selecting the Perform Full Host Registration

and Inventory option from the PXE menu when the computer boots. If imaging a number of

computers, the more efficient procedure would be to:

1. Log into the Fog management portal.

2. Register the computers by uploading a CSV file (see Host Registration).

3. Click List All Hosts in the Host Management module.

4. Place a check mark next to the name of each host to be imaged.

5. Enter a group name in the Create new group text box.

6. Click the Process Group Changes button.

7. Click List All Groups in the Task Management module.

8. In the row corresponding to the group to be imaged, click either Deploy or Multicast to

open the Confirm Task form.

9. Optionally check Schedule Single Task Execution and enter a date to schedule image

deployment for a future time.

10. Click Image All Computers to initiate image deployment.

Note: You must ensure that computers which are being imaged are covered by the appropriate

Windows licence.

Page 22: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 20 of 29

Using Fog Snap-ins

A Fog snap-in is a script or Windows installer package (MSI) that can be run on a Windows client. A

snap-in is associated with one or more computers and can either be executed as part of the imaging

process, on demand, or on a schedule. The Fog client software periodically checks for and runs any

snap-ins that are scheduled to be run. The snap-in module is enabled during installation of the Fog

client service. The snap-in service must is enabled using the management portal both:

Globally – via Fog Configuration Snapin Client.

At host level by clicking on Service Settings within the host or group page.

There are three stages to snap-in management:

1. Create snap-in

2. Associate snap-in with computer(s)

3. Run snap-in

If using snap-ins to deploy Windows installer packages, it may be necessary to increase the following

values in the PHP configuration file – php.ini:

upload_max_filesize

post_max_size

memory_limit

The Apache server must be restarted in order for changes to take effect.

Snap-in Creation

To create a snap-in:

1. Log into the Fog management portal

2. Click New snapin in the Snap-in Management module.

3. Fill in the Add new Snapin definition form. The values entered in the Snapin name and

Snapin description fields are displayed in the snap-in list. The values entered in the other

fields depend on the type of snap-in. See Table 1 for some examples.

4. Check the Reboot after install box if required

5. Click the Add button to add the snap-in.

Page 23: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 21 of 29

Table 1: Snap-in Settings

Snap-in Type Snapin Run With Snapin Run With Arguments

Snapin File Snapin Arguments

Windows install package – app1.msi

c:\windows\system32\msiexec.exe /quiet /i app1.msi

File that is passed as an argument to a Windows executable, e.g. c:\progs\prog.exe /s data.txt

c:\progs\prog.exe /s data.txt

Windows batch script with a command-line argument, e.g. myscript.cmd xyz

c:\windows\system32\cmd.exe /c myscript.cmd xyz

VBScript or javascript file that requires command-line arguments, e.g. myscript.vbs /p1 abc /p2 def

c:\windows\system32\cscript.exe myscript.vbs - OR - myscript.js

/p1 abc /p2 def

A zip file – extras.zip - whose contents are extracted to c:\extras using 7-zip

c:\program files\7-zip\7z.exe e -y –o"C:\extras"

extras.zip

Note: There appears to be a bug on Fog v0.32 which strips backslashes from the snap-in run

with arguments and snap-in arguments fields when the snap-in is edited. I was able to correct

this by editing /var/www/fog/management/includes/snapin.edit.include.php, and

replacing:

echo ( "<tr><td>"._("Snapin Run With Arguments").":</td><td><input

class=\"smaller\" type=\"text\" size=\"50\" name=\"rwa\" value=\"" .

htmlentities(stripslashes($ar["sRunWithArgs"])) . "\" /></td></tr>" );

with echo ( "<tr><td>"._("Snapin Run With Arguments").":</td><td><input

class=\"smaller\" type=\"text\" size=\"50\" name=\"rwa\" value=\"" .

htmlentities($ar["sRunWithArgs"]) . "\" /></td></tr>" );

and

echo ( "<tr><td>"._("Snapin Arguments").":</td><td><input

class=\"smaller\" type=\"text\" name=\"args\" size=\"60\" value=\"" .

$ar["sArgs"] . "\" /></td></tr>" );

with echo ( "<tr><td>"._("Snapin Arguments").":</td><td><input

class=\"smaller\" type=\"text\" name=\"args\" size=\"60\" value=\"" .

htmlentities($ar["sArgs"]) . "\" /></td></tr>" );

near line 182

Page 24: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 22 of 29

Snap-in Deployment

A snap-in must be associated with a computer using the Fog management portal before it can be

deployed.

To associate a snap-in with a computer:

1. Select a specific computer within the Host Management module to open the Host

Management – General form.

2. In the left-hand menu, click Snap-ins to open the Snapins form.

3. A list of snap-ins already associated with the computer is displayed, select the snap-in name

from the Add new snapin package list.

4. Click the Add Snapin button.

To associate a snap-in with multiple computers, use the Group Management module. This works in

a similar way to associating a snap-in with a single computer except that the snap-in form does not

display a list of snap-ins already associated with the group.

Snap-ins can be deployed to a single computer or group of computers using the Task Management

module in the Fog management portal.

To deploy snap-ins to a single computer, use the Fog Management portal as follows:

1. Click List All Hosts in the Task Management module.

2. Click the Advanced link in the row corresponding to the selected computer

3. In the Task Management – Advanced Options form, click either Deploy Snapins or Deploy

Single Snapin.

4. If Deploy Single Snapin was selected, a drop-down list of snap-ins is presented in the Task

Management – Confirm Task form. Note: Although all snap-ins are listed, the task will run

only if a snap-in is selected that is associated with the computer.

5. The snap-in deployment can be scheduled to run one at a future time by checking Schedule

Single Task Execution, or to run regularly by checking Cron Style Task Execution. Leave both

check boxes clear to deploy the snap-in immediately.

6. Click the Deploy Snapin button

To deploy snap-ins to a number of computers simultaneously, select a specific group via Task

Management List All Groups. This works in a similar way to deployment to a single computer

except that there is no option to deploy a single snap-in.

Page 25: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 23 of 29

Fog will send a WOL packet to the computer(s) to which snap-ins are being deployed. The Fog client

periodically checks for and runs snap-ins associated with that computer.

Page 26: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 24 of 29

Other Fog Services

The Fog Client service can perform a number of tasks, including:

Changing the computer host name.

Joining the computer to an Active Directory domain.

Automatically adding or removing local and network printers.

Automatically shutting down or rebooting logged out computers at specified times.

Automatically logging out users after a specified period of inactivity.

Deleting unauthorised user accounts.

Deleting the contents of specified directories when a user logs out.

With the exception of joining Active Directory, these services are enabled:

On the client computer during installation of the Fog Client service

Globally, via Fog Configuration Hostname Changer in the management portal

At the computer level, by clicking on Service Settings within the host or group page in the

management portal.

Disabling a service globally overrides any host level settings.

Note: There does not appear to be any way to change which Fog Client services are enabled

without reinstalling the Fog Client.

Hostname Changer

On Windows startup, the Fog Client service compares the computer name with the information

stored in the Fog database. If the names are different, it will automatically rename and reboot the

computer.

This service can be used in conjunction with automated Windows setup after imaging. If the

computer name is left blank in the unattended setup answer file, Windows 7 will assign a random

name to the computer. The correct name will be assigned by the Fog hostname changer.

Active Directory Registration

The Fog Client service can automatically join an Active Directory domain after a computer is imaged.

Active Directory registration requires enabling Hostname Changer. Fog v0.32 does not require

NETDOM.EXE to be present on the computer to be joined, although it was a requirement for older

Fog versions. To configure Active Directory registration, do the following within the Fog

management portal:

1. Select a specific host or group within the Host Management or Group Management module.

Page 27: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 25 of 29

2. Click Active Directory in the left-hand menu

3. In the Modify AD Information form, check the Join Domain after image task box, enter the

following then click Update:

a. Fully qualified domain name

b. LDAP name of organizational unit, can be left blank to create computer object in

default location

c. Username and encrypted password of user with permission to create computer

objects, in DOMAIN\USERNAME format

Figure 4: Modify AD Information Form

To encrypt the password, download the contents of /opt/fog-setup/fog_0.32/FOGCrypt on

the Fog server to a Windows computer, and from the command prompt execute:

FogCrypt <password>

where <password> is the password to be encrypted.

The encrypted password is displayed, and can be copied to the Modify AD Information form.

Note: The FogCrypt program and the HostnameChanger DLL use a default pass phrase for

encrypting and decrypting the password used for joining the workstation to Active Directory. For

this reason it is advisable to either:

Disable the account used to join Active Directory when not in use, and change the

password before each use.

Recompile HOSTNAMECHANGER.DLL with a new pass phrase and change the pass phrase

in the FogCrypt CONFIG.INI. The HOSTNAMECHANGER source code is stored in /opt/fog-

setup/fog_0.32/FOG Service/src/FOG_HostNameChanger folder on the Fog server.

Page 28: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 26 of 29

Printer Management

The Fog Client service periodically checks the Fog server for printers associated with the computer

and adds or removes them appropriately.

Printers are defined within the Printer Management module of the management portal.

Information required to define a printer are:

Alias – name of Windows printer queue

Printer Port

Printer Model

Print INF File – path to printer installation INF file. Both the INF file and the printer drivers

must be stored on a shared folder.

Print IP – required for network printers

Printers are associated with a computer or group of computers within the Printer Configuration form

which is accessed by clicking on the Printers link within the computer or group page. The form is

used to:

Control whether the Fog client adds and removes, or only adds printers

Add printers to a computer or group.

Remove printers from a computer or group.

Green Fog

The Fog Client service will automatically shut down or reboot all computers at a specific time if no

one is logged on. The shutdown and reboot times are set via Fog Configuration Green FOG in the

management portal.

Auto Log Out

The Fog Client service will automatically log out a user after a specified period of inactivity. The

number of minutes of inactivity is set via Fog Configuration Auto Log Out in the management

portal.

User Cleanup

The Fog Client service will remove unauthorised user accounts on log out. The authorised username

list is defined using Fog Configuration User Cleanup in the management portal. Usernames that

begin with an entry in the list – e.g. admin matches administrator, admin and admin1 – will NOT be

removed.

Page 29: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 27 of 29

See also:

The FOG Client Service

[http://fogproject.org/wiki/index.php?title=Managing_FOG#The_FOG_Client_Service]

Fog printer management

[http://fogproject.org/wiki/index.php?title=Managing_FOG#Printers]

Page 30: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 28 of 29

Glossary

Apache

The open-source Apache web server used for hosting web content. The term can also refer to

the Apache Software Foundation, the developers of the Apache web server and other software.

CSV

Acronym for Comma-Separated Values, which is a text file format that uses a comma as a field

delimiter.

DHCP

Acronym for Dynamic Host Configuration Protocol, which is used to automatically assign network

addresses and other information to computers.

MSI

A software packaging format used by the Windows installer to install and manage software

products.

Multicast

Technique for efficiently sending information simultaneously over a network to multiple

destinations.

MySQL

An open-source relational database management system.

NFS

Acronym for Network File System, which is a protocol that allows files to be accessed over the

network in a similar way to local file access.

Open-source software

Software that can be used without requiring payment of a licence fee, and whose source code is

freely available for distribution and modification.

PHP

A scripting language for developing dynamic web pages.

PXE

Acronym for Preboot eXecution Environment, which is a protocol for booting a computer over its

network interface as opposed to a local fixed or removable hard disk.

TFTP

Acronym for Trivial File Transfer Protocol, which is a protocol used primarily for the transfer of

boot files within the PXE protocol.

Page 31: Using_Fog

Using Fog to Deploy and Manage Windows Computers

13 January 2012 Page 29 of 29

WMI

Acronym for Windows Management Interface, which provides an interface for accessing

information on hardware and software components. WMIC.EXE is a Windows command-line

utility to gather WMI information.

WOL

Acronym for Wake-on-LAN, which is a standard that allows a computer to turn itself on when it

receives a specific message over its network card.