Blog

3 minutes read
You can use the following PowerShell command to set the monitor timeout to "never":powershell ([System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null) $power= [System.Windows.Forms.SystemInformation]::PowerStatus $power.IsMonitorOn = $trueHow to keep monitor on indefinitely?To keep a monitor on indefinitely, follow these steps:Adjust the power settings on your computer to prevent the monitor from entering sleep mode.
4 minutes read
To dynamically append time in a file using PowerShell, you can use the Get-Date cmdlet to get the current date and time, and then use the Out-File cmdlet to append this information to a file. Here is a simple example:$currentTime = Get-Date $currentTime | Out-File -FilePath "C:\path\to\your\file.txt" -AppendThis will append the current date and time to the specified file.
4 minutes read
To delete Outlook inbox subfolder contents using PowerShell, you can use the Search-Mailbox cmdlet. First, you need to connect to the Exchange Online PowerShell by running the following command: $UserCredential = Get-Credential Connect-ExchangeOnline -Credential $UserCredential -ShowBanner $false Next, you can use the Search-Mailbox cmdlet to search and delete the contents of the desired subfolder.
2 minutes read
You can send an email from Yahoo SMTP server using PowerShell by utilizing the Net.Mail.SmtpClient class. First, you will need to specify the SMTP server settings for Yahoo, which are smtp.mail.yahoo.com for the SMTP server address and port 465 with SSL enabled. You will also need to provide your Yahoo email address and password for authentication. Next, you can create a new instance of Net.Mail.MailMessage class and specify the sender, recipient, subject, and body of the email.
6 minutes read
Sending an email with PowerShell is a fairly simple process that involves utilizing the Send-MailMessage cmdlet. This cmdlet allows you to send an email from within your PowerShell script by specifying the necessary parameters such as the recipient, subject, body, and SMTP server.To send an email using PowerShell, you first need to load the necessary modules by importing the PSSendMail module or using the .Net namespace.
5 minutes read
To run multiple PowerShell scripts simultaneously, you can open multiple PowerShell windows or use the Start-Process cmdlet to start each script in a new process. Another option is to create a PowerShell script that runs each desired script as a separate job using the Start-Job cmdlet. This allows you to run multiple scripts concurrently and monitor their progress.
3 minutes read
To delete all Azure resources with PowerShell, you can use the Remove-AzResourceGroup cmdlet. This cmdlet allows you to specify the name of the resource group that you want to delete, and it will remove all resources contained within that group. Additionally, you can use the Get-AzResourceGroup cmdlet to list all the resource groups in your Azure subscription, so you can easily identify and delete the ones you no longer need.
4 minutes read
To load a custom PowerShell profile with a single command, you can use the following command: . $PROFILE This command will dot-source (i.e., execute) the current user's PowerShell profile, which can be used to customize your PowerShell environment with functions, aliases, variables, and other settings. By running this command, your custom profile settings will be loaded into the current PowerShell session.
6 minutes read
In PowerShell, you can compare variable properties by accessing the properties of the variables and using comparison operators. To compare variable properties, use the dot notation to access the properties of the variables and then use comparison operators such as -eq (equal), -ne (not equal), -gt (greater than), -lt (less than), -ge (greater than or equal to), and -le (less than or equal to).
6 minutes read
To search a collection with an array in PowerShell, you can use the -contains operator to check if an element is present in the array. Here's an example: $myArray = @('apple', 'banana', 'orange', 'grape') $collection = @('apple', 'orange', 'pear') foreach ($item in $collection) { if ($myArray -contains $item) { Write-Host "$item found in the collection.