Understanding PowerShell Toolmaking

This article was originally posted on the IpSwitch.com blog. As we use PowerShell Toolmaking to automate more tasks, most of us eventually find ourselves reinventing the wheel. We write a script to do task X, another to do task Y, then task Z comes around. A few weeks go by and we begrudgingly write another script to do task X again. This is because scripts have traditionally been treated as disposable. It’s not until you repeat this process a few times that you realize you need to take your scripting skills to another level. It’s time to build PowerShell “tools” rather than disposable scripts. Related Article: Automate Data Encryption Using PowerShell Tools vs. Scripts What do I mean by “tools”? I’m referring to using PowerShell Toolmaking to write a piece of code that’s built for reuse and modularity. It’s a script or function that’s built in a way that allows you to […]

Read more

End of the Road for Windows PowerShell?

This article was originally posted on the IpSwitch.com blog. PowerShell 5.x is soon being replaced. Once the official version of PowerShell Core 6.0 is deployed into production, we can get more details about the future. When Microsoft introduced Bash on Windows, it triggered a huge debate about whether the company would continue with PowerShell. However, Microsoft announced that although Bash and PowerShell differ in their focus and design, both are here to stay. Now, Windows PowerShell has another competitor in the form of PowerShell Core. In a recent blog post, Microsoft disclosed the roadmap of PowerShell 6.0, announcing that PowerShell 5.x would not receive any new features or updates, and it would only get critical fixes. According to Joey Aiello, program manager and committee member of PowerShell 6.0, “Windows PowerShell 5.1, much like .NET Framework 4.x, will continue to be a built-in, supported component of Windows 10 and Windows Server 2016. However, […]

Read more

Leveraging PowerShell Automation in The Cloud

This article was originally posted on the IpSwitch.com blog. As part of this cloud transition, it’s important to realize that even though you can’t see a system it still needs to be managed. Let’s talk about PowerShell automation. These days, just about every CIO, IT manager and IT professional has his head in the cloud. Organizations have found that offloading various utilitarian services to the cloud allows them to focus more on delivering business value rather than just keeping the lights on. When deploying services to the cloud, whether it be a simple Infrastructure as a Service (IaaS) offering or Platform as a Service (PaaS), companies still need to focus on automation. Microsoft, Amazon and Google offload a lot of work but not everything. Let’s focus on one way to manage resources in the cloud with PowerShell.Related Article: PowerShell Scripting and Open Management Infrastructure (OMI) Most (if not all) cloud vendors support […]

Read more

The PowerShell Script Orchestrator

This article was originally posted on the IpSwitch.com blog. With companies moving services to the cloud, applications offering robust APIs and a driving need for automation, we need a more mature scripting language. Some scripting languages are designed for one purpose and one purpose only. VBScript and batch files were used to automate small tasks. These languages were meant to offer a helping hand with various ad hoc tasks solely on local Windows systems. Nowadays, this just won’t cut it.  We need an automation Swiss army knife. We need a PowerShell script. Related Article: PowerShell Scripting and Open Management Infrastructure (OMI) Since PowerShell can interact with just about anything you can think of, it can be considered an automation orchestrator coordinating all kinds of different products and services to work together. Let’s jump into an example of how PowerShell can build a workflow and orchestrate a multi-service setup. PowerShell can scrape information […]

Read more

How to Use PowerShell Copy-Item Cmdlet to Transfer Files Over WinRM

This article was originally posted on the IpSwitch.com blog. It’s easy to copy files with PowerShell Copy-Item via the command line. Once you specify the source and destination location, it just happens. Unfortunately, many administrators don’t think about how this process occurs until it doesn’t work. Whether or not you think about this, all TCP network communication (such as SMB file copies) use network ports to make the bits transfer. For a file copy process to get a file from point A to point B, a port needs to be open all the way to the destination node. In the case of an SMB file copy, that port is 445. This is a common port that’s usually open internally, except in some high-security situations or across a DMZ. PowerShell Copy-Item If you’re in a high-security environment or need to transfer files from an internal network to a DMZ that might have various port […]

