Here is a quick code sample that displays a popup warning dialog:
Add-Type -AssemblyName System.Windows.Forms
$message = 'Your system will shutdown soon!'
$title = 'Alert'
[System.Windows.Forms.MessageBox]::Show($message, $title, [System.Windows.Forms.MessageBoxButtons]::OKCancel,
Occasionally it is useful and even necessary to use console applications in PowerShell scripts. In the previous tip, for example, we looked at ways to remove mapped network drives, and even though Remove-PSDrive claims to be able to do this, the most reliable way is to still use the old net.exe console…
While Remove-PSDrive can remove all kinds of drives including network drives, changes may not take effect until the system reboots. That’s of course ridiculous.
This task is a good example why it is useful that PowerShell made console applications equal citizen. In fact, even in year 2021 the most…
There are many ways to list mapped network drives. One of them uses PowerShell’s Get-PSDrive and checks to see whether the target root starts with “\\”, indicating a UNC network path:
PS> Get-PSDrive -PSProvider FileSystem | Where-Object DisplayRoot -like '\\*'
In previous tips we looked at how you can use Get-PrinterProperty to read printer properties for locally installed printers. This cmdlet is part of the PrintManagement module which ships with all Windows operating systems.
Important: Since property names are print driver specific, this cmdlet can be…
In the previous tip we looked at Get-PrinterProperty which is part of the PrintManagement module and available on Windows operating systems.
In this tip, let’s check out how you can actually use the printer values in your own scripts, and how storing them in a hash table makes accessing printer properties…
You probably know Get-Printer which returns the names of all installed printers on a system. However, you can’t get specific printer features or settings that way.
Get-PrinterProperty can help. Simply submit the name of a printer (use Get-Printer to find out the available printer names), and run…
A telnet client comes with every Windows 10 version but it is initially hidden. To enable the telnet client, run this command with full Admin privileges:
PS> Enable-WindowsOptionalFeature -Online -FeatureName TelnetClient -All
Online : True
RestartNeeded : False
In the previous tip we created new shortcut files, and you have seen how the CreateShortcut() method provides methods to control almost any detail of a shortcut. Here’s the code again that creates a PowerShell shortcut on your Desktop:
$path = [Environment]::GetFolderPath('Desktop') |
Powered by IDERA