Forum Discussion
Execute PowerShell script and collect output
Can you give us some more info what you are trying to accomplish? so we can help you
An example to write the output to a file
Write-Error -Message "Forced Fail" -Category OperationStopped
mkdir "c:\temp"
echo "Forced Fail" | out-file c:\temp\Fail.txt
There are around 50 intune managed machines in our org. I need to execcute the PowerShell script on all of those machines (this I can accomplich) and collect the output. Your example is perfect for showing how the write a file to C:\Temp, but how can I, as an intune admin collect the file from the 50 intune managed machines?
- Jun 15, 2021Hi,
You could take a look on how I did the same with the laps solution or bitlocker.
A perfect method to get back some information and reports...
https://call4cloud.nl/2021/05/the-laps-reloaded/- singhupendra786Jan 23, 2024Copper Contributor
Rudy_Ooms_MVP We have this script below
$computer = $env:COMPUTERNAME
$namespace = "ROOT\CIMV2"
$classname = "Win32_InstalledWin32Program"Write-Output "====================================="
Write-Output "COMPUTER : $computer "
Write-Output "CLASS : $classname "
Write-Output "====================================="Get-WmiObject -Class $classname -ComputerName $computer -Namespace $namespace |
Select-Object Name,VendorWhich is giving below mention output on local device
Mozilla Firefox (x64 en-US) Mozilla
Mozilla Maintenance Service Mozilla
Microsoft 365 - en-us Microsoft Corporation
Microsoft 365 Apps for enterprise - en-us Microsoft Corporation
Microsoft OneDrive Microsoft Corporation
Microsoft OneNote - en-us Microsoft Corporation
USBPcap 1.5.4.0 Tomasz Mon
FortiClient Fortinet Technologies Inc
Rapid7 Insight Agent Rapid7, Inc.
ImageRight Document Converter Vertafore, Inc.
Remote Desktop Microsoft Corporation
OpenSSL (64-bit) Shining Light Productions
ImageRight PDF Printer Vertafore, Inc.
Local Administrator Password Solution Microsoft Corporation
Microsoft Teams Meeting Add-in for Microsoft Office Microsoft
NVIDIA Graphics Driver 537.79 NVIDIA Corporation
Zoom (64-bit) Zoom
Microsoft Update Health Tools Microsoft Corporation
Power BI Report Builder Microsoft Corporation
Google Chrome Google LLC
DisplayLink Graphics DisplayLink Corp.
Microsoft Edge Microsoft Corporation
Microsoft Edge Update
Microsoft Edge WebView2 Runtime Microsoft Corporation
Npcap Nmap Project
Lenovo Vantage Service Lenovo Group Ltd.
Wireshark 4.2.2 x64 The Wireshark developer community, https://www.wiresha...
Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.38.33130 Microsoft Corporation
ImageRight Microsoft Add In Vertafore, Inc.
Jabra Xpress GN Audio A/S
Configuration Manager Support Center Microsoft Corporation
Teams Machine-Wide Installer Microsoft Corporation
Microsoft Intune Management Extension Microsoft Corporation
Adobe Acrobat Reader Adobe Systems Incorporated
Clean Your Device Lenovo
ImageRight Desktop Vertafore, Inc.
Microsoft Teams classic Microsoft Corporation
Microsoft Visual Studio Code (User) Microsoft CorporationNow i want to send this script to other device and capture that with me using Intune , would you please suggest i can collect
- Jan 23, 2024Hi... You could convert that script in a proactive remediation... buttttt maybe its worth looking at Intune Pivot that is going to be released in the feature (technical take off)
https://techcommunity.microsoft.com/t5/endpoint-management-events/advanced-analytics-supercharge-real-time-reporting-with-insights/ev-p/3971513
In which you can query this information realtime from the device.... with a kql query...