Loading…

READY TO ROCK?

Click the button below to start exploring our website and learn more about our awesome company
Start exploring

[How-To] Powershell okienko – part 1

Enable / Disable Proxy + Restart IE and set-up Homepage

if ((Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyEnable | Select-Object ProxyEnable).ProxyEnable -eq 0)
{
Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyEnable -Value 1
$Message = "Proxy Enabled`n"
$Message = $Message + ((Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' | Select-Object ProxyServer).ProxyServer) + "`n"
}
else
{
Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyEnable -Value 0
$Message = "Proxy Disabled`n"
}
if ((get-process iexplore -erroraction silentlycontinue) -eq $null)
{}
else
{
Stop-Process -Name iexplore -PassThru
$Message = $Message + "`n- Restarting a browser.`n"

$IEStartPage = (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Internet Explorer\Main' -Name "Start Page" | Select-Object "Start Page").'Start Page'
$IEApp = New-Object -ComObject InternetExplorer.Application
$IEApp.Navigate("$IEStartPage")
$IEApp.Visible = $true

$Message = $Message + "`nHome page: " + $IEStartPage
}
Start-Sleep -seconds 2

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")
[Microsoft.VisualBasic.Interaction]::MsgBox("Status: $Message","OkOnly,Information", "Information")

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Facebook
  • LinkedIn
  • Twitter

Pridaj komentár

*

Táto webová stránka používa Akismet na redukciu spamu. Získajte viac informácií o tom, ako sú vaše údaje z komentárov spracovávané.