none
Make a DSC Script resource execute with elevated privileges RRS feed

  • Question

  • Hello Everyone,

    Is there a built-in way into DSC to make it execute certain resources as administrator with elevated privileges on Windows 8.1?

    What's i'm trying to achieve for example is install SQL Express 2012 in a Script DSC resource, but it keeps telling me that i'm not admin with and fails. If i run the same command from command prompts ("As administrator") it succeeds.

    C:\downloads\SQLEXPR_x64_ENU.exe /Action=Install /qs /IAcceptSQLServerLicenseTerms /InstanceName=sqlexpress /ROLE=AllFeatures_WithDefaults /SQLSYSADMINACCOUNTS="BUILTIN\Administrators"

    A similar situation is when I want to disable Windows Firewall in a WindowsProcess resource:

    powershell.exe "netsh firewall set opmode disable"

    That would also blow up because i'm not admin.

    I've tried to give the admin credentials to the DSC resources but it seems on windows 8.1, it's different from "Run as Administrator"

    So far I've managed to achieve some of this by running it from a PSExec session to the same machine which i'm currently configuring, but this seems like a hack to me.

    Please let me know if there is a way around this.

    Thanks in advance!

    Ivan Kosharov



    Thursday, January 8, 2015 12:24 PM

Answers

  • Not sure if this will help, but when you execute the DSC script, perhaps use the "-verb runas" parameter?  I can't test this right now, but give it a shot.
    • Marked as answer by Kevin Remde Friday, July 17, 2015 12:08 PM
    Wednesday, July 1, 2015 7:43 PM

All replies

  • Any update on this?
    Wednesday, February 4, 2015 12:13 PM
  • Not sure if this will help, but when you execute the DSC script, perhaps use the "-verb runas" parameter?  I can't test this right now, but give it a shot.
    • Marked as answer by Kevin Remde Friday, July 17, 2015 12:08 PM
    Wednesday, July 1, 2015 7:43 PM
  • Ivan - Did this solve things for you?  Or is this so far in the past that you've moved well beyond this problem? 

    Kevin


    Kevin Remde US DPE - IT Evangelism - Microsoft Corporation http://blogs.technet.com/kevinremde http://twitter.com/kevinremde

    Monday, July 6, 2015 4:35 PM