Archive for the ‘IT Pro’ Category

Using Windows PowerShell as an IT Pro – Part 17

Thursday, April 22nd, 2010

In my last post I looked at some Comparison Operators. Now I will examine some more Comparison Operators.

Greater than and Less than operators

The greater than operator (-gt) returns a value of TRUE or the matches when one or more of the input values is greater than the specified pattern. The less than operator (-lt) returns a value of TRUE or the matches when one or more of the input values is less than the specified pattern. When the ‘or equals to’ operators (-ge, -le) are used, they also compare to see if the value is equal to the specified pattern.

The following examples show the effects of these operators.

8 -gt 7

CompOper05

8 -ge 8

CompOper06

"c" -lt "a"

CompOper07

"a" -le "c"

CompOper08

1, 2, 3 -le 2

CompOper09

Containment Operators

The containment operators (-contains and -notcontains) are similar to the equality operators. However, the containment operators always return a Boolean value, even when the input is a collection.

Also, unlike the equality operators, the containment operators return a value as soon as they detect the first match. The equality operators evaluate all input and then return all the matches in the collection. In a very large collection, the -contains operator returns results quicker than the equal to operator. The following examples show the effect of the -contains operator.

1, 2, 3 -contains 2

CompOper10

"PowerShell" -contains "Shell"

CompOper11

"Windows", "PowerShell" -notcontains "Shell"

CompOper12

In my next post we will finish looking at Comparison Operators.

Using Windows PowerShell as an IT Pro – Part 16

Friday, April 16th, 2010

In my last post I looked at Assignment Operators. Now I will examine Comparison Operators.

Comparison operators let you specify conditions for comparing values and finding values that match specified patterns. To use a comparison operator, specify the values that you want to compare together with an operator that separates these values.

By default, all comparison operators are case-insensitive. To make a comparison operator case-sensitive, precede the operator name with a "c". For example, the case-sensitive version of "-eq" is "-ceq". To make the case-insensitivity explicit, precede the operator with an "i". For example, the explicitly case-insensitive version of "-eq" is "ieq".

All comparison operators except the containment operators (-contains, -notcontains) and type operators (-is, -isnot) return a Boolean value when the input to the operator (the value on the left side of the operator) is a single value (a scalar). When the input is a collection of values, the containment operators and the type operators return any matching values. If there are no matches in a collection, these operators do not return anything. The containment operators and type operators always return a Boolean value.

Windows PowerShell supports the following comparison operators.

Operator

Description

-eq

Equal to. Includes an identical value.

-ne

Not equal to. Includes a different value.

-gt

Greater-than.

-ge

Greater-than or equal to.

-lt

Less-than.

-le

Less-than or equal to.

-like

Match using the wildcard character (*).

-notlike

Does not match using the wildcard character (*).

-match

Matches a string using regular expressions. When the input is scalar, it populates the $Matches automatic variable.

-notmatch

Does not match a string. Uses regular expressions. When the input is scalar, it populates the $Matches automatic variable.

-contains

Containment operator. Includes an identical value that is not part of a value. Always returns a Boolean value.

-notcontains

Containment operator. Does not include an identical value. Always returns Boolean.

-replace

Replace operator. Changes the specified elements of a value.

Equality Operators

The equality operators (-eq, -ne) return a value of TRUE or matches when one or more of the input values is identical to the specified pattern. The entire pattern must match an entire value.

The following examples show the effect of the equal to operator:

"a" -eq "A"

CompOper01

"a" -ceq "A"

CompOper02

1, 2, 3 -eq 2

CompOper03

"Power" -ne "Shell"

CompOper04

In my next post we will examine more Comparison Operators.

Exchange 2010 Server Roles

Monday, April 12th, 2010

Exchange server roles were introduced three years ago with Exchange Server 2007 as a way to group specific Exchange management tasks together often on separate dedicated servers. Think of Exchange Server roles as similar to the Windows Server server roles, you CAN run all the roles on the same server, but generally it is not a good idea in anything other than the smallest deployments. For example, if you download the Hyper-V Evaluation VHD for Exchange 2010 testing, that server has all the roles installed on a single virtual machine.

