Occasionally, it may become necessary to delete a set of subfolders within a given folder. Here is a simple chunk of code that deletes the folders from a list of folder names.
Warning: this code will delete the subfolders listed in $list without further confirmation. If the subfolders do not exit, nothing…
To manage auto starting programs on Windows, don’t bother writing extensive scripts. PowerShell can directly open the autostart manager included in task manager which does all you need:
PS C:\> Taskmgr /7 /startup
This opens a window and lists all auto starting programs, along with their…
The PowerShell Gallery not only offers public modules with new PowerShell commands but also public scripts. Before you invest time, you may want to investigate if someone else may have created PowerShell code that can do what you want.
Here is a quick example that illustrates how searching and downloading…
PowerShell remoting is insanely powerful: with Invoke-Command, you can send arbitrary PowerShell code to one or many remote machines and execute it there in parallel.
On Windows Servers, PowerShell remoting is typically enabled, so all you need are Administrator privileges. Here is a simple example:
New-Item can create new things on any PowerShell drive, including the function: drive that holds all PowerShell functions.
If you’d like, you can define new functions dynamically inside your code. These new functions would then exist only in the scope where they were defined. To make them script-global…
In the previous parts, we created the Test-Password function that can test user account passwords for both local and remote user accounts.
In our last part, we’ll add error handling to the Test-Password function so it responds gracefully when the user enters domain that does not exist or is unavailable…
In the previous tip we showed how PowerShell can validate and test user account passwords, however the password was requested in plain text. Let’s change this so that PowerShell masks the password when it is entered.
You can re-use the strategy used below for any other PowerShell function where…
PowerShell can test user account passwords for you. This works both for local and domain accounts. Here is a sample function called Test-Password:
Windows operating systems can be uniquely identified by a so-called 4K-Hash: this is a special hash string that is 4000 bytes in size. You can use this hash for example with “Windows Autopilot” to add physical and virtual machines.
The 4K Hash is just one piece of information required to…
If your laptop battery is going low too soon, or you’d like to investigate related issues, there is a simple way to generate an extensive battery charging report. It shows exactly when your battery was charged, what its capacity is, and how long it took to deplete.
Here is the code to create a…
Powered by IDERA