Archive for November, 2009


Ran into a case where I need to know if –Verbose had been passed in as a parameter to an advanced function today.  I initially thought I could simply do the following:

function Test
{

    [CmdletBinding()]
    param()
    if($Verbose)
    {
        $True
    }
    else
    {
        $False
    }
}

PS C:\Users\spowser> Test -Verbose
False

Hmmmm.  Ok.  Powershell doesn’t think –Verbose was used.  Has to be a way to get to the bound parameters.

Found this as the solution.

function Test
{

    [CmdletBinding()]
    param()
    if($PSBoundparameters["Verbose"].IsPresent)
    {
        $True
    }
    else
    {
        $False
    }
}

PS C:\Users\spowser> Test -Verbose
True

Much better 🙂

Hope this helps.

-Shane

WSUS Client Issues

 
Ran into the following error today on a Windows XP SP3 machine when trying to get Windows updates working.
 
"The Background Intelligent Transfer Service service terminated with service-specific error 2147500053 (0x80004015). "
 
Created the following script to fix it.
 
 
-Shane