So I'm trying to create a workbook that will pull down all info from AzureAD using powershell.(C:\Script\VBA Testing\ExportOffice365UsersAndGroups.ps1)
and then send commands to powershell and run them.
I've thought of different ways such as creating a ps1 file:
strpath = "C:\Script\VBA Testing\"
Set oFile = fso.CreateTextFile(strpath & "Testing.ps1")
oFile.WRiteline "Connect-AzureAD"
oFile.Close
then just running it to creating a batch file that will run the script after creating it as running powershell scripts seem to be hard.
I am able to start powershell and run the command but the issue is that for some reason its not noticing the modules i have run.
"Powershell -noexit -File ""C:\Script\VBA Testing\Testing.ps1"""
just returns that the module AzureAD does not exist but if i just start powershell and try it, it works fine.
Same if i set it to run from C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Anyone have any bright ideas that might help me?
Pretty much I just need it to do Connect-AzureAD then run a few lines.. What im thinking is that every change i do will update the ps1 file and in the end i press a button and that will run the entire script.
A lot of users are running 32bit excel so need something that will check if its running 32bit and if so, run powershell 64bit instead of 32bit.