Posts

"SignTool Error: No private key is available" with Thales SafeNet Token

Image
When you're trying to digitally sign a file using the signtool.exe with a Thales SafeNet token you may see the following error This can occur when the password being passed to signtool is incorrect and if the password for the token has expired. Open the SafeNet Authentication Client, click the advanced settings "cog" icon. Right click the token and select "Log On to Token..." and enter your password. If the password has expired you will be prompted for a new password. The password can be passed in the command line for signtool.exe "D:\build\signtool.exe" sign /f " D:\PathTo\YourCert.cer " /tr http://timestamp.digicert.com /td sha256 /fd sha256 /csp "eToken Base Cryptographic Provider" /k "[{{ YourPassword }}]= containername " %1

SOLVED: UAC - Running Microsof Edge as "Run as Administrator" does not elevate and does not have administrator rights

Image
When you run Microsoft Edge as administrator by right clicking and selecting "Run as administrator" you find that the browser doesn't have administrator rights and has not elevated. Peforming the same action in Google Chrome does not have the issue. Viewing the process in Task Manager shows that the browser is not running elevated. The issue is caused because Microsoft automatically and silently  de-elevates the process when it's run as a safety precaution.  To prevent this from happening you can use the following parmeter command --do-not-de-elevate

SOLVED: Get the "connect as" credentials for an IIS web application using the "WebAdministration" PowerShell cmdlets Get-WebApplication

When using the WebAdministration PowerShell cmdlets Get-WebVirtualDirectory the username, password and other virtual directory information as expected. However when using the Get-WebApplication cmdlet these properties aren't available even though a web application is a virtual directory. If you look at the applicationHost.config file you'll see that the application in fact has a virtual directory (with path "/") associated with it.  This virtual directory has the additional information required. <application path="/TestApp" applicationPool="TestSite">    <virtualDirectory path="/" physicalPath="C:\TestApp" userName="administrator" password="[enc:AesProvider:B2sdfsd1213E98dV53cb5NfdZndNWvCUf/AekXE=:enc]" /> </application> To access this information get the "/" virtual directory from the collection property. $app = Get-WebApplication "TestApp" ; $app . Collection [ 0

SOLVED: The Get-IISAppPool PowerShell cmdlet returns the application pool password encrypted starting [enc:IISWASOnlyCngProvider

When you run the  Get-IISAppPool PowerShell cmdlet and try and view the password of the application pool you may see that the password looks like this: [enc:IISWASOnlyCngProvider:uQaGVt5rssdfPO129+N0iAJs3iE0d46qeDy34lnYeOvoMWrts9t+cwY7BgtBnYO+IINgGaPiz+19820knjdaf81ndafjsdfyHzmaF3Cgqg=:enc] To resolve the issue and view the plain text password simply right click the PowerShell console and select Run as Administrator .  When running as administrator the following command will display the application pool's password in plain text. (Get-IISAppPool -Name " name ").ProcessModel.Password

SOLVED: The IISAdministration cmdlets don't reflect changes made to a Microsoft IIS Server configuration

You might find that when you're running the IISAdministration cmdlets such as Get-IISAppPool that the cmdlets return out of date information that doesn't reflect the current configuration settings. To resolve the issue you need to run the Reset-IISServerManager to re-load the latest configuration. Reset-IISServerManager -Confirm:$false

SOLVED: Find web sites and applications using a Microsoft IIS server application pool using the IISAdministration PowerShell cmdlets

If you're using the IISAdministration PowerShell module you may want to find out what applications are in use by an application pool. (if you're using the older WebAdministration module I've written the solution here ). # Gets the names of the applications in the specified application pool. Function Get-ApplicationPoolApplicationNames {     [ CmdletBinding () ]      param (         [ Parameter () ]           [ System.Object ] $ApplicationPoolName      )      process      {         $applicationNames = New-Object System.Collections.Generic.List``1[System.String] ;           $webSites = Get-IISSite ;           foreach ( $webSite in $webSites )           {                     foreach ( $application in $webSite . Applications)                {                     if ( $application . ApplicationPoolName -eq $ApplicationPoolName )                     {                          if ( $application . Path -eq "/" )                          {               

SOLVED: Find web sites and applications using a Microsoft IIS server application pool using the WebAdministration PowerShell cmdlets

Image
If you're using the older WebAdministration PowerShell module for IIS you'll notice when browing application pools you'll see the applications in the pool. https://learn.microsoft.com/powershell/module/webadministration However when you try and get the applications property it's not there because it's provided as a formatted property. You can grab the code from inside the formatter however there is a simpler method by enumerating the web sites and applications - these can be returned in the format SiteName or SiteName\ApplicationName # Gets the names of the applications in the specified application pool. Function Get-ApplicationPoolApplicationNames {      [ CmdletBinding () ]      param (         [ Parameter () ]           [ System.Object ] $ApplicationPoolName     )      process      {           $applicationNames = New-Object System.Collections.Generic.List``1[System.String] ;           $webSites = Get-Website ;           foreach ( $webSite in $webSi