SCCM / Powershell / Orchestration Get-Applications Error

rhysbrennan
Tera Expert

Hi,
We are testing Software Asset Management and integration of SCCM application discovery.
I have added the SCCM server and selected discover. I am consistently getting the below error.

I have examined the script and I am finding it difficult to identify the part of the script this error is occurring:

MID Server Log:

05/10/17 09:51:35 (831) Worker-Standard:PowershellProbe DEBUG: Running command:-> C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy unrestricted -noninteractive -nologo -noprofile -command "& {& 'scripts\PowerShell\PSScript.ps1' -computer 'SCCM01.server.removed'     -script 'd:\ServiceNow\ORC_DEV\agent\scripts\PowerShell\SCCM\GetApplications.ps1' 'use_mid_service_account' $false -useCred $true -ismid $false -isDiscovery $false -debug $true; exit $LASTEXITCODE}"

<error>Cannot find path 'C:\Users\SVC_SNOrch_DEV\Documents\:\' because it does not exist.Stack Trace:</error>

find_real_file.png

I have added the account as an administrator on both the SCCM server and the MID server.

The part that stands out is the trailing "😕" in 'C:\Users\SVC_SNOrch_DEV\Documents\:\'. This is obviously not a true path.

I've confirmed the profile is on both the MID Server and the SCCM Server:
C:\Users\SVC_SNOrch_DEV\Documents

1 ACCEPTED SOLUTION

We finally resolved the issue with a little help from SNOW/HI.



"Use the credentials to log into the SCCM Server and connect via Windows PowerShell from the System Center Configuration Manager console at least once to set the path variable for that credential."



This seems really weird, but it is the fix. As you mentioned above, log into SCCM and run Powershell from the SCCM console. I don't think a command is even needed. I think the fact that you open it once sets the variable/path and allows the MID job to work successfully thereafter.



Shane


View solution in original post

4 REPLIES 4

Shane S_1
Kilo Expert

Rhys, did you find a solution? I get the same error.


After a day it self resolved.



From memory I logged into the SCCM server, opened powershell and ran some of the commands the scripts run to troubleshoot. Didn't find any clues to the cause.



That's about all I did after posting the question.


We finally resolved the issue with a little help from SNOW/HI.



"Use the credentials to log into the SCCM Server and connect via Windows PowerShell from the System Center Configuration Manager console at least once to set the path variable for that credential."



This seems really weird, but it is the fix. As you mentioned above, log into SCCM and run Powershell from the SCCM console. I don't think a command is even needed. I think the fact that you open it once sets the variable/path and allows the MID job to work successfully thereafter.



Shane


Hi Schaetz,



How do you set the path variable for that credential via the Windows PowerShell from the system Center Configuration ?



Regards