Archive

You are currently browsing the archives for the Powershell category.

Jun

21

Describe PowerShell…

By Gene Laisne

Enjoyed doing the PowerShell presentation today. If anyone has any questions about PowerShell that I can help with, let me know.

On that note, the scripting guys had this post about how to explain PowerShell! (It’s like they knew)

Enjoy…

Describe Windows PowerShell to Four Types of Users

Nov

23

“Make your life easy” PowerShell scripts

By Gene Laisne

“Make your life easy” PowerShell scripts

PowerShell

Some advanced PowerShell

Aug

5

Great stuff!

By Gene Laisne

 

 General

Windows Server 2008 SP1 and Windows Vista SP1 now UNSUPPORTED
How to add comment for a GPO with PowerShell
Microsoft Shares Video Tour of its Cloud Datacenters

Updates

SQL Server 2008 R2 Service Pack 1 Now Available On Microsoft Update
Updates: Process Explorer v15.01 and TCPView v3.05

PowerShell

Use PowerShell to Troubleshoot Software Installation
Parse Windows Trace Logs by Using PowerShell
Use Date Types to Filter Event Trace Logs in PowerShell
PowerShell Deep Dive @ The Experts Conference Europe 2011
Use ScriptCop to Help Write Better PowerShell Scripts  
Create and Parse Performance Monitor Logs with PowerShell 
Use Performance Counter Sets and PowerShell to Ease Baselining  
Capture Performance Counter Data and Write to SQL Server  
Import Counters from a Perfmon Chart into PowerShell  
Use PowerShell to Monitor Your SQL Server Performance  
Create a Simple Graphical Interface for a PowerShell Script  
Secrets to Building a WPF Application in Windows PowerShell

Desktop

With only 1000 days left of extended support, don’t you think it’s time to retire Windows XP?

 Office Applications  

Connect your notes to SkyDrive with the updated Microsoft OneNote app for iPhone, available today  

Office Powerpoint  
More new, free SmartArt graphics: Hexagon Radial and Picture Frame
 Add artistic effects to your slide presentation (video)
The right SmartArt graphics for the job

Office Resource Kit  
Important information for Access 2010 64-bit customers regarding Office 2010 SP1 

Office Sustained Engineering  
Office Binary File Format Validation Tool Available 

Technet

** Build your own book of TechNet articles  

Development

Defense in Depth: Locking Down Mash-Ups with HTML5 Sandbox
Container Pretty Printer – Advanced STL, Part 6
How we used HTML5 to make SkyDrive fast for millions of people
GoingNative: a New Channel 9 Show Dedicated to Native Development
Developing Windows Applications in C++ (Articles Series)

 Virtualization  

App-V Application Virtualzation  Website | RSS Feed
Clients encounter error code xxxxxx0A-200001CD when streaming RTSPS in Microsoft App-V 
Now available for download: Hotfix Package 3 for Microsoft Application Virtualization 4.6 Service Pack 1: July 2011  

Future events such as these will occur in… the FUTRE

Buy now or wait for a sale? Let the computer decide.

Jul

7

PowerShell resources

By Gene Laisne

 

List of Free PowerShell eBooks:         http://www.hofferle.com/archives/624

Don’t Write Scripts, Write PowerShell Functions: http://blogs.technet.com/b/heyscriptingguy/archive/2011/06/26/don-t-write-scripts-write-powershell-functions.aspx

Microsoft (& community) script repository:
http://gallery.technet.microsoft.com/ScriptCenter/

–Gene

Jun

23

PowerShell resources

By Gene Laisne

I love VBScript! I have a library of VBScript functions and scripts as far as the eye can see. I can dance and frolic (yes, I said frolic) with VBScript all day long, But… (There is always a ‘but’) the more I get into PowerShell, the more I like it. What would take me lines and lines in VBScript, I can do in one line of PowerShell. And as we all know, the fewer lines, the fewer bugs.

Here, I want to give people some resources that I think will be very useful for picking up PowerShell. I see PowerShell as having 4 different levels.

  1. Just using simple commands and getting used to piping (I know *nix folks, but a lot of Windows people aren’t used to this idea of piping).
  2. Automating repetitive tasks with scripts.
  3. Writing Functions and better scripts
  4. Building modules and sharing code.

Admittedly, I my self am no Guru on PowerShell. I find myself somewhere at level 2-3 and only glimpsing level 4. But, where I can, I’m willing to offer a hand. Here are some resources for learning PowerShell.

Learn PowerShell before its an emergency – This is a series of beginner videos for PowerShell by “the Scripting Guy” (Microsoft’s in-house script guru).

