This file contains 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
$CSCode = @' | |
using System; | |
using System.Runtime.InteropServices; | |
public static class Security | |
{ | |
[StructLayoutAttribute(LayoutKind.Sequential)] | |
private struct SID_IDENTIFIER_AUTHORITY | |
{ | |
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] |
This file contains 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
$ErrorActionPreference = 'Stop' | |
$WarningPreference = 'Stop' | |
$Description = ('RestorePoint created by CRP task ({0})' -f [datetime]::Now.ToString('yyyy/MM/dd-hh:mm:ss')) | |
try { | |
Enable-ComputerRestore -Drive C:\ | |
Checkpoint-Computer -Description $Description | |
} | |
catch { | |
exit 0x80040205 #INTERNALEXCEPTION |
This file contains 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
<# ======================================================= | |
ストアアプリ再登録スクリプト 2019/07/12 | |
for Windows 10 64bit Version 1809 | |
======================================================= #> | |
$ErrorActionPreference = 'Continue' | |
$ProgressPreference = 'SilentlyContinue' | |
# Get all apps list | |
$Apps = Get-AppxPackage -ErrorAction Stop | |
This file contains 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
Param ( | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$NugetApiKey, | |
[Parameter(Mandatory = $false)] | |
[ValidateNotNullOrEmpty()] | |
[string[]]$ExcludeDirs = @('.git', '.vscode'), | |
[Parameter(Mandatory = $false)] |
This file contains 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
<# ++++++++++++++++++++++++++++++++++++++++++++++ | |
環境変数PATHから指定の値を削除する | |
+++++++++++++++++++++++++++++++++++++++++++++++++ #> | |
function Remove-EnvironmentPath { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory = $true, Position = 0)] | |
[string] $Path, # 削除する値 | |
[Parameter(Mandatory = $true, Position = 1)] |
This file contains 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
<# ++++++++++++++++++++++++++++++++++++++++++++++ | |
環境変数PATHの末尾に指定の値を追加する | |
+++++++++++++++++++++++++++++++++++++++++++++++++ #> | |
function Add-EnvironmentPath { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory = $true, Position = 0)] | |
[string] $Path, # 追加する値 | |
[Parameter(Mandatory = $true, Position = 1)] |
This file contains 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
# Original code | |
# https://stackoverflow.com/questions/39717230/powershell-class-implement-get-set-property | |
# This technique is so impressive! | |
class c { | |
hidden $_p = $($this | Add-Member ScriptProperty 'p' ` | |
{ | |
# get | |
"getter $($this._p)" | |
}` | |
{ |
This file contains 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
$PS32 = 'C:\Program Files (x86)\Adobe\Adobe Photoshop CC 2018 (32 Bit)\Photoshop.exe' | |
$PS64 = 'C:\Program Files\Adobe\Adobe Photoshop CC 2018\Photoshop.exe' | |
gci HKLM:\SOFTWARE\Classes | ? {$_.Name -match 'Photoshop'} | gci -Recurse | gp | ? {$_.'(default)'.contains($PS32)} | % { sp -Path $_.PSPath -Name '(default)' -Value $_.'(default)'.Replace($PS32,$PS64)} |
This file contains 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
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"> | |
<LayoutOptions StartTileGroupCellWidth="6" StartTileGroupsColumnCount="1" /> | |
<DefaultLayoutOverride> | |
<StartLayoutCollection> | |
<defaultlayout:StartLayout GroupCellWidth="6"> | |
<start:Group Name="ブラウザ"> | |
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Accessories\Internet Explorer.lnk" /> | |
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" /> | |
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk" |
This file contains 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
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"> | |
<LayoutOptions StartTileGroupCellWidth="6" StartTileGroupsColumnCount="1" /> | |
<DefaultLayoutOverride> | |
<StartLayoutCollection> | |
<defaultlayout:StartLayout GroupCellWidth="6"> | |
<start:Group Name="ブラウザ"> | |
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Accessories\Internet Explorer.lnk" /> | |
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" /> | |
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk" /> | |
<start:DesktopApplicationTile Size="2x2" Column="2" Row= |