Contents tagged with powershell

  • Overriding Inheritance for IIS 6.0 Virtual Directories

    If you have an IIS site that has a mixture of ASP.NET 1.1 and 2.0 virtual directories below it, changing the root site ASP.NET settings could affect the virtual directory ASP.NET settings as well since IIS inherits except for explicit overrides. This little PowerShell script will take each setting and persist it to the virtual directory so you are able to freely change the root site settings without affecting the applications below it.

  • ASP.NET PowerShell Runspace Control

    This is just a little concept project I am working on so I can run PowerShell scripts within my ASP.NET applications. As I am a server administrator, I love PowerShell + WMI, and bringing this power into ASP.NET my automation capabilities are being greatly simplified. I'll build on this solution as I play around with actually implementing this as a primary source of automation from support a Windows Server environment.

  • PowerShell: Keeping Secrets for Batch Scripts

    As a system administrator, I write a lot of utility scripts, and I love using PowerShell. However, I cannot always use the local scheduler with a service account to run a script, sometimes I have to provide a username and password to an application or service. I hate storing them in plaintext, and while I don't fully like storing the encrypted text, key, and IV in the script, it is one step better than the plaintext solution. While the ultimate solution would be to have it stored as part of the user profile for the job, this is an issue when I don't have direct access to the production system to be able to run as the service account and I just need an encrypted file / text to later decrypt and use.

  • PowerShell: Adding the Using Statement

    So, I happened to come across a need for the using statement from C#. I basically didn't want to use Try...Finally when I am so used to the short-hand using statement. Thank goodness I already have a Try..Catch..Finally statement/function for PowerShell, I can just use that existing framework and make a using statement/function pretty easily.

  • PowerShell: Threading Enhancements FTW!

    To build on the threading library I mentioned here, I've added some functionality to make it easier to communicate with the seperate thread. Still, keep in mind that PowerShell will only allow one pipeline to be executing in a runspace at any given time. So, these new functions can only be used while the thread is inactive. But, they provide power into setting up the thread to be run and communicating with the original runspace.

  • PowerShell: Threading for PowerShell v1.0

    Ok, so this solution really isn't threading, but a neat way to get async scripts to run! The important thing to remember is that each "thread" is actually a PowerShell "runspace". Meaning, scripts run within the thread don't have access to objects or functions defined outside the thread. The script is composed of the following commands: