BWMerlin Posted May 31 Posted May 31 I have written a very simple script in PowerShell and pushed it out to our devices via the script feature in WS1. When I click on a device and go to the script tab and click on the script run history I can see a variety of information that isn't always the most helpful when troubleshooting. I was wondering what output from scripts gets returned into the WS1 script log in the console? Is it as simple as using write-out inside my PowerShell script to have data captured via these logs?
Employee Andreano Lanusse Posted May 31 Employee Posted May 31 Scripts differ from Sensors in that they do not return a specific value, rather they return an execution status. The console shows the script status on the device details page based on the execution code as: Executed - Workspace ONE UEM displays this status after the exit code returns a 0. Failed - Workspace ONE UEM displays this status after the exit code returns any value that is not a 0. The syntax on your script is basically a line calling Exit 0 or Exit 1. Hope this helps. 1
Employee Glyn Dobson Posted June 7 Employee Posted June 7 The script log should contain your write-output. The example output below is from this example script that uninstalls java $apps = Get-WmiObject -Class Win32_Product | Where-Object {($_.Name -match "Java") -and ($_.vendor -match "oracle")} $result = "" if ($apps) { foreach($app in $apps) { $appName = $app.Name $appVendor = $app.vendor $result = $result + "Uninstalling $appName by $appVendor |" $app.uninstall() | Out-Null } } else { $result = "Oracle Java not found" } Write-Output $result
BWMerlin Posted June 17 Author Posted June 17 On 6/8/2024 at 12:41 AM, Glyn Dobson said: The script log should contain your write-output. Thanks @Glyn Dobson, so I just want to clarify if I return anything to write-out put it will show in the WS1 console script log? i.e write-out "hello world"
Employee Glyn Dobson Posted June 19 Employee Posted June 19 Yes, that said I believe the script execution result and the logs are collected separately. Try doing a Workflow sync from the console and see if that causes the logs to be populated. You can also check the troubleshooting tab to see if there were any errors during the execution (timeout etc).
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now