Tag Archives: PowerShell Magazine

New article on PowerShell Magazine: Compress files and folders with System.IO.Compression.ZipFile class

Unfortunately it is not possible to compress or extract zipped files using cmdlets in PowerShell. This feature will be introduced in PowerShell 5.0, but for the time being using the System.IO.Compression.ZipFile class can be a nice workaround. The full article  is available on PowerShell Magazine : Compress files and folders with System.IO.Compression.FileSystem class

1
[System.IO.Compression.ZipFile]::ExtractToDirectory('c:testing.zip', 'c:newtest')

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Links in this Article
PSTip: Compress files and folders with System.IO.Compression.FileSystem class
PowerShell Magazine
External Articles
Share

New article on PowerShell Magazine: Access remote registry using PowerShell

My latest article on PowerShell Magazine is on how to access the registry on a remote system. This is a technique I have used in a number of my scripts, for example: Get-RemoteProgram. The full article containing tips on how to use the Microsoft.Win32.Registry class is available on PowerShell Magazine : Access remote registry using PowerShell

The following example will retrieve the SubKeyNames of HKLM:\System\CurrentControlSet on the Server1 system:

1
2
3
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,'Server1') 
$RegSubKey = $Reg.OpenSubKey("System\CurrentControlSet")
$RegSubKey.GetSubKeyNames()

Win32RegistryKey

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Links in this Article
PSTip: Access remote registry using PowerShell
PowerShell Magazine
External Articles
Get-RemoteProgram
My entries in TechNet Script Gallery

 

Share

New article on PowerShell Magazine: Connect to Azure Virtual Machines without being prompted for credentials

The mstsc tool unfortunately does not support credentials, because of this I have written a short function that uses mstsc in combination a input of username and password or a PowerShell credential object. In the tip on PowerShell Magazine I show how to use this function to connect to Azure virtual machines. The full article  is available on PowerShell Magazine : Connect to Azure Virtual Machines without being prompted for credentials

Connect-Mstsc –ComputerName cloudservice.cloudapp.net:58142 –U jaapbrasser -P secretpw1

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Links in this Article
PSTip: Connect to Azure Virtual Machines without being prompted for credentials
PowerShell Magazine
External Articles
Connect-Mstsc
My entries in TechNet Script Gallery
Share

New article on PowerShell Magazine: Change a drive letter using Win32_Volume class

In Powershell there are a lot of neat little tricks available, today I will show how to change a drive letter using the Win32_Volume WMI class. The full article  is available on PowerShell Magazine : Change a drive letter using Win32_Volume class

$DvdDrive = Get-CimInstance -Class Win32_Volume -Filter "driveletter='F:'"
Set-CimInstance -InputObject $DvdDrive -Arguments @{DriveLetter="Z:"}

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Links in this Article
PSTip: Change a drive letter using Win32_Volume class
PowerShell Magazine
External Articles
Share

New article on PowerShell Magazine: Save untitled tabs in PowerShell ISE to clipboard

When I am working in the PowerShell ISE I often have many open untitled tabs open. In order to bring some order to the chaos I wrote a small function to save all untitled tabs to the clipboard so I could paste it somewhere else. The full article  is available on PowerShell Magazine : Save untitled tabs in PowerShell ISE to clipboard

After posting this tip, I noticed that Richard Diphoorn posted a nice addition to this tip on his blog. He uses the Send-MailMessage cmdlet to send the untitled tabs by email, to OneNote for example. His post is available here: Send Unsaved Untitled PowerShell ISE tabs to E-Mail

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Links in this Article
PSTip: Save untitled tabs in PowerShell ISE to clipboard
PowerShell Magazine
External Articles
Quantica: Send Unsaved Untitled PowerShell ISE tabs to E-Mail
Share