Search This Blog

Install Active Directory Module for Windows PowerShell

See Mike Pferiffer’s Blog below.  Notes Active Directory Web Services (ADWS) or Active Directory Management Gateway Service is required to use Active Directory Module.  Quest Software ActiveRoles Management Shell for Active Directory’s Get-QADUser without this requirement.

 

With the release of PowerShell 2.0, we now have a PowerShell module that we can use to administer Active Directory. The Active Directory Module for Windows PowerShell runs on Windows Server 2008 R2 and on Windows 7 and relies on a web service that is hosted on one or more domain controllers in your environment. In this post I'll go over what you need in order to install and use the Active Directory Module for PowerShell, also known as AD PowerShell.

Setting up your Domain Controllers

In order to use the Active Directory Module for Windows PowerShell on 2008 R2 and Windows 7, you first need to be running Active Directory Web Services (ADWS) on at least one Domain Controller. To install Active Directory Web Services (ADWS) you'll need one of the following:

1. Windows Server 2008 R2 AD DS

You can load Active Directory Web Services (ADWS) on a Windows Server 2008 R2 Domain Controller when you install the AD DS role. The AD PowerShell module will also be installed during this process. Active Directory Web Services (ADWS) will be enabled when you promote the server to a DC using DCPromo.

2. Active Directory Management Gateway Service

If you cannot run Windows Server 2008 R2 Domain Controllers, you can install the Active Directory Management Gateway Service. Installing this will allow you to run the same Active Directory web service that runs on Windows Server 2008 R2 DC's. You can download the Active Directory Management Gateway Service here. Make sure you read the instructions carefully, there are several hotfixes that need to be applied depending on the version of Windows you are running. You can install the Active Directory Management Gateway Service on DC's running the following operating systems:

  • Windows Server 2003 R2 with Service Pack 2
  • Windows Server 2003 SP2
  • Windows Server 2008
  • Windows Server 2008 SP2

Note: You can also use AD PowerShell to manage AD LDS instances on Windows Server 2008 R2. If you plan on using AD LDS, Active Directory web services will be installed with the AD LDS role, the AD PowerShell module will also be installed during this process. The ADWS service will be enabled when your LDS instance is created.

Once you've got Active Directory web services up and running on your Domain Controller(s), you'll notice you now have an ADWS service as shown here:

At this point, you should be ready to install the AD PowerShell module. You can run AD PowerShell on all versions of Windows Server 2008 R2 (except the Web Edition) and on Windows 7.

Installing the Active Directory Module for Windows PowerShell on 2008 R2 member servers

You can install the Active Directory Module on Windows 2008 R2 member servers by adding the RSAT-AD-PowerShell feature using the Server Manager. I usually use the ServerManager module to do this because it is quick and easy. To install the feature using the ServerManager module, launch PowerShell and run the following commands:

Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell

Remember, this only needs to be done on Windows Server 2008 R2 member servers. The RSAT-AD-PowerShell feature will be added to 2008 R2 DC's during the DCPromo process.

Installing the Remote Server Administration Tools (RSAT) feature on Windows 7

In order to install the Active Directory Module for Windows PowerShell you need to download the RSAT tools for Windows 7here. Once this is installed you are still not finished, you need to enable the Active Directory module. Navigate to Control Panel > Programs and Features > Turn Windows Features On or Off and select Active Directory Module for Windows PowerShell as show here:

Once you have Active Directory web services running on at least one domain controller and the AD PowerShell module is installed, you are ready to run the AD PowerShell module. You can do this in one of two ways. First, you can access the "Active Directory Module for Windows PowerShell" shortcut in Administrative Tools as shown here:

Right click the shortcut and select "Run as administrator" in order to start PowerShell with elevated permissions.

You can also simply import the AD PowerShell module in your existing PowerShell session. Just use the Import-Module ActiveDirectory command:

Import-Module ActiveDirectory

That's all that needs to be done to get up and running...I will get into using the AD PowerShell cmldets in future posts so keep an eye out for that.

Upgrade vSphere Virtual Machine

Recap vSphere upgrade process:

The following article is from Scott Lowe with some of my update.

