PowerShell Team

PowerShell Team, PowerShell

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

Post by this author

Finding out what determines which properties are displayed

MoW, a Monad newsgroup regular, asked why only the Caption, Name and PeakUsage properties were displayed from the command “get-WMIObject Win32_PageFileUsage” while the output object had a lot more properties. I think it is worth it to explain in details how to find out which properties are displayed.First, I would look at which view ...

Verb-Noun vs Noun-Verb

Kurt asked the question "why not Noun-Verb vs Verb-Noun" in his post: http://blogs.msdn.com/monad/archive/2006/02/16/533522.aspx#574708 There are lots of answers to this some better than others.  Let me rattle off a couple of them: Jeffrey P. SnoverMonad Architect [Edit: Monad has now been renamed to Windows PowerShell. This script or ...

Comparative Examples in MSH and KSH

  Most shells (such as Windows CMD.EXE and the UNIX shells SH, KSH, CSH, and BASH) operate by executing a command or utility in a new process, and presenting the results (or errors) to the user as text. Text-based processing is the way in which system interaction is done with these shells. Over the years, a large number of text ...

Sunday morning drive with my hair on fire: Types/Community/Synthetic types/Democracy/Cool XML tricks

Exploring types is a pain! Monad provides Get-Member which makes it pretty nice to explore an OBJECT but if you want to explore that object's type, you have to use the capabilities of the System.RuntimeType class. Let me make that distinction a little clearer.  Imagine that I've got some xml:$x=[XML]"<a><b>TEST</b><a&...

A bit about Scriptblocks

When scripting with MSH one of the most useful things to know about are scriptblocks (lambda functions).  Scriptblocks are compiled bits of MSH script which you can pass around and invoke whenever you feel like it.  They turn out to be so useful that if you look at the cmdlets you’ll find a few that take scriptblocks (foreach-...

Monad portal in Script Center.

Most scripters are familar with Microsoft script center.  Script center now has a portal for Microsoft Command Shell.  You can access the portal at http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx -Arul Kumaravel [Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight ...

PINVOKE or accessing WIN32 APIs

In the very early days of Monad, we focused on a world where everyone would publish Cmdlets and providers.  Cmdlets and providers were designed around providing the best user experience.  They provide the right, high-level, task-oriented abstractions that users want while also providing the semantic benefits that ...

Using-Culture -Culture culture -Script {scriptblock}

One of the traditional challenges with scripting is dealing with different CULTURES.  Imagine the case where you are writing a script and you'll have to parse datetime string from different cultures.  If it was just one culture, you could set the process culture and be done with it.  Here is a function that allows you to...

Debugging Monad Scripts, Part 7 (Final): How Traps Work

Did your command or script fail and/or report an error?  We hope to have a proper script debugger in a future version, but until then, MSH has some handy features to help you figure out what went wrong.  In this series of blog entries, I will present some of those features.  Thanks to Jim Truher [MSFT], Bruce Payette [MSFT], ...

Debugging Monad Scripts, Part 6: Trace-Expression, Breakpoint Script

Did your command or script fail and/or report an error?  We hope to have a proper script debugger in a future version, but until then, MSH has some handy features to help you figure out what went wrong.  In this series of blog entries, I will present some of those features.  Thanks to Jim Truher [MSFT], Bruce Payette [MSFT], ...