The default PowerShell prompt displays the current location. When you are deep inside nested folders, this steals room for your actual input, and...
posts-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
Tags
Administration agent-based monitoring Agentless Monitoring alert responses alert thresholds alerting Alerts Amazon Aurora Amazon EC2 Amazon RDS Amazon RDS / Aurora Amazon RDS for SQL Server Amazon Redshift Amazon S3 Amazon Web Services (AWS) Analytics application monitoring Aqua Data Studio automation availability Azure Azure SQL Database azure sql managed instance Azure VM backup Backup and recovery backup and restore backup compression backup status Backup Strategy backups big data Blocking bug fixes business architecture business data objects business intelligence business process modeling business process models capacity planning change management cloud cloud database cloud database monitoring cloud infrastructure cloud migration cloud providers Cloud Readiness Cloud Services cloud storage cloud virtual machine cloud VM clusters code completion collaboration compliance compliance audit compliance audits compliance manager compliance reporting conference configuration connect to database cpu Cross Platform custom counters Custom Views customer survey customer testimonials Dark Theme dashboards data analysis Data Analytics data architect data architecture data breaches Data Collector data governance data lakes data lineage data management data model data modeler data modeling data models data privacy data protection data security data security measures data sources data visualization data warehouse database database administration database administrator database automation database backup database backups database capacity database changes database community database connection database design database developer database developers database development database diversity Database Engine Tuning Advisor database fragmentation database GUI database IDE database indexes database inventory management database locks database management database migration database monitoring database navigation database optimization database performance Database Permissions database platforms database profiling database queries database recovery database replication database restore database schema database security database support database synchronization database tools database transactions database tuning database-as-a-service databases DB Change Manager DB Optimizer DB PowerStudio DB2 DBA DBaaS DBArtisan dBase DBMS DDL Debugging defragmentation Demo diagnostic manager diagnostics dimensional modeling disaster recovery Download drills embedded database Encryption End-user Experience entity-relationship model ER/Studio ER/Studio Data Architect ER/Studio Enterprise Team Edition events execution plans free tools galera cluster GDPR Getting Started Git GitHub Google Cloud Hadoop Healthcare high availability HIPAA Hive hybrid clouds Hyper-V IDERA IDERA ACE Index Analyzer index optimization infrastructure as a service (IaaS) infrastructure monitoring installation Integrated Development Environment interbase Inventory Manager IT infrastructure Java JD Edwards JSON licensing load test load testing logical data model macOS macros managed cloud database managed cloud databases MariaDB memory memorystorage memoryusage metadata metric baselines metric thresholds Microsoft Azure Microsoft Azure SQL Database Microsoft PowerShell Microsoft SQL Server Microsoft Windows MongoDB monitoring Monitoring Tools Monyog multiple platforms MySQL news newsletter NoSQL Notifications odbc optimization Oracle PeopleSoft performance Performance Dashboards performance metrics performance monitoring performance schema performance tuning personally identifiable information physical data model Platform platform as a service (PaaS) PostgreSQL Precise Precise for Databases Precise for Oracle Precise for SQL Server Precise Management Database (PMDB) product updates Project Migration public clouds Query Analyzer query builder query monitor query optimization query performance Query Store query tool query tuning query-level waits Rapid SQL rdbms real time monitoring Real User Monitoring recovery regulations relational databases Releases Reporting Reports repository Restore reverse engineering Roadmap sample SAP Scalability Security Policy Security Practices server monitoring Server performance server-level waits Service Level Agreement SkySQL slow query SNMP snowflake source control SQL SQL Admin Toolset SQL CM SQL code SQL coding SQL Compliance Manager SQL Defrag Manager sql development SQL Diagnostic Manager SQL Diagnostic Manager for MySQL SQL Diagnostic Manager for SQL Server SQL Diagnostic Manager Pro SQL DM SQL Doctor SQL Enterprise Job Manager SQl IM SQL Inventory Manager SQL Management Suite SQL Monitoring SQL Performance SQL Quality SQL query SQL Query Tuner SQL Safe Backup SQL script SQL Secure SQL Security Suite SQL Server sql server alert SQL Server Migration SQL Server Performance SQL Server Recommendations SQL Server Security SQL statement history SQL tuning SQL Virtual Database sqlmemory sqlserver SQLyog Storage Storage Performance structured data Subversion Support tempdb tempdb data temporal data Tips and Tricks troubleshooting universal data models universal mapping unstructured data Uptime Infrastructure Monitor user experience user permissions Virtual Machine (VM) web services webinar What-if analysis WindowsPowerShellHelp Make PowerShell a Better Place!
Rather than ranting about things that don't work as expected, or things you feel are missing, be constructive! The PowerShell team takes great...
Try CTRL+SPACE!
In the PowerShell ISE, there are two key shortcuts that can help you. Pressing TAB works just like in the console, and each time you press TAB, you...
Adding Command Not Found Handler
Whenever PowerShell comes across a command name that it does not know, you see a red error message. However, starting with PowerShell 3.0, there is...
Auto-CaseCorrecting PowerShell Code
Often when you write PowerShell scripts, you may not have used the correct casing, used only partial parameter names, or used aliases instead of...
Finding Loaded Assemblies
To dump all .NET assemblies that are loaded in a PowerShell session, try this: System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object...
Finding Cmdlet Parameter Aliases
PowerShell cmdlets and functions can have parameters, and these parameters can have (shorter) alias names. One prominent example is the...
Simplify Parameter Attributes
If all of your systems run PowerShell 3.0 or better, you can start shortening function parameter attributes. Boolean attributes now all default to...
Why GetTempFileName() is Evil
Some may have come across a .NET call that is supposed to generate random temporary file names: $path = [System.IO.Path]::GetTempFileName() $path...
Creating Encoded PowerShell Commands on the Fly
When you run PowerShell code outside a PowerShell console, you need to submit the code to powershell.exe. To make sure your code does not conflict...
Adding ValidateRange to a Variable
If you'd like to apply a numeric range of legal values to a variable, you can add a ValidateRange attribute to the variable, pretty much like...
Why $MaximumHistoryCount has a Limit
If you try and increase your maximum command history, you may run into some limitations: PS C:\> $MaximumHistoryCount = 100000 The variable...
Increase History Cache
Command history can be a great help when you work for a while in a PowerShell session. Each session stores the commands you issued, and you can...
Getting Last Bootup Time
In PowerShell 3.0 and better, it's trivial to get back real DateTime information from WMI using Get-CimInstance. This would tell you when your...
Copying Arrays (Part 2)
In a previous tip we explained how you can safely "clone" an array using Clone() method. This will copy the content of an array to a new...
Copying Arrays (Part 1)
When you copy variable content, you may just copy the "reference" (memory address), not the content. Take a look at this example: $a =...
Using Encoded Scripts
In VBScript there were encoded scripts. Encoding is by no means a safe way of hiding script content, but it makes it a little harder for users to...
Use try…finally to Execute Code when PowerShell Closes
If you must run some code before PowerShell should exit, you could simply use a try…finally clause like this: try { # some code Start-Sleep...
Using Background Jobs
Background jobs can help speed up your scripts. If your scripts consist of a number of separate tasks that also could run in parallel, then...
Removing Windows 10 Apps
Windows 10 comes with a bunch of preinstalled apps. Fortunately, you can use PowerShell to remove any app you don’t like. You may need...
Fixing Remoting Sender Information
If you use Invoke-Command to remotely execute PowerShell code, you may have noticed that PowerShell remoting adds a new PSComputerName property that...
Setting New Windows Registered Owner
This small piece of code prompts for a new registered owner name, then updates the value in the Windows Registry. Note that this requires...
Downloading Files
Invoke-WebRequest can download files from the internet for you. This example downloads a 33MB public NASA video to your computer, then starts to...
Using Hash Table as Conditional Code Repository
It is routine for scripts to check whether a folder exists, and if it is missing, to create it: #requires -Version 1 $path = 'c:\testfolder'...
Why Invoke-Expression is Evil
Invoke-Expression takes any string and treats it as PowerShell code. This way, you could construct dynamic code, and then execute it....
Accessing Web Page Content
Beginning with PowerShell 3.0, the cmdlet Invoke-WebRequest can download web page content quite easily. This would scrape all links from...
Analyzing svchost Processes
Occasionally, you may see a bunch of processes named "svchost" in your task monitor or Get-Process output. These processes are hosts for Windows...
Identifying Services by ProcessID
Group-Object is a great cmdlet to create lookup tables. If you wanted to identify a Windows service by its process ID, here is a way: $serviceList =...
Creating Real Classes
PowerShell introduces class support in PowerShell 5.0, but you can define your own classes in other PowerShell versions as well. Simply use C# code...
Adding Test Hosts to PowerShell ISE
To quickly open new test hosts inside the PowerShell ISE that ships with PowerShell 3.0 and better, here is a small helper function: #requires...