The .NET Environment class can provide the paths to common folders like a user desktop: Environment]::GetFolderPath("Desktop") Use this...
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 WindowsPowerShellWriting Your Own Event Log Entries
If you have registered a new event log source, such as "PowerShellScripts" as described in the previous tip, you can now write your own...
Adding New Event Log Sources
Every event log maintains a list of registered sources. You need a source name if you want to write your own event log entries. Make sure you have...
Lowering Process Priority
Sometimes, you may want to lower process priority for some processes. That's a PowerShell one liner. Note that the next line lowers priority for...
Getting Help on WMI Methods
Have you ever wanted to get a list of all WMI methods present inside a specific WMI class – plus a meaningful description and a list of all...
Renewing all DHCP Leases
Some WMI classes contain static methods. Static methods do not require an instance....
Calling ChkDsk via WMI
Some WMI classes contain methods that you can call to invoke some action. For example, the next line initiates a disk check on drive D:...
Getting Help for WMI Classes
In a previous tip, you discovered how to search for WMI classes like Win32_VideoController. Now, what exactly is the purpose of this class? You can...
Finding Interesting WMI Classes
WMI is a huge repository. If you want to get to useful information, you will need to specify the name of a valid WMI class. Fortunately, it is easy...
Rename Drive Label
WMI can also read any drive label (the name that appears next to a drive inside Explorer), and you can change the drive label, too—provided...
Remove Empty Entries
One little known fact is that Where-Object is a cool and simple way of removing empty objects. Let's say you want to list all network adapters...
Finding Your Current Domain
Try this quick and simple way to find out the domain name that you are currently connected: [ADSI]"" The domain name is returned if you...
Retrieving Clear Text Password
Get-Credential is a great way of prompting for credentials, but the Password you enter into the dialog will be encrypted. Sometimes, you may need a...
Use PowerShell Cmdlets!
Whenever possible, try to avoid raw .NET access if you would like to create more readable code. For example, the following line returns the current...
Checking for .NET Framework Version with Powershell
You can use the -contains operator if you need to check whether a specific version of .NET is present on your system: @(dir...
Finding Available .NET Frameworks
Try this if you would like to get a quick overview of all installed .NET framework versions: dir $env:windir\Microsoft.NET\Framework\v* -name It...
Getting Visual Help for PowerShell Cmdlets
Here is a new way of getting help for your PowerShell cmdlets: If you are inside the U.S., try this: http://go.microsoft.com/fwlink/?LinkID=190436...
Secret Timespan Shortcuts
Usually, to create time spans, you will use New-Timespan. However, you can also use a more developer-centric approach by converting a number to a...
Finding Secret Date-Time Methods
However, to use developer-centric date-time methods, you will need to know them first. Here is how: Get-Date | Get-Member -memberType *Method This...
Adding and Subtracting Time
There are actually two different ways of manipulating dates and times. Here is the high-level approach to subtract 30 days from today: (Get-Date) -...
Creating Time Spans
A time span represents a time interval, and you can use time spans to subtract or add time to a date. For example, to get the date seven days ago:...
Make Function Parameters Mandatory
Mandatory parameters are special because if you do not submit it, PowerShell will automatically ask for it. You can use mandatory parameters in your...
Add Help to Your Functions
You should simply copy and paste the following block comment right above your functions and magically Get-Help works with your functions, too!...
Opening Current Folder in Explorer
Ever wanted to open the current PowerShell folder in an Explorer view? Try this: ii . This will work as long as the current folder is a valid file...
Get Running Process Owners
If you need to filter running processes by owner, for example to terminate the ones owned by some user, you should use WMI and the GetOwner()...
Check for a Battery
If your script needs to know whether your computer has a battery, you can ask WMI. Here is a small function: function Has-Battery {@(Get-WmiObject...
Store Pictures in User Accounts
Have you ever wondered how PowerShell would store a jpeg picture into your Active Directory user account? With the help of some low-level .NET...
Accessing Function Parameters by Type
Adding parameters to your functions is fairly easy. You can add a param() block and specify the parameters. But what if you wanted to assign values...
Creating Your own Types
Did you know that you can compile any .NET source code on the fly and use this to create your own types? Here is an example illustrating how to...
Calculating Server Uptime
Have you ever wanted to find out the effective uptime of your PC (or some servers)? The information can be found inside the event log. Here is an...