locked
Removing a common windows features from multiple computers RRS feed

  • Question

  • Hi Guys, I want to remove/disable SMB V1 from multiple computers using below command:

    Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol

    I have the computers list in a txt file, please help me how can I execute this command on computers listed in my txt file?

    Please note: no machines should be rebooted automatically while or after invoking this command.

    Thanks


    Amit Kumar Sharma

    Wednesday, March 22, 2017 9:19 AM

Answers

  • Hi Amit,

    you can run a command against multiple computers like this:

    Invoke-Command -ComputerName (Get-Content .\computers.txt) -ScriptBlock { Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol }

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Marked as answer by -AKS- Wednesday, March 22, 2017 2:09 PM
    Wednesday, March 22, 2017 1:03 PM
  • Hi Fred, Thanks for your reply.. After some R&D, I was able to achieve my requirements using below command:

    $ComputersList = Get-Content -Path "D:\temp\testservers.txt"

    Invoke-Command -ComputerName $ComputersList {Remove-WindowsFeature FS-SMB1 -NoRestart}

    I have posted complete details on my blog URL given below:

    http://www.techiessphere.com/2017/03/disable-smbv1-on-multiple-computers.html

    Thanks


    Amit Kumar Sharma

    • Marked as answer by -AKS- Wednesday, March 22, 2017 2:08 PM
    Wednesday, March 22, 2017 2:08 PM

All replies

  • Hi Amit,

    you can run a command against multiple computers like this:

    Invoke-Command -ComputerName (Get-Content .\computers.txt) -ScriptBlock { Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol }

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Marked as answer by -AKS- Wednesday, March 22, 2017 2:09 PM
    Wednesday, March 22, 2017 1:03 PM
  • Hi Fred, Thanks for your reply.. After some R&D, I was able to achieve my requirements using below command:

    $ComputersList = Get-Content -Path "D:\temp\testservers.txt"

    Invoke-Command -ComputerName $ComputersList {Remove-WindowsFeature FS-SMB1 -NoRestart}

    I have posted complete details on my blog URL given below:

    http://www.techiessphere.com/2017/03/disable-smbv1-on-multiple-computers.html

    Thanks


    Amit Kumar Sharma

    • Marked as answer by -AKS- Wednesday, March 22, 2017 2:08 PM
    Wednesday, March 22, 2017 2:08 PM
  • Hello, Thanks for your reply..

    Could you please let me know how did you achieve all these functions using group policy?

    It would be great if I can achieve all these settings/tasks mentioned in my article using Group Policy..

    http://www.techiessphere.com/2017/03/disable-smbv1-on-multiple-computers.html

    Thanks


    Amit Kumar Sharma

    Thursday, March 23, 2017 4:29 AM
  • Sorry - I was thinking badly. I meant to post using DSC but was thinking about another post.


    \_(ツ)_/


    • Edited by jrv Thursday, March 23, 2017 5:42 AM
    Thursday, March 23, 2017 5:41 AM
  • No Problem.. :)

    Amit Kumar Sharma

    Thursday, March 23, 2017 3:10 PM