I'm running below lines in VBA in Access
cmd = "powershell -ExecutionPolicy Bypass -Command ""&{. 'C:\Users\chb8wz\Desktop\users.ps1';countLines -logFile '" & fname & "'}"""
Shell cmd
The script "users.ps1" returns the value of number of user from particular OU:
$Users = (Get-ADUser -Filter * -SearchBase "ou=Useraccounts").count
How can I save the value of users (e.g powershell returns 200) to a variable in VBA?