Need detection for the script

TechUST 516 Reputation points


I have this script and I want to deploy it using the Win32 method in Intune. Could you suggest a detection logic for me

Set-ExecutionPolicy Bypass -Scope Process -Force try {     Get-CimInstance -Namespace root/WMI -ClassName Lenovo_SetBiosSetting | Invoke-CimMethod -MethodName SetBiosSetting -Arguments @{parameter = "UserPresenceSensing,Disable" }


Get-CimInstance -Namespace root/WMI -ClassName Lenovo_SaveBiosSettings | Invoke-CimMethod -MethodName SaveBiosSettings     Write-Output "User Presence Sensing is Disabled."     shutdown.exe /r /t 28800 /c "System will restart in 8h"     return 0 } catch {     Write-Output $_.Exception.Message     return 1 }

Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,721 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ZhoumingDuan-MSFT 10,900 Reputation points Microsoft Vendor

    @TechUST,Thanks for posting in Q&A.

    Based on my search, I found that we can create a custom detection script to detect if the win32 app has been successfully installed (whether the script get the expected result after execution), and you can use the end result of the execution of your script as a flag to determine whether it has been executed correctly on the device.

    Here are some links about how to create a custom script you can refer.

    Non-official, just for reference.

    Hope it will help.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.