#author("2021-11-15T03:42:56+00:00","default:k1rou","k1rou")
#author("2022-04-04T13:16:16+09:00","default:k1rou","k1rou")
*PowerShell とは [#d33f4a7b]
**PowerShell のIDE [#odf18b98]
-PowerShell ISE
*PowerShellの実行ポリシー [#c09c5f2b]
-実行ポリシーを確認
Get-ExecutionPolicy
-実行ポリシーを設定
Set-ExecutionPolicy
**実行ポリシーの種類 [#la224f5c]
-Restricted (デフォルト)
-AllSigned
-RemoteSigned
-Unrestricted
-Bypass
-Undefined
--https://www.atmarkit.co.jp/ait/articles/0805/16/news139.html
**スコープ [#ia8fa7f6]
-Set-ExecutionPolicy にScopeオプションとして指定する
-Scopeの種類
--Process
--CurrentUser
--LocalMachine
*PowerShell スクリプト [#gcbd5b64]
-スクリプトファイルのファイル名
--拡張子:.ps1
-スクリプトファイルの実行
--パス指定が必要
./<script-file.ps1>
--スクリプトの実行ポリシーの変更
Set-ExecutionPolicy RemoteSigned
*もろもろ [#f02b23ce]
-PowerShellのバージョン確認
$PSVersionTable
-PowerShell ISE
*便利な使い方 [#ad22e97b]
-Grep
Select-String -Pattern "<keyword-正規表現>" <file-name> | % {$_.ToString()} > <out-file-name>
-Diff(UTF-8)
$a=Get-Content -Encoding UTF8 <file-name1>
$b=Get-Content -Encoding UTF8 <file-name2>
Compare-Object $a $b
*関連サイト [#l35596dc]
-PowerShellスクリプティングの第一歩(後編)~
https://www.atmarkit.co.jp/ait/articles/0709/20/news125.html
-PowerShell 開発のための Visual Studio Code の使用~
https://docs.microsoft.com/ja-jp/powershell/scripting/components/vscode/using-vscode
*関連用語 [#a3c736df]
-[[.NET Framework]]
-[[ファイルレス攻撃]]