Guy recommends :
Free Solarwinds
VM Console

Solarwinds VM Console Free Download

Find out which of your VMs are a waste of space and which VMs need more resources.



Windows PowerShell Examples of Real Life Tasks

Windows PowerShell Examples of Real Life Tasks

This section is dedicated to putting PowerShell into action.  I have selected topics to illustrate how PowerShell can help with real life tasks.

 ♣

Contents of My PowerShell Example Pages

Each topic has its own 'how to' instructions and also 'Learning points'.  As a result you will be able to modify my examples to suit your situation.  The only pre-requisite is that you must download the correct version of PowerShell and .Net Framework for your operating system.  Microsoft's site has separate versions of PowerShell for XP, Windows Server 2003 and Vista.  In the case of Windows Server 2008, PowerShell is built-in but you need to 'Add Feature'.

Real Life PowerShell Example: Get-Eventlog Remote EventID

PowerShell's Get-Eventlog is tricky to operate.  What makes it easier is focussing on the parameters, especially -logname and for remoting, -computer.  Once you get the basics working there is a wealth of techniques and properties you can apply to this most versatile cmdlet.

Scenario: You need to investigate a particular EventID. 
Important:  Amend my value of -lt '100' to -eq 'YourNumber'.  Do remember the speech marks.
Optional: Change "LocalHost" to "YourNetworkMachine"

# PowerShell Remote EventLog example with specific EventID
Clear-Host
$Machine = "LocalHost"
Get-Eventlog -logname System -computer $Machine -newest 1000 `
| Where-Object {$_.EventId -lt '100'} `
| Format-Table MachineName, Source, EventID -auto

Note 1: Please change -lt to -eq, and '100' to the EventID you are researching.

Note 2: The above script is ready for remoting, just change the value of $Machine variable.

Note 3: See more about Eventlogs

Guy Recommends:  Solarwinds' Free Bulk Import ToolFree Download of Solarwinds  Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD's attributes, click to import the users.  Optionally, you can provide the name of the OU where the new accounts will be born.

There are also two bonus tools in this free download, and all 3 have been approved by Microsoft:

  1. Bulk-import new users into Active Directory.
  2. Seek and zap unwanted user accounts.
  3. Find inactive computers.

Download your FREE bulk import tool.

Other Windows PowerShell Topics

If you like this page then please share it with your friends

 


See More Windows PowerShell Examples of Real-life Tasks

PowerShell Tutorials  • PowerShell Examples  • IpConfig  • PowerShell NetSh

Monitor Performance - PowerShell  • Get-Counter  • PowerShell temp

PowerShell WOL (Wake-on-Lan)  • Services   • Windows PowerShell

Please email me if you have a better example script. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.

Download my ebook:Getting Started with PowerShell
Getting Started with PowerShell - only $9.25

You get 36 topics organized into these 3 sections:
   1) Getting Started
   2) Real-life tasks
   3) Examples of Syntax.

In addition to the ebook, you get a PDF version of this  Introduction to PowerShell ebook  It runs to 120 pages of A4.

 *


Custom Search

Guy Recommends: WMI Monitor and It's Free!Solarwinds WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.

Fortunately, Solarwinds have created the Free WMI Monitor so that you can actually see and understand these gems of performance information.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

 

Home Copyright © 1999-2012 Computer Performance LTD All rights reserved

Please report a broken link, or an error.