CSED 431 Week 10 -- April 5




Using the remote servers

You will reboot them. However, if you shut them down, we need to find Miao to restart them.

We will probably need to upgrade to Release 2, but we'll try to avoid that.



Configuring default users

There are two ways:
The former is "better", in that settings can be made mandatory. The latter is often more convenient: you configure one account, and replicate the settings.

From http://www.windowsitpro.com/article/tips/how-can-i-set-the-default-domain-user-profile-.aspx:

  1. Create a profile that you want to use as the basis for all new users and log off as the user.
  2. Log on to the workstation as a domain administrator.
  3. Start the System Control Panel applet (Start, Settings, Control Panel, System).
  4. Select the Advanced tab.
  5. Click Settings in the User Profiles section of the tab.
  6. Select the profile you created in the first step and click Copy To.
  7. In the "Copy profile to" field, enter a location of \netlogon\default user. In the "Permitted to use" field, click Change and set to Everyone, as the figure shows. Click OK.
  8. Click OK to the main User Profiles dialog box, then click OK to the System Properties.


mapping \\winser08-pld\NETLOGON





Powershell

http://technet.microsoft.com/en-us/library/ee332545.aspx

new-item (ni)    -type [file|directory]
copy-item (cp, copy)
remove-item (rm, del)
move-item (mv, move)

get-childitem (dir, ls)      -recurse,
    ls | sort [name|length|lastwritetime| ...]

get-member

variables: begin with $
    $dir = ls


get-executionpolicy, set-executionpolicy
    restricted, allsigned, remotesigned, unrestricted

get-process (ps)
    ps svchost
    ps |get-member
    ps|select-object cpu,name
    ps | where {$_.handles -gt 200 -and $_.name -eq "svchost"}

In the last, note what where is doing. Sort of. We're using a pipe, and each object produced by the ps command is assigned in turn to the special variable $_. We are looking at $_'s .handles and .name attributes. If they don't have that, then there's simply no match.


set-location (cd; chdir)

import-module ActiveDirectory

Alas, this is what we needed Server 2008 Release 2 for. And I'm still working on that. However, the basics are at
using PowerShell to manage Active Directory without the ActiveDirectory module:
    http://www.computerperformance.co.uk/powershell/powershell_active_directory.htm

From that site:

# PowerShell Counts objects in Active Directory
# Connect to hard-coded root
# Author: Guy Thomas
# Version 1.5 Sept 2007 tested on PowerShell v 1.0 and RC2

$Dom = 'LDAP://DC=csed;DC=cs;DC=luc;DC=edu'
$Root = New-Object DirectoryServices.DirectoryEntry $Dom

# Create a selector and start searching from the Root of AD
$selector = New-Object DirectoryServices.DirectorySearcher
$selector.SearchRoot = $root
$adobj= $selector.findall()
"There are $($adobj.count) objects in the $($root.name) domain"

Note the peculiar way of specifying the csed.cs.luc.edu domain. DC stands for "Domain Component".




Changing product keys

The old ways:
The win7 way: system => change product key

The usual time you want to do this is when you are replicating an installation throughout a lab. Microsoft has various tools (eg sysprep) for cloning disk images, but late activation is simplest.

Note that for class I didn't bother with this; the winser08's all have the same product key. But they also have exactly the same virtual hardware environment. Occasionally I mess that up, by changing something, and then I have to re-enter a key (which, because we're an msdnaa member, is free).




Lab

Log into and set up your permanent domain server as a domain controller. Do not bother with DHCP; DNS will be taken care of automagically.

Log into your windows 7 instance, and have it join the domain. Make a note of any problems you encounter. What is the DNS problem?

Install PowerShell on your windows server. Go to Server Manager => Features => Add Feature

Run PowerShell. Try the following commands
    ls
    get-date
    get-date -displayhint [date|time]
    $d = get-date
    $d
    $d.addDays(1)       addMinutes, addMonths, etc