Skip to content

Install-SqlDscReportingService: Continues running command even if not elevated #2070

@johlju

Description

@johlju

Problem description

The command is meant to stop executing if not in elevated prompt.

Verbose logs

C:\Users\sqladmin\Desktop\report.txt -InstallFolder 'C:\Program Files\SSRS2022' -SuppressRestart -Verbose
Assert-ElevatedUser : This command must run in an elevated PowerShell session. (DRC0043)
At C:\Program Files\WindowsPowerShell\Modules\sqlserverdsc\17.1.0\SqlServerDsc.psm1:3604 char:5
+     Assert-ElevatedUser -ErrorAction 'Stop'
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Command parameters:String) [Assert-ElevatedUser], Exception
    + FullyQualifiedErrorId : UserNotElevated,Assert-ElevatedUser

VERBOSE: Specified executable arguments: /quiet /IAcceptLicenseTerms /Edition=Dev /log "C:\Users\sqladmin\Desktop\report.txt"
/InstallFolder="C:\Program Files\SSRS2022" /norestart

Invoke a setup action
Are you sure you want to invoke the setup action 'Install'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

How to reproduce

Run the command in a non-elevated prompt.

Expected behavior

Stop executing.

Current behavior

Continues executing.

Suggested solution

Probably misses an -ErrorAction 'Stop' somewhere?

Operating system the target node is running

OsName               : Microsoft Windows Server 2025 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 26100.1.amd64fre.ge_release.240331-1435
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.26100.2161
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.2161
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module version used

Name         Version Path
----         ------- ----
SqlServerDsc 17.1.0  C:\Program Files\WindowsPowerShell\Modules\SqlServerDsc\17.1.0\SqlServerDsc.psd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.good first issueThe issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions