<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3226004193471051236</id><updated>2011-11-28T01:09:59.717Z</updated><category term='Getting started with Powershell'/><title type='text'>Learn-Powershell</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-3226702407658649876</id><published>2011-09-27T08:32:00.001+01:00</published><updated>2011-10-01T09:06:57.192+01:00</updated><title type='text'>Book Review: Automating Microsoft Windows Server 2008 R2 Administration with Windows PowerShell 2.0</title><content type='html'>I have just read the book by Matthew Hester and Sarah Dutkiewicz entitled Automating Microsoft Windows Server 2008 R2 Administration withy Windows PowerShell 2.0 published Sybex. A strange place to start on a book review, The size. As this is an IT book you expect it to be a huge book for which you hope an eBook appears soon after as reading it would be similar to a half-hour workout at the gym, however at 400 odd pages in paperback this book is roughly a similar weight to a netbook. This made me happy as it meant that I could sling this in my bag and read it on the train. The size wasn't the only thing that made this an easy read on the train. The way this book was written in a very easy to read way, an especially important thing when writing about things like a scripting language.   &lt;br /&gt;  &lt;br /&gt;  &lt;div style="text-align: center; clear: both" class="separator"&gt;&lt;a style="margin-left: 1em; margin-right: 1em" title="Buy the Book" href="http://www.amazon.co.uk/Automating-Microsoft-Windows-Server-PowerShell/dp/1118013867/ref=pd_sim_b1" target="_blank" imageanchor="1"&gt;&lt;img style="margin: 0px 0px 5px" border="0" src="http://1.bp.blogspot.com/-zZZuyEd_jNM/ToGCYwhWMRI/AAAAAAAAAFQ/rot5EFko9OY/s320/9788126531806.jpg" width="250" height="320" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;   &lt;br /&gt;This book will take you from very little or even no PowerShell knowledge to a point where you can be proficient at self discovery very quickly. Once you have got the basics covered the appendixes will take you further.     &lt;br /&gt;    &lt;br /&gt;In the chapters, contents at a glance:&lt;/p&gt;  &lt;p&gt;&lt;i&gt;Introduction.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;Chapter 1: What is PowerShell and Why Do You Need It? &lt;/p&gt;  &lt;p&gt;Chapter 2: Installing and Configuring PowerShell 2.0. &lt;/p&gt;  &lt;p&gt;Chapter 3: PowerShell Grammar Lesson. &lt;/p&gt;  &lt;p&gt;Chapter 4: Aliases, Functions, and the Pipe. Oh My! &lt;/p&gt;  &lt;p&gt;Chapter 5: Creating Your Own Scripts. &lt;/p&gt;  &lt;p&gt;Chapter 6: Remoting with PowerShell 2.0. &lt;/p&gt;  &lt;p&gt;Chapter 7: PowerShell and the Server. &lt;/p&gt;  &lt;p&gt;Chapter 8: Managing Active Directory with PowerShell. &lt;/p&gt;  &lt;p&gt;Chapter 9: Managing Desktops with Server PowerShell. &lt;/p&gt;  &lt;p&gt;Chapter 10: Manage IIS Web Server with PowerShell. &lt;/p&gt;  &lt;p&gt;Chapter 11: PowerShell and Deployment Services. &lt;/p&gt;  &lt;p&gt;Chapter 12: PowerShell and Virtualization. &lt;/p&gt;  &lt;p&gt;Appendix A Solutions to Exercises. &lt;/p&gt;  &lt;p&gt;Appendix B Developing at a Command Prompt. &lt;/p&gt;  &lt;p&gt;Appendix C Providing for PowerShell. &lt;/p&gt;  &lt;p&gt;Appendix D Custom Cmdlets and Advanced Functions. &lt;/p&gt;  &lt;p&gt;Appendix E Packaging PowerShell Extensions. &lt;/p&gt;  &lt;p&gt;Appendix F Building Your Own GUI with PowerShell. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;Index.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;For each of the topic&amp;#160; specific chapters Matthew and Sarah do a great job of ensuring you’re aware of the basics of what you will be working with before jumping into the PowerShell.&amp;#160; This makes this book great if you are new to Windows Server or just not familiar with certain aspects of the OS.&lt;/p&gt;  &lt;p&gt;This book has two great authors working in different areas, one’s an IT Pro and the other a Developer.&amp;#160; This adds a lot to the book as Sarah has been able to explain best how to take your skills further in the appendixes while Matthew has used his experience as an IT Pro evangelist to cover the basics and common tasks in the chapters.&lt;/p&gt;  &lt;p&gt;This book was a great read and I hope that Matthew and Sarah plan to write a new version for when we get the final release of PowerShell 3.0 and Server vNext although from only seeing a small amount so far on Sever vNext this would be a packed full book so this is another reason to by this book now so you’re ahead of the game for vNext…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-3226702407658649876?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/3226702407658649876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2011/09/book-review-automating-microsoft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/3226702407658649876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/3226702407658649876'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2011/09/book-review-automating-microsoft.html' title='Book Review: Automating Microsoft Windows Server 2008 R2 Administration with Windows PowerShell 2.0'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-zZZuyEd_jNM/ToGCYwhWMRI/AAAAAAAAAFQ/rot5EFko9OY/s72-c/9788126531806.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-9067333464831536806</id><published>2011-05-25T13:55:00.004+01:00</published><updated>2011-05-25T13:57:50.333+01:00</updated><title type='text'>Using New-TimeSpan cmdlet in scripts</title><content type='html'>During the 2011 Scripting Games&amp;nbsp;I learned to used many new things... one being how to use New-TimeSpan cmdlet.&lt;br /&gt;&lt;br /&gt;It was April 12th 2011 on and Event 7 of the scripting games was posted... Our challenge?&amp;nbsp; Create a pop up box at log on to show how long is left to submit orders before the financial year ends...&amp;nbsp;Read more on the following page: &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/2011+scripting+games/beginner/event+7/"&gt;http://blogs.technet.com/b/heyscriptingguy/archive/tags/2011+scripting+games/beginner/event+7/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My solution to this was as follows:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;div class="container"&gt;&lt;div class="line number1 index0 alt2"&gt;&lt;code class="powershell comments"&gt;# Scripting Games 2011 Beginner Event 7 #&lt;/code&gt;&lt;/div&gt;&lt;div class="line number2 index1 alt1"&gt;&lt;/div&gt;&lt;div class="line number3 index2 alt2"&gt;&lt;code class="powershell variable"&gt;$Timespan&lt;/code&gt; &lt;code class="powershell plain"&gt;= &lt;/code&gt;&lt;code class="powershell functions"&gt;New-TimeSpan&lt;/code&gt; &lt;code class="powershell color1"&gt;-Start&lt;/code&gt; &lt;code class="powershell plain"&gt;(&lt;/code&gt;&lt;code class="powershell functions"&gt;get-date&lt;/code&gt;&lt;code class="powershell plain"&gt;)&lt;/code&gt; &lt;code class="powershell color1"&gt;-End&lt;/code&gt; &lt;code class="powershell plain"&gt;31/07/2011&lt;/code&gt;&lt;/div&gt;&lt;div class="line number4 index3 alt1"&gt;&lt;/div&gt;&lt;div class="line number5 index4 alt2"&gt;&lt;code class="powershell variable"&gt;$MsgBox&lt;/code&gt; &lt;code class="powershell plain"&gt;= &lt;/code&gt;&lt;code class="powershell functions"&gt;New-Object&lt;/code&gt; &lt;code class="powershell color1"&gt;-ComObject&lt;/code&gt; &lt;code class="powershell plain"&gt;wscript.shell&lt;/code&gt;&lt;/div&gt;&lt;div class="line number6 index5 alt1"&gt;&lt;code class="powershell variable"&gt;$MsgBox&lt;/code&gt;&lt;code class="powershell plain"&gt;.Popup(&lt;/code&gt;&lt;code class="powershell string multi"&gt;"There are $($timespan.days) days until the end of the fiscal year."&lt;/code&gt;&lt;code class="powershell plain"&gt;,0,&lt;/code&gt;&lt;code class="powershell string multi"&gt;"Fiscal Year Notification"&lt;/code&gt;&lt;code class="powershell plain"&gt;)&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;Two lessons from this script are:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Making pop up message boxes.&amp;nbsp; This is very simple way using the New-Object cmdlet to create the box with a ComObject.&amp;nbsp; When I say this is easy, I mean easy to use not explain.&amp;nbsp; Resources like the Scripting Guy or MSDN will help explain this much better than I could.&lt;/li&gt;&lt;li&gt;New-TimeSpan cmdlet.&amp;nbsp; This is what I wanted to explain in this post.&amp;nbsp; Basically if you want to see the difference in time between one date and another then it's simple using this cmdlet.&amp;nbsp; For example if you want to know how many days there are between November 10th 2012 and December 11th 2013 you would simply type "New-TimeSpan 10/11/12 11/12/13" (For the UK US "New-TimeSpan 11/10/12 12/11/13" should work).&amp;nbsp; This will give the result of "Days : 296"&lt;/li&gt;&lt;/ol&gt;In the Scripting games I was only required to give&amp;nbsp;a count down of days but this can be extended to a specific point in the day.&amp;nbsp; The following block of script is my countdown to when I finish working at my current employer.&amp;nbsp; I have the TimeSpan going from Now (Using Get-Date to retrieve current date and time) and then I use Get-Date but with parameters to specify the Day, Month, Year, Hour, and Minute of the day.&amp;nbsp; I have put the cmdlet and it's parameters into a Variable to make it easier to specify later in the script when I want only, for example, the number of days, or hours.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;$Timespan = New-TimeSpan -Start (get-date) -End (Get-Date -Day 24 -Month 6 -Year 2011 -Hour 15 -Minute 30)&lt;br /&gt;$MsgBox = New-Object -ComObject wscript.shell&lt;br /&gt;$MsgBox.Popup("There are $($timespan.days) days, $($timespan.hours) hours, and $($timespan.minutes) minutes until I Finish!",0,"Time Until I Leave")&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I have made 2 variables in this script; one for the TimeSpan, and the other for the message box.&amp;nbsp; With both of these I extend them by using some of their methods.&amp;nbsp; To find out what their methods are Create the variable (The following example will use the Message Box) "$MsgBox = New-Object -ComObject wscript.shell", then type "$MsgBox | Get-Member" you will see all methods available to that object.&amp;nbsp; From this list, as I wanted a pop up box, I selected the Pop up method.&amp;nbsp; This was used by typing "$MsgBox.Popup("Text String for in the box",0,"Window Title")".&amp;nbsp; From what I can tell the "0" means it waits for a response by clicking the OK button.&amp;nbsp; If you put a different number then it will automatically shut after &lt;em&gt;&lt;what i="" think=""&gt;&lt;/what&gt;&lt;/em&gt; is the number of seconds.&lt;br /&gt;&lt;br /&gt;With the $TimeSpan variable I have used the object properties to only display the property I am wanting.&amp;nbsp; For example to show only the Days property I just use $TimeSpan.Days and it will display the number of days.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-v1aet_Jm3zc/Tdz7QbX9ZpI/AAAAAAAAADM/SkGfzFUgLxs/s1600/MsgBox.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="145" src="http://2.bp.blogspot.com/-v1aet_Jm3zc/Tdz7QbX9ZpI/AAAAAAAAADM/SkGfzFUgLxs/s320/MsgBox.PNG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;For this script I have saved it and created a shortcut on my desktop to the following:&lt;br /&gt;&lt;blockquote&gt;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "c:\Scripts\TimeUntilDeparture.ps1"&lt;/blockquote&gt;&lt;br /&gt;I hope this is of use to you...&lt;br /&gt;Thanks for reading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-9067333464831536806?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/9067333464831536806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2011/05/using-new-timespan-cmdlet-in-scripts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/9067333464831536806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/9067333464831536806'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2011/05/using-new-timespan-cmdlet-in-scripts.html' title='Using New-TimeSpan cmdlet in scripts'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-v1aet_Jm3zc/Tdz7QbX9ZpI/AAAAAAAAADM/SkGfzFUgLxs/s72-c/MsgBox.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-2926484858304576325</id><published>2011-04-24T23:27:00.001+01:00</published><updated>2011-04-24T23:57:21.457+01:00</updated><title type='text'>Lessons from the Scripting Games 2011</title><content type='html'>&lt;div&gt;&lt;p&gt;We have just come to the end of another year for the Microsoft Scripting Games.&amp;#160; It was another exciting event and one in which I managed to take part in full this year... well not quite, I missed one deadline due to not knowing what day it was, and the other to having been traveling for most of the last day I had to write and submit it on (my fault for leaving it 'til the last minute).&amp;#160; Still that is better than the 1 script I had time to submit last year.&lt;/p&gt;&lt;p&gt;This year as I'm still &lt;u&gt;fair&lt;/u&gt;ly new to PowerShell and generally work in the console rather than Scripting I enter in the Beginner Category.&amp;#160; Having finished in the top half of the board I intent to train for the next year to participate in the advanced games...&lt;/p&gt;&lt;p&gt;Until then I need to learn from this years scripts and see where I did well, where others did well, and where failing occurred...&lt;/p&gt;&lt;p&gt;Lesson 1 I shall take from this years games is the requirement for reusable code... in the most part this required use of Advanced Functions. These aren't as scary as they sound.&amp;#160; I won't go into how to use them now but I do plan to write alot about that in the future.&amp;#160; I don't want to write this until I'm clearer on this myself and I am not blogging from my phone.&lt;/p&gt;&lt;p&gt;Lesson 2 add help into your Scripting.&amp;nbsp; Within you functions open the help text with &amp;lt;# help info &amp;gt;&lt;/p&gt;&lt;p&gt;I will follow up with more lessons later on, but, for now take a look at some of the entries both high and low staring and read the scripts and comments to discover more...&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-2926484858304576325?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/2926484858304576325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2011/04/lessons-from-scripting-games-2011.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/2926484858304576325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/2926484858304576325'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2011/04/lessons-from-scripting-games-2011.html' title='Lessons from the Scripting Games 2011'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-1612278860395771218</id><published>2011-02-13T21:35:00.001Z</published><updated>2011-02-13T21:35:15.792Z</updated><title type='text'>Update to PowerCli</title><content type='html'>&lt;div&gt;&lt;p&gt;VMWare has resently released the latest version of its powershell client, PowerCli 4.1.1.&amp;#160; Alan Renouf's blog is a great place to go if you work with VMWare and he's just posted the lastest powercli poster to download.&amp;#160; Whilest your there check out the rest of his site. http://www.virtu-al.net/2011/02/13/powercli-4-1-1-poster/&lt;/p&gt;&lt;p&gt;&lt;a href="Alan Renouf (alanrenouf): New blog posting, PowerCLI 4.1.1 Poster - http://tinyurl.com/483htn4  http://twitter.com/alanrenouf/status/36875246703218688  (Sent via Seesmic http://www.seesmic.com)"&gt;Tweet from Alan Renouf (alanrenouf)&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-1612278860395771218?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/1612278860395771218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2011/02/update-to-powercli.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/1612278860395771218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/1612278860395771218'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2011/02/update-to-powercli.html' title='Update to PowerCli'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-6532670832286039580</id><published>2010-05-07T21:41:00.001+01:00</published><updated>2010-05-07T21:41:31.337+01:00</updated><title type='text'>Guessing the Election</title><content type='html'>&lt;p&gt;For those who read this blog from the UK you may know there was a general election yesterday.&amp;#160; Having stayed up all night watching&amp;#160; BBC1 (while nodding off regularly) it was seeming like they were taking wild guesses about who would win the seats before they were announced.&lt;/p&gt;  &lt;p&gt;After playing Rock Paper Scissors with the computer for a bit (Code below) I thought I could probably use powershell to guess at the election.&amp;#160; Firstly I will show you Rock, Paper, Scissors.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;get-random “Rock”,”Paper”,”Scissors”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;After that I thought to the election and how it would be useful for whose who didn’t know which way to vote&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;get-random “labour”,”Lib Dem”,”Conservitives”,”other”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;And then I thought to how to predict the election results.&amp;#160; For this we are going for more than a one liner although it could be done in one line.&amp;#160; For this I have created a folder in the root of C: called election and made a list of constituenies in a csv file and a file with a list of parties&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;$Locations=import-csv C:\Election\Constituenies.csv     &lt;br /&gt;foreach ($Location in $Locations) {write-output $Location,(Get-Random(get-content C:\Election\Parties.csv))}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is only a basic script at the moment but it is something that could be built on to to make it more use.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-6532670832286039580?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/6532670832286039580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/05/guessing-election.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/6532670832286039580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/6532670832286039580'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/05/guessing-election.html' title='Guessing the Election'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-5934734786836887996</id><published>2010-04-05T21:56:00.003+01:00</published><updated>2010-04-25T09:01:40.969+01:00</updated><title type='text'>Windows Server 2008 R2 Core</title><content type='html'>Ok, so you might be wondering what that has to do with Powershell.&amp;nbsp; Hopefully by the end of this post you might know why I am posting this.&amp;nbsp; I am writing about Microsoft Windows Server 2008 R2 core as this has the ability to install Powershell (some hacks have been preformed to get it onto 2008 original but these aren’t supported)&lt;br /&gt;Firstly I’ll let Microsoft introduce what Server Core is for if you are unaware:&lt;br /&gt;&lt;blockquote&gt;The Server Core installation option for the Microsoft Windows Server 2008 R2 operating system provides a minimal environment for running specific server roles that reduces the maintenance and management requirements and the attack surface for those server roles.&lt;br /&gt;&lt;a href="http://www.microsoft.com/windowsserver2008/en/us/r2-compare-core-installation.aspx"&gt;http://www.microsoft.com/windowsserver2008/en/us/r2-compare-core-installation.aspx&lt;/a&gt;&lt;/blockquote&gt;So with being cut back the main thing to go is the GUI leaving you with only a command prompt window to work with.&amp;nbsp; You will find you need a couple of commands to get you to the point of where you can install Powershell and get back to a more sensible console.&amp;nbsp; A quick reference sheet is available &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=8DD99AC0-4A59-41E9-8037-F33760D560F0&amp;amp;displayLang=en"&gt;here&lt;/a&gt;.&amp;nbsp; What I plan to do here is go through what you have to do to get from a clean install to be working with Powershell.&amp;nbsp; I’m starting from the point of the installation finishing and having chosen my password.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When you log in you will be presented with a cmd.exe, this is it, don’t expect any more as it’s not coming. &lt;/li&gt;&lt;li&gt;At this stage the name of the computer is fairly random. I’m just on a workgroup for now so to rename the computer I need to type:      &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;netdom renamecomputer %computername% /NewName:** &lt;/li&gt;&lt;li&gt;After a reboot the name will be changed &lt;/li&gt;&lt;li&gt;you can check the name with the “echo %computername% command &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Many services require a static IP address, however I am not setting up anything that is dependent on that and as the quick reference sheet is clear on how to do that I’ll skip over it for here. &lt;/li&gt;&lt;li&gt;Next up we’ll look at what roles and services are enabled and disabled, to do this we use the Dism command as follows:      &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;dism /online /get-features /format:table &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;If you look up the list you will find a service called “MicrosoftWindowsPowerShell” and this is set to disabled by default.&amp;nbsp; When you find what you want installed type the following:      &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;tt&gt;start /w ocsetup &lt;/tt&gt;name_as_above &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;em&gt;(Thanks to Jeffrey Hicks for letting me know an easier way)&lt;/em&gt;   &lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;tt&gt;To get Powershell you will need to first have .net framework 2.0 running (NetFx2-ServerCore)then turn on powershell as follows (please note names are caps sensitive):&lt;/tt&gt;       &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;tt&gt;start /w ocsetup NetFx2-ServerCore&lt;/tt&gt; &lt;/li&gt;&lt;li&gt;&lt;tt&gt;start /w ocsetup MicrosoftWindowsPowerShell&lt;/tt&gt; &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;tt&gt;you can now start Powershell by going to:&lt;/tt&gt; &lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;tt&gt;%systemroot%\system32\WindowsPowerShell\v1.0 then running Powershell.exe&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;tt&gt;Now you can get a list of Roles and Features by:&lt;/tt&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Import-Module ServerManager&lt;/li&gt;&lt;li&gt;Get-WindowsFeature&lt;/li&gt;&lt;ul&gt;&lt;li&gt;You can also add and remove using the Add-WindowsFeature and Remove-WindowsFeature comlets.&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;Jeffrey Hicks has a great blog post about setting Powershell as your default shell here: &lt;a href="http://jdhitsolutions.com/blog/2010/03/powershell-quick-start-on-server-core-r2/" title="PowerShell Quick Start on Server Core R2 - The Lonely Administrator"&gt;PowerShell Quick Start on Server Core R2 - The Lonely Administrator&lt;/a&gt; – Do this on a test server to start with so you don’t end up breaking your server&lt;br /&gt;I hope this is a good start and to find out more check out the &lt;a href="http://powerscripting.net/" title="http---powerscripting.net-"&gt;http---powerscripting.net-&lt;/a&gt; Podcast Episode 110&amp;nbsp;when they are talking to “The Server Core Guy”.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-5934734786836887996?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/5934734786836887996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/04/windows-server-2008-r2-core.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/5934734786836887996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/5934734786836887996'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/04/windows-server-2008-r2-core.html' title='Windows Server 2008 R2 Core'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-7959708254200732425</id><published>2010-03-15T19:41:00.001Z</published><updated>2010-03-15T19:41:42.103Z</updated><title type='text'>Powershell With Microsoft Exchange</title><content type='html'>&lt;p&gt;This is just a quick post for those wanting to use Powershell with Microsoft Exchange and there is some coverage of Powershell with Active Directory in server 2008 R2 – &lt;strong&gt;Free&lt;/strong&gt; eBook for download here: &lt;a href="http://www.red-gate.com/specials/Exchange/the_sysadmin_handbook_ebook.htm?utm_source=simpletalkExchange&amp;amp;utm_medium=email&amp;amp;utm_content=handbookebookmarch10"&gt;http://www.red-gate.com/specials/Exchange/the_sysadmin_handbook_ebook.htm?utm_source=simpletalkExchange&amp;amp;utm_medium=email&amp;amp;utm_content=handbookebookmarch10&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Looks good from a quick scan and I hope it’s of use to you&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-7959708254200732425?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/7959708254200732425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/03/powershell-with-microsoft-exchange.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/7959708254200732425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/7959708254200732425'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/03/powershell-with-microsoft-exchange.html' title='Powershell With Microsoft Exchange'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-6986141679935104447</id><published>2010-02-28T23:15:00.001Z</published><updated>2010-02-28T23:15:02.746Z</updated><title type='text'>VMware ESX and Powershell</title><content type='html'>&lt;p&gt;I had planned to explain a bit about using Powershell and VMware ESX together but having just seen a post from &lt;a href="http://www.twitter.com/AlanRenouf" target="_blank"&gt;@AlanRenouf&lt;/a&gt; I through I would leave it to him to explain with his presentation from the London VMware User Group (VMUG).&amp;#160; To see a little of what you can do and some example scripts, head over to the link below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.virtu-al.net/2010/02/26/london-vmug-my-presentation/"&gt;http://www.virtu-al.net/2010/02/26/london-vmug-my-presentation/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When I know more about what to do with VMware and Powershell I will do an in-depth starter blog on it but for now Alans presentation is a great start.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-6986141679935104447?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/6986141679935104447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/vmware-esx-and-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/6986141679935104447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/6986141679935104447'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/vmware-esx-and-powershell.html' title='VMware ESX and Powershell'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-6648957558970590491</id><published>2010-02-23T22:38:00.001Z</published><updated>2010-02-23T22:38:53.325Z</updated><title type='text'>Active Directory in Server 2008R2 – Navigation and Basics for starters</title><content type='html'>&lt;p&gt;Something Microsoft missed out on in Powershell v1 was active directory cmdlet, however for v1 Quest came to the rescue with their AD commands available free at &lt;a href="http://www.quest.com/powershell/activeroles-server.aspx"&gt;http://www.quest.com/powershell/activeroles-server.aspx&lt;/a&gt;.&amp;#160; Now for the release of Windows Server 2008r2 the Active Directory guys have finally developed full set of cmdlets in a module for working with Active Directory out of the box.&amp;#160; Once Active Directory is installed onto a 2008R2 Domain Controller you will be able to do either “Import-Module ActiveDirectory” or you can just load from the shortcut in the Administrative Tools area on the start menu (but this is something you will want every day if your an AD Admin so right click the shortcut and say ‘pin to taskbar’.&amp;#160; Or if you want to manage your servers from your workstation you’ll require the Remote Server Administration Tools for Windows 7.&amp;#160; Which ever way you enter you will need to know what to do when you get in – below is a poster for your bedroom wall (or somewhere more useful) with your day to day commands, the image will link you to the Active Driectory Powershell Blog from where you can download it.&lt;/p&gt;  &lt;p&gt;&lt;a title="Active Directory Team&amp;#39;s Powershell Blog" href="http://blogs.msdn.com/adpowershell/"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="AD powershell cmdlet poster" border="0" alt="AD powershell cmdlet poster" src="http://lh6.ggpht.com/_229SFPX9ZyQ/S4RY9_bSM-I/AAAAAAAAACY/hQ9EfRNRXd4/AD%20powershell%20cmdlet%20poster%5B4%5D.png?imgmax=800" width="417" height="424" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;So, Let get started… Once you are in powershell and have the ActiveDirectory module loaded type “Get-PSDrive” and you will see AD as one of the options – Yes this means you can “Set-Location AD:” and work your way through just like it was Windows Explorer (Thank you MS).&amp;#160; When you get the prompt of “PS AD:\&amp;gt;” try Dir and see where you can go.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_229SFPX9ZyQ/S4RY-ZTLdII/AAAAAAAAACc/t78QGt8ZHP4/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_229SFPX9ZyQ/S4RY--X9R5I/AAAAAAAAACg/i4qhya4_7Vs/image_thumb%5B1%5D.png?imgmax=800" width="422" height="120" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;As my server is just a test domain awaiting expansion my FQ domain name is just called Forest.Local .&amp;#160; To get into my active Directory I would just type “Set-Location ‘\DC=Forest,DC=Local’”.&amp;#160; Dir again and you will see your OU’s and Containers and you can keep going though using the Set-Location command or its’ alias CD to navigate to where you want to go.&amp;#160; If you go “Set-Location .\CN=Users&amp;quot; you can then try out some of the new cmdlets such as New-ADUser, Get-ADUser, Remove-ADUser – should all be self explanatory what they do (in case you’re wondering though New-ADUser will create a user, Get-ADUser will get you the users info of a specified user, and Remove-ADUser will Remove the users), if you need to know more use the Get-Help command.&lt;/p&gt;  &lt;p&gt;The same applies to ADComputer, ADGoup, ADOrganisationalUnit, Etc.&amp;#160; This should cover you for all basic tasks you want to carry out in Active Directory from Powershell.&lt;/p&gt;  &lt;p&gt;Something to be aware of is when you are using the Set-Location cmdlet you will need to know whether you are going to a container (CN) or OrganisationalUnit (OU) and when navigation to the domain you will need the DC.&lt;/p&gt;  &lt;p&gt;You can tell what you need by using dir or the cmdlet Get-ChildItem and looking at the DistinguishedName.&amp;#160; So for my domain I start with “Set-Location ‘\DC=Forest,DC=Local’” then from there you can go into a container with “Set-Location .\CN=Users&amp;quot;, go back up a level with “Set-Location ..”, and go into an Organisational Unit with “Set-Location .\OU=MyOrgUnit”&lt;/p&gt;  &lt;p&gt;I know this is very basic stuff but it’ll get you by if you’re just starting out, so I hope it was a valuable read for someone.&lt;/p&gt;  &lt;p&gt;Thanks for reading and please leave feedback,&lt;/p&gt;  &lt;p&gt;Dave&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-6648957558970590491?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/6648957558970590491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/active-directory-in-server-2008r2.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/6648957558970590491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/6648957558970590491'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/active-directory-in-server-2008r2.html' title='Active Directory in Server 2008R2 – Navigation and Basics for starters'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_229SFPX9ZyQ/S4RY9_bSM-I/AAAAAAAAACY/hQ9EfRNRXd4/s72-c/AD%20powershell%20cmdlet%20poster%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-5053522409874196451</id><published>2010-02-22T20:05:00.001Z</published><updated>2010-02-22T20:05:53.513Z</updated><title type='text'>What Can I Use PowerShell For?</title><content type='html'>&lt;p&gt;In this post I am after help from everyone who is already using powershell to help everyone who is learning.&amp;#160; I’m not just being lazy, however having been on holiday for a week I haven’t had a chance to update the blog so this should (if it works as planned) help get some good content onto the site quickly.&lt;/p&gt;  &lt;p&gt;What I want to have a people using and with expertise (especially other blog/resource writers) write in the comments section of this post just a quick “mini blog post” with the following (if you can’t post a comment then please send an email with the following and I’ll upload on your behalf.):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Name of a useful cmdlet your find useful or you think is important to someone learning powershell&lt;/li&gt;    &lt;li&gt;A short explanation how it’s used and why powershell is your choice of weapon for the task&lt;/li&gt;    &lt;li&gt;Who you are and where you can be found for twitter/blogs/podcasts -&amp;#160; please also state the intended reader level of your blog (beginner, intermediate, expert, Snover)&lt;/li&gt;    &lt;li&gt;Area(s) of expertise (i.e. Active Directory, Exchange, VMware, etc.)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Hopefully if readers like the style of your comment they will head towards your blog.&amp;#160; I hope for this to be a good way to get some useful scripts and one liners onto the site from people of different use areas, help readers find other blogs for learning from and to get a good collection of resources.&lt;/p&gt;  &lt;p&gt;I aim to keep this post alive and keep it near the top.&amp;#160; So all that left for me to do now is thank everyone for the help and for those learning, I hope this helps.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-5053522409874196451?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/5053522409874196451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/what-can-i-use-powershell-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/5053522409874196451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/5053522409874196451'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/what-can-i-use-powershell-for.html' title='What Can I Use PowerShell For?'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-8390810578626916691</id><published>2010-02-04T20:04:00.002Z</published><updated>2010-02-05T16:37:41.495Z</updated><title type='text'>Remove-Item</title><content type='html'>&lt;p&gt;This is just going to be a quick post, it’s a quick bit about what I did earlier at work.&amp;#160; As a bit of background, we have lots of users logging onto lots of computers and profiles don’t currently exist in the roaming variety.&amp;#160; At times the profiles that create on the desktops around the place mess up and have to be deleted.&amp;#160; Doing this manually claims it takes between hours and days to complete.&amp;#160; Before Powershell I made a .bat file that had a list of usernames prefixed by rmdir.&amp;#160; Earlier I had to do the task again and I thought, how will I do this in powershell?&lt;/p&gt;&lt;p&gt;As a start I just went to the Documents and Settings and typed “Remove-Item .\04* –force” (for student users, usernames are prefixed with year of entry), then I though, Can I do more than one at a time so I tried “Remove-Item .\05*,.\06* –force”.&lt;/p&gt;&lt;p&gt;After being happy with that I thought, ‘what more can I do?’, so after “get-help remove-item” I noticed an exclude option, that got me thinking.&amp;#160; All I want to keep in is “All Users”,“Default User”, and any users starting with admin.&amp;#160; I ended up with the script as follows:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;c:&lt;/p&gt;&lt;p&gt;cd '\documents and settings'&lt;/p&gt;&lt;p&gt;Remove-Item .\* –Exclude “All Users”,”Default User”,Admin* -force&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;That’s all there was to deleting everything but what I wanted in that directory – also completes quickly – no waiting for a few hours for the deletes to go though.&lt;/p&gt;&lt;p&gt;This is such a basic task made better with powershell.&amp;#160; Whatever you are trying to do, think, What Can Powershell Do?&lt;/p&gt;&lt;p&gt;Quick warning: DO NOT type “Remove-Item \*” without the . \ for current directory or you may wipe the c: drive&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-8390810578626916691?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/8390810578626916691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/remove-item.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/8390810578626916691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/8390810578626916691'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/02/remove-item.html' title='Remove-Item'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-5325028086810760594</id><published>2010-01-27T23:11:00.000Z</published><updated>2010-01-27T23:12:15.332Z</updated><title type='text'>PS1 – the scripting side of Powershell</title><content type='html'>&lt;p&gt;OK… Powershell effectively has two ways of being used.&amp;#160; You can type straight onto the command line or you can script.&amp;#160; This is similar to your traditional command prompt (cmd) where you could open cmd and type your command you want or you can open notepad and write your command into a .bat script file.&amp;#160; I have given a few commands in previous posts&amp;#160; but I haven’t explained how to make an actual script yet, or even what a script is.&lt;/p&gt;&lt;p&gt;If you have been working with computers for a while (especially if your in an admin/tech person role) you will have come across .bat, .vbs, .kix or possibly Perl or Java script files.&amp;#160; Good new for everyone is that we can say bye bye to them and say hello to the .ps1 file.&lt;/p&gt;&lt;p&gt;Something to be aware of before trying to run a .ps1 file in powershell is that you will need to sign your script or make sure that powershell has it’s execution policy set to remote signed.&amp;#160; To check what your current execution policy is set to, in powershell console type: get-executionpolicy .&amp;#160; To view available options type get-help set-executionpolicy and that will give you more details on this.&amp;#160; If you don’t want to open up your script execution policy then your can sign your scripts, I won’t go into that on this blog as I haven’t done this yet, when I do give it a go (sometime soon) I will blog how to do it (or how I did it – hopefully that should be like how you are meant to do it?).&lt;/p&gt;&lt;p&gt;Anyway I have waffled around the subject of this post for long enough so I will get straight onto it.&amp;#160; &lt;/p&gt;&lt;p&gt;You can make a .ps1 file in many ways, the most basic way being opening notepad, writing some Powershell commands, and saving with the extension .ps1 at the end of the file name.&amp;#160; If you would prefer to have Powershell on tap whilst writing your script then try the Windows Powershell ISE.&amp;#160; This will give you a tabbed scripting window, a Powershell command input console and a shared output window.&amp;#160; This is a useful environment&amp;#160; to script in because it allows you to write and test either sections or the whole of your script from the same window you are working in.&amp;#160; The Powershell command input console also allows you to run get-member and help on anything you are putting into your script.&lt;/p&gt;&lt;p&gt;&lt;em&gt;Now we know what the script is when should we write one and for what?&lt;/em&gt;&lt;/p&gt;&lt;p&gt;When to write a script seems to be a common question, generally if you are planning to use a command regularly then why not make a script and save wearing out your keyboard?&amp;#160; In my last post I gave the script for a making a powershell logo, it wasn’t very useful but it’s a script and a good example for this post.&amp;#160; Many tutorials you find online will be working with making a script for a task, by starting with the basics you can be ready to work on anything you find online.&amp;#160; You can use a script for many a task, think what you do regularly and think, “Can I script this?”&lt;/p&gt;&lt;p&gt;One last point that I won’t really go into on this post (big topic so needs it’s own but it ties in with this) is your profile.&amp;#160; Your profile is something that loads when you open up powershell, you can set lots of useful stuff in there and it’s editable by you.&amp;#160; I currently have a very basic profile which I have set to change my default directory, load my powershell logo script (it calls in a ps1 file to do that) then clears my screen ready for use.&amp;#160; It’s not much but it’s all I need so far.&amp;#160; As I head off onto a future post I will steer back to the current one but pointing out that your profile is basically a ps1 file that loads when powershell loads.&lt;/p&gt;&lt;p&gt;At this point I think we now a bit about scripts and I’ll hopefully be guiding you through more of what to do with them in up coming posts so check back again and thanks for reading.&lt;/p&gt;&lt;p&gt;Dave.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-5325028086810760594?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/5325028086810760594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/ps1-scripting-side-of-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/5325028086810760594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/5325028086810760594'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/ps1-scripting-side-of-powershell.html' title='PS1 – the scripting side of Powershell'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-1990816250191391766</id><published>2010-01-19T23:05:00.001Z</published><updated>2010-01-19T23:05:05.229Z</updated><title type='text'>A Cool but pointless script</title><content type='html'>&lt;p&gt;Ok, Powershell may be the best thing to happen to windows (and other) administrators since the slicing of bread… or more likely since the mmc console.&amp;#160; But for everything useful you can find a completely pointless task for fun… this is what I have be spending a few hours doing recently.&lt;/p&gt;  &lt;p&gt;I had seen some ones script to make a Powershell Christmas tree about a month back and thought that was quite cool, then having started this blog I created a twitter account to go along side.&amp;#160; I was happy with the little bird type icon that you get as a default Profile Picture but my wife told me I had to do something more interesting.&amp;#160; I didn’t want to have the standard Powershell picture that most Powershell tweeters use so I thought I could do one in the same style as the Christmas tree I had seen before.&amp;#160; Not knowing where to start I searched for the code of the Christmas Tree (can be found here: &lt;a title="http://dnn.itprotoronto.ca/Blogs/tabid/62/EntryId/80/Powershell-Christmas-Tree-ndash-Again.aspx" href="http://dnn.itprotoronto.ca/Blogs/tabid/62/EntryId/80/Powershell-Christmas-Tree-ndash-Again.aspx"&gt;http://dnn.itprotoronto.ca/Blogs/tabid/62/EntryId/80/Powershell-Christmas-Tree-ndash-Again.aspx&lt;/a&gt; ) and I got to editing.&amp;#160; What I ended up with was great in a massively geeky way to the point I had to show it off.&amp;#160; having shown it to my wife and in-laws where better to next show it off than here.&amp;#160; I will attach the script in a quote below this paragraph and also show off the screen shot.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;clear-host      &lt;br /&gt;write-host &lt;/p&gt;    &lt;p&gt;$Rows = 15     &lt;br /&gt;$Slash = 1      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $oldpos = $host.ui.RawUI.CursorPosition &lt;/p&gt;    &lt;p&gt;# &amp;gt; sign &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Foreach ($r in ($Slash ..2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14)){      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; write-host $(&amp;quot;&amp;#160;&amp;#160; &amp;quot; * $r) -NoNewline      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1..((($rows +$r) * 0)+1) | %{       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; write-Host &amp;quot; ***&amp;quot; -ForegroundColor White&amp;#160; -nonewline       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; write-host &amp;quot;&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Foreach ($r in ($rows..2)){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; write-host $(&amp;quot;&amp;#160;&amp;#160; &amp;quot; * $r) -NoNewline       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1..((($rows -$r) * 0)+3) | %{&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; write-Host &amp;quot;*&amp;quot; -ForegroundColor White&amp;#160; -nonewline       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; write-host &amp;quot;&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; # Underscore &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; write-host $(&amp;quot;{0}*************************&amp;quot; -f (' ' * ($Rows +10) ))&amp;#160; -ForegroundColor White      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; write-host $(&amp;quot;{0}*************************&amp;quot; -f (' ' * ($Rows +10) ))&amp;#160; -ForegroundColor White       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $host.ui.RawUI.CursorPosition = $oldpos       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; sleep .05&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I have to say it’s not the cleanest of scripts possible but it’s a good start.&lt;a href="http://lh3.ggpht.com/_229SFPX9ZyQ/S1Y6nVG3LnI/AAAAAAAAACM/nZlZ0oabByY/s1600-h/Powershell%20Logo%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Powershell Logo" border="0" alt="Powershell Logo" src="http://lh5.ggpht.com/_229SFPX9ZyQ/S1Y6n6yL1aI/AAAAAAAAACQ/pSlmwWjqOJ8/Powershell%20Logo_thumb%5B2%5D.png?imgmax=800" width="242" height="230" /&gt;&lt;/a&gt; This blog post has overtaken my last post for what will be published first as I am still writing my other one which is about the PS1 file that is for Powershell scripts but it will be ready soon.&amp;#160;&amp;#160; Now you may wonder if this may ever be of use at all but I have a use for it already (besides my profile picture on twitter).&amp;#160; Something else I will cover in the near future is your profile.&amp;#160; In brief your profile is a script that runs when you open Powershell, it is customisable and so as I could I customised it.&amp;#160; I have my profile set so it changes directory to where my scripts live, runs this script to make the logo, then clears the screen again.&amp;#160; It’s not of much use but it’s fun and make Powershell look like it has a boot screen like that of windows when it boots.&lt;/p&gt;  &lt;p&gt;So there you have it.&amp;#160; A very useless script but it has a point – I learned about doing something in Powershell whilst having fun.&amp;#160; I am not alone on making pointless scripts for the sake of it and if it’s something you want to do then check out the Scripting Guys scripting games – an annual event for scripters of all levels to try out making a script to for fill a given requirement.&lt;/p&gt;  &lt;p&gt;For now anyway it’s time for bed, so have fun learning Powershell and don’t forget to check back another day for more blogs on learning Powershell.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-1990816250191391766?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/1990816250191391766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/cool-but-pointless-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/1990816250191391766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/1990816250191391766'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/cool-but-pointless-script.html' title='A Cool but pointless script'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_229SFPX9ZyQ/S1Y6n6yL1aI/AAAAAAAAACQ/pSlmwWjqOJ8/s72-c/Powershell%20Logo_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-697122497901036851</id><published>2010-01-10T20:16:00.022Z</published><updated>2010-01-12T17:42:44.677Z</updated><title type='text'>Working With Txt and Csv files.</title><content type='html'>One of the most useful things I've see so far from using powershell is the way you can work with external files such as txt or csv files. They can be used to both import data into powershell and output to.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;We shall start by looking at importing from a txt file.&lt;/em&gt;&lt;br /&gt;As the most basic thing we can do with a txt file just type "get-content &lt;path&gt;" and it will display what is in the file - not much use on it's own but the cool stuff comes next. Try this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: #cc9933;"&gt;get-wmiobject win32_operatingsystem -computername (get-content c:\computers.txt) &amp;#124; select __server,localdatetime&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;My "computers.txt" file just contains a list of computers names. This one line of script will come back to you and tell you the name of the computer (__server) and the time and date on that computer (localdatetime). That's just 2 of many options you can select. Try&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span style="color: #cc9933;"&gt;get-wmiobject win32_operatingsystem &amp;#124; get-member&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;"Get-wmiobject -list" will give you a list of all wmiobject classes available. Your most likely to start looking at win32_operatingsystem and win32_bios.&lt;br /&gt;If you are looking for a specific object like one related to bios type "get-wmiobject -list *bios*" and it will list only those objects with bios in the name.&lt;br /&gt;Remember that if you use the -computer (get-content &lt;path&gt;) then you can pull in the list of computers you wish to audit.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Importing from CSV files:&lt;/em&gt;&lt;br /&gt;For starters just type "import-csv &lt;path&gt;". The import-csv command on it's own will simply dump the file to screen and by default it will show it in a list format. it can also be viewed in a table like how it would apear in excel. Try:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span style="color: #cc9933;"&gt;Import-Csv c:\Book1.csv &amp;#124; format-table&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;This, like the "get-content &lt;path&gt;" command on it's own, isn't much use without extra options to go with it. So how can a csv file be of use?&lt;br /&gt;As a system admin I can make use of csv files as a way of creating users (I will go into detail in a future blog) in Active Directory. Other uses might will also be covered in future posts as examples come up (yes that does mean I can’t think other other uses atm).&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Can I only import?&lt;/em&gt;&lt;br /&gt;No… a useful cmdlet is “export-csv &amp;lt;path\file.csv&amp;gt;” and “out-file &amp;lt;path\file.txt&amp;gt;” Try:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: #cc9933;"&gt;get-help &amp;#124; out-file c:\pwrshell_help.txt&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc9933;"&gt;notepad.exe c:\pwrshell_help.txt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc9933;"&gt;get-process &amp;#124; export-csv c:\processes.csv&lt;br /&gt;import-csv C:\processes.csv format-table&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;You can also import and output to html and xml files.&lt;br /&gt;&lt;br /&gt;If you stick with me on this blog then you will see many more examples when I get more in-depth into powershell.&lt;br /&gt;&lt;br /&gt;Thanks for reading,&lt;br /&gt;Dave.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-697122497901036851?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/697122497901036851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/working-with-txt-and-csv-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/697122497901036851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/697122497901036851'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/working-with-txt-and-csv-files.html' title='Working With Txt and Csv files.'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3226004193471051236.post-1293520970446534379</id><published>2010-01-10T17:42:00.006Z</published><updated>2010-04-10T10:41:03.626+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Getting started with Powershell'/><title type='text'>First Post of Learn-Powershell</title><content type='html'>Welcome to my first post on my Powershell Blog. I am currently in the process of learning powershell.  &lt;br /&gt;&lt;br /&gt;In this first blog I will explain the basics of powershell including how to get it.  &lt;br /&gt;&lt;br /&gt;&lt;em&gt;How to get Powershell&lt;/em&gt;  &lt;br /&gt;The First thing to note is at time of writing the current version of powershell is version 2.0 which ships with Windows server 2008 R2 and Windows 7. For other operating systems it is download able as part of the Microsoft Windows Management Framework from &lt;a href="http://support.microsoft.com/kb/968929"&gt;http://support.microsoft.com/kb/968929&lt;/a&gt; or by searching the web for "Microsoft Management Framework". If you search for "Powershell 2.0" then you will find the CTP (Pre-Release) version.  &lt;br /&gt;&lt;br /&gt;&lt;em&gt;What is Powershell?&lt;/em&gt;  &lt;br /&gt;Powershell is a (fairly) new scripting and command prompt environment for managing windows clients; servers; server functions such as Exchange 2007 and later; SQL Server 2008 and later; and Microsoft's System Center tools such as Virtual Machine Manager. It is also being used by 3rd party companies like VMware in ESX server.  &lt;br /&gt;&lt;br /&gt;The eventual aim is for administrators to know powershell and then everything can be done through powershell either in the command line or through scripts (*.ps1 files) which are command line inputs but made to run in an automated way to save typing and allow for scheduling. (&lt;em&gt;If you are used to scripting using *.BAT files then you will understand the similarity with the powershell command line and how to script for it as its similar to that of the relationship between the classic windows command prompt and batch files&lt;/em&gt;.)  &lt;br /&gt;&lt;br /&gt;&lt;em&gt;Where do I start?&lt;/em&gt;  &lt;br /&gt;&lt;ul&gt;&lt;li&gt;First place to start is by installing it and get a shortcut to it somewhere accessible - you will want to spend lots of time using it. The best way to start to know what powershell can do is to use it. From now on if you want to use command prompt, don't, open powershell. All you want to do in command prompt is abalible from powershell and generally with the same command names as an alias of the powershell name. (ie. Set-Location uses the more familiar cd or chdir command found in windows and Linux).&lt;/li&gt;&lt;li&gt;Once you are started using powershell for your basic day-to-day tasks like ipconfig, file management, etc. you can work your way onto the new powershell commands. These are always formatted in verb-noun. A couple to get you started are Get-Command and Get-Help. A useful feature of V2 is tab completion, start writing a command, hit tab until you find the one you want, if you overshoot then shift + tab will take you back up. Try typing get-comm and hitting tab - it will give you the get-command option. The more you give it the more refined the ablible commands you tab through will be. To find out the availible verbs just type verb.&lt;/li&gt;&lt;li&gt;Now you have the hang of using powershell as a replacement for command prompt then you can try writing scripts. There are many ways you can write and edit scripts. You can use your basic text editor such as Notepad.exe or a more scripting focused text editor like notepad++. Personally I am finding the Windows Powershell ISE (Intergrated Scripting Environment) very useful as you can select sections of text and run that or run the whole thing from the one window and imidiately see the output. There are lots of ISE's avalible but this is a good one to start on as it's free and downloads with PowershellV2.&lt;/li&gt;&lt;li&gt;To allow scripts to run after you first install you'll be required to input the command "Set-ExecutionPolicy" hit enter and it will ask you to supply the value: The recommended option is "RemoteSigned". To read more on this option type "help Set-ExecutionPolicy".&lt;/li&gt;&lt;li&gt;The final getting started tip for this blog is Get-Member. Get-Member will help you know what you want to use in your command. To use it simply type the command you want to use and follow it with the pipe symbol ( | found above the \ key)and get-command like this: "Import-Csv | &lt;path&gt;Get-Member" will tell your what methods are avalible and what NoteProperties (field Names) are ablible for that file.&lt;/path&gt;&lt;/li&gt;&lt;/ul&gt;&lt;em&gt;Where can I find out more?&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;There are many places to go to find out more of what to do with powershell. I will be continuing this blog as I go through my travels of learning powershell and hopefully pass something useful on like this.&lt;br /&gt;Other places I would recommend to go include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://powerscripting.net/"&gt;http://powerscripting.net/&lt;/a&gt; and listen to the podcasts and read the blogs of Jonathan Walz &amp;amp; Hal Rottenberg.&lt;/li&gt;&lt;li&gt;&lt;a href="http://get-scripting.blogspot.com/"&gt;http://get-scripting.blogspot.com/&lt;/a&gt; and listen to the podcasts and read the blogs of Jonathan Medd and Alan Renouf.&lt;/li&gt;&lt;li&gt;There are many Powershell people on twitter including the above few, also worth following ScriptingGuys, ASKTechNetUK, jamesoneill and others. There are places with lists of all powershell bloggers and microbloggers on the net and they are talked about in the get-scripting podcast.&lt;/li&gt;&lt;li&gt;From the Scripting Guy comes the scripting wife. &amp;nbsp;She's learning Powershell from the&amp;nbsp;beginning, follow her adventures here:&amp;nbsp;&lt;a href="http://blogs.technet.com/heyscriptingguy/archive/tags/Scripting+Wife/default.aspx"&gt;http://blogs.technet.com/heyscriptingguy/archive/tags/Scripting+Wife/default.aspx&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/magazine/default.aspx"&gt;http://technet.microsoft.com/en-us/magazine/default.aspx&lt;/a&gt; The Technet magazine has a column writted by Don Jones each month with I've found very useful so far.&lt;/li&gt;&lt;li&gt;Don Jones has also done some videocasts on using powershell for admin tasks: &lt;a href="http://www.idera.com/Promo/Practical-PowerShell/"&gt;http://www.idera.com/Promo/Practical-PowerShell/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-gb/scriptcenter/dd742419.aspx?ppud=4"&gt;http://technet.microsoft.com/en-gb/scriptcenter/dd742419.aspx?ppud=4&lt;/a&gt; There are many parts of the Microsoft Technet site worth looking at - go-explore.&lt;/li&gt;&lt;li&gt;&lt;a href="http://keithhill.spaces.live.com/blog/cns!5A8D2641E0963A97!6930.entry?ppud=4&amp;amp;wa=wsignin1.0&amp;amp;sa=553898797"&gt;http://keithhill.spaces.live.com/blog/cns!5A8D2641E0963A97!6930.entry?ppud=4&amp;amp;wa=wsignin1.0&amp;amp;sa=553898797&lt;/a&gt; a free ebook from Keith Hill – free is never a bad price to pay, check it out.&lt;/li&gt;&lt;li&gt;From Microsoft - Windows PowerShell Quick Reference Guide&amp;nbsp;&lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=df8ed469-9007-401c-85e7-46649a32d0e0&amp;amp;utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed:+MicrosoftDownloadCenter+(Microsoft+Download+Center)#tm"&gt;http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=df8ed469-9007-401c-85e7-46649a32d0e0&amp;amp;utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed:+MicrosoftDownloadCenter+(Microsoft+Download+Center)#tm&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;For now I hope I've got you started ok.&lt;br /&gt;Thanks for reading this blog and hope you enjoy learning powershell.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3226004193471051236-1293520970446534379?l=learn-powershell.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learn-powershell.blogspot.com/feeds/1293520970446534379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/first-blog-of-learn-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/1293520970446534379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3226004193471051236/posts/default/1293520970446534379'/><link rel='alternate' type='text/html' href='http://learn-powershell.blogspot.com/2010/01/first-blog-of-learn-powershell.html' title='First Post of Learn-Powershell'/><author><name>Dave Ackroyd</name><uri>http://www.blogger.com/profile/12660778296576407768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_229SFPX9ZyQ/SeDwU96_XLI/AAAAAAAAAAM/4WyScllIBuk/S220/Dave+Head.jpg'/></author><thr:total>0</thr:total></entry></feed>
