VBAからPowerShell実行

sPS1Path = "ファイル.ps1"

Call ExecPowerShell(sPS1Path)

' PowerShellの実行(Execコマンド使用バージョン)
Private Function ExecPowerShell(cmdStr As String) As String
 
    ' WshShellオブジェクト
    Dim oExec As Object
 
    ' Execコマンドで実行する
    '  -NoLogo                          著作権の見出しを出さない
    '  -ExecutionPolicy RemoteSigned    実行権限を設定
    '  -Command                         コマンド引数(これ以降にPowerShellのコマンドレット構文を記載)
    Set oExec = CreateObject("Wscript.shell").Exec("powershell -ExecutionPolicy Unrestricted -File " + cmdStr)
     
    ' ジョブが実行中(0)の間は、スリープしながら完了(1)まで待つ
    Do While oExec.Status = 0
        ' 100ミリ秒
        Sleep 100
    Loop
 
    ' 標準出力取得
    ExecPowerShell = oExec.StdOut.ReadAll
 
End Function