public class BasicTest { public static int Add(int a, int b) { return (a + b); } public int Multiply(int a, int b) { return (a * b); } } "@ Add-Type -TypeDefinition $Source # BasicTestクラスの静的メソッドを使う [BasicTest]::Add(4, 3) # もちろんインスタンスを生成することも可能 $BasicTestObject = New-Object BasicTest $BasicTestObject.Multiply(5, 2)
Windows 8, 8.1 Restricted (All undefined) Windows 10 Restricted (All undefined) Windows Server 2008 R2 Restricted (All undefined) Windows Server 2012 Restricted (All undefined) Windows Server 2012 R2 RemoteSigned (LocalMachine) Windows Server 2016 RemoteSigned (LocalMachine) Windows Server 2019 RemoteSigned (LocalMachine) PoweShell Core OS ポリシー (設定スコープ) Windows RemoteSigned (LocalMachine) Linux Unrestricted (All scopes) macOS Unrestricted (All scopes) 76 既定のポリシー