Read more

How to Use PowerShell’s Abstract Syntax Tree to Your Advantage

This article was originally posted on the IpSwitch.com blog. The PowerShell AST essentially breaks down the code into a hierarchical tree with each element representing a part of the tree, making the scripts self aware. Have you ever seen the movie Inception? It’s about a guy that can enter someone’s dreams and steal stuff from their subconscious. It’s a trip that will leave you questioning the reality around you. It gave me that same feeling as The Matrix did, like reality is not what you believe it to be. It’s some deep stuff. This has nothing to do with PowerShell, but it gives you a sense of what the PowerShell Abstract Syntax Tree (AST) does. Imagine a PowerShell script that is self-aware. Imagine a PowerShell script that can read itself, or even generate other scripts based on what’s contained in itself. Think of it as meta-scripting. It’s a neat concept and has a […]

Read more

Manage DNS Zones With PowerShell

This article was originally posted on the IpSwitch.com blog.   If you find yourself making changes on your Microsoft DNS servers using the DNS MMC snapin you’re probably wasting a lot of time. Why? Because it’s possible to create, modify or remove any DNS object that you can from the MMC with PowerShell! By using PowerShell to manage DNS allows you not only control things from the command line but to take those commands and put them into a script to automate all kinds of time-consuming tasks. To limit this article’s scope, we’re going to just focus on managing DNS zones with PowerShell although it’s completely possible to administer other DNS objects like records and the server itself as well. Before we get too far, there are a few prerequisites you need to be aware of. First, I’m assuming you have permissions to read, modify and remove DNS zones from your Windows DNS […]

Read more

Automate Data Encryption Using PowerShell

This article was originally posted on the IpSwitch.com blog. In today’s dangerous cyber environment, it’s more important than ever to protect your data. Bad guys are always on the lookout for an easy score. As a sysadmin, it’s one of your many jobs to set up security controls and make sure your network is not an easy target. One way to do that is to ensure your network perimeter is secured to prevent any unauthorized access. However, what if your network is breached anyway? Perhaps someone physically comes into your data center and steals a server to gather valuable data you may have stored on it. If your data is not encrypted, kiss it goodbye. But, if you had the foresight to encrypt the data on that server beforehand, while your data might still be gone, at least you’ll know it won’t be read. Related: How to Automate 5 Repetitive IT Tasks Encrypting […]

Read more

How to Copy Files Into a Microsoft Azure Storage Account

This article was originally posted on the IpSwitch.com blog. When working with Microsoft Azure, you’ll inevitably come to a point to where you need to access material stored locally on premise. This might be a virtual disk in VHD format to use for Azure’s IaaS service, a few PowerShell scripts you need executing on your Azure virtual machines or maybe just some configuration files for your Azure websites. Regardless, for your Azure resources to access these files, they’ll need to be located in an Azure storage account. The Set-AzureStorageBlobContent cmdlet There are a couple of ways to transfer files stored locally into your Microsoft Azure storage account. I’ll be doing this via the Set-AzureStorageBlobContent PowerShell cmdlet using the newer Azure Resource Manager (ARM) resources. The Set-AzureStorageBlobContent is available in the Azure PowerShell module, so you’ll need to ensure you get this module downloaded and available for use first. You’ll also need an Azure subscription […]

Read more

PowerShell Script: Developing A HTTP Script Monitor In PowerShell

This article was originally posted on the IpSwitch.com blog. How would you define a web server as being “up”? It doesn’t just respond to a simple Internet Control Message Protocol (ICMP) echo request (ping). Even though this is a great indicator of a web server’s operating system being online — and it being connected to the network — it doesn’t say much for the actual service the web server is providing. That’s where a PowerShell script comes in. When monitoring systems, it’s important to track as close to the real service as possible. In a web server’s case that service is an HTTP request. A web request consists of lots of interdependent parts, including things like the server being connected to the network, having a MAC address, an IP address, a TCP port that’s listening on port 80 and, at the top of this stack, the HTTP status code that the server […]

Read more
1 2 3 10