The server role groups a set of features and components which perform specific functions in the messaging infrastructure. By using server roles you are able to reduce the attack surface of the Exchange Server and allows you to deploy and customize Exchange to fit your business goals and needs.  The Exchange Server 2010 server roles are as follows:

  • Mailbox Server: This is the host server for all mailbox and public folder databases. Address lists and offline address books are also generated and maintained on the Mailbox server. The server indexes all the databases and provides the ability to search across multiple mailboxes and Public folders. The Mailbox server also enforces messaging records management and retention policies for the organization.
  • Client Access Server: The CAS is basically the communication gateway between the messaging client and the mailbox. The server hosts the client protocols for mail access including POP3, IMAP4, HTTPS, Outlook Anywhere, the Availability service, and the Auto-discover service.
  • Unified Messaging Server: Unified Messaging basically refers to the marriage between e-mail and the telephone system. This allows you to access your voice mail through your email client, and allows you to access your e-mail through your telephone (system can read your email to you). Users can also receive faxes through this integration.
  • Hub Transport Server: The Hub Transport server is the router for the Exchange organization. This handles all mail flow inside the organization, applies transport rules, applies journaling policies, and delivers messages to the recipient.
  • Edge Transport Server: This server is your protective layer between the internal messaging environment and the outside world. Anti-spam and Antivirus scanning take place on the Edge Transport server. As such, this server is typically placed on a perimeter network with a firewall on either side of it, meaning a firewall between the Internet and the perimeter and a firewall between the perimeter and the company network.

Using Windows PowerShell as an IT Pro – Part 15

Thursday, April 8th, 2010

In my last post I reviewed Arithmetic Operators. Now I will explore Assignment Operators.

Assignment operators assign one or more values to a variable and perform numeric operations on the values before the assignment. Windows PowerShell supports the following assignment operators.

Operator Description
= Sets the value of a variable to the specified value.
+= Increases the value of a variable by the specified value, or appends the specified value to the existing value.
-= Decreases the value of a variable by the specified value.
*= Multiplies the value of a variable by the specified value, or appends the specified value to the existing value.
/= Divides the value of a variable by the specified value.
%= Divides the value of a variable by the specified value and then assigns the remainder (modulus) to the variable.
++ Increases the value of a variable, assignable property, or array element by 1.
Decreases the value of a variable, assignable property, or array element by 1.

The assignment operator (=) assigns values to variables. If the variable already has a value, the assignment operator (=) replaces the value without warning. Since the assignment operator has been mentioned multiple times in this training, no additional details are included here.

The assignment by addition, subtraction, multiplication, and division operators all work more or less the same way. For numeric types it takes the first part of the operator (+, -, *, /) and performs the appropriate calculation and then it assigns the result. For strings, it appends the specified value to the existing value. The assignment by subtraction and division operators do not work with strings. Let’s take a closer look at several of these operators.

The assignment by addition operator (+=) either increments the value of a variable or appends the specified value to the existing value. The action depends on whether the variable has a numeric or string type and whether the variable contains a single value (a scalar) or multiple values (a collection). First, it adds, and then it assigns.

$a = 5

$a += 2

$a

Operator06

When the value of the variable is a string, the value on the right side of the operator is appended to the string.

$a = "String"

$a += ” Appended”

$a

Operator07

The assignment by subtraction operator (-=) decrements the value of a variable by the value that is specified on the right side of the operator. This operator cannot be used with string variables and it cannot be used to remove an element from a collection. First, it subtracts, and then it assigns.

$a = 5

$a -= 2

$a

Operator08

The increment operator (++) increases the value of a variable by 1. When you use the increment operator in a simple statement, no value is returned.

$a = 6

++$a

$a

Operator09

The decrement operator (–) decreases the value of a variable by 1. As with the increment operator, no value is returned when you use the operator in a simple statement. Use parentheses to return a value.

$a = 6

(–$a)

Operator10

In my next post we will examine Comparison Operators.

Exchange 2010 Deployment Assistant

