Vol. 17, #35 - August 27, 2012 - Issue #894

Server Management with PowerShell

  1. Editor's Corner
    • Short Personal Note
    • Server Management with PowerShell
    • Tip of the Week
    • Recommended for Learning
    • Quote of the Week
  2. Admin Toolbox
    • Admin Tools We Think You Shouldn't Be Without
  3. Events Calendar
    • Americas
    • Europe
    • Asia/Pacific
  4. Webcast Calendar
    • Free Webinar: IT Management in the Cloud for 2012 and Beyond
    • Register for Webcasts
  5. Tech Briefing
    • New V3 Language Features
    • Running Remote Commands
    • Windows Server 2012: Getting started with PowerShell Web Access
    • Windows PowerShell 3.0 and Server Manager Quick Reference Guides
    • Windows PowerShell Support for Windows Server 2012
    • Let’s Build a Cloud… With PowerShell
  6. Windows Server News
    • SMB cookbook: Whipping up a virtualization disaster recovery plan
    • Define a cloud storage policy that balances risks and cost
    • VDI backup strategies: Copying, storing and securing virtual desktops
    • Top five tips to improve VMware server capacity planning
  7. WServerNews FAVE Links
    • This Week's Links We Like. Fun Stuff.
  8. WServerNews - Product of the Week
    • SolarWinds Log & Event Manager: No more complex Searches

 

SolarWinds Log & Event Manager: No more complex Searches

Finding answers to simple questions in your log data doesn’t have to be painful. SolarWinds Log & Event Manager simplifies finding answers. Take advantage of the drag-and-drop search builder and avoid complex Boolean searches. Use the interactive visual drill-down and get clear view of results. And use normalized terms instead of learning unique terms for each device. Spend less time finding answers. Start using simple searches today.

Download a free trial!

 

Editor's Corner

SAVE THIS NEWSLETTER so you can refer back to it later for tips, tools and other resources you might need to do your job or troubleshoot some problem you're dealing with. And please feel free to FORWARD IT TO A COLLEAGUE who you think might find it useful. Thanks!

Short Personal Note

My latest book from Microsoft Press is now available for pre-order on Amazon. The book is called Installing and Configuring Windows Server 2012 Training Guide and it's part of a new series of titles from Microsoft Press that focus on learning the skills that IT pros need for performing their job using Microsoft products.

Image

http://www.wservernews.com/go/1345717516338

The book is fully accurate for the RTM release of Windows Server 2012 despite what the Book Description says on Amazon. Here's the list of chapters in this title:

  1. Preparing for Windows Server 2012
  2. Deploying Servers
  3. Server Remote Management
  4. Deploying Domain Controllers
  5. Active Directory Administration
  6. Network Administration
  7. Hyper-V Virtualization
  8. File Services and Storage
  9. Print and Document Services
  10. Implementing Group Policy

Much of my new book is focused on using PowerShell to manage Windows Server 2012, so this issue of WServerNews includes a few excerpts from my book to both whet your appetite (to entice you into buying my book) and to show you some of the things you can do as an admin using PowerShell.

Note that the target audience of the book is Windows intermediate-level admins who have several years of work experience but who might still be beginners when it comes to using PowerShell, so I'm hoping that readers will find my book useful to learn how they can start using PowerShell to simplify and automate the administration of Windows servers in their environment.

So without any further ado, here are a couple of excerpts from my upcoming book with permission from Microsoft Press. Enjoy!

P.S. These excerpts haven't finished going through the editorial review process yet, so they may change a bit in the published version.

P.P.S. Don't forget to click on the link above to pre-order my book! After all, authors gotta eat...

Oops, I almost forgot the obligatory XKCD comic, probably because I'm writing this editorial around midnight after a really long day of work--which reminds me WHY I SOMETIMES STAY UP SO LATE:
http://www.wservernews.com/go/1345717537072

Server Management with PowerShell

I've included below two short excerpts from my upcoming book on the following topics:

Provisioning and managing shared storage using Windows PowerShell

Storage Spaces, a new feature of Windows Server 2012, is designed to make storage virtualization affordable even for small businesses. Storage spaces is easy to deploy and manage, and it can provide your business with shared storage that can grow on demand to meet your evolving needs. Here's an excerpt from one of the practice exercises in Chapter 8 that shows how you can configure a Storage Spaces solution using Windows PowerShell:

In this exercise you will use Windows PowerShell to create a new storage pool, create virtual disks on the pool, create volumes on the virtual disks, and create SMB shares on the volumes.

