Option Explicit
'Option Private Module
Option Compare Text
Sub test()
Dim oShell As WshShell
Dim oExec As WshExec
Dim str As String
Dim strReturn As String
Dim strUserName as String
strUserName = "username_here"
str = "net user /DO " & strUserName
Set oShell = New WshShell
Set oExec = oShell.Exec("cmd.exe")
On Error Resume Next
oExec.StdIn.WriteLine (str)
oExec.StdIn.Close
strReturn = oExec.StdOut.ReadAll
Debug.Print strReturn
On Error GoTo 0
Err.Clear
If Not (oExec Is Nothing) Then Set oShell = Nothing
If Not (oShell Is Nothing) Then Set oShell = Nothing
strReturn = Split(strReturn, "Global Group memberships")(1)
strReturn = Split(strReturn, "The command")(0)
strReturn = Replace(strReturn, vbCrLf, "")
Dim arrSplit As Variant
arrSplit = Split(strReturn, "*")
Dim i As Long
For i = 0 To UBound(arrSplit)
ActiveSheet.Range("A1").Offset(i).Value = Trim(arrSplit(i))
Next i
End Sub