I need a VBA function to return the description of AD groups.
Returning the value with Powershell would be easy:
Adgroup = "abc"
strCommand = "Powershell.exe [environment]::CurrentDirectory='C:\Windows\System32\WindowsPowerShell\v1.0'; start-job -ScriptBlock{Get-ADGroup -identity " & Adgroup & " -Properties Description | select Description | ft -HideTableHeaders} | wait-job | receive-job"
Set WshShell = CreateObject("WScript.Shell")
Set WshShellExec = WshShell.Exec(strCommand)
strOutput = WshShellExec.StdOut.ReadAll
Debug.Print strOutput
This code returns the correct output, however it has the downside of popping up the PS window.
I found a solution that can hide the PS window, however when I use it, the Antivirus software blocks the script. Since I do not want to mess with it, I need a different solution.
What would be a good non Powershell approach for this?