Define DynamicKeyword 'ExecTest'
Note: Don't copy&paste from following code. PowerShell SyntaxHighlighter remove some lines. Instead, use RAW view.
#Requires -Version 4.0
Set-StrictMode -Version Latest
function Get-EventLogError | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory,ParameterSetName="FromLastBootupTime")] | |
[switch] $FromLastBootupTime, | |
[Parameter(Mandatory,ParameterSetName="FromLastQueryTime")] | |
[switch] $FromLastQueryTime, | |
[Parameter(Mandatory,ParameterSetName="Range")] | |
[DateTime] $From, |
#Requires -Version 3 | |
#Credential file path | |
$script:CredentialsFile = Join-Path $env:TEMP "SavedCredentials\Credentials.xml" | |
function Set-SavedCredential() | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] |
#if ComputerName is not supplied. Connect to "internetbeacon.msedge.net" by default | |
Test-NetConnection | |
#Test ping(ICMP protocol) | |
Test-NetConnection "google.com" | |
#Ping with TraceRoute | |
Test-NetConnection "google.com" -TraceRoute | |
#Set Remote ComputerName |
PowerShell crash when calling ShowDialog for the second time. This error occurred when leaving PowerShell console for a long time(10-20 minutes)
#TODO:support for non serializable object(example:PSCustomObject) | |
function Out-HtmlView | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter()] | |
[int]$Depth = 2, | |
[Parameter(Mandatory,ValueFromPipeLine)] | |
$InputObject | |
) |
function Main | |
{ | |
#Execute Query(Note:Github Search API return up to 1000 results for each search.) | |
$results = Find-GitHubRepository -Filter "language:powershell+created:>=2013-12-01&sort=stars" -Verbose | |
#Show Results | |
Write-Host ("Total Repositry Count : {0}" -f $results.total_count) | |
Write-Host ("Returned Repository Count: {0}" -f $results.items.Count) | |
$selectedItems = $results.items | select name, description, html_url, fork | Out-GridView -OutputMode Multiple |