I am one of those IT Pros who keeps close tabs on system resources. I like to know what is being used and by what. As you might imagine, a cmdlet like Get-Process, is pretty useful to me. One of the things I’m always checking is how much memory Google Chrome is taking. I don’t…
Tag: PowerShell
Friday Fun: The Measure of a Folder
Last week, I demonstrated how to measure a file with PowerShell. This week let’s go a step further and measure a folder. I’m going to continue to use Measure-Object although this time I will need to use it to measure numeric property values. Here’s the complete function after which I’ll point out a few key…
Add Logon As Service Right with PowerShell
I saw a comment on Twitter today about a limitation in PowerShell. Specifically the ability to grant the logon as a service right to a user account. Manually, if you use the Services management console and specify the user, Windows will automatically grant that right. But if you are trying to do this from a…
Another PowerShell Valentine
I’ve been sharing some Valentine’s Day themed fun on Twitter today. This one is a bit too long to fit into a tweet. $text = “Happy$([char]3)Valentine’s$([char]3)Day” $text.ToCharArray() | foreach -begin { $colors = “Cyan”,”Magenta”,”Yellow”,”White”,”Red”,”DarkRed”,”Green” } -process { write-host $_ -NoNewline -ForegroundColor ($colors| Get-Random)} -end {“`n”} To get the full effect you need to run in…
Friday Fun: The Measure of a File
I’ve been working with PowerShell since the days of Monad and have written a lot of PowerShell scripts. Out of idle curiosity, and the need for a Friday Fun topic, I decided to see how many lines of PowerShell I have written. Or at least that are in my Scripts folder. Turns out I have…
Get PowerShell Parameter Aliases
During a recent PowerShell training class we naturally covered aliases. An alias is simply an alternate name, often something that is shorter to type, or maybe even more meaningful. There are aliases for commands, properties and parameters. Discovering aliases for commands is pretty easy with Get-Alias. Property aliases are discoverable using Get-Member. But, discovering parameter…
Convert Text to Object with PowerShell and Regular Expressions
A few weeks ago I was getting more familiar with named captures in regular expressions. With a named capture, you can give your matches meaningful names which makes it easier to access specific captures. The capture is done by prefixing your regular expression pattern with a name. PS C:\> “UNC is \\server01\public” -match “\\\\(?<servername>\w+)\\(?<sharename>\w+)” True…
PowerShell Essentials Webinar
Tomorrow I will be presenting a day of PowerShell training via a series of webinars for Windows IT Pro magazine. I will be presenting 3 webinars, each about 1 hour in length. The first webinar is on the PowerShell syntax and shell. Basically, how to survive in the shell if you are beginner. The second…
Creating CIM Scripts without Scripting
When Windows 8 and Windows Server 2012 came out, along with PowerShell 3.0, we got our hands on some terrific technology in the form of the CIM cmdlets. Actually, we got much more than people realize. One of the reasons there was a big bump in the number of shipping modules and cmdlets was CDXML….
Your Future in PowerShell
I recently wrote an article that I hope will get you thinking about how PowerShell will affect your career, how it will be used and where you on the PowerShell career pipeline. Thanks in advance for taking a few minutes to read my article on the 4Sysops site and let me know what you think….
Friday Fun with REST, Regex and Replacements
I just love using the web cmdlets that were introduced in PowerShell 3.0. One of the cmdlets I use the most is Invoke-RESTMethod. This isn’t because I’m dealing with sites that offer REST-ful services, but rather I like that the cmdlet does all the heavy lifting for me when I point it to an RSS…
I Want PowerShell 4.0
I’ve been writing a bit about PowerShell 4.0 lately, especially on my Prof. PowerShell column. If you are running Windows 7 it isn’t too difficult to go to http://www.microsoft.com/en-us/download/details.aspx?id=40855 and download the Windows Management Framework 4 package. Remember you will also need version 4.5 of the .NET Framework. This will also apply to Windows Server…
PowerShell Deep Dive First Sales
Last year I had the pleasure of editing PowerShell Deep Dives, published by Manning. This book is a community project with chapters contributed from MVPs and leading members of the PowerShell community. You won’t find this content anywhere else. Anyway, I have the first royalty report from Q3 2013. Looks like we sold a little…
Updated PowerShell Script Profiler
Last year I wrote a sidebar for the Scripting Guy, Ed Wilson and an update to his PowerShell Best Practices book. I wrote a script using the new parser in PowerShell 3.0 to that would analyze a script and prepare a report showing what commands it would run, necessary parameters, and anything that might pose…