Automatically confirm

This topic contains 7 replies, has 4 voices, and was last updated by  postanote 6 days, 10 hours ago.

  • Author
  • #86918


    Hi, I need this command to be repeated. When someone accidentally allows the adapter to always deactivate. At the same time it is confirmed by automatic. (Yes to All)

    I have this

    Get-NetAdapter -physical | where status -eq 'up' | Disable-NetAdapter


  • #86920


    So you want this to run without confirmation? if so adding -Force to the script will tell powershell "hey, i know what im doing, run the command and trust me"

    • #86923


      Parameter -Force does not work :/

  • #86930


    I got IT! With this Disable-NetAdapter –Confirm:$False. But I need help with repeating when someone allow the adapter so I need disable it again.

  • #86944


    Is this something not more suited to Group Policy? As you would need a script to actively listen for that event to occur, then run itself – Something which is beyond me im afraid!

  • #87005


    Is their an event generated when the adapter is turned on? If so write a scheduled task with a trigger of that event ID to run your script to disable the adapter.

  • #87416


    Now I need to run the script silently with Task manager. In order not to see it started. I dont know which argue I should use.

  • #87680


    Any process / task will show up in Task Manager.
    Why are you trying to hide it?
    If you mean hide the PowerShell Console or ISE Window, you just need to minimize it using the hidden option.

    Start-Process -WindowStyle hidden -FilePath notepad.exe
    PowerShell.exe -windowstyle hidden { your script.. }

    One more thing. about doing this as a scheduled task. Scripts can/will run silently without -WindowStyle Hidden if the task is set to Run whether user is logged on or not on the General tab under "Security Options" section.

    Yet, as noted, GPO or PowerShell DSC is a more enterprise solution for this sort of thing.

    GPO example:
    Under User Configuration > Administrative Templates > Network > Network Connections
    you will find numerous settings to help you secure the LAN connections.
    Prohibit access to the Properties of a LAN connection should do it for you.
    It will greyed out the option to change. Yet, if they are savvy, the can just drop
    to the command line and use netsh, powershell, vbscript to mess wiht stuff.

    So, this also means you have to ensure these folsk doing tis are not local admins.

You must be logged in to reply to this topic.