Thursday, April 1st, 2010

As I’ve been working through some of the new Exchange 2010 material recently, I came across the Exchange 2010 Deployment Assistant. This tool is also called ExDeploy, which if you remember working with Exchange 2003 is the same name as the Deployment Tool from that version. So this is not exactly a new idea, but let’s take a look at what they put together for Exchange 2010.

The Exchange 2010 Deployment Assistant is a web based tool that basically gathers information about your environment and uses that information to create a customized checklist detailing the procedures that will help to simplify your Exchange 2010 deployment.

To access the Exchange 2010 Deployment Assistant, go to the following web site:
http://technet.microsoft.com/en-us/exdeploy2010/default.asp

On the home page, you will choose one of four options:

  • Upgrade from Exchange 2003
  • Upgrade from Exchange 2007
  • Upgrade from Exchange 2003 & 2007
  • New installation of Exchange 2010

Just to see how detailed the checklist is, let’s explore the Upgrade from Exchange 2003 & 2007 option. On the first page, we are asked three questions:

  1. Are you running a disjointed namespace?
  2. Are you planning to deploy an Exchange 2010 Edge Transport server role?
  3. Are you planning to deploy an Exchange 2010 Unified Messaging server role?

Now the Assistant doesn’t expect you to be an expert at all things Exchange (though a little knowledge goes a long way) so each question can be expanded to show a full explanation of why the topic is important during the Exchange deployment. So for these questions, I’m answering No, Yes, No.

Surprisingly, the Deployment Assistant is able to create a checklist based on just the answers to these three questions. The checklist include the following steps along with detained explanations on what to do along the way:

  • Confirm prequisties steps are done (stuff like making sure all the installation minimum requirments are satisfied on the existing Exchange Servers and in Active Directory).
  • Install the Client Access server role (insert the disk, run through the installation wizard).
  • Add digital certificates on the Client Access server (to secure external access to Exchange, including an exportable private key in X.509 format).
  • Enable Outlook Anywhare (allowing remote users to access their mail without them needing to VPN into the network).
  • Configure OAB and Web Services virtual directories (allowing Outlook Anywhere clients to discover and automatically connect to Exchange 2010).
  • Configure settings on virtual directories (used for Autodiscover, ActiveSync, OWA, Exchange Control Panel, PowerShell, Exchange Web Services, and public folders).
  • Install the Hub Transport server role (responsible for mail flow).
  • Configure a legacy host name (to allow coexistance with Exchange 2003 and 2007).
  • Install the Mailbox server role (host for mailbox and public folder databases).
  • Change the OAB generation server (for creating and updating the OAB).
  • Install the Edge Transport server role (anti-spam and antivirus filtering, and applies messaging and security policies).
  • Subscribe the Edge Transport server (enables internet mail flow).
  • Move mailboxes from Exchange 2003 or Exchange 2007 to Exchange 2010 (self explanatory, but be aware that users cannot send or receive email while the mailbox is being moved so this should only be performed when would otherwise be sleeping).
  • Post-installation tasks (just a list of items to check on each server such as making sure that the servers have been activated with a valid product key).

And that is the complete upgrade path. Seems pretty easy. What I like about this checklists is that it can be used directly because it only lists the step needed for your specific environment. When working through many of the Deployment whitepapers, you need to determine whether many of the steps are relevant to your situation. Using the Exchange Server Deployment Assisstant reduces or removes this problem.

Exchange 2010: OWA

Wednesday, March 31st, 2010

Outlook Web Access has gone through many improvements over the years, starting as a very basic web interface and has been building up to a thin client replica of the Microsoft Outlook client. With Exchange Server 2010, OWA appears to be a fully mature edition.

OWA now lets you group messages by conversation, grouping all messages that originated from a single message and all the resulting replies. This is not a big deal if you are just going back and forth between one other person in the organization, but if you are receiving feedback from 10 or 100 people in your organization, you’ll can easily keep those messages together.

To help protect people from sending damaging or embarrassing messages, Exchange Administrators can configure Mail Tips. This feature is implemented similar to how Outlook Rules work and can provide users with a warning when an email is being sent to an external recipient, to a large distribution group, or to someone who is currently Out of Office.

