Running script (.cmd) or exe under user context using DSC

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 3 weeks, 4 days ago.

  • Author
    Posts
  • #57025
    Profile photo of divya
    divya
    Participant

    Hello,

    We are trying to install Windows 10 ADK under user context. We performed following steps:
    1. Created self signed certificate for Target Node and Authoring Node on Target Node(referred https://msdn.microsoft.com/en-us/powershell/dsc/secureMOF)

    2. Ran following script to install ADK, but ADK keeps on installing under system context when checked in task manager on target node.
    I checked the mof file created and it shows credential=NULL.
    Please guide of we are missing on anything.

    Configuration MyConfiguration
    {
    param(
    [Parameter(Mandatory)]
    [PSCredential]$MyCredential
    )

    Import-DscResource -ModuleName PSDesiredStateConfiguration

    Node $AllNodes.NodeName
    {
    Script ADK10
    {
    SetScript = {& \\UNCPATH\ADK10.cmd}
    TestScript = {$False}
    GetScript = {# Do Nothing}
    }
    Credential = $credential
    }
    LocalConfigurationManager
    {
    CertificateID = '3F6609C3FB9E8BC141F04C9EB07186E346DD64AA'
    }
    }
    }
    $cd = @{
    AllNodes = @(
    @{
    NodeName = "TargetServerName"
    PSDscAllowDomainUser = $true
    CertificateFile = 'Path to public key certificate'
    Thumbprint = '3F6609C3FB9E8BC141F04C9EB07186E346DD64AA'
    }
    )
    }
    MyConfiguration -ConfigurationData $Cd -OutputPath "\\UNCPath\Test3"
    Set-DscLocalConfigurationManager -Path "\\UNCPath\Test3" -Force -Verbose
    Start-DscConfiguration -Path "\\UNCPath\Test3" -Wait -Verbose -force

  • #57536
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Again, this is really an ADK thing, not PowerShell – it's something you might need to take up with Microsoft Product Support.

You must be logged in to reply to this topic.