Category: PowerShell 101
Common tasks you perform using the GUI that you can do faster in Windows PowerShell
Use PowerShell to disable scheduled tasks
How can I use Windows PowerShell to disable a scheduled task? Use the Disable-ScheduledTask cmdlet and specify the task name, for example: Disable-ScheduledTask -TaskName “SystemScan” How can I use Windows PowerShell to disable all scheduled tasks in a particular folder? Use the Get-ScheduledTask cmdlet to enumerate the scheduled tasks in the folder, and then pipe the objects to […]
Read moreUse PowerShell to disconnect virtual disk
How can I use Windows PowerShell to disconnect from a virtual disk? Use the Disconnect-VirtualDisk cmdlet and specify the friendly name, for example: Disconnect-VirtualDisk -FriendlyName VirtualDisk01
Read moreUse PowerShell to dismount a disk image
How can I use Windows PowerShell to dismount a virtual disk? Use the Dismount-DiskImage cmdlet. It will dismount either an ISO or a virtual hard disk. Specify the path then using -imagepath. Here is an example: Dismount-DiskImage -imagepath “C:\fso\myisodisk.iso”
Read moreHow Can I Be Notified Any Time a Service Goes Down?
How can I be notified any time a service goes down? There are a couple different ways you can do this, but perhaps the simplest approach is to create a script that monitors WMI events. We don’t have time to do a detailed explanation of WMI events in this column, but the basic idea is that you can ask WMI […]
Read morePowerShell: Get a GUI interface for any PowerShell cmdlet
Some cmdlets have too many parameters to list. Is there an easy way to build a cmdlet with its parameters for the console? Just use the Show-Command cmdlet with any PowerShell cmdlet to get a GUI interface. In the following example, we use this with the Import-MDTDriver cmdlet. When you are done, you will have three options: Run, Copy (for the […]
Read morePowerShell: Use a destructive PowerShell cmdlet safely
PowerShell has a built-in safety switch to many of its cmdlets. The –whatif parameter, which is meant to show you what would happen if you used a PowerShell cmdlet without actually executing the cmdlet. An example of this in action is in the following Remove-Item cmdlet. This will attempt to remove the document, HSG-Article-Sean-Should-Not-Lose.docx, without actually removing it. Remove-Item .\HSG-Article-Sean-Should-Not-Lose.docx […]
Read moreHow to get all groups that a user is a member of?
Open PowerShell with administrator privileges and run: Get-ADPrincipalGroupMembership username | select name name —- Domain Users Domain Computers Workstation Admins Company Users Company Developers AutomatedProcessingTeam Example:
Read moreSetting Distribution Group Delivery Restrictions via PowerShell
Adjusting the delivery restrictions on distribution groups is quite a common task. The more members a group has the more of a problem this ends up being in big organisations. Setting the permissions in the Exchange Management Console (EMC) is simple enough when you have one or two people/groups to add to the allowed list. When you have many user/groups […]
Read more