Open cm5778 opened 3 years ago
Consider using built-in parameter PSDscRunAsCredential
to change what user the resource is run as.
@johlju apologies for not getting back sooner, I am having issue including PSDscRunAsCredential which I am trying to figure out, besides just to trim down the issue, I tried creating an application using Invoke-Command with credentials which giving Bad network error.
I will update on PSDscRunAsCredential
after adding below scripts
$ConfigData = @{
AllNodes = @(
@{
NodeName = "$Computer"
PSDscAllowDomainUser = $true
};
);
}
and below in configuration Registry CmdPath { Key = 'HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor' ValueName = 'DefaultColor' ValueData = '1F' ValueType = 'DWORD' Ensure = 'Present' Force = $true Hex = $true PsDscRunAsCredential = Get-Credential } I am getting this error:
going through : https://docs.microsoft.com/en-us/powershell/scripting/dsc/pull-server/securemof?view=powershell-7.1
which suggesting to have encrypt mof using certs, except it seems a bit complicated, am I in right path
btw I am using PowerShell version 5.1
I am trying to create a webApplication on IIS pointing to Azure File share using PowerShell DSC xWebApplication as below xWebApplication AppName { DependsOn = "[xWebSite]xWebSiteName" Name = "appname" PhysicalPath = "\azurefileshare\etc" WebAppPool = $AppPoolName Website = $WebSiteName } I am getting "Parameter 'PhysicalPath' should point to existing path." error where the mentioned path can be accessed manually and able to set to IIS application manually. All the user accounts involved in the process have full control access on file share Also observed in Process Monitor that PowerShell DSC kicks off "C:\windows\system32\wbem\wmiprvse.exe" running as NT AUTHORITY\SYSTEM and not sure how to change user when running th PowerShell DSC.
Can someone help in this regard please.