Mass Delete Users

Is there a way to use the import CSV option to delete users instead? Or any way to delete users en mass? 

  • Hello Goliath_Of_Cedar

    You want to have a look at the Orion SDK - https://github.com/solarwinds/OrionSDK
    First you'll need to download the SDK and set it up, you'll find instructions on the site.
    The SWQL Studio is included with the SDK, well worth getting familiar with it.


    Then you can select the accounts you want using a SWQL query, for an example all user accounts starting with 'admin':

        SELECT Uri FROM Orion.Accounts WHERE AccountID LIKE 'admin%'
     
    This creates an list of the Account Uris, which you can then loop through and use Remove-SwisObject to remove the accounts.

    ## Load the module
    Import-Module -Name SwisPowerShell
    
    ## Orion connection details
    $SwisParams = @{
        Hostname = '<insert Orion hostname>';
        Username = '<user name>';
        Password = '<password>';
    }
    ## Create the connection
    $swis = Connect-Swis @SwisParams
    
    ## Get the URIs of the accounts to delete
    $uris = Get-SwisData $swis "SELECT Uri FROM Orion.Accounts WHERE AccountID LIKE 'admin%'"
    
    ## Loop through the URIs and delete the accounts
    foreach($uri in $uris)
           { Remove-SwisObject $swis -Uri $uri }

    This code is not tested and please test it carefully before bulk deleting anything! 

  • Hi  , right now the only way to mass delete users is via the API (SWSD User API). How many users are you looking to delete/disable? Are you using something like Azure to provision the users? If so, it should be auto disabling or deleting the users based on their access via Azure.