Dwarfsoft [GPA]

Archive for July, 2012

PowerShell Profile and Global Functions

by on Jul.16, 2012, under Scripting, Work

So I came across an interesting problem today while trying to dynamically load Functions using a Load-Lib function. The issue was that Loading a Script within a function means that the functions defined within that File are only defined within the Scope of the loading function. The two ways around this are to Define every Function like:

Function Global:Load-Lib { ...

Personally, I wanted my script to be the same whether I was loading it as a Global Module, or locally within a Function. In order to get the behaviour I wanted I had to redefine the functions as Global dynamically. This idea would also resolve the other issue I had: Redefining functions did not seem to always overwrite or replace the existing function code.

(continue reading…)

Leave a Comment :, more...

PowerShell, Exchange 2010, and MPS Report Sanitization

by on Jul.13, 2012, under Uncategorized

I’ve spent a lot of time over the last couple of weeks buried in PowerShell scripting. Mostly PowerShell 1, but some VMWare PowerCLI and some Exchange 2010 PowerShell Scripting.

I look forward to posting up some code, particularly for performing some Post Server-Build tasks and rebuild tasks after some experience failing to get Exchange 2010 Setup /m:RecoverServer working (and having it remove all instances of the server from the AD Configuration).

Additionally, today I spent a lot of the day working on a script to Sanitize MPS Reports. So far I have a Powershell 1 script that can extract the entirety of the MPS Cab (Maintaining folder structure) and I’m on the way to getting regex to clean the files of any IP Addresses, Site info, AD Structure, and User Data. As I work for an Outsourcer to a Government Department, there are certain things we are and are not allowed to send to external sources… Having found very few Sanitization products available (and none that were flexible enough for my liking, although Notepad++ Regex Replacement on Folder was very close) I decided to write my own. Next week I hope to bring some scripts to the fore on this task.

(continue reading…)

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!