Powershell code
Sub Sample2()
Dim WSH, sCmd As String, Result As String, tmp, i As Long
Dim Result1 As Object
Set WSH = CreateObject("WScript.Shell")
sCmd = "ipconfig"
Set Result1 = CreateObject("Wscript.shell").Exec("powershell -NoLogo -ExecutionPolicy RemoteSigned -Command " & sCmd)
Do While Result1.Status = 0
DoEvents
Loop
Result = Result1.StdOut.ReadAll
tmp = Split(Result, vbCrLf)
For i = 0 To UBound(tmp)
Cells(i + 1, 1) = tmp(i)
Next i
Set Result1 = Nothing
Set WSH = Nothing
End Sub