Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Script Resource "No user exists" #190

Open
DanteNahuel opened this issue Jun 3, 2020 · 0 comments
Open

Script Resource "No user exists" #190

DanteNahuel opened this issue Jun 3, 2020 · 0 comments

Comments

@DanteNahuel
Copy link

Details of the scenario you tried and the problem that is occurring

I'm using a Script resource to run a cmd that installs software.
The first run always, always returns an error "No user exists".
After the first run, dsc auto corrects the issue and it works without a problem and the node gets in compliance.

Verbose logs showing the problem

PS>TerminatingError(install-univ-v5.cmd): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No users exist. Please set up a user."

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Script software
        {
            DependsOn = "[PendingReboot]AfterDomainJoin"
            SetScript =
            {
                # Start logging the actions 
                Start-Transcript -Path C:\Temp\install.txt -Append -Force
                New-Item -Path "C:\Temp" -Name "software" -ItemType "directory" -Force
                Copy-Item -Path "\\network\MSI$\software\*" -Destination "C:\Temp\software\" -Recurse -Force
                Set-Location "C:\Temp\software"
                & "C:\Temp\software\install.cmd" 
                Stop-Transcript
            }
    
    
                
            TestScript =
            {
                $software = "Software Service";
                $service = Get-Service -DisplayName $software -ErrorAction SilentlyContinue

                    If ($null -eq $service)
                    {
                        Write-Verbose "Software is not installed"     
                            return $False 
                    }
                        Else
                    {
                        Write-Verbose "Software is Installed"
                        Return $True
                        
                    }
            }
    
    
        GetScript = { @{ $software=  Get-Service -DisplayName "software Service" -ErrorAction SilentlyContinue} }
        PsDscRunAsCredential = $SecureCred      
        }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant