Book Image

PowerShell 3.0 Advanced Administration Handbook

By : Sherif Talaat, Haijun Fu
Book Image

PowerShell 3.0 Advanced Administration Handbook

By: Sherif Talaat, Haijun Fu

Overview of this book

<p>Technology’s growing rhythm is running faster than before, and business needs are getting more complex every day. So, it is time to learn something new to help conquer the challenge. With PowerShell in your toolbox, you can easily perform many tasks with less time, effort, and cost. PowerShell is a helpful scripting technology that enables the automation of system management tasks and the creation of system management tools.<br /><br />"PowerShell 3.0 Advanced Administration Handbook" comes with a set of real-world scenarios and detailed scripts that will help you get started with PowerShell, learn what PowerShell is, how to write the syntax, and build your scripts, and how to use and integrate PowerShell with different technologies, products, and tools.<br /><br />This handbook starts with the essential topics of PowerShell, then introduces the new features in PowerShell 3.0. The book then goes through building PowerShell scripts, function, and developing extensions like snap-ins and modules, and continues with detailed examples showing the usage of PowerShell with different technologies and products to give you an idea of PowerShell usage in the real world.</p>
Table of Contents (21 chapters)
PowerShell 3.0 Advanced Administration Handbook
Credits
About the Authors
Acknowledgement
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Managing Windows Firewall


Windows Firewall is a built-in component in Windows operating systems that allows you to control the incoming and outgoing network traffic and communications.

Task 1 – enabling or disabling Windows Firewall profiles

In this task, we will use the Set-NetFirewallProfile cmdlet to disable all Windows Firewall profiles, and then enable the firewall public profile.

#Disable all Firewall Profiles
PS > Set-NetFirewallProfile –All –Enabled False

#Enable Windows Firewall Public Profile
PS > Set-NetFirewallProfile –Name Public –Enabled True

Task 2 – creating Windows Firewall rules

In this task, we will use the New-NetFirewallRule cmdlet to create a new Windows Firewall rule.

Example 1

This example explains how to create a firewall rule that blocks all outbound traffic to any FTP protocol.

PS > New-NetFirewallRule -Name "Block FTP" -DisplayName "Block FTP" -Direction Outbound -Action Block -Protocol TCP -LocalPort FTP

Example 2

This example explains how to create a firewall...