Quantcast
Channel: The Lonely Administrator » ScriptBlock
Browsing latest articles
Browse All 10 View Live

Friday Fun: Start-TypedDemo v2

Not too long ago I posted a function I wrote for doing PowerShell demonstrations. My goal was to simulate a live interactive demo but without the typing so I could focus on explaining and not typing....

View Article



ScriptBlocks On the Fly

I’m always preaching about writing PowerShell scripts and functions with reuse and modularization in mind. You should never have to write the same block of code twice. But what about in the shell...

View Article

Get Properties with Values

One of my nuisance issues when using WMI with Windows PowerShell, is that when looking at all properties I have to wade though many that have no value. I’d prefer to only view properties that have a...

View Article

The PowerShell Day Care: Building ScriptBlocks

Good morning kids and welcome to the PowerShell Day Care center. We offer a creative and nurturing environment for PowerShell professionals of all ages. Later there might even be juice and cookies. But...

View Article

Friday Fun What a CHAR!

Last week I posted a PowerShell snippet on Twitter. My original post piped an array of integers as [CHAR] type using an OFS. Don’t worry about that. As many people reminded me, it is much easier to use...

View Article


Re-Use PowerShell Scriptblocks

//Re-Use PowerShell Scriptblocks// I commented on a blog post today that showed how to use a hash table with Select-Object to format file sizes say as KB. dir $env:temp -rec | select...

View Article

Scripting with PSCredential

I see this question often: how can I pass a parameter value for a PSCredential that might be a credential object or it might be a user name? In the past I’ve used code like this: begin { Write-Verbose...

View Article

PowerShell Scripting with [ValidateScript]

The last few days we’ve been looking at parameter validation attributes you might use in a script of function. Yesterday I wrote about [ValidateRange] and demonstrated how you might use it. That...

View Article


Friday Fun: 13 More Scriptblocks

In celebration of Friday the 13th I thought I would offer up a menu of 13 more script blocks. If you missed the first course, you can find the original 13 scrptblocks here. I’m not going to spend a lot...

View Article


Skipping WMI System Properties in PowerShell

One of my favorite techniques when using WMI in PowerShell is to pipe an object to Select-Object and select all properties. Try this: get-wmiobject win32_bios | select * It works, but it also gets all...

View Article
Browsing latest articles
Browse All 10 View Live




Latest Images