Upgrading a VMware Infrastructure 3.x environment to VMware vSphere 4 involves more than just upgrading vCenter Server and upgrading your ESX/ESXi hosts (as if that wasn’t enough). You should also plan on upgrading your virtual machines. VMware vSphere introduces a new hardware version (version 7), and vSphere also introduces a new paravirtualized network driver (VMXNET3) as well as a new paravirtualized SCSI driver (PVSCSI). To take advantage of these new drivers as well as other new features, you’ll need to upgrade your virtual machines. This process I describe below works really well.

Please note that this process will require some downtime. I personally tested this process with both Windows Server 2003 R2 as well as Windows Server 2008; it worked flawlessly with both versions of Windows.

1. Record the current IP configuration of the guest operating system. You’ll end up needing to recreate it.

2. Upgrade VMware Tools in the guest operating system. You can do this by right-clicking on the virtual machine and selecting Guest > Install/Upgrade VMware Tools. When prompted, choose to perform an automatic tools upgrade. When the VMware Tools upgrade is complete, the virtual machine will reboot.

3. After the guest operating system reboots and is back up again, shutdown the guest operating system. You can do this by right-clicking on the virtual machine and selecting Power > Shutdown Guest.

4. Upgrade the virtual machine hardware by right-clicking the virtual machine and selecting Upgrade Virtual Hardware.

5. In the virtual machine properties, add a new network adapter of the type VMXNET3 and attach it to the same port group/dvPort group as the first network adapter.

6. Remove the first/original network adapter.

7. Add a new virtual hard disk to the virtual machine. Be sure to attach it to SCSI node 1:x; this will add a second SCSI adapter to the virtual machine. The size of the virtual hard disk is irrelevant.

8. Change the type of the newly-added second SCSI adapter to VMware Paravirtual.

9. Click OK to commit the changes you’ve made to the virtual machine.

10. Power on the virtual machine. When the guest operating system is fully booted, log in and recreate the network configuration you recorded for the guest back in step 1. Windows may report an error that the network configuration is already used by a different adapter, but proceed anyway. Once you’ve finished, shut down the guest operating system again.

11. Edit the virtual machine to remove the second hard disk you just added.

12. While still in the virtual machine properties, change the type of the original SCSI controller to VMware Paravirtual (NOTE: See update below.)

13. Power on the virtual machine. When the guest operating system is fully booted up, log in.

14. Create a new system environment variable named DEVMGR_SHOW_NONPRESENT_DEVICES and set the value to 1.

15. Launch Device Manager and from the View menu select Show Hidden Devices.

16. Remove the drivers for the old network adapter and old SCSI adapter. Close Device Manager and you’re done!

If you perform these steps on a template, then you can be assured that all future virtual machines cloned from this template also have the latest paravirtualized drivers installed for maximum performance.

UPDATE: Per this VMware KB article, VMware doesn’t support using the PVSCSI adapter for boot devices. That is not to say that it doesn’t work (it does work), but that it is not supported. Thanks to Eddy for pointing that out in the comments!  The VMware KB article has been updated, VMware support using the PVSCSI adapter for boot devices on Windows Server 2008 and Server 2003.

Reference: Scott Lowe – vSphere Virtual Machine Upgrade Process

Install HP ESXi Offline Bundle for VMware ESXi 4.1

Prerequisites

  • vSphere Command-Line Interface (vSphere CLI) on a Microsoft Windows computer.
  • HP ESXi bundle zip file (e.g. hp-esxi4.1uX-bundle-1.0a.zip)

Procedure

1. Power off any VMs that are running on the host.

2. Place the host into maintenance mode.

3. Find out which bulletins are applicable to the ESXi host.

vihostupdate.pl --server <server> --scan --bundle <local_path>/hp-esxi4.1uX-bundle-1.0a.zip

4. (Optional) List all the bulletins that are available in the bundle.

vihostupdate.pl --server <server> --list --bundle <local_path>/hp-esxi4.1uX-bundle-1.0a.zip

5. Install bulletins from the bundle on the ESXi host.

