ustas -


3 ways IT teams can use PowerShell in AI initiatives

As they embark on AIOps strategies, IT admins -- particularly those in Windows shops -- can lean on a familiar tool for data gathering and issue remediation: PowerShell.

With the amount of data that enterprise computer systems generate, traditional troubleshooting models are no longer viable. Good riddance to sifting through systems logs to uncover the root cause of a widespread outage.

AIOps -- artificial intelligence for IT operations -- means different things to different people. But, in a general sense, it refers to the use of machine learning algorithms to solve IT ops problems more efficiently. With AIOps, an enterprise uses event and performance data to uncover and predict trends. In addition to data collection and analysis, an AIOps strategy often involves tools that help identify and remediate IT system issues.

While PowerShell might not immediately spring to mind when IT admins think of AI, the tool can play a role in AIOps -- and work alongside some AI-driven IT management tools.

Here are three use cases for PowerShell in AI initiatives.

1. Data gathering

Data gathering, or the ingestion of data, is an important part of the AIOps process. It enables IT teams to pull information from multiple data sources and apply machine learning to the data streams. Here, PowerShell can both gather and dump data.

For instance, with PowerShell remoting, IT admins can gather Windows events for thousands of machines and put it in a CSV file for analysis.

To retrieve any application error event from any device in Active Directory and export to a local CSV file, use this command:

C:\windows\system32> Get-WinEvent -ComputerName (Get-ADComputer -Filter *).Name -FilterHashtable  @{Logname="Application"; ProviderName="Application Error"} | Export-csv c:\temp\test.csv

2. Data analysis

PowerShell, first and foremost, is a scripting language. It's a powerful tool to create and run scripts, but it can assist in data analysis.

One of PowerShell's greatest capabilities is to convert all sorts of data into a common framework: objects. Whether it is a CSV file, a REST API or SQL, all data types are converted into PowerShell objects, which then can be analyzed by a common method.

When admins connect PowerShell to data sources such as SQL databases, they can use the tool to orchestrate data manipulation, and even some machine learning algorithms. This method isn't as efficient as, for example, Python, which offers more machine learning libraries, but PowerShell carries its own benefits -- in particular, its integration with the Azure cloud and AI suite of services.

AIOps 101

Before sys admins can grasp the role of PowerShell in AI-driven IT initiatives, they require a baseline understanding of AIOps itself. Watch this brief video for a crash course in AIOps use cases, technologies and challenges.

3. Issue remediation

Part of the AIOps experience is to remediate issues within the enterprise proactively. On Windows, PowerShell can support this effort.

Natively, IT pros can use PowerShell remoting fairly easily -- as long as it's enabled -- to run commands and scripts on thousands of machines. For instance, if the IT operations team must disable and restart a Windows service for a high volume of machines due to an incident, it can perform this logic in PowerShell:

C:\windows\system32> Set-Service BITS -StartupType Automatic

C:\windows\system32> Start-Service BITS

PowerShell can also work alongside a real-time IT monitoring tool, such as Nexthink, to support remediation efforts; admins can use PowerShell to run through a Windows service on any endpoint connected to the Nexthink platform, and they can store the script results within the Nexthink database for analysis.

The future of PowerShell in AI initiatives

The Windows OS is still prominent in enterprise environments. The versatility of PowerShell enables it to support AIOps processes, including data retrieval, data analysis and issue remediation. Moving forward, particularly with the cross-platform capabilities of PowerShell Core, data scientists will continue to see a role for the tool.

Next Steps

PowerShell looping examples for the 4 key commands

When to use the Windows command prompt vs. PowerShell

Dig Deeper on Scripting, Scheduling and IT Orchestration