Thursday, 3 July 2025

Analysis Service in Power BI Report Server

 We couldn’t connect to the Analysis Services server. Make sure you’ve entered the connection string correctly... link

Tuesday, 1 July 2025

Setup PowerShell Universal Dashboard

# Run PowerShell as Administrator
Install-Module -Name UniversalDashboard.Community

# Check PowerShellGet version
Get-Module -Name PowerShellGet -ListAvailable

# If you do not have PowerShellGet version 2.0 or higher
Install-Module -Name PowerShellGet -Force

# Check PowerShellGet version
Get-Module -Name PowerShellGet -ListAvailable

# Delete old version of PowerShellGet
    # for x64
    Get-ChildItem -Path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet'
    Remove-Item -Path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1' -Recurse -Force


    # for x86
    Get-ChildItem -Path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet'
    Remove-Item -Path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1' -Recurse -Force


# Copy new version from x64 to x86
Copy-Item -Path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\' -Destination 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\'

# Copy new version from x86 to x64
Copy-Item -Path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\' -Destination 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\'

# Close the PowerShell session and reopen it
# Install the universal dashboard community module
# If you run into a command already available error, explicitly allow the new module to override the existing commands by using the -AllowClobber
Install-Module -Name UniversalDashboard.Community -AllowClobber

# Check
Get-Module UniversalDashboard.Community


Saturday, 22 February 2025

Activate Office Permanently

  • Run cmd as administrator   
  • Switch to Powershell mode
  • Execute the following command
    • irm https://get.activated.win | iex

Sunday, 29 December 2024

SQL: Generate a range of numbers

SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n
FROM 
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) tens(n),
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) hundreds(n),
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) thousands(n)
ORDER BY 1


Monday, 25 November 2024

SQL: Cannot execute as the database principal because the principal "dbo" does not exist

Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission. (Framework Microsoft SqlClient Data Provider):

  • Server Name: server_name or IP
  • Error Number: 15517
  • Severity: 16
  • State: 1
  • Line Number: 1

Resolution: ALTER AUTHORIZATION ON DATABASE::[YourDatabaseName] TO [sa];


Wednesday, 6 November 2024

SQL: Linked Server Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Sometimes when trying to access a linked server, you’d get an error saying “Login failed for user NT AUTHORITY\ANONYMOUS LOGON”. 

This happens because you’re connected using Windows authentication, and SQL Server fails to “forward” your credentials to the linked server.

To check if SQL is using Kerberos:

USE [master]
GO
SELECT      s.session_id, s.original_login_name, c.net_transport, c.auth_scheme, c.local_net_address, c.local_tcp_port, s.program_name
FROM sys.dm_exec_sessions s

LEFT OUTER JOIN sys.dm_exec_connections c on s.session_id = c.session_id
WHERE s.is_user_process = 1


To determine the authentication method of a connection, execute the following query:

SELECT net_transport, auth_scheme
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;


Validating Authentication Properties Used by Connections

USE [master]
GO
SELECT COUNT(auth_scheme) as sessions_count, net_transport, auth_scheme
FROM sys.dm_exec_connections
GROUP BY net_transport, auth_scheme

 

To resolve this:

  • Both SQL Servers and the Client must be in the same Domain
  • Both SQL Servers must be able to register SPNs (Service Principal names)


Sunday, 3 November 2024

SQL: Create user and grant read-only access to a database

1. Create the Login (if it doesn’t exist)
If the login for the user hasn’t been created at the SQL Server level, you need to create it. This example assumes the user is an SQL Server authentication user.

    USE [master];
    CREATE LOGIN [new_username] WITH PASSWORD = 'your_password';


2. Grant Access to the Database
Now, switch to the database you want to grant access to and create a user associated with the login.

    USE [your_database_name];
    CREATE USER [new_username] FOR LOGIN [new_username];


3. Add the User to the db_datareader Role
Finally, add the user to the db_datareader role to provide read-only access to the database.

    ALTER ROLE [db_datareader] ADD MEMBER [new_username];


Analysis Service in Power BI Report Server

 We couldn’t connect to the Analysis Services server. Make sure you’ve entered the connection string correctly... link