Skip to main content

Description

The admin module provides simulated command and control command line access to the SMS Provider’s AdminService API.

Requirements

  • Any (SMS Admins local group)

Usage

Commands

get_collection

Description

The get_collection module can pull data regarding a single collection or recover all configured collections from the site server. Each query is demonstrated in the example below.

Usage

get_collection Query for all (*) or single (id) collection(s)

Example

get_device

Description

The get_device command will query the site server for a provided hostname. If the request is the first time the host has been queried, the data is pulled from the API. Otherwise, the results are stored in a local database to avoid unnecessary queries.

Usage

get_device [hostname]

Example

get_lastlogon

Description

The get_lastlogon command will query the site for every client the provided user account was the last logged on user.

Usage

get_lastlogon [name]

Example

get_puser

Description

Query SCCM for any enrolled client where the supplied user account is configured as the primary user.

Usage

get_puser [username]

Example

get_user

Description

Query SCCM for details for a provided username. If the request is the first time the user has been queried, the data is pulled from the API. Otherwise, the results are stored in a local database to avoid unnecessary queries.

Usage

get_user [username]

Example

add_admin

Description

Add a provied account as a site server admin. This is useful for the scripts module where SCCM is configured to require a secondary account for script approval (default setting). The account type is not limited to a traditional user account and can be a machine.

Usage

add_admin [username] [sid]

Example

backdoor

Description

Replace the built-in CMPivot script stored in the site server database with a user supplied script. This command will not run unless a backup exists for the script to ensure the operator is able to undue/restore the backdoored script. Note: This is still a beta feature and not recommended to be used in production.

Usage

backdoor [/path/to/script]

Example

backup

Description

Performs a back up of the existing built-in CMPivot script. Required prior to any manipulation of the CMPivot script. Note: This is still a beta feature and not recommended to be used in production.

Usage

Example

delete_admin

Description

Remove a target administrator account from SCCM. Note: cannot be performed against itself.

Usage

Example

restore

Description

Restore a modified CMPivot script to its previous state. Note: This is still a beta feature and not recommended to be used in production.

Usage

Example

script

Description

Execute a provided PowerShell script on a target host. The script is intended to be self deleting from the remote host as well as from the site database. If the hierarchy is configured to require script approval (default) alternate credentials must be specified to approve the script. Alternate credentials can be obtained by using the add_admin command to add a secondary account as an administrator.

Usage

script [/path/to/script]

Examples

Script approval not required

Script approval required

Script execution fails
Exit and provide alternate approval credentials. Run script again.

show_admins

Description

Show the current SCCM admin accounts.

Usage

show_admins

Example

interact

Description

Sets the target device for command line interactions to a specified ResourceID. This setting must be configured prior to any remote enumeration or script execution.

Usage

interact [ResourceID]

Example

In the below example, the dp device is queried. In the result the 16777221 is returned. The operator can now interact with that device and configure the command line.

administrators

Description

Query the interactive device for members of the device’s local administrators group.

Usage

administrators

Example

cat

Description

Display the contents of a file on the interactive device. The command line must be configured with the path to the file contents directory. For example, if the file you want to display is in “C:\Windows\Temp”, you must issue a cd command to configure the command line with that file path in addition to the interactive device. NOTE: SCCM limits the result returned from scripts to 4KB. If the file size is larger it will be truncated or unreliable. Additionally, since scripts are used, you may need to supply alternate credentials. See scripts for more information.

Usage

cat [filename]

Example

cd

Description

Change directories on the command line. This is required for both the ls and cat commands.

Usage

cd [filepath]

Example

console_users

Description

Returns data detailing the users that have logged on

Usage

console_users

Example

disk

Description

List available disk drives and space on the interactive system

Usage

disk

Example

environment

Description

List environment variables from the interactive system

Usage

Example

ipconfig

Description

Run ipconfig on the interactive host and retrieve networking info.

Usage

ipconfig

Example

list_disk

Description

Lists available disk drives on the interactive system

Usage

list_disk

Example

ls

Description

Will list the contents of the current directory represented on the command line. Defaults to C:. You must issue a cd command to another known directory (i.e. cd C:\Users to list the contents of that Users directory and so on.

Usage

ls

Example

osinfo

Description

Query operating system and architecture info for the interactive device

Usage

Example

ps

Description

List current running processes for the interactive device

Usage

ps

Example

services

Description

List current running services on the interactive device

Usage

services

Example

sessions

Description

List active sessions on the interactive device

Usage

sessions

Example

shares

Description

List all available file shares on the interactive device

Usage

shares

Example

software

Description

List currently installed software on the interactive device

Usage

software

Example