Hello,
Thank you for posting in Q&A forum.
We suggest that you try using PowerShell's output redirection to export the command's output to a text file. In your script, you can add the>operator at the end of each command and specify the file path to save the output. For example:
Powershell
New Item 'C: \ Windows \ System32 \ config \ imageconfig' - ImageType File Value '{imagename: "NONE", sharingaaccount: "NONE", viaGI: "NO"}'>'C: \ Windows \ Temp-output. txt' Set itemProperty - Path 'C: \ Windows \ System32 \ config \ imageconfig' - Name IsReadOnly - Value $true>>'C: \ Windows \ Temp.output. txt'
In this example, the>operator is used to overwrite the output file, and the>>operator is used to append the output to the end of the file. You can choose one as needed.
In the SCCM script, you can directly embed the above commands into the script and specify the output file path as a location that the SCCM client can access. For example:
Powershell
New Item 'C: \ Windows \ System32 \ config \ imageconfig' - ImageType File Value '{imagename: "NONE", sharingaaccount: "NONE", viaGI: "NO"}'>'C: \ Windows \ Temp-output. txt' Set itemProperty - Path 'C: \ Windows \ System32 \ config \ imageconfig' - Name IsReadOnly - Value $true>>'C: \ Windows \ Temp.output. txt'
This will execute the script on the SCCM client's computer and save the output to the specified text file.
Hope this answer can help you well.
Best regards,
Jill Zhou