User can now perform more powerful searches from Outlook Web Access, similar to what is available in the full Outlook client. You can search by recipient, whether attachments were included, and many other common search criteria. You can also set your favorite searches so that you can reuse them with a single click of the mouse.

Presence information is now integrated into Outlook Web Access allowing you to immediately know whether a person is available, busy, or not available using a green, yellow, red color coding. Depending on how important your message is and the recipient’s status, you can decide to Instant Message the person, another feature that is integrated directly into OWA when the Microsoft Office Communications Server is also implemented.

Finally, one of my favorite features now is the SMS Sync feature. By using Exchange ActiveSync, you can configure the server to automatically send out SMS text messages to your cell phone. This feature is also configured using rules, so whenever you get an email from a particular client, you can have a notification sent directly to your phone.

Using Windows PowerShell as an IT Pro – Part 14

Wednesday, March 31st, 2010

In my last post I reviewed arrays. Now I will explore Operators.

An operator is a language element that can be used in a command or expression to perform an operation. Windows PowerShell supports several types of operators to help you manipulate values. First, let’s look at Arithmetic operators.

Arithmetic operators calculate numeric values. Arithmetic operators are used to add, subtract, multiply, and divide values, and to calculate the remainder (modulus) of a division operation.

In addition, the addition operator (+) and multiplication operator (*) also operate on strings, arrays, and hash tables. The addition operator concatenates the input. The multiplication operator returns multiple copies of the input. You can even mix object types in an arithmetic statement. The method used to evaluate the statement is determined by the type of the leftmost object in the expression.

Windows PowerShell supports the following arithmetic operators:

Operator Description Example
+ Adds integers; concatenates strings, arrays, and hash tables. 6+2
“file” + “name”
- Subtracts one value from another value. 6-2
(get-date).date – 1
- Makes a number a negative number. -6+2
-4
* Multiplies integers; copies strings and arrays the specified number of times. 6*2
“w” * 3
/ Divides two values. 6/2
% Returns the remainder of a division operation. 7%2

 

Windows PowerShell processes arithmetic operators in the following order:

· Parentheses ()

· – (for a negative number)

· *, /, %

· +, – (for subtraction)

Windows PowerShell processes the expressions from left to right according to the precedence rules. The following examples show the effect of the precedence rules:

3+6/3*4

Operator01

10+4/2

Operator02

(10+4)/2

Operator03

(3+3)/(1+1)

Operator04

You can also do this with non-numeric types. Numbers, strings, arrays, and hash tables can be added; numbers, strings, and arrays can be multiplied. However, you cannot multiply hash tables.
When adding strings, arrays, or hash tables, the elements are concatenated. When you concatenate collections, such as arrays or hash tables, a new object is created that contains the objects from both collections. If you try to concatenate hash tables that have the same key, the operation fails.
For example, the following commands creates two strings and then adds them:
$a = "1"
$b = "A"
$a + $b

In my next post we will examine assignment operators.

More Windows 7 Tips and Tricks

Monday, March 29th, 2010

Windows 7 builds and improves upon the advances made in Windows Vista.  A lot has been written about how to take advantage of the new features, but a lot of this information is scattered all over the place.  Here are some of the new features that I personally use.

Sizing and moving windows

If you want to have two windows up side-by-side, it’s easy have Windows automatically size them for you with the snap feature.  Simply drag a window to the left side of the screen, and it will automatically dock to the left.  Then do the same with your second window on the right side of the screen and you’ve got both windows running side-by-side.  This is great for widescreen monitors, and if you were paying attention to my previous blog, you know that you can do this with Windows key shortcuts (Win+Left/Right Arrow).

Let’s say you want to minimize all windows but the one in which you are currently working.  You can quickly do this by clicking and holding onto the windows bar of your current window and then shaking the mouse back and forth a few times.  Bring the minimized windows back by doing it again.

The improved calculator

