Jump to content

Powershell User Context


Keith

Recommended Posts

I am trying to create a PowerShell script that will run DBCC checks on a SQL server and then report status back to Pulseway.  I have a working script that I can run from the command line but the script will not run correctly when sent as a Pulseway script.  Here are the details.

The script fails because it is unable to authenticate to the SQL server.  The SQL Server is running on the same machine as I am running the script on.  Thus wil are not dealing with cross machine accounts.  I have put debug code into the script and the account reported back by PowerShell is MACHINENAME$.  The machine is in a domain and thus the script appears to be reporting back the machine account in the domain.  This implies to me that when Pulseway runs a script it is using the NT AUTHORITY\SYSTEM account and that the MACHINENAME$ account would then be used for any network access.  Is this correct?

I have given SQL Server rights to NT AUTHORITY\SYSTEM as well as DOMAIN\MACHINENAME$ and NT AUTHORITY\LOCAL SERVICE.  Non of these rights appear to allow me to connect to SQL.  Has anyone ever written Powershell code for Pulseway and been able to connect to SQL Server?

Any ideas, thoughts or details on the user contexts used by Pulseway would be helpful.

Link to comment
Share on other sites

  • Staff

Hi Keith,

Have you tried to configure the PS impersonation from the Pulseway Manager -> Settings -> Runtime. Once this will be configured, then all your PS scripts will be executed from the configured account.

image.png.d76ce5d665dc08f03ab46316c1373ab4.png

I hope this helps.

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...