This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code conversion from C# to PowerShell | |
# http://msdn.microsoft.com/en-us/library/windows/apps/hh802768.aspx | |
# nuget Windows 7 API Code Pack -Shell | |
# http://nugetmusthaves.com/Package/Windows7APICodePack-Shell | |
# Install-Package Windows7APICodePack-Shell | |
Add-Type -Path .\Microsoft.WindowsAPICodePack.dll | |
Add-Type -Path .\Microsoft.WindowsAPICodePack.Shell.dll | |
# create toast template TO xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DSC Push のサンプルとして、サーバー30台に対する DSC-Service のWindows 機能インストールを行う | |
configuration InstallDSCServiceCredential | |
{ | |
param | |
( | |
[PSCredential] | |
$credential | |
) | |
node $AllNodes.NodeName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ScreenShot | |
{ | |
[CmdletBinding()] | |
param( | |
[parameter(Position = 0, Mandatory = 0, ValueFromPipelinebyPropertyName = 1)] | |
[ValidateNotNullOrEmpty()] | |
[string]$OutPath = "$env:USERPROFILE\Documents\ScreenShot", | |
#screenshot_[yyyyMMdd_HHmmss_ffff].png | |
[parameter(Position = 1, Mandatory = 0, ValueFromPipelinebyPropertyName = 1)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter Show-LogoutputEX | |
{ | |
"[{0}][{1}][{2}]" -f ((Get-Date).ToString("yyyy/MM/dd HH:mm:ss")),$_[0], $_[1] | |
} | |
function Invoke-ScriptBlockEX ([scriptBlock]$scriptBlock, [string]$WhatDoing) | |
{ | |
begin | |
{ | |
$sw = New-Object System.Diagnostics.Stopwatch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get API Access https://console.developers.google.com/project/projectID/apiui/api?authuser=0 | |
$clientId = "INPUT CLIENT ID for API" | |
$clientSecret = "CLIENT SECRET for API" | |
#return to us locally not via a web server | |
$redirectUri = "urn:ietf:wg:oauth:2.0:oob" | |
$grantType = "authorization_code" | |
# change scope here, you can use oauth playground to find scopes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 3.0 | |
<# | |
.Synopsis | |
Get HostName to IPAddress Entry / IPAddress to HostName Entry | |
.DESCRIPTION | |
using Dns.GetHostEntryAsync Method. | |
You can skip Exception for none exist HostNameOrAddress result by adding -SkipException $true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
# Copy "All Directory Structure" and "File" which Extension type is .bat | |
Copy d:\GitHub\valentia -Destination d:\fuga -Force -Recurse -Filter "*.bat" | |
# Copy "All Directory Structure" and "File" which Extension type is .md | |
Copy d:\GitHub\valentia -Destination d:\fuga -Force -Recurse -Filter "*.md" | |
# If you want to exclude specific file to copy | |
Get-ChildItem -Path $Destination -Recurse -File | where Name -in Readme_J.md | Remove-Item -Recurse | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install (simple way) | |
# Write this code to "%USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1" | |
# Install (module way) | |
# Place this script to "%USERPROFILE\Documents\WindowsPowerShell\Modules\UseLayoutRounding\UseLayoutRounding.psm1" and | |
# write "Import-Module UseLayoutRounding" to Microsoft.PowerShellISE_profile.ps1 | |
Add-Type -TypeDefinition @" | |
using System; | |
using System.Collections.Generic; | |
using System.Reflection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$message = "font '{0}' found! Your environmet will trouble with MS14-045. See https://support.microsoft.com/kb/2982791" | |
$fontregistory = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\' | |
(Get-Item -Path $fontregistory).Property | % {(Get-ItemProperty -path $fontregistory).$_ | where {$_.EndsWith('.otf')} | where {Test-Path $_} | %{ Write-Host ($message -f $_) -ForegroundColor Red;return}} | |
Write-Host 'Your environment is OK.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Copy-ItemEX | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[parameter(Mandatory = 1, Position = 0, ValueFromPipeline = 1, ValueFromPipelineByPropertyName =1)] | |
[alias('PSParentPath')] | |
[string]$Path, | |
[parameter(Mandatory = 1, Position = 1, ValueFromPipelineByPropertyName =1)] |
OlderNewer