In Windows 7, the built-in calculator has been redesigned to allow you to go beyond basic math with unit conversion, such as Fahrenheit to Celsius and ounces to grams. Calculation templates make it easier to figure out things like fuel economy and lease payments. Additionally, new features such as Programmer, Scientific, and Statistics modes and tracking calculation history make it a very powerful tool.

image

 

The Problem Steps Recorder

 

If you’re having a problem with an application and need an easy way to illustrate the problem to tech support or your friend the computer expert, you can use Problem Steps Recorder to automatically capture the steps you take, including a text description of where you clicked and screen shot. Once you have recreated the problem and captured these steps, you can save them to a file and send it to your support person, who can then open it up and view the steps you recorded.

To launch Problem Steps Recorder, simply click Start, type PSR and then hit Enter. Or, you can do it using the Win+R shortcut key.

image

Open multiple instances of the same program

Here’s another helpful tip that can make it easier to get things done in Windows. If you’ve already got an application running, like Microsoft Word, or a Command Prompt, and you want to open another instance of the program, rather than clicking through the Start menu, you can simply Shift+Click on the taskbar icon to quickly launch another instance.

The taskbar and Start menu

In Windows 7 you can pin favorite programs anywhere on the taskbar or Start menu for consistent and easy access. And once you’ve pinned some items to the taskbar, you can easily rearrange them any way you like by clicking and dragging. You can also use the taskbar to preview windows by moving the mouse over a taskbar icon to see a thumbnail preview of open files or programs. Then, move your mouse over a thumbnail to preview the window full-screen. You can even close a window from the thumbnail preview – a big time saver.

Windows 7 Windows Key Shortcuts

Monday, March 29th, 2010

Windows 7 comes with many new tools and features designed to make it the most robust and powerful operating system ever.  The intuitive design means that many people know how to use Windows, but there are numerous tips and tricks that you can master to make yourself a more efficient user, and in the next two updates, I’m going to talk about some of these.

Most people know how to use CTRL+C and CTRL+V to  copy and paste, but did you know that in addition to these and other commonly-known shortcut keys, there are numerous others that involve the Windows key? Take a look at this table and familiarize yourself with a few of these shortcuts and you’ll find yourself navigating Windows like an expert:

Key Combination

Result

Win+Up Arrow

Maximize window

Win+Down Arrow

Minimize / restore window

Win+Left Arrow

Snap window to left side

Win+Right Arrow

Snap window to right side

Win+Home

Minimize / restore all other windows

Win+Space

View desktop without minimizing any windows

Win+Tab  Win+Shift+Tab

Cycle through windows in 3D

Win+D

Minimize / restore all windows

Win+E

Open Windows Explorer at Computer node

Win+F

Open Windows Search

Win+L

Lock desktop

Win+R

Open Run window

Win+U

Open Ease of Access Center

Data-tier Applications

Thursday, March 25th, 2010

SQL Server 2008 R2 provides an easy way to author, deploy, and manage data-tier objects as a single entity through data-tier applications. A data-tier application (DAC) is an entity that contains all of the database and instance objects used by an application.

You can create DACs using two methods. First, you can use the Extract Data-tier Application wizard to extract database and instance objects from a database in SQL Server Management Studio (SSMS). This wizard will take you through a couple simple steps and create the DAC for you.

After you have extracted the DAC, you can author it in Visual Studio 2010 or you can deploy it to an instance of SQL Server using the Deploy Data-tier Application wizard. The Deploy Data-tier Application wizard will guide you through several steps to deploy the DAC to the instance you select.

You can create a DAC in Visual Studio 2010 or author a DAC you extracted by starting a Data-Tier Application project. After a DAC has been imported, you can add several elements to the DAC project: DAC properties, definitions of all the database objects used by the application, definitions of the instance-level objects, a server selection policy that defines the pre-requisite conditions an instance of the Database Engine should have to host the DAC, and files and scripts that can be embedded in the DAC.

There are two ways to view DACs: through Object Explorer and through Utility Explorer. Object Explorer will let you see a list of DACs on the instance. Utility Explorer will give you a more detailed view of the DAC, and allows you to view utilization information just like managed instances.