deploy powershell script

Glenn Maxwell 10,106 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 Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,443 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,354 questions
Microsoft Configuration Manager Application
Microsoft Configuration Manager Application
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Application: A computer program designed to carry out a specific task other than one relating to the operation of the computer itself, typically to be used by end users.
455 questions
Microsoft Configuration Manager
0 comments No comments
{count} votes

Accepted answer
  1. CherryZhang-MSFT 6,481 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 54,286 Reputation points
    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