Configure WinRM for HTTPS

Configure WinRM for HTTPS manually Configuring for HTTPS involves following steps. Check whether WinRM service is running Create HTTPS listener Add firewall exception Validate HTTPS listener Check whether WinRM service is running Get-Service WiRM If the WinRM service is not running, you might need to configure WinRM using winrm quickconfig. When you configure winrm first time,…

GUI Forms PowerShell

GUI Forms PowerShell Windows PowerShell also supports building of Graphical User Interface (Forms). Many of the GUI administration tools available are scripted in PowerShell. There are many commercial and free tools available in the market, but let us see how to build a GUI form with PowerShell scripting. Let us build a simple form now.…

Managing Registry with PowerShell

Managing Registry with PowerShell Managing registry with PowerShell: Registry keys are items on Windows PowerShell drives, working with them is very similar to working with files and folders. Registry entries are properties of keys and, as such, cannot be directly browsed, we need to take a slightly different approach when working with them. Playing with…

Parse and scrape a web page

Parse and scrape a web page Invoke-WebRequest: The Invoke-WebRequest cmdlet sends HTTP, HTTPS, FTP, and FILE requests to a web page or web service. It parses the response and returns collections of forms, links, images, and other significant HTML elements. This cmdlet was introduced in Windows PowerShell 3.0. Invoke-WebRequest show you formatted output of various properties of…

Regular Expressions

PowerShell – Writing Regular Expressions A regular expression is a string, written using a special regular expression language, that helps a computer identify strings that are of a particular format—such as an IP address, a UNC, or an e-mail address. A well-written regular expression has the ability to allow a Windows PowerShell script to accept as…

Remote Sessions and Invoke-Command

PowerShell Remote Sessions: PowerShell Remote Sessions and Invoke-Command: PowerShell Remoting lets you run PowerShell commands or access full PowerShell sessions on remote Windows systems. It’s similar to SSH for accessing remote terminals on other operating systems. Enable PowerShell Remoting Enable PowerShell Remoting on the PC You Want to Access RemotelyYour first step is to enable…

Working with WMI

Working with WMI (Windows Management Instrumentation) One of the most useful jobs for PowerShell is to create a bank of WMI based scripts. Furthermore, scripting WMI with PowerShell is much easier and more efficient than WMI with VBScript. What is WMI? WMI is the Microsoft implementation of Web-Based Enterprise Management (WBEM), with some enhancements in…

Working with Files and Folders

PowerShell – Working with Files and Folders Creating Folders and Files We use the cmdlet New-Item to create a folder or a file. We need to specify the Item type (the FileSystem Windows PowerShell provider distinguishes between directories and files). The following command creates a new folder in the present working directory. We can also create a…

Error Handling, exceptions and debugging

One of the key parts of any good PowerShell script is error handling. PowerShell errors are of two types. Terminating and Non-Terminating Errors. Terminating Error: A terminating error is an error that will halt a function or operation. A serious error during execution that halts the command (or script execution) completely. If you make a syntax…