Create and Configure Virtual Machine with PowerShell

Create New Virtual Machine Let’s go to create the new virtual machine. Type new-vm -vmname test -memorystartupbytes 1GB Create Virtual Hard Drive new-vhd -path “C:\users\Public\Documents\Hyper-v\Virtual Hard Disks\test.vhdx” -sizebytes 20GB -fixed Use the -fixed to determine that your Virtual Hard Drive will be fixed. Because by default use Dynamic Virtual Hard Disk Type. After create the Virtual Hard Disk you will see […]

Read more

PowerShell: Alert me when Disk Space is running low on my Windows Servers (E-Mail Notification)

With this PowerShell script you can get an email notification when your disk space is running low on your Windows Servers. PowerShell Script: function getDiskFreeSpace { Get-WmiObject Win32_Volume -computername $args -filter “drivetype = 3” | Select-Object _SERVER, Name, @{Name=”Size(GB)”;Expression={“{0:N1}” -f($.Capacity/1gb)}},@{Name=”FreeSpace(GB)”;Expression={“{0:N1}” -f($_.freespace/1gb)}},@{Name=”FreeSpacePerCent”;Expression={“{0:P0}” -f($_.freespace/$_.capacity)}} | Where-Object -FilterScript {$_.FreeSpacePerCent -lt 95} | Sort-Object -property “FreeSpacePerCent” | Format-Table } ForEach($s in Get-Content c:\Temp\serverlist.txt) { […]

Read more

Must have PowerShell Tool for SysAdmins

Hey Guys, as a Windows SysAdmin some of your primary tools is Active Directory and PowerShell. I want to share this tool I found online from Patrick Gruenauer – Author of https://sid-500.com/ You can download the tool from here: https://sid-500.com/2018/05/22/active-directory-domain-services-section-version-1-1/ Active Directory Domain Services Section What can we do with it? This is the question for this part. I wanna […]

Read more

Useful PowerShell Scripts/Commands

Step 1: Get-Help, Get-Command, Get-Member and Get-Alias Thanks to Justin for pointing out that I left out probably the most useful command. Get-Help. I’ve added some of my other favorite commands for learning as well, which I still use almost daily. Get-Help is an amazingly useful command and is quite versatile. Get-Help Get-WMIObject – Will output basic help and tips […]

Read more

Disable the Clutter feature in O365 mailboxes

To disabled the clutter feature in a user’s O365 mailbox run the following command:   Turn off Clutter for single user Get-Mailbox –identity someone@somewhere.com | Set-Clutter -enable $false    OR   Single mailbox: Set-Clutter -Identity <user name> -Enable $false      If you want to disable this feature for all users in your tenant as an admin, you can do this with […]

Read more

Delete all Calendar events from a mailbox

Connect to O365 using powershell first   Open PowerShell or EMS If this is an O365 mailbox, you will need to connect to the O365 environment Connect to Exchange On-line From the PowerShell console on an Exchange 2010 server: $Cred = Get-Credential  $s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic –AllowRedirection  Import-PSSession $s    Then run this command in powershell: Search-Mailbox -identity “UsersMailbox” -SearchQuery kind:meetings -DeleteContent   

Read more

How to copy old user’s mailbox to another user’s mailbox on Office 365 and Exchange Server using PowerShell

You will come across the issue with leavers mailboxes needing to be transferred to another users mailbox. If you are looking after on-site exchange, then the process is slightly shorter as you don’t need to connect to the remote Powershell.   To connect to O365 first run this PS command: $Cred = Get-Credential  $s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic […]

Read more

Bulk import email aliases to Office 365 using Powershell

If you need to add email aliases to O365 accts in bulk use the following (EMS) powershell command with the CSV file formatted this way:   Name ProxyAddresses user1@domainold.com user1@domainnew.com   Run this in EMS: Import-Csv C:\email-aliases.csv | ForEach-Object{ $name = $_.Name }  Import-Csv C:\email-aliases.csv | ForEach-Object{ $proxy = $_.ProxyAddresses -split ‘;’}  Set-RemoteMailbox -Identity $name -EmailAddresses @{add= $proxy}    OR   Get the display name and email […]

Read more

How to Add Computers to a Domain Using PowerShell

Performing a Domain Join Using PowerShell Once you’ve established correct DNS resolution for the domain name, start a PowerShell prompt with local administrative privileges. Press the Windows key to switch to the Start menu, type PowerShell and press CTRL+SHIFT+ENTER. If prompted, enter a local administrator username and password, or give consent to run PowerShell. In the PowerShell prompt, type add-computer –domainname ad.contoso.com -Credential AD\adminuser […]

Read more

How to Get the Serial Number of a Remote Computer Using PowerShell

Retrieving the Serial Number from a Local Computer The get-ciminstance PowerShell command was introduced in PowerShell 3.0. It allows administrators to run WMI queries on local or remote computers. To retrieve the BIOS serial number of the local computer, we need to access the Win32_BIOSWMI class. Log on to Windows Server 2012 R2, click the PowerShell icon on the desktop taskbar. In the prompt window, […]

Read more
1 2 3 10