vihostupdate.pl --server <server> --install --bundle <local_path>/hp-esxi4.1uX-bundle-1.0a.zip --bulletin bulletin1,bulletin2

if you omit the --bulletin argument, this command installs all the bulletins in the bundle.

6. Verify that the bulletins are installed on your ESXi host.

vihostupdate.pl --server <server> --query

Reference: see HP Installation Instructions for more details

Exchange Server 2010 RAM Recommendations

  • 1GB per CPU core for Edge Transport and Hub Transport servers
  • 2GB per core for Unified Messaging and Client Access servers
  • For Mailbox servers, 4GB plus between 3MB and 30MB per mailbox (so somewhere between 7GB and 34GB for a 1,000-mailbox server)
  • 2GB per core for servers that combine Hub Transport and Client Access servers
  • For servers that combine the Mailbox role with other roles, a minimum of 8GB (4GB plus 3-30MB/mailbox)

Reference: Exchange 2010: Can You Have Too Much RAM? and Understanding Memory Configurations and Exchange Performance

How to Manage SQL Server Database Files

  • Log files
    • Query log space usage for every DB on the server: DBCC SQLPERF(‘logspace’)
    • Add a log file to the DB: ALTER DATABASE dbname ADD LOG FILE(NAME = logicalname, FILENAME = ‘filepath’, SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth)
    • Modify auto growth: ALTER DATABASE dbname FILE (NAME = logicalname, AUTOGROW = size)
    • Remove MAXSIZE limit: ALTER DATABASE dbname (NAME = logicalname, MAXSIZE = UNLIMITED)
    • Prevent autogrow: ALTER DATABASE dbname (NAME = logicalname, AUTOGROW = 0)
  • Data files
    • the command is essentially the same with some new options (e.g. “TO FILEGROUP”).

How to Plan SQL Server Database Files

  • Log files:
    • Place log files on a different physical partition than data files.
    • It’s not true – using several log files will get a performance gain – log files are written sequentially which means that each log file is filled up before the next one is written to.
  • Data files:
    • Place data files on a different physical partition from log files.
    • It’s true – using several data files can get a performance gain – data files use an equal fill algorithm (all of the files are filled equally as much as possible).
  • File growth:
    • Do not accept the defaults for file growth.
    • The best is to set both data and log files as large as possible – it can be very expensive (performance wise) to grow files
    • The next best is to set files to autogrow by fairly large predicable increments (grow data file by at least 1 GB).  It’s best to grow files by a specific value than by a percentage.
    • Set all data files to grow at the same rate, and all log files to grow at the same rate.  Data files don’t have to grow at the same rate as log files.

More details see http://www.petri.co.il/sql-server-database-files.htm

Picture Resizer–TinyPic

http://www.efpage.de/eTinypic.html

Free Disk Defragmentation Tool

  • UltraDefrag: can defragment any system files including registry hives and paging file.
  • Smart Defrag: has Auto Defrag feature – works automatically and quietly in the background.
  • MyDefrag: see differences between Ultra Defrag and MyDefrag
  • Defraggler: can specify to defrag one or more files.

Free All-in-One Music Converter - Easy CD-DA Extractor

www.poikosoft.com

  • Rips Audio CDs
  • Converts audio files format
  • Edits metadata
  • Burns Audio CDs, MP3 CD/DVDs, and Data CD/DVDs

Upgrade VMware ESXi 3.5 to vSphere 4.1 Using Host Update Utility

Upgrade ESXi 3.5 to 4.1 summary:

  • upgrade ESXi 3.5 to 4.0 Update 1
  • upgrade ESXi 4.0 Update 1 to 4.1
  • I cannot upgrade EXSi 3.5 to 4.1 directly using Host Update Utility

Upgrade procedure:

  1. Download “VMware vSphere Client and Host Update Utility 4.0 Update 1”.  (VMware vSphere Client 4.1 download package does not include Host Update Utility)
  2. Install VMware vSphere Client and Host Update Utility 4.0 Update 1.
  3. Download “Upgrade package from ESXi Server 3.5 to ESXi Server 4.0 Update 1” ZIP package.
  4. Launch Host Update Utility 4.0 to upgrade ESXi Server 3.5 to 4.0 Update 1 with the ZIP package.  This will upgrade ESXi to 4.0.0 build-208167.
  5. Then follow the instruction on “Upgrade vSphere ESXi from 4.0 to 4.1 Using vihostupdate

