Sometimes, you'd like to turn security identifiers (SIDs) into real names. Here is a function that can do this for you: function SID2Name($sid){...
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 WindowsPowerShellConverting User Names to SIDs
If you want to translate a valid user name to its security identifier (SID), here is a function to do that for you: function Name2SID($name,...
Changing Units
When you list folder contents, file sizes are in bytes. If you'd rather like to view them in MB or GB, you can use calculated properties, but by...
Closing Excel Gracefully
When you access Microsoft Excel from script, you may have noticed that it never gets removed from memory again, even if you call its Quit() method:...
Formatting Currencies
Formatting numbers as currencies is straight-forward - as long as it is your own currency format: '{0:C}' -f 12.22 If you want to output...
Using Regular Expressions with Dir
When you use Dir (alias: Get-ChildItem) to list folder contents, you can use simple wildcards but they do not give you much control. A much more...
Permanently Changing User Environment Variables
To create or change an environment variable in the user context, use this low-level call: [environment]::SetEnvironmentVariable('Test',...
Using Wildcards with Environment Variables
You can use the env: PowerShell drive to list all Windows environment variables like this: PS> Dir env:*user* Name Value ---- ----- USERNAME...
Creating PowerShell Menus
PowerShell is console based, so its default menus are console based as well. To offer choices to your users, here is some sample code to create a...
Scanning Registry for ClassIDs
The Windows Registry is a repository filled with various Windows settings. Get-ItemProperty can read Registry values and accepts wildcards. So, with...
Bypassing Execution Policy
When execution policy prevents execution of PowerShell scripts, you can still execute them. There is a secret parameter called "-" . When you use...
Controlling Automatic Updates Installation Time
To find out when Automatic Updates wakes your PC to install new updates, here is a script that will retrieve that information: $updateObj =...
Controlling Automatic Updates
To control whether Windows download and/or installs updates silently or prompts for permission, use this script and set the appropriate...
Retrieve Yesterday’s Error Events
To retrieve all error events from a system log that occurred yesterday, here is how to calculate the start and stop times: PS> $end = Get-Date...
Creating Intelligent Variables
To create variables that calculate their content each time they are accessed, use access-triggered variable breakpoints. This line, for example,...
Setting Breakpoints in PowerShell Scripts
Most sophisticated PowerShell editors have built-in debugging support. PowerShell can handle breakpoints natively, too, though. To make PowerShell...
PowerShell Script Security Auditing
When you digitally sign scripts, you can easily tell whether a script was manipulated or comes from an untrusted source. Here is a function that can...
Re-Encoding ISE-Scripts
When you save scripts with the PowerShell ISE script editor, they are saved with the rather unusual "Big Endian Unicode" encoding....
Digitally Signing PowerShell Scripts
In a previous tip, we illustrated how you access a code signing certificate that was installed on your computer. With such a certificate, you can...
Finding Code Signing Certificates
To digitally sign PowerShell scripts, you need a certificate with the purpose "CodeSigning". Here is how you find out which code signing...
How Large Are My Folders?
To find out the total size of all subfolders in a directory, try this function: function Get-FolderSize($Path=$home) { $code = { ('{0:0.0}...
HTML-Scraping with RegEx
To scrape valuable information from websites with PowerShell you can download the HTML code and then use regular expressions to extract what you are...
Finding Multiple RegEx Patterns
PowerShell comes with great support for regular expressions but the -match operator can only find the first occurrence of a pattern. To find all...
Creating Pipeline Filters
In a previous tip, we illustrated how a function can run inside a PowerShell pipeline. That's an excellent way to create filters. Here is a...
Using Functions inside the Pipeline
Code inside PowerShell functions always is placed in the begin, process, or end block. You may not have noticed this because when you don't do...
Forget the "Finally"-Block
When you handle errors using try/catch/finally, you may wonder what the finally block is for. Here is a demo: try { dir nonexisting:\ -ErrorAction...
Understanding and Handling Terminating Errors
To suppress errors in a cmdlet, you can use the common parameter -ErrorAction SilentlyContinue. Here is a sample: Get-WmiObject Win32_BIOS...
Use "E" in Numbers
To quickly define large integers, use the keyword "E" inside your number: PS> 64E6 64000000 ReTweet this Tip! http://bit.ly/pGRrMP
Executing PowerShell Commands with Full Privileges
If a script needs to run only particular commands with full Administrator privileges, you can run those in a separate elevated shell. $code =...
Running Script with Full Privileges
On UAC-enabled systems, to make sure a script is running with full admin privileges, add this code at the beginning of your script:...