I want to write a VBA macro to execute the following DOS command (verified, works) by pressing a button in excel:
powershell.exe -command "Get-ADGroupMember -identity "Sec_Tc_RWaccess" -Recursive | Get-ADUser -Property userPrincipalName, Enabled| Select userPrincipalName, Enabled | Export-csv -path C:\temp\textfile.csv"
My idea was to use the function:
Shell (Program,WindowStyle)
but I don't manage to pass the arguments to powershell.exe
Programstring need to be doubled.