Launch VBScript in a Logon Batch Script

An example of a batch file Logon script that launches a VBScript program is as follows:

@echo off
wscript %0\..\NetLogon.vbs

The "%0" in the batch file is interpreted by the command processor to be the name and path of the current file, which is the batch file itself. The string "%0\..\" then becomes the folder where the batch file is stored. The batch file above will launch the VBScript program NetLogon.vbs as long as it is saved in the NetLogon share with the batch file. This syntax is preferable to a UNC path, because it does not hard code the name of a Domain Controller. The syntax will work no matter which Domain Controller authenticates the user. The logon script will work no matter which Domain Controllers are available or where in the network the user logs on.

Reference: http://www.rlmueller.net/index.html

Windows Server Enable or Disable Logging of Printing Events

Windows Server 2008 R2

  • Go to: Server Manager -> Diagnostics -> Event Views -> Applications and Service Logs -> Microsoft -> Windows -> PrintService -> Operational -> right click on the right side under Actions "Enable Log".

Windows Server 2003

To enable or disable logging of printing events

  1. Open Printers and Faxes.
  2. On the File menu, click Server Properties, and then click the Advanced tab.
  3. To enable or disable writing spooler error events to the system log file, select or clear the Log spooler error events check box.
  4. To enable or disable writing spooler warning events to the system log file, select or clear the Log spooler warning events check box.
  5. To enable or disable writing spooler information events to the system log file, select or clear the Log spooler information events check box.
  6. Stop and restart the spooler service, or reboot the server.

Notes

  • To open Printers and Faxes, click Start, and then click Printers and Faxes.
  • By default, all printing events are written to the system log file. If you want to reduce the amount of data that is logged, disable the logging of information events. If you want to further reduce the amount, disable the warning events. Disabling the logging of spooler error events is not recommended.

Upgrade vSphere EXSi from 4.0 to 4.1 Using vihostupdate

  1. Run vSphere Host Update Utility 4.0 to install all 4.0 patches.
  2. If the host is managed by vCenter Server, you must Upgrade vCenter Server to v.4.1 first.
  3. Install vSphere CLI on a computer.
  4. Download the upgrade ZIP bundle to the vSphere CLI computer.  Make sure download the ESXi (ESX Installable) ZIP bundle.
  5. Power off any virtual machines that are running on the host and place the host into maintenance mode.
  6. (Optional) Configure a scratch directory (see KB1004177).  Create a directory (scratch_dir) on the VMFS volume.
  7. (Optional) Set the scratch directory to /vmfs/volumes/datastore1/scratch_dir
  8. (Optional) Select  the “ScratchConfig.ConfiguredSwapState” option.
  9. (Optional) Reboot the ESXi host.
  10. On vSphere CLI computer, vihostupdate.pl --server <host-ip-addr> -i -b "upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip" -B ESXi410-GA-esxupdate
  11. vihostupdate.pl --server <host-ip-addr> -i -b "upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip" -B ESXi410-GA
  12. Reboot the ESXi host.

