I needed to delete a Glacier vault, which (because it’s not empty) needs the use of an SDK or the CLI. Since I’m using
Windows, I figured that I might as well take the opportunity to play with the AWS Tools for PowerShell.
         
        » read more
    
    
    
        
        
        
            The documentation is for Java, and mentions the PKCS10CertificationRequest class.
         
        » read more
    
    
    
        
        
        
            I was attempting to convert some Java code that uses Bouncy Castle into the
equivalent PowerShell. The Java code was using the PKCS10CertificationRequest class,
and I needed to see if there was an equivalent in the .NET libraries:
         
        » read more
    
    
    
        
        
        
            We had an issue at work last week where a web application was taking a little bit too long to start up, which was causing intermittent failures. We’d like the application to be always-running, so that this doesn’t happen.
         
        » read more
    
    
    
        
        
        
            How do we find out if there’s a worker process for an application pool? Note that there can be more than one worker process for each application pool. Note also that a worker process can host multiple web applications.
         
        » read more
    
    
    
        
        
        
            Again, this is more-or-less a direct port from the C# post.
         
        » read more
    
    
    
        
        
        
            Note: This is a bit long, because I want to take a moment to show some of the problems you might have using PowerShell to call .NET code that’s written in a certain style.
         
        » read more
    
    
    
        
        
        
            PowerShell has a really cool feature where it’ll coerce a string into an enum value. I’ll demonstrate by exporting a certificate from the Windows certificate store:
         
        » read more
    
    
    
        
        
        
            This is all just .NET reflection code, converted from C# to PowerShell, but it can be useful…
         
        » read more
    
    
    
        
        
        
        » read more
    
    
    
        
        
        
            
Prefer enum types over constants or properties
        
        » read more
    
    
    
        
        
        
            Attempting to use Add-Type to load a .NET assembly in PowerShell this afternoon, I got the following error:
         
        » read more
    
    
    
        
        
        
            Attempting to use Add-Type to load a .NET assembly in PowerShell this afternoon, I got the following error:
         
        » read more
    
    
    
        
        
        
            $certs = Get-ChildItem cert:\LocalMachine\My | where { $_.Subject –like 'CN=Victim*' }
foreach ($cert in $certs) {
    $store = Get-Item $cert.PSParentPath
    $store.Open('ReadWrite')
    $store.Remove($cert)
    $store.Close()
}
 
         
        » read more
    
    
    
        
        
        
            ```powershell
Create a script block. It doesn’t capture $x.
$x = ‘A’
$sb = { Write-Host $x }
         
        » read more
    
    
    
        
        
        
            Some programs write their output in different colours. If they’re badly-behaved and don’t reset the colours when they’ve finished, your PowerShell console might be left with the wrong background or foreground colours.
         
        » read more
    
    
    
        
        
        
            I’ve been using PowerShell as a better Command Prompt for a while now. Increasingly, however, it’s one of the first
tools I reach for when I come across a problem, rather than being an afterthought.
         
        » read more
    
    
    
        
        
        
            There’s probably a better way to do this, but here’s what I came up with in a couple of minutes…
         
        » read more