Script Center – Microsoft site for all things scripting. Chances are someone may have written something that you could use. Or, use this as an educational resource for PowerShell.

Mastering PowerShell – Free on-line book by a PowerShell MVP that looks like a great soup-to-nuts resource.

Windows PowerShell 2.0 Administrator’s Pocket Consultant – Great book. This is how I got up to speed. Not an “idiots” book, but not a ‘nutshell’ book either, a nice in-between which is what I like for learning something new.

I have more, but I wanted to get something out there. I’ll add more as I find them.

–Gene

May

31

PowerShell, Free XBOX and a Core blog.

By Gene Laisne

PowerShell

Great video tutorial (MS 400 level) for PowerShell 2.0. Highlights what’s new, Shows how to create GUIs easlily… Advanced Automation Using Windows PowerShell 2.0

Hey Scripting Guys
Create and Use Default Values in PowerShell Scripts  – 21-May-2011
Design Your PowerShell Functions to Be Reusable  – 20-May-2011
Create Custom Objects in Your PowerShell Script  – 19-May-2011
Real-World PowerShell Tips from a 2011 Scripting Games Winner  – 18-May-2011
Writing Output with PowerShell  – 17-May-2011
Add Excellent Comments to Your PowerShell Script  – 16-May-2011
Use PowerShell to Data Mine Your Outlook Sent Items – 25-May-2011 – As a note, having written some Outlook code myself. This script runs against Outlook, NOT Exchange or even Outlook as a “window” to Exchange. Just Outlook. 😉

Windows Powershell  Website | RSS Feed
Download the Updated Core Help CHM  – 16-May-2011

Other

How to get a free XBOX

Capture and Analyze Network Traffic with Internet Explorer 9

Admin

Two Minute Drill–Launch a task on a recorded event – This is a great little way to spawn a task when an event occurs on a Windows Vista (or better) system.

Ask the Core Team – This is the Microsoft Windows Core Team. From a cursory overview, looks like lots of good posts on things core server technologies.

Some of their posts:
Sysprep, SkipRearm, and Image Build Best Practices
Customizing Default users profile using CopyProfile
How To: Customize the Windows 7 Start Menu and Taskbar Using unattend.xml

Office

Office Access  Website | RSS Feed
Power Tip: Managing Access Add-ins with a SurfaceController  – 20-May-2011
Office 2010 SP1 on track for late June  – 17-May-2011

Office Excel and Excel Services  Website | RSS Feed
Avoid losing the state of the global IRibbonUI ribbon object  – 19-May-2011
Make your data pop with conditional formatting  – 17-May-2011

Office Powerpoint  Website | RSS Feed
Create sexy curved lines in your slides (video)  – 18-May-2011
Create rich media-based presentations with Producer (it’s free!)  – 16-May-2011

Office Sustained Engineering  Website | RSS Feed
Announcing Service Pack 1 for Office 2010 and SharePoint 2010  – 16-May-2011

Office Word  Website | RSS Feed
Figuring out figures – Part 1  – 19-May-2011
An image, a diagram, and a chart meet in a document…  – 16-May-2011

Mar

28

More support and admin links

By Gene Laisne

New KB articles released for January and February  

Some PowerShell videos that are very helpful
Fromatting in PowerShell
PowerShell Profiles
Beyond basic scripting

IE9
Preparing your site for IE9

Deals
Save 40% on Books from Microsoft Press Now through April 6, 2011

Office Applications  

Office Excel and Excel Services  
America’s debt: Get the facts!  – 17-Mar-2011
Try it for free: Count values that meet a condition with the COUNTIF function  

Office Outlook  
Office.com videos and articles help you master Outlook 2010  – 18-Mar-2011

Office Powerpoint  
How to use STAMP: The Subtitling Text Add-in for Microsoft PowerPoint 2010  
Transform your class presentation with video and images: A 5-minute makeover (video)  

Office Sustained Engineering  
Blocking ActiveX Controls from Loading in Microsoft Office  

Office Word  
New 2011 calendar templates for Word 2010  

SysInternals  
Updates: Process Explorer v14.1, VMMap v3.03, ProcDump v3.03, and Zero Day is now Available! 

Scripting Hey Scripting Guys
Scripting Wife Uses PowerShell to Get Days Until NCAA Final Four 
Use PowerShell to Detect if a Workstation Is in Use 
Use PowerShell to Document Exchange Server Prior to Upgrade 
Use PowerShell to Determine Fragmentation of Your Drive 
Change Drive Letters and Labels via a Simple PowerShell Command 

