Mike Leger Posted February 27 Posted February 27 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.
Administrators Anne Posted February 28 Administrators Posted February 28 Hey @Mike Leger Thanks for reaching out! From what I can tell The output is formatted as Table. But type is TEXT. Only free text can be output and Table format is not supported. Let me know if this makes any sense and if you have any other questions please feel free to reach out any time. Thanks, StefanÂ
DeWaynes Posted May 27 Posted May 27 @Mike Leger Try this out. it worked from me. I was able to pull the output variable from inside of a workflow. # 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) {     $ShareList =  "Current File Shares on $env:COMPUTERNAME:`n" + $shares | Format-Table -AutoSize } else {     $ShareList =  "No file shares found on $env:COMPUTERNAME." } #convert the list of file shares from a table to a string $ShareList = $shares | Format-Table -AutoSize | Out-String #rewrite the file share list to the output variable $shares = $ShareList #write output to screen of needed #write-output $shares
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