Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Problem executing Powershell from Excel VBA

$
0
0

I am writing a vba script to execute a Powershell Script multiple times, based on an active directory group.  When I open powershell  1.0 by itself (even not as administrator) I can run the script just fine.  However, if I open Powershell through the shell function in vba or by calling an object, powershell doesn't even recognize the script exists, nor the folder the script is in.

Any ideas?

strProgram = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned -noexit"
strFile = "&" & Chr(34) & "C:\Windows\System32\WindowsPowerShell\v1.0\Scripts\GetADCount.ps1" & Chr(34)

strCompleteName = strProgram & " " & strFile

Call Shell(strCompleteName, 1)


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>