posts-powershell

Converting Excel CSV to UTF8

Converting Excel CSV to UTF8

When you export Microsoft Excel spreadsheets to CSV files, Excel by default saves CSV files in ANSI encoding. That's bad because special characters...

Converting Excel CSV to UTF8

Change Order of CSV Columns

If you have a CSV file and would like to change the order of columns, simply import it into PowerShell, use Select-Object to change the order, and...

Converting Excel CSV to UTF8

Check Windows License Status

In a previous tip we explained how you can use slmgr, a built-in VBScript, to check Windows licensing state. Accessing the Raw Licensing Data in...

Converting Excel CSV to UTF8

Stripping Decimals Without Rounding

Extracting the Integer Part of a Division Result When you divide numbers and just want the decimals before the decimal point, you could cast the...

Converting Excel CSV to UTF8

Removing Multiple White Spaces

Removing multiple white spaces from text is easy in PowerShell. -replace operator Simply use -replace operator and look for whitespaces ("\s") that...

Converting Excel CSV to UTF8

Sending Emails with Special Characters

Send Emails with PowerShell Using Send-MailMessage PowerShell has built-in support for sending emails: Send-MailMessage! All you need is an SMTP...

Converting Excel CSV to UTF8

Ignoring Empty Lines

Reading Text Files and Skipping Blank Lines To read in a text file and skip blank lines, try this: $file = 'c:\sometextfile.txt' Get-Content $file |...

Converting Excel CSV to UTF8

Writing Registry Key Default Values

Set the default value for a registry key If you need to set the default value for a registry key, you can use either of these approaches:...

Converting Excel CSV to UTF8

Case-Sensitive Hash Tables

PowerShell hash tables PowerShell hash tables are, by default, not case sensitive: PS > $hash = @{} PS > $hash.Key = 1 PS > $hash.keY = 2...