| by Arround The Web

How to Use PowerShell replace to Replace Text With Examples

The text can be replaced and removed using two methods in PowerShell, including the “replace()” method and the “-replace” operator.

Share Button
Read More
| by Arround The Web

Copy-Item: Copy Files Like a Boss in PowerShell

“Copy-item” cmdlet’s core purpose is to copy the files or folders from one location to another. It copies the file to another location with the same namespace.

Share Button
Read More
| by Arround The Web

4 Ways to Check Your PowerShell Version

The PowerShell version can be checked using various ways, including “Get-Host”, “$PSVersionTable”, “$Host.Version”, or “Registry Key”.

Share Button
Read More
| by Arround The Web

Select the Values of One Property on all Objects of an Array in PowerShell

To select the values of one property on all objects of an array in PowerShell, use these methods “Select-Object”, “$array.Property”, or “%{$_.Property}”.

Share Button
Read More
| by Arround The Web

Secure String PowerShell

To secure a string value or password in PowerShell, two methods, including “ConvertTo-SecureString” and “Read-Host” are used.

Share Button
Read More
| by Arround The Web

PowerShell Syntax for Send-Mailmessage – Email to Multiple Recipients

The email can be sent to multiple recipients by creating an array of strings and adding emails within inverted commas separated by commas.

Share Button
Read More
| by Arround The Web

PowerShell – Extract File Name and Extension

The file name and extension can be extracted or exported with the combination of the “Get-ChildItem” cmdlet and the “Out-File” cmdlet.

Share Button
Read More
| by Arround The Web

Install Software Using PowerShell Script

To install the software using PowerShell, first add the “Start-Process” command and then add the software file and execute it for standard installation.

Share Button
Read More
| by Arround The Web

Get Date and Time on the Same Line – PowerShell

The date and time can be printed on the same line using two approaches, “Get-Date -Format G” and “(Get-Date).ToString()”.

Share Button
Read More
| by Arround The Web

How to Install .MSI Using PowerShell

To install the “.MSI” file using PowerShell, write out the “Start-Process” cmdlet, specify the path of the installer and finally execute it.

Share Button
Read More
| by Arround The Web

How do I Convert an Array Object to a String in PowerShell?

An array object can be converted to a string using several methods, including [String]$array, [system.String]::Join(” “, $array) or join operator.

Share Button
Read More
| by Arround The Web

How Can I Replace Every Occurrence of a String in a File With PowerShell

Every occurrence of a string in a file can be replaced using two methods including “Get-Content and Set-Content” and “System.IO.File”.

Share Button
Read More
| by Arround The Web

How Can I Check if a String is Null or Empty in PowerShell?

The string value can be checked if it is null or empty in PowerShell using IsNullorEmpty(), IsNullOrWhiteSpace, or conditional if-else statements methods.

Share Button
Read More
| by Arround The Web

Get Full Path of the Files in PowerShell

To get the full path of the files in PowerShell, use the “Get-ChildItem” cmdlet alongside “Select-Object”, “Format-Table”, or “ForEach” commands.

Share Button
Read More
| by Arround The Web

EXE Silent Installation – PowerShell

To install the EXE file silently, first, use “Start-Process” command, specify the “EXE” file path, and add the “-ArgumentList” option with “/S /v/qn” values.

Share Button
Read More
| by Arround The Web

How to Rename Files in a Loop in PowerShell

Renaming of files in a loop in PowerShell can be performed by using the “ForEach()” loop with the combination of the “Get-ChildItem” and “Rename-Item” cmdlets.

Share Button
Read More
| by Arround The Web

Run PowerShell Script As Administrator

To run the PowerShell script as administrator, first, run the PowerShell as administrator. Then, execute the PowerShell script using path and script file name.

Share Button
Read More
| by Arround The Web

Function return value in PowerShell

return value in the PowerShell function exits the script after the execution of the code above it. It can also return values to the console.

Share Button
Read More
| by Arround The Web

Echo Equivalent for Script Testing in PowerShell

The “Write-Output” and the “Write-Host” commands are the “Echo” equivalent in PowerShell. Both of the commands write the input text as an output.

Share Button
Read More
| by Arround The Web

Running PowerShell as Another User and Launching a Script

To run a PowerShell script as a different user, first, open and log in to “Windows PowerShell Credential Request”. After that, execute the script from it.

Share Button
Read More