So in the script i have Output as FileShares as a text output
In Automation > Custom Fields I have another one called FileShares as a custom Text field as well.
My script is pretty basic, so I don't see why its not saving the field.
# Outputs
$FileShares = "0"
# Get all shared folders on the local computer
$shares = Get-WmiObject -Class Win32_Share | Select-Object Name, Path
# Output the list of shares
if ($shares) {
Write-Host "Current File Shares on $env:COMPUTERNAME:`n"
$shares | Format-Table -AutoSize
} else {
Write-Host "No file shares found on $env:COMPUTERNAME."
}
Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable FileShares ""$shares""") -Wait
So all I'm doing is getting a list of shared folders on a computer, saving it as $shares, and then writing that as a formatted table.
At the end, i'm running the CLI, to set the variable of FileShares to the results of $shares
The script runs, and i can see results, however I cannot see the results in the computers custom field.