In the previous tip we added considerable speed to a common script pattern. Now, let’s squeeze out even more performance with a pretty unusual...
Powershell
Categories
- Free tools
- SQL Admin Toolset
- SQL Compliance Manager
- SQL Defrag Manager
- SQL Diagnostic Manager for MySQL
- SQL Diagnostic Manager for SQL Server
- SQL Diagnostic Manager Pro
- SQL Doctor
- SQL Enterprise Job Manager
- SQL Inventory Manager
- SQL Query Tuner for SQL Server
- SQL Safe Backup
- SQL Secure
- SQL Workload Analysis for SQL Server
- Uptime Infrastructure Monitor Formerly Uptime
Performance (Part 1): From 6 min to 2 sec
Here is a common mistake found in many PowerShell scripts: $start = Get-Date $bucket = @() 1..100000 | ForEach-Object { $bucket += "I am adding...
Keeping Track of Script Execution
Here is a chunk of code that demonstrates how you can store private settings in the Windows Registry: # store settings here $Path =...
Retrieving Outlook Calendar Entries
If you use Outlook to organize your calendar events, here is a useful PowerShell function that connects to Outlook and dumps your calendar entries:...
Getting AD Users with Selected First Letters
How would you query for all AD users with names that start with a “e”-“g”? You shouldn’t use a client-side filter such...
Adding New Incrementing Number Column in a Grid View Window
Maybe you’d like to add a column with incrementing indices to your objects. Try this: $startcount = 0 Get-Service | Select-Object -Property...
Improving Group-Object
In the previous tip we explained what Group-Object can do for you, and how awesome it is. Unfortunately, Group-Object does not scale well. When you...
Discover Group-Object
Group-Object is an awesome cmdlet: it can easily visualize distributions. Check out the examples below: Get-Process | Group-Object -Property Company...
Automating “Live” Websites
Occasionally, there is the need to automate tasks on websites that have been opened manually. Maybe you need to log into internal web pages first...
Installing Printers
Starting with Windows 8 and Server 2012 R2, these operating systems ship a PowerShell module called PrintManagement. The cmdlets found in this...
Using CSV to Create Objects
Sometimes it may be clever to use simple text-based CSV format internally to bulk-create objects, especially if the original data is already...
Finding Active Directory Group Members Efficiently
Often, AD Administrators need to find all members of a given AD group, including nested members. Here is a code snippet that frequently surfaces in...
Using Artificial Intelligence with Azure Cognitive Services
The cloud these days not only offers virtual machines and storage, but also brand new and exciting services such as the cognitive services. You need...
Backing Up All Scripts to ZIP
PowerShell 5 finally includes support for ZIP files, so if you want to backup all of your PowerShell scripts into one ZIP file, here is a one-liner:...
Running PowerShell Code as Someone Else
Local admin privileges are extremely powerful, and you should use techniques such as JEA to minimize the number of local Admins as much as you can....
Hardening Script Block Logging
By default, script block logging data is open to anyone, not just Administrators. When script block logging is enabled, any user can access the log...
Enabling Script Block Logging
In the previous tips, we took a deep look at how PowerShell 5 script block logging works: in a nutshell, when enabled, all PowerShell code that...
Finding Secret Passwords in Memory
Some scripts may leave variables with sensitive information behind. This can happen by accident, when the global scope is used, or when users call...
Outputting Data to HTML Reports
Here is a super easy and useful PowerShell function called Out-HTML: function Out-HTML { param ( [String] $Path = "$env:temp\report$(Get-Date...
Stealing Sensitive Data from PowerShell Functions
Frequently, PowerShell functions work with sensitive information, i.e. log-on information including passwords, and store this information in...
Handling Credentials as Parameters
Credentials are objects that contain a user name and an encrypted password. If your PowerShell functions should be able to accept credentials,...
Resolving Mapped Drive
Ever wanted to know the original URL behind network drives? Here is an easy PowerShell way: # make sure the below drive is a mapped network drive #...
Downloading Data with BitsTransfer in the Background
Downloading very large files can be a challenge because the download process may take longer than a machine is turned on. With BitsTransfer, you can...
Downloading Data via SSL and BitsTransfer (Sync)
A very convenient built-in way to download files, even with SSL connections, is Start-BitsTransfer. It also sports a progress bar that shows the...
Downloading Data via SSL and Invoke-WebRequest
Invoke-WebRequest can download files for you but may struggle with HTTPS URLs. To use SSL connections, you may have to change a default setting....
Finding Disabled GPOs
Here is a quick one-liner that dumps all Group Policy objects that have all settings disabled: Get-Gpo -All | Where-Object GpoStatus -eq...
Browsing All Event Logs
Get-EventLog always requires you to specify exactly one event log via -LogName. You cannot use wildcards, and you cannot browse all event logs at...
Creating Event Log Reports
You probably have used Get-EventLog frequently to dump event log information, for example: PS> Get-EventLog -LogName System -EntryType Error...
Keyboard Shortcuts for PowerShell Console
The PowerShell console starting in version 5 ships with a module called PSReadLine which does much more than just coloring command tokens. It comes...
Using SSH from PowerShell
PowerShell 6 (PowerShell Core) finally ships with SSH support: you can use SSH to connect to non-Windows machines for PowerShell remoting...