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') |
PowerShell creates new LNK files and edits existing ones with the help of an old COM object.
Let’s first find all LNK files anywhere in your start menu:
[Environment]::GetFolderPath('StartMenu') | Get-ChildItem -Filter *.lnk -Recurse
You get back all LNK files found anywhere in your…
Windows 10 comes with a number of PowerShell modules that you can use to control Server functionality - like WSUS Update Management which is only one example of many.
In earlier Windows 10 builds, these PowerShell modules were part of so-called RSAT tools (Remote Server Administration Tools), a separate…
Windows 10 ships with the ActiveDirectory PowerShell module – it may just not be enabled yet. If you would like to use PowerShell cmdlets for AD management – i.e. Get-ADUser – simply run the following code with full Administrator privileges:
$element = Get-Wi…
In the previous tip we looked at Get-EventLog to do a forensic analysis and find search-related errors in the Application log. Get-EventLog is simple to use yet it is slow and deprecated. While it is perfectly OK to use Get-EventLog on Windows PowerShell, you might want to switch to Get-WinEvent instead…
Event logs log almost any aspect of Windows so if something goes wrong or stops working as expected, it is a good idea to include event log forensic strategies into your troubleshooting.
For example, some users reported that their Windows “Instant Search” stopped finding newer Email items. Why would…
Let’s assume you are invited to the 37th birthday of a friend. What can you put on the birthday card? Try this:
PS> Invoke-RestMethod -Uri http://numbersapi.com/37 -UseBasicParsing
37 is the number of plays William Shakespeare is thought to have written (counting Henry IV as three parts).
When you split texts, you typically lose the splitting character. That’s why the backslash in this example is lost:
PS> 'c:\test\file.txt' -split '\\'
IMPORTANT: Note that the -split operator expects a regular expression. If you want to split at backslashes…
In the previous tip we showed that Sort-Object accepts property names, hash tables or plain script blocks to sort things, and we used script blocks to control the sort algorithms, and sort string information by date and time, not alphanumerical.
In this final example, let’s use this to sort IPv4 addresses…
Powered by IDERA