Skip to content

Instantly share code, notes, and snippets.

@Bradford1040
Created June 2, 2025 09:49
Show Gist options
  • Save Bradford1040/7e3b89ab2993b52cf7bdec27d1f25d9a to your computer and use it in GitHub Desktop.
Save Bradford1040/7e3b89ab2993b52cf7bdec27d1f25d9a to your computer and use it in GitHub Desktop.

To restart a network service in Windows using PowerShell, you can use the Restart-Service cmdlet. To specifically restart the "Network Service", you would use the command Restart-Service -Name "Network Service".

Here's a more detailed breakdown:

  • Restart-Service: This PowerShell cmdlet is used to restart a service.
  • -Name "Network Service": This parameter specifies the name of the service to be restarted. The service name is case-insensitive.
  • Example: Restart-Service -Name "Network Service".

Alternatively, you can use the -DisplayName parameter to match services by display name. For example, Restart-Service -DisplayName "Network Service" would also work.

For more complex scenarios, you can use the -Confirm parameter to prevent accidental restarts, -Exclude to exclude specific services from the restart, and -Force to restart the service even if it's not in the correct state, according to Microsoft Learn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment