Up another PowerShell Tree

A few weeks ago I posted a PowerShell script that created a directory tree, like the TREE command from the CMD shell. Then while testing something new in PrimalForms, I realized I had a literal form object, a tree view, that I could use. So I put together a short script that creates a graphical tree for a given directory, along with the file counts and sizes from my original scripts. As a bonus, because I now had a graphical interface I could do things such as display empty folders in a different color. The script not only gives you a handy tool but also serves as a demonstration on how to use a TreeView control.

Read More

DEADLINE: PowerShell Special Forces Training

If you were considering taking part in the upcoming PowerShell Special Forces training in Boston, you’re time is rapidly running out.  Registration ends April 6th.  This will likely be the only public PowerShell training in the Northeast this year. Class size is limited so don’t miss out. Register at http://www.scriptingoutpost.com/p-81-special-forces-training-windows-powershell.aspx. I hope you’ll join me.

Read More

April One-Liner

Here’s another way to get disk utilization using your PSDrives. This is a one line command.  I’ve broken it up with the line continuation character. This only works locally, only queries PSDrives using the FileSystem provider and that have a value for the Used property. Get-PSDrive -PSProvider filesystem | where {$_.used} | select Root,@{name=”Size(GB)”;expression={($_.used+$_.free)/1GB -as […]

Read More

Out-CSV

Sometimes it’s the little things that can make life easier. Here’s one of them. We know that PowerShell treats comma separated items as an array:

PS C:\> $a=”a”,1,”b”,”jeff”,4

PS C:\> $a
a
1
b
jeff
4
PS C:\>

But what if you want back in its original comma delimited list? Or suppose you wanted to create a comma delimited line of all running services? Export-CSV isn’t really going to help in these situations. I came up with function called Out-CSV.

Read More

Get ServiceAccount Name with ADSI

One drawback to the service objects returned from Get-Service is that you can’t see what account the service is running under, often referred to as the service account. This will be something like LocalService or perhaps even a special user account like Mydomain\svcAccount123. You can retrieve this information by querying Windows Management Instrumentation (WMI) and the Win32_Service class. But did you know you can also use ADSI?

Read More

Sometimes all you need is an editor

System Administrator are a busy lot and some of them literally run around all day fighting fires on computers no longer connected to anything. Others use remote access to tend to a large number of servers. Or both. Thanks to scripting, most repetitive tasks are taken care of. But sometimes you need to double check […]

Read More

Microsoft Update PowerShell v1.0

After a lot of hard work on the PowerShell team’s part, Microsoft has finally made PowerShell v1.0 available as an optional download on Microsoft Update. It will likely only be detected if you have no other versions of Powershell already installed, this includes any CTP release. Obviously you must be running a supported operating system […]

Read More

PowerShell Tree

Of course since I’ve posted a VBScript version of the Tree command, I had to do it in PowerShell. On one hand, this would have been pretty straightforward since PowerShell can use COM objects and I could have simply reused the FileSystemObject. But that didn’t feel right. So I came up with a version that uses cmdlets and PowerShell features like the -f formatting operator. So here is TREE.PS1.

Read More

Registration for Intermediate PowerShell Ends soon

I’m in the middle of running our online PowerShell Fundamentals class. The Intermediate class starts April 6. Registration ends on March 30th, or until the class fills up. Class size is limited. You can register for the class at ScriptingOutpost.com.

This course covers intermediate topics such as error handling, debugging, regular expressions, advanced modularization techniques, advanced object manipulation, and much more. You’ll be a more refined and efficient administrator by leveraging more of PowerShell’s flexible and powerful capabilities.

Read More

Status Indicators with PowerShell and PolyMonRT

In my last Mr. Roboto column, I wrote about the open source project, PolyMonRT. I recently suggested it to someone as a solution, especially because PolyMonRT supports PowerShell as a provider. My friend wanted to use the status light indicator to show when a particular service was running or not. Basically Green is good and Red is not. It tool a little fiddling on my part but I came up with the process.

Read More

Search

Enter any query and press enter
Advanced search operators:
+ ⟶ Term must appear
- ⟶ Term must not appear
"" ⟶ Exact string must appear
How do I use these?

Join our mailing list

Enter your email address to subscribe to our mailing lists for Monthly Blog Digests, Product Announcements and more (you can choose which you receive once you sign-up!)

Tags

Categories

Archives

Dashboard