Powershell Cheat Sheet for beginners

Powershell Cheat Sheet for beginners

PowerShell has become something of an ace in the hole when it comes to performing commands on Windows. For years, Windows command line fans were restricted, but PowerShell emerged as a formidable alternative in 2006.

What is PowerShell in Windows?

Microsoft created PowerShell as an interactive Command-Line Interface (CLI) and automation engine to aid in system configuration and administrative task automation.

This utility comes with its own command line and a programming language that is comparable to Perl. PowerShell was originally created to manage things on users’ computers.

Today PowerShell … Read the rest

Can you use Linux commands in Powershell?

Today we discuss one of a few questions a lot of sysadmins and IT Admins ask?

Can you use Linux commands in Powershell?

The Windows Subsystem for Linux (WSL) was a big step forward in this regard, allowing developers to call Linux commands from Windows via wsl.exe (e.g. wsl ls). While an improvement, the experience falls short in various ways:

  1. It’s inconvenient and strange to use wsl to prefix commands.
  2. WSL login profiles with aliases and environment variables do not honour default parameters.
  3. Backslashes are sometimes misinterpreted as escape characters rather than directory separators in Windows paths supplied as arguments.
Read the rest

Backing Up an SQL Database with PowerShell

Backing Up an SQL Database with PowerShell

Before making any changes in the production environment, every DBA should take a backup of their SQL database so that they can readily restore it if something goes wrong during the migration. If you have SQL Server Management Studio (SSMS), you can backup and restore databases with ease (Refer this artcle: Backup and Restore SQL Database using SSMS). Using Server Management Objects in Powershell, you may backup and restore SQL databases (SMO).

We’ll use the Server Management Objects (SMO) namespace class Microsoft.SqlServer.Management.Smo.Backup to get a SQL Database backup. To finish the backup procedure, … Read the rest

Powershell Get-Eventlog Get-Process and Stop-Process commands

Get-EventLog

We use PowerShell to parse your Server’s/computers event logs using the Get-EventLog cmdlet. There are several parameters available. Use the -Log switch followed by the name of the log file to view a specific log.

For example we can use the following command to view the Application log:

Get-EventLog -Log "Application"

Few options we have with Get-Eventlog options

-Verbose
-Debug
-ErrorAction
-ErrorVariable
-WarningAction
-WarningVariable
-OutBuffer
-OutVariable

Get-WinEvent with filter for event id

PowerShell’s Get-WinEvent cmdlet is a powerful method to filter Windows event and diagnostic logs. Performance improves when a Get-WinEvent is used with filters like =FilterHashtable  with logname … Read the rest

Google Cloud WordPress ftp setup step by step

Google Cloud WordPress ftp setup step by step

Are you looking for instructions on how to set up Passive FTP Mode on a Plesk Google Cloud instance?

Plesk servers that only have active FTP connections do not allow you to access to the server through FTP. Many of us wants to enable Passive FTP. Here is how?

How to enable Google Cloud WordPress FTP Mode (Passive)

The steps to configure passive FTP are as follows:

1.To begin, we must first build a firewall rule. To do so, make sure the following settings are in place:

  • Name: To distinguish the firewall
Read the rest

Best Free WordPress Themes Available in 2021 and What is expected ?

Best Free WordPress Themes Available in 2021

If you’re new to WordPress, it may seem natural to believe that if a free WordPress theme appears similar to what you had in mind for your website, it’ll be a good fit. Unfortunately, it isn’t quite that straightforward. That’s why, in today’s post, we’ve laid down a strong checklist of criteria you can use to ensure that the free WordPress themes you’re considering are a good fit. We’ve also compiled a list of what we consider to be the top free WordPress themes currently available this year.

In 2021, what should you

Read the rest

Here is all you need to know on Google Cloud WordPress Hosting ?

Here is all you need to know on Google Cloud WordPress Hosting ?

I’ll show you how to host a WordPress site on a Google VM instance in this article. After that, I’ll go over how to install WordPress on a Cloudways managed Google cloud server in more depth.

Cloudways is a managed cloud hosting platform that, owing to an easy-to-use interface, allows you to host your apps on Google cloud servers. GCE’s integration with Cloudways gives you a whole new world of managed WordPress hosting, with unbeatable dependability, speed, and uptime.

Before we go into the steps to get … Read the rest

What is powershell execution policy?

What is powershell execution policy?

The PowerShell execution policy was created with the goal of being administrator-friendly while also being accessible to end users. The latter goal, more than the former, was a little more difficult to achieve, given that convenience is typically inversely proportionate to security.

Malicious VBS (Visual Basic Script) files disguised as useful bits of software have been sent around in emails on occasion. Unsuspecting users double-clicked the script files, falling for scams ranging from letting the script’s creator know you executed the script to giving the script’s creator entire access over your machine.

The script can … Read the rest

How to concatenate string in powershell?

How to concatenate string in powershell?

 

1. Concatenate string Use -join

$var = -join(“Hello”, ” “, “world”);

Stores  “Hello world” to $var.

So to output, in one line:

Write-Host (-join(“Hello”, ” “, “world”))

2. Concatenate string using “-“

Write-Host “$($products.Id) – $($products.Name) – $($products.Owner)”

3. Concatenate string using indirectly with “-“

Write-Host (“{0} – {1} – {2}” -f $products.Id,$products.Name,$products.Owner )
Or just (but I don’t like it 😉 ):

Write-Host $products.Id ” – ” $products.Name ” – ” $products.Owner

 

4. Concatenate string using “+”

$string = $products.ID
$string += ” – ”
$string += $products.Name
$string += ” … Read the rest