vCenter Server 4.1 Installation

  1. Install Windows Server 2008 R2 (64-bit)
  2. Create a vCenter SQL database and a vCenter database user; set the db owner to vCenter database user; grant DBO right on the MSDB database.
  3. Install Microsoft SQL Server Native Client 2005 or 2008.
  4. Create a SQL DSN (make sure select SQL Server Native Client driver.
  5. Install vCenter Server 4.1

Account Management Event ID 642 Anonymous Logon

There are more one one DCs (DC1 and DC2, DC1 is the PDC Emulator) in a domain.  An administrator changes an AD user account attribute, e.g. changing password/unlocking account, on DC2.

On DC2, two security events (628 (for password reset) and 642) are logged with the administrator user id.  On DC1 (the PDC emulator), only one event (642) is logged with NT Authority\Anonymous Logon.

I agree the event ID 642 on DC1 is created by the replication of the changes to the DC holding the PDC Emulator role.  Sometimes, I also see this happened on a non PDC Emulator DC.

Research:
http://social.technet.microsoft.com/Forums/en/winserverDS/thread/bf847f47-5637-453a-8752-9b985f8118f7

http://social.technet.microsoft.com/Forums/en/winserverDS/thread/65703372-53a6-434a-a9fb-0ad03ab9132c

Delete File Name Includes An Invalid Name

http://support.microsoft.com/kb/320081
del "\\?\c:\path_to_file_that contains a trailing space.txt "

subinacl /onlyfile "\\?\c:\path_to_problem_file" /setowner=domain\administrator /grant=domain\administrator=F

Or

rmdir /s <drive:><path>

Install SQL 2008 RTM on Windows Server 2008 R2

  1. Install SQL 2008 SP1 (this will only install the SQL setup support file)
  2. Install .NET Framework 3.5.1 feature through Server Manager, Features, Add Features
  3. Install SQL 2008
  4. Install SQL 2008 SP1

Linux Guest Different MAC Address Error on VMware vSphere

Converted a Linux (Fedora 5) PC to a VMware vSphere guest.  The Linux guest OS shows a failed message when shutting down interface eth0.

Fix: edit /etc/sysconfig/network-scripts/ifcfg-eth0’s HWADDR to match the MAC address assigned the Linux guest OS.

Linux Guest Hangs at “Starting udev” on VMware vSphere

Converted a Linux (Fedora 5) PC to a VMware vSphere guest.  The Linux guest OS hangs at “Starting udev”.

Fix:

  1. Restart the Linux guest OS;
  2. Press any key at the GRUB boot menu, press e to edit, and add the highlighted words at the “kernel” line; press enter, and then b to boot;
    kernel /vmlinuz-2.6.18-1.2257.fc5smp ro root=/dev/sdb1 clock=pmtmr divider=10 hgb quiet
  3. Once it boots in the console, edit /boot/grub/grub.conf with the same setting.

Reference: http://itsecureadmin.com/2010/03/linux-guest-hangs-at-starting-udev-vmware-vsphere/
or http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427

Error 2753 The file “???” is not marked for installation

Get this error when trying to remove an application managed by a group policy installer package.

Fix: Install Windows Installer CleanUp Utility (msicuu2) to remove the application.

Windows Server 2008 R2 Hyper-V Server License

Q. Which edition of Windows Server 2008 R2 should I buy for my Hyper-V server?
John Savill

A. The decision about whether to purchase the Standard, Enterprise, or Datacenter edition of Windows Server 2008 R2 should depend on two major factors: the number of virtual machines (VMs) you intend to run and your high availability requirements.

High availability is only available with the Enterprise and Datacenter SKUs, so if you want clusters and features like Live Migration, you have to use Enterprise or Datacenter edition.

The next factor is the number of VMs. Standard Edition supports one physical OS and one virtual OS (VM), Enterprise supports one physical OS and four virtual OSs, and Datacenter supports one physical OS and an unlimited number of virtual OSs. Note that Standard and Enterprise are purchased on a per-server basis while Datacenter is purchased on a per-processor basis, and at least two processors (sockets) must be licensed on each server with Datacenter.

You can assign multiple licenses to a single physical server. For example, I could purchase two copies of Enterprise Edition and assign them to a single physical server, which would allow me to run eight VMs. I could also buy eight copies of Standard Edition or just two of Datacenter (I need two because two is the minimum number purchasable with Datacenter—two sockets).

  • Generally, the following is a good guideline for the most cost effective SKU to buy, but remember to consider future growth.
  • Standard Edition is most cost efficient for one to three VMs per server. Note that if you run three VMs, you'll need to buy three copies of Standard Edition.
  • Enterprise Edition is most cost efficient from four VMs on a server up to four VMs per processor. For example, if I have a dual processor box and want to run eight VMs, I could buy two copies of Enterprise edition.
  • Datacenter Edition is most cost efficient for more than four VMs per processor, because you can run an unlimited number of VMs per processor and license each processor. While Datacenter is more expensive than Enterprise when running four VMs per processor, you have more scalability and support for future growth, so you could, potentially, adopt Datacenter over Enterprise when you consider future requirements. Remember that you have to license all processors in the server.

Microsoft offers an online calculator that can help you choose the right SKU to buy.

Remember that if you're using the maximum number of virtual instance rights, you can't run any workloads other than Hyper-V in the parent partition. If you run additional workloads in the parent partition (which isn't recommended), you lose one of your virtual instance rights. So if you're running Enterprise Edition and you're also running a file and print server on the Hyper-V host, you can only run three virtual OS instances.

When you purchase a SKU of Windows Server, you have the right to run that version and any lower version in your virtual environments. For example, if I buy Datacenter Edition, I can run Datacenter, Enterprise, or Standard in my VMs. If I buy Enterprise edition, I can run Enterprise or Standard in my VMs.

Finally, remember you can't move these virtual OS environment rights between servers. If you want to run four VMs on each server and have the ability to live migrate them to another server (which would mean it would run eight VMs), you need two licenses of Enterprise on the target server (or Datacenter). This is why when you're using Live Migration and clusters, it's normally advised to purchase Datacenter.

Q. If I'm performing a physical to virtual migration, can I move my physical Windows license to the virtual environment?

A. Assuming you're turning off the physical box and wiping the OS, you can move a Windows license from a physical to a virtual environment based on Microsoft's 90 day move rights. These rights allow licenses to be moved once every 90 days between servers, including moving to a virtualization host.

Symantec Extend WG Protocol Driver Error

Event ID: 7000, Source: Service Control Manager - “The Extend WG Protocol Driver service failed to start due to the following error: The system cannot find the file specified.”

The following steps fix the error message:
1. Open Device Manager
2. Click View > Show hidden devices
3. Expand Non-Plug and Play Drivers and uninstall the Extend WG Protocol Driver
4. Open regedit
5. Delete the key "WGX" in HKLM\SYSTEM\CurrentControlSet\Services
6. Reboot system

Access SkyDrive as a Map Drive

Requirement:

  • Windows 7 (some says Windows XP would work, not test)
  • Office 2010 (beta is fine; need to verify if this is optional)
  • Windows Live account

Set up:

  • Download SkyDrive Simple Viewer for WebDAV
  • Run dumpurls.exe <Windows Live UserName> <Password> to get a list of addresses
  • Map a network drive with one of the addresses
  • Enter Windows Live ID and password

VMware vSphere 4 Notes

1. vSphere Editions for Small Businesses Comparison

Basic ESXi physical hardware limit: 2 physical processors, 6 cores per processors, 256GB memory.

 

2. VMware vCenter Server

VMware vCenter Server Installation

VMware vCenter Server Administration

  • After installing vCenter Server:
    • Create a datacenter
    • Join ESX(i) host to vCenter Server

Batch File for Checking OS Architecture Type

@echo off
echo Detecting OS processor type

if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT
echo 32-bit OS
REM Run 32-bit executable
goto END

:64BIT
echo 64-bit OS
REM Run 62-bit executable

:END

Batch File for Checking OS Architecture Type

@echo off
echo Detecting OS processor type

if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT
echo 32-bit OS
REM Run 32-bit executable
goto END
:64BIT
echo 64-bit OS
REM Run 62-bit executable
:END

Allocate Virtual Processors

The recommendation is to allocate more virtual processors than you have physical processors and let the hypervisor take care of scheduling the CPU work across the physical cores. Microsoft typically recommends you have no more than eight virtual processors per physical core.

Install Nagios Client (NC_Net) On Windows Server 2008

  1. Create a shortcut to the MSI package. C:\Windows\System32\msiexec.exe /i "C:\Users\eluadmin\Desktop\NC_Net_setupV4.4.0.msi"
  2. Right click the shortcut and select “Run as administrator”

Use WinSCP to Transfer Files in vCSA 6.7

This is a quick update on my previous post “ Use WinSCP to Transfer Files in vCSA 6.5 ”. When I try the same SFTP server setting in vCSA 6.7...