New-GitHubOrganizationEnableOrDisableSecurityProductOnAllOrgRepos

SYNOPSIS

Enable or disable a security feature for an organization

SYNTAX

__AllParameterSets

New-GitHubOrganizationEnableOrDisableSecurityProductOnAllOrgRepos [-Org] <string>
 [-SecurityProduct] <string> [-Enablement] <string> [-QuerySuite <string>] [-Body <Object>]
 [-Accept <string>] [-WhatIf] [-Confirm]

ALIASES

This cmdlet has the following aliases,

  • Get-GHNewOrganizationEnableOrDisableSecurityProductOnAllOrgRepos

DESCRIPTION

The New-GitHubOrganizationEnableOrDisableSecurityProductOnAllOrgRepos cmdlet invokes the POST method of the /orgs/{org}/{security_product}/{enablement} endpoint (Enable or disable a security feature for an organization)

[!WARNING] Closing down notice: The ability to enable or disable a security feature for all eligible repositories in an organization is closing down. Please use code security configurations (https://docs.github.com/rest/code-security/configurations) instead. For more information, see the changelog (https://github.blog/changelog/2024-07-22-deprecation-of-api-endpoint-to-enable-or-disable-a-security-feature-for-an-organization/).

Enables or disables the specified security feature for all eligible repositories in an organization. For more information, see “Managing security managers in your organization (https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).”

The authenticated user must be an organization owner or be member of a team with the security manager role to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the ‘admin:org’, ‘write:org’, or ‘repo’ scopes to use this endpoint.

Endpoint: POST /orgs/{org}/{security_product}/{enablement} API version: 2026-03-10

EXAMPLES

EXAMPLE 1

New-GitHubOrganizationEnableOrDisableSecurityProductOnAllOrgRepos -Org 'github' -SecurityProduct 'dependency_graph' -Enablement 'enable_all'

Invokes POST /orgs/{org}/{security_product}/{enablement}

EXAMPLE 2

New-GitHubOrganizationEnableOrDisableSecurityProductOnAllOrgRepos -Org 'github' -SecurityProduct 'dependency_graph' -Enablement 'enable_all' -Body @{ query_suite = 'default' }

Sends the request body from a hashtable, parameters override the keys of -Body

PARAMETERS

-Accept

The Accept header (media type) of the request Default value: application/vnd.github+json

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Body

The whole request body as a hashtable or object. Keys that are also available as parameters are overwritten by the parameter values

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Enablement

The action to take.

‘enable_all’ means to enable the specified security feature for all repositories in the organization. ‘disable_all’ means to disable the specified security feature for all repositories in the organization.

Path parameter [ enablement ]

Allowed values: ‘enable_all’, ‘disable_all’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 2
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Org

The organization name. The name is not case sensitive.

Path parameter [ org ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-QuerySuite

CodeQL query suite to be used. If you specify the ‘query_suite’ parameter, the default setup will be configured with this query suite only on all repositories that didn’t have default setup already configured. It will not change the query suite on repositories that already have default setup configured. If you don’t specify any ‘query_suite’ in your request, the preferred query suite of the organization will be applied.

Body property [ query_suite ]

Allowed values: ‘default’, ‘extended’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SecurityProduct

The security feature to enable or disable.

Path parameter [ security_product ]

Allowed values: ‘dependency_graph’, ‘dependabot_alerts’, ‘dependabot_security_updates’, ‘advanced_security’, ‘code_scanning_default_setup’, ‘secret_scanning’, ‘secret_scanning_push_protection’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Objects with properties named like the path parameters can be piped to this function

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

OUTPUTS

The response of the GitHub API (objects

{{ Fill in the Description }}

NOTES

OperationId: orgs/enable-or-disable-security-product-on-all-org-repos Category: orgs / orgs Deprecated: this endpoint is deprecated by GitHub