Skip to content

Instantly share code, notes, and snippets.

<#
More about Feedly API - #The feedly Cloud API - https://developer.feedly.com/
What are the differences with a regular access token?
A developer access token has a longer life than a regular access token: it expire after 30 days (instead of one week).
It can be renewed by feedly pro accounts. It is limited to 250 API requests per day
#>
######################### Global variable #######################################
try
{
Get-Function
}
catch
{
$_.Exception.Message
}
try
{
Get-Item E:\File
}
catch
{
$_.Exception.Message
}
try
{
Get-Item -Path F:\file, D:\temp -ErrorAction Stop
}
catch
{
Write-Warning $_.Exception.Message
}
finally
{
$oldErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = 'Stop'
try
{
Get-Item -Path F:\file, D:\temp
}
catch{
Write-Warning $_.Exception.Message -ForegroundColor Yellow
}
$Error.Clear()
Get-Item -Path F:\file, D:\temp -ErrorAction SilentlyContinue
if(-not $?)
{
Write-Warning $Error[0].Exception.Message
}
$Error.Clear()
$oldErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
Get-Item -Path F:\file, D:\temp
if(-not $?)
{
Write-Warning $Error[0].Exception.Message
}
$ErrorActionPreference = $oldErrorActionPreference
try
{
Get-ItemFile
}
catch{
Write-Host $_.Exception.Message
}
finally
{
Write-Host "koniec przykładu ..."
function Test-Trap {
trap {"Error found: $_"}
$WebSite = Invoke-WebRequest -Uri "https://google.tv" -TimeoutSec 5
Write-Output $WebSite.StatusDescription
}
Test-Trap
powercfg /list
<#
Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Zr˘wnowaľony) *
Power Scheme GUID: 64e503f0-b342-49a3-be71-aea540101d3f (Zegary wyˆĄczone (prezentacja))
Power Scheme GUID: 94334198-5f41-42e4-b4b5-6732b7e13386 (Samolotowy)
#>
$PowerSchemeGUID = "381b4222-f694-41f0-9685-ff5bb260df2e"