Category: PowerShell

The trust relationship between this workstation and the primary domain failed – Azure Restore

 jamilpremji  July 30, 2024  0 Comments on The trust relationship between this workstation and the primary domain failed – Azure Restore

When restoring an Azure server you may run into the following issue, “The trust relationship between this workstation and the…

Create an Event Log Entry and Source

 jamilpremji  May 20, 2024  0 Comments on Create an Event Log Entry and Source

This PowerShell script demonstrates how to write an event with a specific Event ID (3009) to the event logs. It…

Sending an e-Mail using Python and Office365 SMTP

 jamilpremji  May 6, 2024  0 Comments on Sending an e-Mail using Python and Office365 SMTP

Parameters to change username – This is your e-mail addresssubject from_address – This has to be the same as the…

Using RoboCopy with PowerShell – Parameterized

 jamilpremji  April 15, 2024  0 Comments on Using RoboCopy with PowerShell – Parameterized

The code sets the source path, destination path, and log file path using variables. It creates an array variable ($robocopyParams)…

Creating a Scheduled Task Using PowerShell to Run A Script Every Hour”

 jamilpremji  April 8, 2024  0 Comments on Creating a Scheduled Task Using PowerShell to Run A Script Every Hour”

To create a scheduled task that runs a specific batch file every 1 hour using PowerShell, you can use the…

How Do I Use Variables in PowerShell

 jamilpremji  April 1, 2024  0 Comments on How Do I Use Variables in PowerShell

In PowerShell, a variable is a container that stores a value or reference to an object. You can use variables…

Query Active Directory Computers

 jamilpremji  March 25, 2024  0 Comments on Query Active Directory Computers

To query all Active Directory (AD) computers in a specific organizational unit (OU) using PowerShell, you can use the Get-ADComputer…

Searching an Event Log Using PowerShell

 jamilpremji  March 18, 2024  0 Comments on Searching an Event Log Using PowerShell

Suppose you want to search your event logs for the last time someone logged onto a server. PowerShell makes it…

Invoke-Command for Remotely Accessing Servers

 jamilpremji  March 11, 2024  0 Comments on Invoke-Command for Remotely Accessing Servers

Invoke-Command is a PowerShell cmdlet that allows you to run commands or scripts on remote computers or servers. It can…

ConvertFrom-Json

 jamilpremji  March 8, 2024  0 Comments on ConvertFrom-Json

The ConvertFrom-Json cmdlet in PowerShell is used to convert a string in JavaScript Object Notation (JSON) format into an object…