DSCResources/MSFT_xProcessResource/Samples/Sample_xWindowsProcess_ArgumentsWithCredential.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Configuration Sample_xWindowsProcess_ArgumentsWithCredential
{
    param
    (
        [pscredential]$cred = (Get-Credential)
    )
    Import-DSCResource -ModuleName xPSDesiredStateConfiguration
    Node localhost
    {
        xWindowsProcess powershell
        {
            Path = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
            Arguments = "-NoExit -file `"c:\testScript.ps1`""
            Credential = $cred
            Ensure = "Present"
        }
    }
}
            

$Config = @{
    Allnodes = @(
                    @{
                        Nodename = "localhost"
                        PSDSCAllowPlainTextPassword = $true
                    }
                )
}

Sample_xWindowsProcess_ArgumentsWithCredential -ConfigurationData $Config