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)