PowerShell for Developers Whether you’re working with an enterprise client with a global presence or building a tool that you want to share with the world, you may find yourself wanting to build support for multiple languages into your scripts. The Import-LocalizedData Cmdlet is a simple and powerful way to achieve this. I put up a pair of posts about my recent experience with a globalization effort and how we were able to get a lot of functionality with only a few lines of code.
Hello Powershell.org! This is the first time I’ve posted for anyone outside of my own powershell blog site PowerShellMasters.com and I just want to thank PowerShell.org for everything they do for our community. I think most of you would agree that this site is one of the best PowerShell sites out there today and I am grateful for the opportunity to reach so many PowerShell people. OK enough with the touchy-feely stuff. 🙂
Password policies are the best 😀 Sometimes they lead to account logouts when someone forgets to logout of a session somewhere on the network though. It might be the TS session they use once a quarter for reporting or maybe you know the feeling when you RDP to a server only to find that it is locked by 2 other admins who forgot to logoff when they left. (Off cause this never happens… we all use PowerShell…) Anyway, this had me searching for a user session somewhere on the network. The worst thing is when my own password expires. I hate when my account ends up being locked. Therefor I made it a rule to just check all servers before I change password. There are multiple ways to do this but of course I tend to go the PowerShell route.
On Wednesday, September 2nd at 2pm EDT (1pm CDT), I’ll be presenting the September TechSession Webinar for PowerShell.org. The topic for this month’s session is: “The Top 10 Considerations When Writing PowerShell Advanced Functions”.
Here’s what you can expect from my presentation:
There are lots of things to consider when writing an advanced function in PowerShell depending on what the function will be designed to accomplish, what operating system and PowerShell versions it will be written for, and who will be using it. During this session, PowerShell MVP Mike F Robbins will walk you through the top 10 items that he takes into consideration along with his thought process when creating advanced functions in PowerShell. We’ll briefly discuss comment based help, parameters, parameter validation, pipeline input, and error handling. This will NOT be a deep dive into any one of these topics as the focus of this session will be on writing advanced functions to maximize code reusability by minimizing static values. Prior experience with PowerShell is recommended.
Often I have had to check something against all servers or clients. A classic problem and every time I run into the it it’s time consuming and running the job multithreaded would be nice.
A few years back I found a nice little script for multithreading which I have been using quite often. Unfortunately this wasn’t a module. And I can’t remember where it came from. So this week I set my mind on recreating this as a module and to see if I can publish it on PowerShell Gallery.
Join us on Thursday, September 3rd when Maximo Trinidad
will be giving a talk called a “Creating a SQL Server Database Report with PowerShell”. As describe by Maximo: This is a deep dive on how to create a SQL Server report using PowerShell and SMO. At the same time, you will learn how to create and work with PowerShell objects, scriptblocks, formatting properties, and generating output results. We’ll be looking into creating a report to identify database properties irregularities. This will be a good start to help begin documenting your SQL Server on the network.
It’s no secret that Microsoft’s WebAdministration module isn’t universally loved. It’s functionality isn’t deep, and it doesn’t play well in the PowerShell pipeline. There are also a number of things in it that run really slowly, making bulk administration a pain.
Last week, Baris Caglar announced that Windows 10 contains a new IISAdministration module, which is a rough draft of what is hoped to be a final module in Windows Server 2016. If you use IIS, get hold of this and start testing so the team can get feedback. Note that this is a _feature of Windows 10; _I haven’t yet been able to test and see if file-copying it to another version of Windows will work or not (if you try, please post your results in a comment). The module seems to rely heavily on the IIS Administration .NET class, going so far as giving you easy access to an instance of it so you can code against it directly for whatever the module itself doesn’t offer.
Modularity and abstraction are a huge benefit in scripting and coding. Which of the following blocks of code are easier to understand?
$SQLConnection = New-Object System.Data.SqlClient.SQLConnection $SQLConnection.ConnectionString = 'Server=SqlServer1;Database=MyDB;Integrated Security=True;Connect Timeout=15' $cmd = New-Object system.Data.SqlClient.SqlCommand("SELECT * FROM Table1",$SQLConnection) $ds = New-Object system.Data.DataSet $da = New-Object system.Data.SqlClient.SqlDataAdapter($cmd) [void]$da.fill($ds) $SQLConnection.Close() $ds.Tables[0] Or…
# Invoke-Sqlcmd2 -ServerInstance SQLServer1 -Database MyDB -Query 'SELECT * FROM Table1' If you aren’t a masochist, the latter probably looks a bit nicer. Oh, and it offers other parameters, error handling, parameterized SQL queries, built in help, and other benefits the .NET code block misses.
Working with wifi I have often needed to do a survey of the surroundings, and therefor I loved that windows 7 (maybe even Vista) introduced more advanced netsh with wifi support.
There’s a lot of useful information but it might be nice to have a more graphical overview. The thing is that a text blob like this is not very handy to work with.

Some time late last year I heard a guy from the powershell team on the Powerscripting podcast talk about ConvertFrom-String and the new template based parsing. And it occurred to me that you can combine this with a simple powershell progress bar (write-progress) to give a visual representation of signal strength.
I’m back from Techmentor Redmond 2015 which was my first public speaking talk ever. It went great. I met a ton of great people and really enjoyed myself. When speaking to IT pros one of the questions I typically ask them is “Are you blogging or sharing your knowledge?”. 9 times out of 10 I get a big, fat no. Why? It’s because they feel like they have nothing to share. They feel like no one would be interested in their ho-hum, mundane life as an IT guy. I always followup that comment with “How do you know?” which ultimately results in a shrug. You don’t know that your life isn’t interesting and can teach others something. Why are you making the decision for others? You’ve acquired lots of knowledge in your career. Don’t be stingy! Share it!
As a personal challenge to you, I have a copy of Don Jones’ and Jeff Hicks’ Learn PowerShell Toolmaking in a Month of Lunches book. If you don’t have a blog today, start one. If you do and haven’t blogged in awhile, dust it off and start writing again. The first one to contact me on my blog Adam, The Automator with a link to their blog with at least 5 good posts will win the book. Don’t try to sneak those piddly little one paragraph posts by me just to get a free book! Minimum post length is 500 words.
You have nothing to lose but perhaps a few hours of your time and some further opportunities in your career. Give back and you will be rewarded.
P.S. Did you know I used to blog about selling used books on Amazon? Talk about a niche topic. At it’s peak it was getting over 1,000 readers/day. Now, don’t you think IT is just a wee bit bigger than that? If I can blog about selling used books and get 1,000 readers/day you can spend just an hour a week writing a blog post about your IT experiences and you will help more people than you think.