Skip to content

Command Line Usage

Chris edited this page Aug 6, 2022 · 11 revisions

Syntax

SharpSCCM.exe <server> <sitecode> [command] [options]

All commands and subcommands have a help page that is automatically generated using the System.CommandLine library. Help pages can be accessed by entering any SharpSCCM command followed by -h, --help, /h, /?, or -?. Required positional arguments are shown within angle brackets and options are shown within square brackets. SharpSCCM supports command line tab completion with dotnet-suggest. For more information, see https://github.com/dotnet/command-line-api/blob/main/docs/Features-overview.md.

Required Arguments

The server and sitecode arguments must be supplied, except when running the local subcommand.

  <server>    The FQDN or NetBIOS name of the Configuration Manager server to connect to
  <sitecode>  The site code of the Configuration Manager server (e.g., PS1)

Subcommands

  add     A group of commands that add objects to other objects (e.g., add device to collection)
  get     A group of commands that query certain objects and display their contents
  invoke  A group of commands that execute actions on the server
  local   A group of commands to interact with the local workstation/server
  new     A group of commands that create new objects on the server
  remove  A group of commands that deletes objects from the server

Examples

Gather Info from SCCM Clients

Get the primary Management Point and Site Code for the local host (needed to run additional commands against the server)

Requirements:

  • Medium integrity context (i.e., any user account) on a Windows SCCM client

Example Usage:

   SharpSCCM.exe local siteinfo

Example Output:

PS C:\Users\cave.johnson.APERTURE\SharpSCCM\bin\x64\Release> .\SharpSCCM.exe local siteinfo  
[+] Connecting to \\localhost\root\ccm  
[+] Executing WQL query: SELECT Name,CurrentManagementPoint FROM SMS_Authority  
-----------------------------------  
SMS_Authority  
-----------------------------------  
CurrentManagementPoint: atlas.aperture.sci  
Name: SMS:PS1  
-----------------------------------  

Clone this wiki locally