locked
Modification to an Powershell script for SCCM RRS feed

  • Question

  • I have an existing PowerShell script where essentially, I am copying a particular folder to remote computers then changing directory through PowerShell on remote machine, then running a secure boot PowerShell command on remote computer.

    I wanted to use the script functionality within Software Library Workspace  to deploy the existing PowerShell that I have to certain amount of computers in a collection.  I wanted feedback on modification that should be done my existing Powershell script.  Here is the script.  Appreciate the feedback in advance.

    $Session = New-PSSession -ComputerName "" -Credential ""
    Copy-Item "C:\Program Files\WindowsPowerShell\Scripts" -Destination "C:\Program Files\WindowsPowerShell\Scripts" -ToSession $Session -Recurse
    Enter-PSSession -"ComputerName ""
    Set-Location 'C:\Program Files\WindowsPowerShell\Scripts'
    Set-SecureBootUefi -Name dbx -ContentFilePath .\content.bin -SignedFilePath .\signature.p7 -Time 2010-03-06T19:17:21Z -AppendWrit

    Sunday, August 16, 2020 5:15 PM

Answers

  • Hi,


    You should use a package to perform the task of copying files, because the script function does not handle the content in any way, and the package makes the content available. Jason once wrote a wonderful blog post about this:
    You can use the %~dp0 batch file parameter within the batch file itself to refer to the directory the batch file is run from.
    Copying Files to Clients Using ConfigMgr


    I hope the above information is helpful to you.


    This MECM Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.



    Best regards,
    Larry

    "MECM" forum will be migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the "MECM" forum's new home on Microsoft Q&A!
    For more information, please refer to the sticky post.


    Monday, August 17, 2020 7:35 AM

All replies

  • Hi,


    You should use a package to perform the task of copying files, because the script function does not handle the content in any way, and the package makes the content available. Jason once wrote a wonderful blog post about this:
    You can use the %~dp0 batch file parameter within the batch file itself to refer to the directory the batch file is run from.
    Copying Files to Clients Using ConfigMgr


    I hope the above information is helpful to you.


    This MECM Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.



    Best regards,
    Larry

    "MECM" forum will be migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the "MECM" forum's new home on Microsoft Q&A!
    For more information, please refer to the sticky post.


    Monday, August 17, 2020 7:35 AM
  • Appreciate the feedback!
    Monday, August 17, 2020 1:11 PM