24/7/365 Support

Windows

Manage Mailboxes

Problem

You want to get and modify information about mailboxes from the Exchange Management Shell.

Solution

To retrieve information about a mailbox (or multiple mailboxes), use the GetMailbox cmdlet:

$user = GetMailbox *preeda*

$user | FormatList * To modify information about a mailbox, use the SetMailbox cmdlet. This example prevents Preeda from sending mail when her mailbox goes over 2 GB, and then verifies it:

$user | SetMailbox –ProhibitSendQuota 2GB $user | GetMailbox

Discussion

Manage Exchange Users

Problem

You want to get and modify information about user domain accounts from the Exchange Management Shell.

Solution

To get and set information about Active Directory users, use the GetUser and SetUser cmdlets, respectively:

$user = GetUser *preeda*

$user | FormatList *

To update Preeda’s title to Senior Vice President:

$user | SetUser –Title "Senior Vice President" $user.Title

Discussion

Automate Wizard-Guided Tasks

Problem

You want to automate tasks you normally complete through one of the wizards in the Exchange Management Console.

Solution

To automate a wizardguided task, complete the wizard in the Exchange Management Shell, and then save the script it displays for future reference.

Discussion

Since the Exchange Management Console user interface uses PowerShell cmdlets to accomplish all its actions, every wizard displays the PowerShell script that you could run to accomplish the same task.

Manage an Exchange 2007 Server

Pointandclick management has long been the stereotype of Windows administration. While it has always been possible to manage portions of Windows (or other applications) through the command line, support usually comes as an afterthought. Once all the administration support has been added to the user interface, the developers of an application might quickly cobble together a COM API or commandline tool if you are lucky. If you aren’t lucky, they might decide only to publish some registry key settings, or perhaps nothing at all.

List Network Adapter Properties

Problem

You want to retrieve information about network adapters on a computer.

Solution

To retrieve information about network adapters on a computer, use the Win32_ NetworkAdapterConfiguration WMI class:

GetWmiObject Win32_NetworkAdapterConfiguration –Computer <ComputerName> To list only those with IP addresses assigned to them, use the WhereObject cmdlet to filter on the IpEnabled property:

PS >GetWmiObject Win32_NetworkAdapterConfiguration –Computer LEEDESK |

>> WhereObject { $_.IpEnabled }

>>

List All IP Addresses for a Computer

Problem

You want to list all IP addresses for a computer.

Solution

To list IP addresses assigned to a computer, use the ipconfig application: PS >ipconfig

Discussion

The standard ipconfig application works well to manage network configuration options on a local machine. To view IP addresses on a remote computer, you have two options.

Use the Win32_NetworkAdapterConfiguration WMI class

Assign a Static IP Address in Windows PowerShell

Problem

You want to assign a static IP address to a computer.

Solution

Use the Win32_NetworkAdapterConfiguration WMI class to manage network settings for a computer:

$description = "Linksys WirelessG USB" $staticIp = "192.168.1.100" $subnetMask = "255.255.255.0" $gateway = "192.168.1.1"

$adapter = GetWmiObject Win32_NetworkAdapterConfiguration –Computer LEEDESK |

WhereObject { $_.Description –match $description}

$adapter.EnableStatic($staticIp, $subnetMask)

$adapter.SetGateways($gateway, [UInt16] 1)

Discussion

Renew a DHCP Lease

Problem

You want to renew the DHCP lease for a connection on a computer.

Solution

To renew DHCP leases, use the ipconfig application. To renew the lease on all connections:

PS >ipconfig /renew

To renew the lease on a specific connection:

PS >ipconfig /renew "Wireless Network Connection 4"

Discussion

The standard ipconfig application works well to manage network configuration options on a local machine. To renew the lease on a remote computer, you have two options.

Use the Win32_NetworkAdapterConfiguration WMI class

Program: Summarize System Information in Windows PowerShell

WMI provides an immense amount of information about the current system or remote systems. In fact, the msinfo32.exe application traditionally used to gather system information is based largely on WMI.

The script shown in Example 246 summarizes the most common information, but WMI provides a great deal more than that.

Example 246. GetDetailedSystemInformation.ps1

Pages

Get Windows Dedicated Server

Only reading will not help you, you have to practice it! So get it now.

Processor RAM Storage Server Detail
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 128 GB (SSD SATA) Configure Server
Intel Atom C2750 2.4 GHz 8c/8t 8 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Xeon E3-1230 v2 3.3 GHz 4c/8t 16 GB DDR3 1× 256 GB (SSD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 250 GB (SSD SATA) Configure Server

What Our Clients Say