Jump to content

Change associated account access for multiple users simultaneously


Michael

Recommended Posts

Hi there,

Is there a way to change access/notification settings for multiple associated accounts at once (like a bulk select)?  I know I can bulk select machines, but this is still done at an individual account level.

When we have multiple users (set up for auditing purposes), whenever we add a new system we have to go through each account and grant them access to it.

Thanks again guys for all your work!

Link to comment
Share on other sites

  • Administrators

Hi Michael,

Unfortunately no, this is not possible at the moment. We're considering on adding a setting on an account association to allow you to specify the access level and notifications access by default for newly added systems.

-Paul

Link to comment
Share on other sites

  • 2 months later...

I threw together a Powershell script that queries and modifies the SQL database to do this. I'm pretty sure it could be done completely as a SQL query, but my SQL ability is pretty limited.

 

$sqlserver = 'localhost'
$database = 'pcmonitor'

$computeridentifiers = @(Invoke-Sqlcmd -ServerInstance $sqlserver -Database $database -Query "SELECT [identifier] FROM [pcmonitor].[dbo].[Computers] WHERE [accountId] =1 AND [active] =1;") | select-object -expand identifier
$useridentifiers = @(Invoke-Sqlcmd -ServerInstance $sqlserver -Database $database -Query "SELECT [id] FROM [pcmonitor].[dbo].[Accounts] WHERE [id] != 1 AND [active] =1;") | select-object -expand id

foreach ($useridentifier in $useridentifiers) {
    foreach ($computeridentifier in $computeridentifiers) {
        $computeridentifier
        Invoke-Sqlcmd -ServerInstance $sqlserver -Database $database -Query "IF NOT EXISTS (SELECT * FROM [pcmonitor].[dbo].[AssociatedAccounts] WHERE associatedAccountId = '$useridentifier' AND computerIdentifier like '$computeridentifier') INSERT INTO [pcmonitor].[dbo].[AssociatedAccounts] (primaryAccountId,computerIdentifier,associatedAccountId,readOnly,sendNotifications,version,active) VALUES (1,'$computeridentifier','$useridentifier',0,1,1,1)"
    }
  }

 

Link to comment
Share on other sites

  • Administrators

Thanks for your contribution. I'd like to add that if you're changing the associated accounts directly in the database you also need to reload the accounts you've touched or to recycle the IIS application pool.

-Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...