1. Use the Get-PhysicalDisk cmdlet to verify that at least two physical disks connected to your server have the CanPool property set to True.

2. Type (Get-StorageSubsystem).FriendlyName to display the value of the FriendlyName property of the storage subsystem on the server.

3. Type the following command to create a new storage pool named Pool 2 that includes all available physical disks in the primordial pool, and uses both thin provisioning and mirror resiliency by default when creating new virtual disks:

New-StoragePool `
-FriendlyName "Pool 2" `
-StorageSubSystemFriendlyName (Get-StorageSubSystem).FriendlyName `
-PhysicalDisks (Get-PhysicalDisk | where CanPool -eq True) `
-ProvisioningTypeDefault Thin `
-ResiliencySettingNameDefault Mirror

4. Type the following command to create a new virtual disk named vDisk 1 that has size 5 TB and uses the default provisioning and resiliency settings for Pool 2:

New-VirtualDisk `
-FriendlyName "vDisk 1" `
-StoragePoolFriendlyName "Pool 2" `
-Size 5TB

5. Use the New-VirtualDisk cmdlet again to create a second virtual disk named vDisk 2 that has size 10 Tb and uses the default provisioning and resiliency settings for Pool 2.

6. Use the Get-VirtualDisk cmdlet to verify that the virtual disks have sizes 5 and 10 TB respectively.

7. Type Get-Disk | where Bustype -eq Spaces to display information about the two virtual disk. Observe that the virtual disks are both offline and have the partition style RAW.

8. Use the following command to initialize both virtual disks and set their partition style to GPT:

 (Get-Disk | where BusType -eq Spaces) | Initialize-Disk -PartitionStyle GPT

9. Use Get-Disk to verify that the two disks are now online and have the partition style GPT.

10. Use the following command to create a new volume on each virtual disk, with each new volume being as large as possible and having a drive letter automatically assigned to it:

