Category: Powershell

Review of “PowerShell Automation and Scripting for Cybersecurity”

….is a comprehensive guide for security professionals, penetration testers, system administrators, and both red and blue teams. It focuses on providing the knowledge needed to leverage PowerShell effectively for security operations. The book is authored by Miriam C. Wiesner, a Senior Security Researcher at Microsoft. From her public bio she brings over 15 years of […]

Retrieve Hashicorp Vault Secrets and Key Names

The web interface that is supplied with Vault has a Search capability, but it is limited. Users are not able to search for nested secrets or Key names. The PowerShell function below can be used to export complete secret paths and the key names. It requires use of the vault command line and that the […]

Crafting an Advanced PowerShell Function with Bing Copilot

In this post, I create an Advanced PowerShell Function that retrieves running services from a specified computer, complete with error handling and network checks, using Bing CoPilot. I’ll include the complete transcript of the conversation Bing Copilot is one of a number of AI applications based on OpenAI’s Large Language Models (I think GTP 4). […]

Disable or Warn Inactive Users

SYNOPSIS:Disable-InactiveUsers.ps1 Disable or warn inactive users that their accounts will be disabled. This script requires the AD comandlets and the ImportExcel module. DESCRIPTION: Disables Inactive users if the -Remediate switch is used. Writes user accounts that would be disabled to file if the -Remediate switch is not used. Creates a folder structure if doesn’t exist. […]

Refactoring

Refactoring. What is it and how does it fit into the pragmatist approach to scripting?From Wikipedia:“In computer programming and software design, code refactoring is the process of restructuring existing computer code without changing its external behavior. Refactoring is intended to improve the design, structure, and/or implementation of the software (its non-functional attributes), while preserving its […]

Design A Simple and Reusable Word Document Template Using PScribo Part 1

In this post I describe creating a simplified PowerShell script for creating a customizable subject matter document template using the PScribo module from the PowerShell Gallery. Goals: Reduce the amount of typing required to produce the document outline, cover, common text, etc. Provide functionality over and above use of a static Word document or template. […]

Use PowerShell to save o365 email Attachments and delete the attachment from the message but don’t delete the message itself.

In this blog I describe creating a PowerShell Function to save email attachments to a local folder while keeping the mail message itself in your mailbox. Problem Statement: Like most of us I receive a lot of email every day. Some important, some not. Many that have attachments. I want to automate saving my email […]