Interesting new downloads
Getting started with Outlook 2010
Getting Started with Microsoft Word 2010
Getting Started with Microsoft OneNote 2010
Getting Started with Microsoft PowerPoint 2010

Mar

22

Support and Admin Links

By Gene Laisne

Helpful URLs

Here are some useful links for support or admin folks. (Maybe some dev at the bottom)

Group Policy Settings Reference Windows Internet Explorer 9
Toolkit to Disable Automatic Delivery of Internet Explorer 9

Technet Webcasts:
TechNet Webcast: PowerShell: Learn It Now before It’s an Emergency (Part 1 of 5) (Level 200)
TechNet Webcast: PowerShell: Learn It Now before It’s an Emergency (Part 2 of 5) (Level 200)
TechNet Webcast: PowerShell: Learn It Now before It’s an Emergency (Part 3 of 5) (Level 200)
TechNet Webcast: PowerShell: Learn It Now before It’s an Emergency (Part 4 of 5) (Level 200)
TechNet Webcast: PowerShell: Learn It Now before It’s an Emergency (Part 5 of 5) (Level 200)

New KB Articles
An Office program is slow or may appear to stop responding (hang) when you open a file from a network location

Support Articles
Error 0xC0000034 during Service Pack 1 installations for Windows 7 and Windows 2008 R2  

Updates
Cumulative update package 3 for SQL Server 2008 Service Pack 2
A Hyper-V update rollup is available for Windows Server 2008 R2

Deals
Sale: Save 40 Percent on Books from Microsoft Press (March 3 – April 6)

Office stuff
Word
Footnote and endnote numbering (video)  – 08-Mar-2011

Access  
Free preview of Total Access Emailer 2010 available  – 11-Mar-2011
New Access templates for your business (video)  – 08-Mar-2011
A capital idea: Changing case in Excel (video)  – 10-Mar-2011
Count your values with the COUNT function (video)  – 08-Mar-2011

Excel

Powerpoint
Add a slide title to a cluttered background (video)  – 08-Mar-2011

Scripting/Programming
Video: Use Batch Cmdlets in Windows PowerShell   (Great illustration of the difference between Powershell and other scripting languages)

Aug

17

PowerPing

By Gene Laisne

Recently I needed to check quickly if twelve systems were up. Rather than writeout each ping command I decided to user PowerShell to do all the heavy lifting. (I’ve been reading up on PowerShell recently)

What I did was write the names of the twelve systems into a text file and issue this command:

foreach ($comp in Get-Content c:\temp\hosts.txt) { ping $comp }

hosts.txt has one system listed per line and as the Get-Content parses the file, it sends each line to the ping command.

Another way would be this:

foreach ($comp in “system1″,”system2″,”system3”) { ping $comp}

On the internet you’ll see this example a lot of the time with something like “foreach ($num in 1,2,3,4,5)” This is nice, but numbers are not strings. If it’s a string, it needs to be in quotes!

If you have a collection of systems that are setup with incrementing DNS names you could do this:

foreach ($hostNumber in 1..10) {ping oit-computer$hostNumber}

This will ping each individual system in turn starting with oit-computer1 and finishing at oit-computer10. (Be sure to use two periods (..) to indicate a span of numbers.)

But, what if you number your systems with leading zeros? Try this trick:

foreach ($hostNumber in 1..10) {$Num = $hostNumber.ToString(“000”); ping OIT-Computer-$Num}

What’s happening here is we have two commands between the { } separated by ‘;’ Don’t forget the ‘;’ otherwise Powershell will error out with “Unexpected token ‘ping’ in expression or statement.” (Each individual element on the line is a token (foreach = token, ( = token, .. = token). First we take our number ($hostNumber) and set it to have leading zeros with the member function ToString(). If you want 4 leading zeros use “0000”.  The result of that change (from 5 to 005 and 10 to 010) goes into the variable $Num. We then use the $Num in the command, directly, without any additional quotes or concatinations. What you get is a series of your systems pinged one at a time.

Now, go a step further if you want, try these commands:

foreach ($hostNumber in 1..255) {$Num = $hostNumber.ToString(“000”); ping 10.100.25.$Num}
foreach ($hostNumber in 1..25) {$Num = $hostNumber.ToString(“000”); nslookup OIT-DSKTOP$Num}
foreach ($user in “gene”,”matt”,”steve”,”jane”) { mkdir \\server\users\$user }
foreach ($comp in “office”,”workstation”,”stevesPC”) { copy c:\temp\file.txt \\$comp\c$\temp }