New-Partition `
-DiskNumber (Get-Disk | where BusType -eq Spaces).Number `
-UseMaximumSize -AssignDriveLetter | Format-Volume `
-FileSystem NTFS -Confirm:$false

11. Verify the result from the output of the above command and note the drive letters assigned to the new volumes.

12. Use the New-Item cmdlet to...

(You'll have to buy the book to see the rest!)

Adding virtual disks to virtual machines using Windows PowerShell

You can use the IDE Controller 0, IDE Controller 1 and SCSI Controller pages of the virtual machine settings dialog in Hyper-V Manager to add new virtual disks to a virtual machine. You can also use subpages of these pages to inspect, browse or edit an existing virtual hard disk, remove a virtual disk that is attached to the virtual machine, or attach a physical disk on the host's storage system to the virtual machine. You can also use Windows PowerShell to create new virtual disks and add them to your virtual machines. Here's an excerpt from Chapter 7 on this topic:

You can also use Windows PowerShell to create new virtual disks and add them to your virtual machines. For example, let's say you want to create and attach a 500 GB dynamically expanding data disk to virtual machine SRV-A on HOST4. You might begin by using the Get-VHD command to display a list of disks attached to SRV-A as follows:

PS C:\> Get-VM -VMName SRV-A | Select-Object VMId | Get-VHD | Format-List Path,VhdFormat,VhdType,Size

Path          : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A.vhdx
VhdFormat        : VHDX
VhdType         : Dynamic
Size          : 536870912000

The above command takes advantage of the pipeline capabilities of Windows PowerShell and works like this:

1. The command Get-VM -VMName SRV-A returns an object representing virtual machine SRV-A.

2. The output of the above command is then piped into the command Select-Object VMId, which returns an object representing the GUID for SRV-A.

3. The GUID for SRV-A is then piped into the Get-VHD command to indicate which virtual machine is to be queried for its virtual disks.

4. The output of the Get-VHD command is then formatted as a list to display only those properties of interest, namely the path and filename of the virtual disk file, the format it uses, the type of the disk, and the disk's size.

Next you can use the New-VHD cmdlet to create the new data disk as follows:

PS C:\> New-VHD -SizeBytes 500GB -Path "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx"

ComputerName      : HOST4
Path          : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx
VhdFormat        : VHDX
VhdType         : Dynamic
FileSize        : 4194304
Size          : 536870912000
...

Next you can use the Add-VMHardDiskDrive cmdlet to attach the new data disk to location 1 on IDE controller 0 as follows:

PS C:\> Add-VMHardDiskDrive -VMName SRV-A -Path "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx"
-ControllerType IDE -ControllerNumber 0 -ControllerLocation 1

You can then use the Get-VHD cmdlet as before to verify the result:

PS C:\> Get-VM -VMName SRV-A | Select-Object VMId | Get-VHD | Format-List Path,VhdFormat,VhdType,Size

Path   : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A.vhdx
VhdFormat : VHDX
VhdType  : Dynamic
Size   : 536870912000

Path   : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx
VhdFormat : VHDX
VhdType  : Dynamic
Size   : 536870912000

Alternatively, you can use the Get-VMHardDiskDrive cmdlet to display all disks connected to the IDE controllers on the virtual machine:

PS C:\> Get-VMHardDiskDrive -VMName SRV-A | Format-List ControllerNumber,ControllerLocation,Path

ControllerNumber  : 0
ControllerLocation : 0
Path        : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A.vhdx

ControllerNumber  : 0
ControllerLocation : 1
Path        : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx

Viewing the IDE 0 Controller page and its sub-pages in the Settings dialog for the virtual machine also confirms that the procedure was successful...

Good resources on managing Windows Server using PowerShell

Be sure to check out the Tech Briefing section of this newsletter for links to blog posts, cheat sheets and other stuff on managing Windows Server using PowerShell. And also see the Admin Tools section of this newsletter for a free tool you can download from Microsoft that you can use to find PowerShell scripts relevant to your job needs.

Finally, did I mention you can pre-order my book on Amazon?
http://www.wservernews.com/go/1345717929246

Send us your feedback

Got questions or suggestions about managing Windows servers using PowerShell? Email me at [email protected]

Tip of the Week

If your organization provides Windows 7 laptops to users and configures their user accounts as standard users who are not local admins on their computers, and then at the end of the day the users go home and try to connect to their home printers to print work-related documents, they may be frustrated to discover they can't connect to their home printers because they don't have sufficient privileges to be able to install new printer drivers on their computers. What can you do to allow them to connect to their home printers without making them local admins on their computers?

Configure the following two Group Policy settings:

Got any tips of your own to share with our readers? Email me at [email protected]

Recommended for Learning

Like free stuff? Who doesn't! Check out the following blog post from Microsoft Press that has a list of all their free ebooks:
http://www.wservernews.com/go/1345718162607

Quote of the Week

"All things in life fall into two categories: things you can control and things you can't You can't control the things that try you, but you can control whether you'll be tried--whether you'll be pushed to be someone you don't want to be."

--Roy S. Johnson in Men's Fitness Magazine from awhile back

You can follow Roy on Twitter at
http://www.wservernews.com/go/1345718272217

Until next week.

Cheers, 
Mitch Tulloch

 

Admin Toolbox

Admin Tools We Think You Shouldn't Be Without

FREE Backup for Hyper-V – Expires Fri Aug 31st - Download Today!
http://www.wservernews.com/go/1345720874062

Microsoft Script Explorer for Windows PowerShell (Release Candidate) helps scripters find Windows PowerShell scripts, snippets, modules, and how-to guidance relevant to you:
http://www.wservernews.com/go/1345718298077

Cisco ASA 5500 Series SSL/IPsec VPN Edition - Voted WindowsNetworking.com Readers' Choice Award Winner - Firewalls & VPN Hardware:
http://www.wservernews.com/go/1345718303608

DeviceLock can be integrated into Active Directory to provide device blocking settings that can be managed using GPOs:
http://www.wservernews.com/go/1345718310749

 

Events Calendar

Americas

Europe

Asia/Pacific

Add your event

Contact Michael Vella at [email protected] to get your conference or other event listed in our Events Calendar.

 

Webcast Calendar

Free Webinar:  IT Management in the Cloud for 2012 and Beyond

September 6, 2012 - Many smaller organizations are migrating to cloud-based antivirus, asset and network management to reap the benefits. Join Osterman Research and GFI Software for a new, educational webinar. Drawing for new iPad for one registrant. Register now!
http://www.wservernews.com/go/1345718520250

Register for Webcasts

 Add your Webcast

Contact Michael Vella at [email protected] to get your webcast listed in our Webcasts Calendar.

 

Tech Briefing

New V3 Language Features

From the Windows PowerShell Blog comes this post about some small improvements in version 3 of PowerShell that can make scripting solutions a whole lot easier:
http://www.wservernews.com/go/1345718875299

Running Remote Commands

From the TechNet Library comes this info about how Windows PowerShell supports remote computing by using various technologies, including WMI, RPC, and WS-Management:
http://www.wservernews.com/go/1345718880003

Windows Server 2012: Getting started with PowerShell Web Access

Aviraj Ajgekar describes how you can run PowerShell commands remotely using only a web browser:
http://www.wservernews.com/go/1345718885003

Windows PowerShell 3.0 and Server Manager Quick Reference Guides

Download these "cheat sheets" for IT pros who want to learn tips, shortcuts, common operations, limitations, and proper syntax for using Windows PowerShell 3.0 and Server Manager in Windows Server 2012:
http://www.wservernews.com/go/1345718889487

Windows PowerShell Support for Windows Server 2012

This TechNet Library topic lists all the Windows PowerShell modules included with Windows Server 2012 and Windows 8:
http://www.wservernews.com/go/1345718894128

Let’s Build a Cloud… With PowerShell

A couple of posts by Yigal Edery on the Private Cloud Blog about how to deploy, configure and manage a demo private cloud using Windows PowerShell:
http://www.wservernews.com/go/1345718898815

http://www.wservernews.com/go/1345718902815

 

Windows Server News

SMB cookbook: Whipping up a virtualization disaster recovery plan

Establishing a virtualization disaster recovery (DR) strategy is an easy and cost-effective way to protect your critical business data in the event of unplanned downtime or disruptions. Discover the four key ingredients you need to whip up a reliable virtualization DR plan in no time. 
http://www.wservernews.com/go/1345718907253

Define a cloud storage policy that balances risks and cost

While the cloud’s storage capacity is technically limitless, storing too much for too long can lead to unnecessary costs. In this helpful tip, learn how to establish an effective – and budget-friendly – cloud-based storage policy so you can minimize issues and get the most from this environment.
http://www.wservernews.com/go/1345718910846

VDI backup strategies: Copying, storing and securing virtual desktops

Backing up your organization’s virtual desktops is just as important as backing up your physical ones, so if you have yet to establish a backup strategy, you may want to get started. Find out how easy it can be to implement an effective, efficient and secure virtual desktop backup strategy.
http://www.wservernews.com/go/1345718915065

Top five tips to improve VMware server capacity planning

For any virtualization project to be successful, server capacity planning is essential – but for many businesses, this task is much easier said than done. Inside this exclusive resource, explore five quick and easy tips that can help you use your hardware more efficiently. 
http://www.wservernews.com/go/1345718918940

 

WServerNews FAVE Links

This Week's Links We Like. Tips, Hints And Fun Stuff

World record-holding highliner Faith Dickey crosses a slack-line between two speeding trucks. Will she make it before the trucks reach the tunnel?
http://www.wservernews.com/go/1345718928315

Tom Cruise test drives the Red Bull Racing F1 car and performs a loop in a helicopter:
http://www.wservernews.com/go/1345718937456

A clever way to get a boat - complete with 80ft mast - under a 65ft bridge.
http://www.wservernews.com/go/1345718944409

It can take from six weeks to six months to build a house. Within the next five years, we may be able to upload design specifications to a massive 3D Printer, press print, and watch as it spits out a house in less than a day.
http://www.wservernews.com/go/1345718954956

"Where Did She Go?" An incredible magic performance by 'Kamyleon' on the French TV show 'The World's Greatest Cabaret':
http://www.wservernews.com/go/1345718960175

Beautifully created morph of Queen Elizabeth from childhood to present time to the music of "Chariots of Fire" by Vangelis:
http://www.wservernews.com/go/1345718966316

 

WServerNews - Product of the Week

SolarWinds Log & Event Manager: No more complex Searches

Finding answers to simple questions in your log data doesn’t have to be painful. SolarWinds Log & Event Manager simplifies finding answers. Take advantage of the drag-and-drop search builder and avoid complex Boolean searches. Use the interactive visual drill-down and get clear view of results. And use normalized terms instead of learning unique terms for each device. Spend less time finding answers. Start using simple searches today.

Download a free trial!

 

WServerNews - Editors

Mitch Tulloch is Senior Editor of WServerNews and is a widely recognized expert on Windows administration, deployment and virtualization. Mitch was lead author of the bestselling Windows 7 Resource Kit from Microsoft Press and has published hundreds of articles for IT pros. Mitch is also a seven-time recipient of Microsoft's Most Valuable Professional (MVP) award for his outstanding contributions in support of the global IT pro community. Mitch owns and runs an information technology content development business based in Winnipeg, Canada. For more information see www.mtit.com

Ingrid Tulloch is Associate Editor of WServerNews and was co-author of the Microsoft Encyclopedia of Networking from Microsoft Press. Ingrid is also Head of Research for our content development business and has co-developed university-level courses in Information Security Management for a Masters of Business Administration program.


·