Browse by Tags

Tagged Content List
  • Blog Post: Same Command. Different Return Types.

    My command seems to behave differently depending on how many items were returned. This is something that the PowerShell Team hears from the community or our internal partners every couple of weeks. This blog post will explain when a Windows PowerShell command returns different types and offer some reasons...
  • Blog Post: Installing PowerShell on Vista/"Longhorn" Server

    1. I am new to PowerShell and would like to install it on my Vista machine. The following page http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx gives you links to various PowerShell downloads. Choose the one that best matches your operating system, platform...
  • Blog Post: Why Can’t I Pipe Format-Table to Export-Csv (and get something useful)?

    Ken's PowerShell blog has an entry Remote Services and PowerShell where he wrote a function to get services from a remote machine using WMI. He formatted the data using FT (format-table) and then went on to export the data to CSV. He pointed out that the following would NOT work rget-service remotemachinename...
  • Blog Post: Why isn’t “New-Object” aliased to “New”

    Alistair Young made a Note to Self : In a standard PowerShell installation, "new" is not an alias for "new-object". You added that. You should therefore know better that to make this kind of dumbass mistake. We talked about making "New" an alias to "New-Object" but decided against it in the end...
  • Blog Post: PowerShell Cheat Sheet Redux - the PDF version

    Attached is a PDF version of Ben Pearce's PowerShell Cheat Sheet. In the past I've encouraged everyone to speak up and complain if we were messing up or not giving you what you needed. I'm pleased to see that you have taken this to heart (seriously). Ben and every other Microsoft employee has been...
  • Blog Post: PowerShell Cheat Sheet

    Ben Pearce was gracious enough to put together a good looking PowerShell Cheat Sheet which I've included as an attachment to this blog post. By definition, a cheat sheet is incomplete so this contains the things that Ben has found to be the most import. I think you'll find it useful. Cheers! Jeffrey...
  • Blog Post: Windows PowerShell Exit Codes

    Windows PowerShell Exit Codes PSMDTAG:FAQ: How can my script control the PowerShell exit code? Answers: 1. A normal termination will set the exitcode to 0 2. An uncaught THROW will set the exitcode to 1 3. The EXIT statement will stop the process and set the exitcode to whatever is...
  • Blog Post: The Wonders of Date Math using Windows PowerShell

    Larry Hayden posted a query about dates at: http://techtasks.com/bookmarks/powershell/2006/09/interview-with-a-scripter-jeffrey-snover/ He has a script which gets all the Application Events that happened TODAY: ———————————————————— $today = [DateTime]::Today $Events = Get-Eventlog -New 1024 Application...
  • Blog Post: ErrorLevel equivalent

    PSMDTAG:FAQ: ErrorLevel - what is the PowerShell equivalent? In Cmd.exe, %ErrorLevel% is a builtin variable which indicates the success or failure of the last executable run. In PowerShell, we support: $? Contains True if last operation succeeded and False otherwise. And $LASTEXITCODE Contains...
  • Blog Post: DateTime Utility Functions

    I often want to find things that happened Today. For instance, which files got changed today. Windows PowerShell makes this easy to do but it can be a bit verbose and I do it a lot so I've added a function to my profile: IsToday. function isToday ([datetime]$date) {[datetime]::Now.Date -eq $date.Date...
  • Blog Post: BizTalk Server Applications: Get/Start/Stop

    Tomas Restrepo has a nice script for getting/starting/stoping BizTalk Server Applications at: ht tp://www.winterdom.com/weblog/2006/09/02/BTSResetWithPowerShell.aspx I like how readable it the script is. It is completely obvious what is going on. Compare that script with his original C# implementation...
  • Blog Post: Writing and Reading info from Serial Ports

    PSMDTAG:FAQ: How do I read/write data from a Serial Port? Writing to a Serial Port PS> [System.IO.Ports.SerialPort]::getportnames() COM3 PS> $port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one PS> $port.open() PS> $port.WriteLine("Hello world") PS> $port.Close() Reading...
  • Blog Post: Background "jobs" and PowerShell

    A lot of people have asked whegther Windows PowerShell can do UNIX job handling. The paraphrase an old management salesperson joke, "YES - YOU can do UNIX job handling with Windows PowerShell" (which means you have to do it yourself). Jim Truher shows you how in his latest blog entry: http://jtruher...
  • Blog Post: More Windows PowerShell Training Available

    Don Jones, of ScriptingAnswers.com, is holding two two-day classes on Windows administrative scripting in Chicago and Seattle this September. While the first day of each class will focus on advanced VBScript techniques, the second day will be entirely devoted to Windows PowerShell. No prior PowerShell...
  • Blog Post: Joel-On-Software on the power of a good language

    Joel Spolsky of Joel-On-Software fame, just posted a blog, "Can Your Programming Language Do This?" http://www.joelonsoftware.com/items/2006/08/01.html In this article, he drives home the point that when it comes to code: Maintainability, Readability, Abstraction == Good! He then points out how languages...
  • Blog Post: ScriptCenter EventLog Article

    ScriptCenter has a very good article exploring the use of Windows PowerShell to analyze your eventlogs. Check it out at: http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/get-eventlog.mspx PSMDTAG:CMDLET: Get-EventLog PSMDTAG:FAQ: EventLog - How do I find out what event logs exist...
  • Blog Post: Encoding Operations Knowledge

    One of the primary goals of Windows PowerShell is to encode operations knowledge. Consider the example of finding out what domain role a computer plays. If you look at the WMI class WIN32_COMPUTERSYSTEM, you'll see that it tells you this information: PS> Get-WMiObject Win32_computerSystem |fl dom...
  • Blog Post: Why do I sometimes get different types?

    PSMDTAG:FAQ: Why do I sometimes get different types or different behaviors? PSMDTAG:FAQ: When I pipe a heterogenous set of objects to an cmdlet that expects a homogenous stream - what happens and why? In our newgroup ( Microsoft.public.Windows.PowerShell ), Alex A asked these questions with the...
  • Blog Post: Suppressing return values in PowerShell functions

    PSMDTAG:FAQ: How do I supress return values in PowerShell functions? This was asked in a newgroup with the clarification: What I mean is: When you call a function Foo that returns a bool, PS will write 'True' or 'False' to the screenby default. Is there anyway to get it to stop writing those...
  • Blog Post: Casting a scriptblock to an arbitrary delegate signature

    Arild asked the following in http://arildf.spaces.msn.com/blog/cns!E99F8B43533149B0!140.entry?_c%3dBlogPart : PSMDTAG:FAQ: Delegates - how to cast a scriptblock to an arbitrary delegate signature? ANSWER - You can't in V1.0. In version 1.0 Windows PowerShell only supports casting scriptblocks to...
  • Blog Post: Issues with Windows PowerShell syntax

    REI recently posted some comments/requests about Windows PowerShell syntax at: http://blogs.msdn.com/powershell/archive/2006/04/25/583273.aspx#675133 Let's go through a few of the points. ...the syntax was just way too cryptic and unintuitive. Often it's even dangerous. Like this: #PowerShell...
  • Blog Post: Setting the console title to be your current working directory

    jmanning wrote: Also, given how common the request is, I'd ask Jeffrey to (pretty-please) also include in this post a prompt function that sets the title to include pwd. Ask and yea shall receive: function Prompt { $host.ui.RawUI.WindowTitle = $(get-location) "PS> " } If you want to...
  • Blog Post: How to I set the title of my Console Window?

    PSMDTAG:FAQ: H ow do I set the title of my console window? ANSWER: $Host.UI.RawUI.WindowTitle = "PowerShell ROCKS" Jeffrey Snover [MSFT] Windows PowerShell/Aspen Architect Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http...
  • Blog Post: Exchange Management Shell

    Here is a pointer to an Introduction To the Exchange Management Shell: http://download.microsoft.com/download/6/d/4/6d4b5c51-dd72-41d3-b5b1-9dc22b1d35f1/IntroExchangeMgmtShell.pdf This is a nice glossy view of the important aspects of both Windows PowerShell and Exchange's use of it. PSMDTAG:FAQ...
  • Blog Post: PSMDTAG:FAQ: What is $OFS

    In my blog entry regarding Cascading Type Casts ( http://blogs.msdn.com/powershell/archive/2006/07/15/Cascading_Type_Casts.aspx ) there was an example: PS> [string][char[]][int[]][char[]]"PowerShell" P o w e r S h e l l And in a comment was a question asking why there were spaces between the...
Page 1 of 3 (60 items) 123