# Active Directory User Permissions

You need to create a user and add user to the following groups:

```markup
Event Log Readers
Remote Management Users
Performance Log Users
Performance Monitor Users
```

{% hint style="info" %}
For IIS monitoring User must have Administrative Privileges.
{% endhint %}

After you add the VirtualMetric user to the groups. You need to add this user to the following WMI Namespaces:

**WMI Security Permissions**

```markup
CIMV2
Hardware
LsiMr13 (Dell Hardware Only)
StandardCimv2
```

\
You can use the following script to add the user on computers you wish to add to VirtualMetric:<br>

| Script Name                     |                                                                                                                |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| VirtualMetric Permission Script | [Download](https://s3.eu-central-1.amazonaws.com/download.virtualmetric.com/VirtualMetricPermissionScript.zip) |

\
You need to update the DOMAIN\USER with the user you configured before. These permission will give access to get hardware data from the server :

```markup
    Set-WmiNamespaceSecurity root/cimv2 add DOMAIN\USER Enable,RemoteAccess
    Set-WmiNamespaceSecurity root/hardware add DOMAIN\USER Enable,RemoteAccess
    Set-WmiNamespaceSecurity root/standardcimv2 add DOMAIN\USER Enable,RemoteAccess
```

\
These permissions will allow to read Windows Service Status. You need to change USER to the username you created before:

{% code overflow="wrap" lineNumbers="true" %}

```markup
$sid = invoke-command -scriptblock {cmd.exe /c 'wmic useraccount where name="USER" get sid'} | where {$_ -ne "" -and $_ -notlike "SID*"}
```

{% endcode %}

To Read Security logs you need to give Read access to following key:

```markup
    HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Security
```

Inside the script update the User from the following line:

```markup
$idRef = [System.Security.Principal.NTAccount]("DOMAIN\USER")
```

**MSSQL Service Configuration**

If you want to use non-administrator user for VirtualMetric, you need to add the following changes for the user account in addition to Bare Metal permissions.\
\
You need to open CMD window to configure Security Descriptions for MSSQLSERVER Service. Type following command on CMD:

```markup
sc sdshow mssqlserver
```

<div align="left"><figure><img src="https://3741708824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhbshAPk7P4wdrLxisUn%2Fuploads%2FqMErsBr5NBOQAfm2dLq2%2Fimage.png?alt=media&#x26;token=0bdbc8ba-ddd8-4af5-8637-b53a84425a53" alt="" width="502"><figcaption></figcaption></figure></div>

You will see default security descriptor of the MSSQLSERVER Service.\
\
Add the following security descriptor to MSSQLSERVER security descriptions:

```markup
(A;;CCLCRPRCLO;;;AU)
```

Update the Security Description via following command:

{% code overflow="wrap" lineNumbers="true" %}

```markup
sc sdset MSSQLSERVER D:(A;;CCLCRPRCLO;;;AU)(A;;CCLCRPRC;;;IU)(A;;CCLCRPRC;;;SU)(A;;CCLCRPWPRC;;;SY)(A;;KA;;;BA)(A;;CC;;;AC)S:(AU;FA;KA;;;WD)(AU;OIIOFA;GA;;;WD)
```

{% endcode %}

<div align="left"><figure><img src="https://3741708824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhbshAPk7P4wdrLxisUn%2Fuploads%2F5Oo7TVBVJWhdPnuG9XSP%2Fimage.png?alt=media&#x26;token=9bb643a7-5c24-4d2b-b5a0-1214ba4a765d" alt="" width="502"><figcaption></figcaption></figure></div>

**SSMS User Configurations**

Using SSMS add user to Server Logins:

<div align="left"><figure><img src="https://3741708824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhbshAPk7P4wdrLxisUn%2Fuploads%2FRAu8IHW6WwbGR0EFYjFd%2Fimage.png?alt=media&#x26;token=60b5a42c-cfe5-4755-b5c4-038c61c4d100" alt=""><figcaption></figcaption></figure></div>

Choose user and click OK button:

<div align="left"><figure><img src="https://3741708824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhbshAPk7P4wdrLxisUn%2Fuploads%2FTS9RHphPeG7lZPDEci4C%2Fimage.png?alt=media&#x26;token=2be94421-f919-4c0b-a4f1-5c86b4eb2a65" alt="" width="520"><figcaption></figcaption></figure></div>

From Securables tab select Search and choose The Server selection.

<div align="left"><figure><img src="https://3741708824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhbshAPk7P4wdrLxisUn%2Fuploads%2F73E1aXIriwTAIQCCQ1ML%2Fimage.png?alt=media&#x26;token=7d68213b-2c2a-4410-896c-afdd84bee7d7" alt="" width="521"><figcaption></figcaption></figure></div>

And enable the following permissions:

**Login Securable Options**

```
Connect Any Database
View any database
View any definition
View server state
```

<div align="left"><figure><img src="https://3741708824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhbshAPk7P4wdrLxisUn%2Fuploads%2F3hAW0pV4nW0oVxrZStBL%2Fimage.png?alt=media&#x26;token=c51ba0ce-8d06-4c34-980f-e5f98c60878c" alt="" width="518"><figcaption></figcaption></figure></div>
