deploy powershell script

Glenn Maxwell 12,871 Reputation points
2023-03-27T22:41:12.19+00:00

Hi All

i want to deploy below PowerShell script using sccm on a collection. The script is working fine but how do i know how many servers this script got deployed successfully and on how many servers the script got failed.

$registryPath = "HKLM:\Software\Microsoft\Cryptography\Wintrust\Config"
$Name = "EnableCertPaddingCheck"
$value = "1"
IF(!(Test-Path $registryPath))
    {
    New-Item -Path $registryPath -Force | Out-Null
    New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType String -Force | Out-Null
    }
 ELSE 
    {
    New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType String -Force | Out-Null
    }
Windows for business Windows Server User experience PowerShell
Microsoft Security Intune Configuration Manager Application
Microsoft Security Intune Configuration Manager Other
Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. CherryZhang-MSFT 6,496 Reputation points
    2023-03-28T02:10:22.83+00:00

    Hi @Glenn Maxwell

    Click Run Details on Script Status Monitoring page when you run the script, you will see the details.

    You can check the Script status at later stage also by navigating to \Monitoring\Overview\Script Status. Script name will be displayed along with Last Update Time, collection name and other info. Double click it to get the same details.

    The screenshot for your reference:

    1

    Looking forward to your feedback.

    Best regards

    Cherry


     

    If the response is helpful, please click "Accept Answer" and upvote it.
    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.

     

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Dillon Silzer 57,826 Reputation points Volunteer Moderator
    2023-03-28T01:24:36.3233333+00:00

    Hello Glenn,

    I would recommend using a try and catch for errors.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_try_catch_finally?view=powershell-7.3#catching-errors

    In both sections you could append a file that all of the servers have access too, or you could make some HTTP POST request using Invoke-WebRequest to some web application to capture it in a database.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.3


    If this is helpful please accept answer.

    1 person found this answer helpful.
    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Garth 5,801 Reputation points
    2023-03-28T10:33:40.3533333+00:00

    Exactly how are you deploying the script? As a app, prog, or script feature?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.