Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CMD Command return partial output  #369

@idanmantin

Description

@idanmantin

I'm trying to run CMD command using the following code in order to execute the command: net user /domain <username> but I got partial output.

My Code:

import winrm

session = winrm.Session('remote_computer', auth=('username', 'password'))
result = session.run_cmd('net user /domain ', 'username')

print(result.std_out.decode())

Output for command net user /domain myuser using the python script:

The request will be processed at a domain controller for domain ad.keyconf.com.

Output for command net user /domain myuser locally on windows machine CMD:

The request will be processed at a domain controller for domain ad.keyconf.com.

User name                    myuser
Full Name
Comment
User's comment
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never

Password last set            2/15/2023 11:29:20 AM
Password expires             3/29/2023 11:29:20 AM
Password changeable          2/16/2023 11:29:20 AM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   2/14/2023 3:06:48 PM

Logon hours allowed          All

Local Group Memberships      *Remote Desktop Users
Global Group memberships     *Domain Users
The command completed successfully.
.
.
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions