Senin, 22 Februari 2016

PowerShell v3 Function Set IEStartPage

Another spin off of the Scripting Guys post,
Hey, Scripting Guy! How Can I Change My Internet Explorer Home Page?
gave me this function for setting the IE start page:
function Set-IEStartPage
{
       [CmdletBinding()]
       param(
             [String]
             $StartPage = about:Blank
       )
      
       if((Get-IEStartPage) -ne $StartPage)
       {
             Write-Verbose "$(Get-TimeStamp): Attempting to set IE start page to $StartPage.";
             Set-ItemProperty -Path HKCU:SoftwareMicrosoftInternet ExplorerMain -Name Start Page -Value $StartPage
            
             if((Get-IEStartPage) -ne $StartPage)
             {
                    Write-Error "$(Get-TimeStamp): The IE start page has not been set to $StartPage.";
             }
             elseif((Get-IEStartPage) -eq $StartPage)
             {
                    Write-Verbose "$(Get-TimeStamp): The IE start page has been set to $StartPage.";
             }
       }
       else
       {
             Write-Verbose "$(Get-TimeStamp): The current IE Home Page already matches $StartPage.";
       }
}

lamsim

About lamsim

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :