Powershell
【Powershell】関数を引数として渡す
· ☕ 1 分で読めます
Photo by Alan Cabello from Pexels Powershellで関数を引数として渡す 方法1 関数を定義して、引数として渡すときに$funtion:<関数名>としてやる 受け取った側は$func.Invoke(引数)で実行可能 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 function Square($n) { $n * $n } function Cube($n) { $n * $n * $n } function InvokeFunc($f) { $f.Invoke(3) } echo "Funtion: Square" InvokeFunc($function:Square) # Output:9 echo

【Powershell】SecureStringの暗号化・復号化
· ☕ 2 分で読めます
Photo by Pixabay from Pexels Windowsで自動化を考えるとき、 やっぱりPowershellが圧倒的に安定みたい。 Powershellでなんでもできる Powershellで認証 で、Powershellで認証を扱うときには クレデンシャルオブジェクトを作って使いますね。 ユーザー名とパスワードを含むオブジェクトです。 $password = ConvertTo-SecureString