Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Latest posts

All good things must come to an end
Feb 16, 2021
Post comments count 4
Post likes count 18

All good things must come to an end

Doctor Scripto

Introduction of New PowerShell Community Blog and Retirement of "Hey Scripting Guy!" Blog, the passing of the Torch to a new Generation.

Testing RPC ports with PowerShell (and yes, it’s as much fun as it sounds!) New and Improved!!
Jan 31, 2021
Post comments count 2
Post likes count 0

Testing RPC ports with PowerShell (and yes, it’s as much fun as it sounds!) New and Improved!!

Doctor Scripto

Summary: Using PowerShell to identify RPC ports in use by capturing content from PowerShell We'd like to introduce you today to one of our newest bloggers!  It's a froopingly awesome friend of ours, Joel Vickery, PFE.  (did I mention Dr. Scripto is a big fan of books written by Douglas Adams?....oops!) Take it away Joel! Thanks Doc!  So hey everybody! What do you do when you have to troubleshoot the dreaded "RPC Unavailable" error 1722, which rears its ugly head anywhere from Active Directory replication to Configuration Manager Distribution Point installations, and many other places in between? We have the ans...

Import Azure DevOps Test Plans from One Environment to Another
Sep 9, 2020
Post comments count 0
Post likes count 2

Import Azure DevOps Test Plans from One Environment to Another

Claudia Ferguson

Summary Standardization of Azure DevOps Test Plans and Reusing Them Between Different Organizations Today we introduce Claudia Ferguson and Mike Stiers to the Scripting Blog. Claudia is a Senior Consultant with the Microsoft Active Directory Migration Services Engineer team, and Mike Stiers is a Microsoft Consultant from Toronto Canada. His focus is to help teams to use scalable infrastructure as code deployments in Azure DevOps. They put together something you will find to be very useful when you need to move DevOps test plans. There is some PowerShell here too (as it's the Scripting Blog!) but the content is...

Just go with the flow…. WorkFlow that is with Windows PowerShell
Dec 18, 2019
Post comments count 6
Post likes count 0

Just go with the flow…. WorkFlow that is with Windows PowerShell

Doctor Scripto

Doctor Scripto returns again with our good friend Joel Vickery, PFE who is going to touch on the use of Workflows In PowerShell. Take it away Joel! Following up on my original post Parallel Processing with jobs in PowerShell, I wanted to go into another method of running parallel processes in PowerShell, namely WorkFlows. WorkFlow is very similar to using the Start-Job/-asJob functionality but it has some distinct advantages that are fully covered in many other blog postings on TechNet.  I'll mention them quickly below, but if you want deeper detail, see the When Windows PowerShell Met WorkFlow blog posting...

PowerTip: Identify Completed PowerShell Jobs with Data yet to be Received
Dec 11, 2019
Post comments count 0
Post likes count 0

PowerTip: Identify Completed PowerShell Jobs with Data yet to be Received

Doctor Scripto

Summary: Doctor Scripto quickly shows how to identify Completed Jobs in PowerShell which have yet to have the data Received Hey Doctor Scripto, How can I identify jobs which already completed but I haven’t done a Receive-Job on to get the data? You can do this with the Get-Job Cmdlet by targeting the -ChildJobState and -HasMoreData like the following example Get-Job -ChildJobState Completed -HasMoreData:$True PowerShell, Doctor Scripto, PowerTip, Sean Kearney

Parallel Processing with jobs in PowerShell
Dec 11, 2019
Post comments count 3
Post likes count 0

Parallel Processing with jobs in PowerShell

Doctor Scripto

Joel Vickery discusses an introductory use of PowerShell jobs and working with data

PowerTip: Use Windows PowerShell to display all Environment variables
Nov 13, 2019
Post comments count 3
Post likes count 2

PowerTip: Use Windows PowerShell to display all Environment variables

Doctor Scripto

Summary: Doctor Scripto demonstrates how to use env: to show all currently set environment variables Question: Hey Doctor Scripto, I remember in DOS if I wanted to see the values of all the Environment variables; like TEMP I could just type the SET Command. How do I do this in PowerShell? Answer: You can do this in one line using the env: PowerShell drive to display all of the currently set Environment variables. dir env: PowerShell, Doctor Scripto, PowerTip, Sean Kearney  

PowerTip: Identify if CredentialGuard is enabled with Windows PowerShell
Oct 30, 2019
Post comments count 3
Post likes count 0

PowerTip: Identify if CredentialGuard is enabled with Windows PowerShell

Doctor Scripto

Summary: Easily identify if Credential Guard is enabled using the Get-ComputerInfo Cmdlet in Windows 10 Question: Hey Doctor Scripto, how can I tell if CredentialGuard has been enabled on my Windows 10 computer? Answer: Just use the Get-ComputerInfo Cmdlet and target the DeviceGaurdSecurityServicesConfigured property. The following line will produce a Boolean $TRUE if it is enabled. 'CredentialGuard' -match ((Get-ComputerInfo).DeviceGuardSecurityServicesConfigured) PowerShell, Doctor Scripto, PowerTip, Credential Guard, Paul Greeley  

Use PowerShell to Identify Unassociated Azure Resources
Oct 30, 2019
Post comments count 2
Post likes count 0

Use PowerShell to Identify Unassociated Azure Resources

Doctor Scripto

Summary: Save costs by Identifying Unassociated Resources left behind after deletions in Azure Q: Hey, Scripting Guy! How can I quickly identify un-associated resources in my Azure subscription? A: Hi SH! At least you know that’s a question to ask! I myself when I first began exploring this new world didn’t realize that when deleting a virtual system in Azure, not all the associated resources are deleted with it! First things first, if you’ve never done it, you’ll need to install the Azure PowerShell modules. This can be done by following the steps provided here on docs.microsoft.com Install the...

PowerTip: Using Set-ADUser with multi-valued attributes
Oct 23, 2019
Post comments count 1
Post likes count 1

PowerTip: Using Set-ADUser with multi-valued attributes

Doctor Scripto

Summary: Using the -Replace parameter with Set-ADUser to take an array to populate multi-valued attributes Question: Hey Doctor Scripto, how can I use Set-ADUser to populate multivalued attributes in Active Directory? Answer: You can use an array with the -Replace parameter to do it. Set-ADUser -Identity "TestUser" -Replace @{ProxyAddresses = @("Address1","Address2","Address3")} PowerShell, Doctor Scripto, PowerTip, Active Directory, Walid Moselhy  

Copy multi-valued Active Directory attributes from one user to another with PowerShell
Oct 23, 2019
Post comments count 1
Post likes count 0

Copy multi-valued Active Directory attributes from one user to another with PowerShell

Doctor Scripto

Summary: Using -Replace parameter with Set-ADUser to copy Active Directory multi-valued attributes Q: Hey, Doctor Scripto! We are in the middle of an Active Directory migration and need to copy the multi-valued attribute “ProxyAddresses” from old user accounts to new ones. Can you do with a few lines of code? —ND A: Hello ND, Hello everyone, your good friend Doctor Scripto is here with Walid, one of our PFEs who really likes mixing PowerShell with Active Directory. Walid, what do you think of this one? Well, Doctor Scripto, it makes a lot of sense to try and automate this type of tasks. Who like...

PowerTip: Use New-Alias to make Cmdlets easier to remember
Oct 16, 2019
Post comments count 0
Post likes count 0

PowerTip: Use New-Alias to make Cmdlets easier to remember

Doctor Scripto

Using New-Alias to create easier to remember shortcuts in PowerShell

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 4
Oct 16, 2019
Post comments count 0
Post likes count 0

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 4

Doctor Scripto

Summary: Using Windows PowerShell to purge Wlan profiles with NetSh.exe. Last week we had a way with a Regular Expression to run one Netsh.exe command and show only the profile names as a PowerShell Array. Today we're going to finish the task and show you how to delete those Profiles. As a quick reminder here's the line in PowerShell we used to capture the list of Wireless profiles by only their names as an Array. The resulting output containing our Wireless profile names looked like this From our first posting we saw that to delete a WLAN profile in Netsh.exe we would execute this command. ...

PowerTip: Show all Installed Capabilities on Windows 10
Oct 9, 2019
Post comments count 0
Post likes count 0

PowerTip: Show all Installed Capabilities on Windows 10

Doctor Scripto

Summary: Identify if capabilities like OpenSSH are installed in your Windows 10 Operating System Hey, Doctor Scripto. I was curious if there was a way to see if a workstation has a capability installed on it like OpenSSH. I’m trying to report on this for my environment. Absolutely! You can run the following line on a workstation to show the installed Capabilities like OpenSSH Get-WindowsCapability -Online | Where-Object { $_.State -eq 'Installed' } PowerShell, Doctor Scripto, PowerTip, Sean Kearney

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 3
Oct 9, 2019
Post comments count 0
Post likes count 0

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 3

Doctor Scripto

Summary: Using Regular Expressions to cleanup string data from NetSh.exe. Let's remember the last two discussions. The first time we looked at using PowerShell to identify wireless profiles with some simple regular expressions. We followed up the next week with how to identify which approach would be the fastest. Today we're going to take that array of information and clean it up so we only have the profile names. As a quick reminder here's the line in PowerShell we used to capture the list of Wireless profiles The resulting output looked like this What we need to do now is cleanup this data so...

PowerTip: Identify Drives Encrypted with Bitlocker
Oct 2, 2019
Post comments count 0
Post likes count 0

PowerTip: Identify Drives Encrypted with Bitlocker

Doctor Scripto

Summary: Using the Get-Bitlocker Cmdlet to show the status of drives on your Windows 10 computer Hey, Doctor Scripto. Is there a nice simple way to see if drives are Bitlocker encrypted? A most excellent question! You can the Get-BitlockerVolume Cmdlet and filter on the VolumeStatus property. Here's an example of a line that will show only drives which have Bitlocker enabled. Get-BitLockerVolume | Where-Object { $_.VolumeStatus -eq 'FullyEncrypted' } PowerShell, Doctor Scripto, PowerTip, Sean Kearney  

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 2
Oct 2, 2019
Post comments count 2
Post likes count 0

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 2

Doctor Scripto

Summary: Using Measure-Command to determine the fastest approach to a solution. Last week we were having some fun using PowerShell as a wrapper around the NetSh.exe command's output. We were left at a decision point. Which way to go? A For loop to clean up the data, which worked fine or Regular Expressions. Although both work which was the better path to use? For me initially, when I first started in PowerShell I very often used a For loop for a few reasons. But as I progressed in my knowledge of PowerShell I've started to touch on Regular expressions as a solution when possible. A go...

PowerTip: Converting a Here-String to an Array in One Line with PowerShell
Sep 25, 2019
Post comments count 2
Post likes count 0

PowerTip: Converting a Here-String to an Array in One Line with PowerShell

Doctor Scripto

Summary: Using the split method in a more powerful fashion to split an array based upon two line terminating types Hey, Doctor Scripto. I was wondering if there was a more efficient way of converting a Here-String to an Array when there were multiple line termination options like Linefeed or Carriage Return and Linefeed? There most definitely is. You can pass multiple parameters to the split method. This example traps both! $HereStringSample=@' Banana Raspberry '@ $HereStringSample.Split(@("$([char][byte]10)", "$([char][byte]10)","$([char][byte]13)", [StringSplitOptions]::None)) PowerShe...

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 1
Sep 25, 2019
Post comments count 0
Post likes count 0

Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 1

Doctor Scripto

Summary: Using PowerShell and Regular Expressions as a wrapper on NetSh.exe output to identify the profiles. Hey, Doctor Scripto! I have a whole pile of old Wireless profiles that have been collecting dust. I know I can use NETSH to view and delete them, but the process is very manual. Do you know if there is an easier way to clear them up? —WF Hello WF, you asked I shall help. Doctor Scripto is in the house! I know the process you mean, I had to do this a few years ago on one of my old laptops. I had wireless profiles from my home, hotels, offices, coffee shops. It was just silly. I think there we...

PowerTip: Identify which Platform PowerShell is running on
Sep 18, 2019
Post comments count 1
Post likes count 0

PowerTip: Identify which Platform PowerShell is running on

Doctor Scripto

Summary: Using $PSVersionTable to identify if you are on Windows or Unix Hey, Doctor Scripto! I'm working on my PowerShell scripts and I need to be able to identify if I'm working on Windows or Linux. How can I do this easily? No problem at all and glad to help. Just examine the $PSVersionTable property called Platform. It will contain one either 'Unix','Win32NT' on PowerShell Core. In the case of Windows PowerShell it will not exist. $PSVersionTable.Platform PowerShell, Doctor Scripto, PowerTip, Sean Kearney  

Creating a Platform Independent Function in PowerShell
Sep 18, 2019
Post comments count 1
Post likes count 0

Creating a Platform Independent Function in PowerShell

Doctor Scripto

Summary: Creating a Function in PowerShell and the power of the $PSVersionTable to make code more portable Q: Hey, Doctor Scripto! I saw that post last week on converting Here-String into an array. I wanted to write my code to trap for PowerShell and PowerShell Core. Could you give me a helping hand? —PG A: Hello PG, Hello everyone, your good friend Doctor Scripto is here with Sean sitting across from me having lunch. Sean what do you think about this idea? Well Doctor Scripto this is actually pretty easy and it makes a LOT of sense to have a function do this to avoid re-writing the same code. ...

PowerTip: Identify if you are running on PowerShell Core
Sep 11, 2019
Post comments count 0
Post likes count 0

PowerTip: Identify if you are running on PowerShell Core

Doctor Scripto

Summary: Pulling up the properties of $PSVersionTable to identify your PowerShell edition Hey, Doctor Scripto! I want to write my modules and scripts to be more portable. How can I tell if I am executing on PowerShell Core? Just use the $PSVersionTable object and examine the PSEdition value. If it returns 'Core' you are running on PowerShell core. $PSVersionTable.PSEdition PowerShell, Doctor Scripto, PowerTip, Sean Kearney  

Maximizing the Power of Here-String in PowerShell for Configuration Data
Sep 11, 2019
Post comments count 3
Post likes count 0

Maximizing the Power of Here-String in PowerShell for Configuration Data

Doctor Scripto

Summary: Discovering some of the awesome and neat ways to leverage a Here-String in a Script or function Q: Hey, Doctor Scripto! I used to write scripts with supporting configuration files that never really changed. I was wondering if there was any way to put them INSIDE the script directly to make it self contained. —AB A: Hello AB, I was chatting with my good friend Sean on this one. Here he talks about using Here-Strings to solve this problem. Thanks Doctor Scripto, yes a Here-String can be a great way to embed the configuration or other data for that matter in a script. If you've never encou...

PowerTip: Read a JSON configuration file as a PowerShell object
Sep 4, 2019
Post comments count 0
Post likes count 1

PowerTip: Read a JSON configuration file as a PowerShell object

Doctor Scripto

Summary: Using the ConvertFrom-Json Cmdlet in PowerShell to read a JSON formatted file Hey, Doctor Scripto! I've seen a lot of JSON files in use in Azure. I'm not very good with editing JSON properly. Is there an easy way to read this and at least edit it with PowerShell? Most definitely my good friend. For the file below called "settings.json" you can convert it to a PowerShell Object for editing purposes using the following line.   Once you have completed this, you can manipulate it like any other PowerShell Object. $PowerShellObject=Get-Content -Path settings.json | ConvertFrom-Json Pow...

Configuring Startup Settings in Microsoft Teams with Windows PowerShell
Sep 4, 2019
Post comments count 2
Post likes count 0

Configuring Startup Settings in Microsoft Teams with Windows PowerShell

Doctor Scripto

Summary: Using the ConvertFrom-JSON and ConvertTo-JSON Cmdlets to edit a configuration file Q: Hey, Doctor Scripto! I need to be able to change the Startup settings in Teams (like the Auto launch feature). I can change it in the Interface, but I need to be able to edit across multiple systems. Could you lend me a hand? —RL A: Hello RL, A very excellent question. For which it produced a most interesting solution when I asked Sean Kearney one of our Microsoft PFE's to look at it. Take it away Sean! Let's begin by examining the settings we are trying to change. They can be accessed under the "Setti...

PowerTip: Using PowerShell to Convert raw Text to a Comma Separated columm
Aug 28, 2019
Post comments count 0
Post likes count 0

PowerTip: Using PowerShell to Convert raw Text to a Comma Separated columm

Doctor Scripto

Summary: Using PowerShell and a very simple Regular Expression to convert Random counts of spaces to a Comma Hey Doctor Scripto! I have some string based output from a non PowerShell application. The output is good but I need to easily parse it. Is there a way to convert that data to something consistent like "Comma Separated?" Why yes you can! This is something that is easily done with a regular expression. Using a simple example like this will identify all content with more than one blank space separating it, and replace it with a comma! $SampleText='Hello             This                      ...

Automating Quser through PowerShell
Aug 27, 2019
Post comments count 0
Post likes count 0

Automating Quser through PowerShell

Doctor Scripto

Summary: Using PowerShell to automate Quser to identify users to Logoff systems in Windows Hey Doctor Scripto! I need to log a user off every computer they’re logged into. The problem is, I don’t know which ones. How can I discover which computers they’re logged into and then log them off? That's a most excellent question!  I know just the person who can answer that.   I was talking my good friend Dan Reist on this topic.   Dan is a Senior Consultant on Data Platforms here at Microsoft.   He actually ran into that same issue. Dan, the room is yours today, take it away! Thanks Doctor Scripto! So my ...

PowerTip: Identify if SQL Servers are configured to best practices
Aug 21, 2019
Post comments count 0
Post likes count 0

PowerTip: Identify if SQL Servers are configured to best practices

Doctor Scripto

Summary: Using the features of the SQLServer PowerShell module to run assessments of your servers How can I easily check that my SQL Servers are all configured to meet best practices? You can use SQL Server Assessments – the latest addition to the SQLServer PowerShell module. Just Run a best practices assessment on your SQL Server as seen below Get-SqlInstance  "DemoSQLServer" | Invoke-SqlAssessment PowerShell, Doctor Scripto, PowerTip, Johnathan Allen, SQL Server  

Executing SQL Server Assessments from PowerShell
Aug 21, 2019
Post comments count 0
Post likes count 0

Executing SQL Server Assessments from PowerShell

Doctor Scripto

Summary: Using the SQLServer module cmdlets to review and monitor SQL Server instance and database configuration Q: Hey, Doctor Scripto! I have loads of SQL Servers in my area of responsibility and I know they all need certain configuration settings but I'm never confident that they are all set just right so I spend a long time every month visiting them all over RDP to give reassure myself. How can I automate this work? —AB A: Hello AB, I know the very person that can answer that question for you. It's my good friend Jonathan Allen. Let me introduce him to you. He's a SQL Server PFE from the UK. He...

PowerTip: Identify Synchronized AzureAD accounts without a License assigned
Aug 14, 2019
Post comments count 4
Post likes count 0

PowerTip: Identify Synchronized AzureAD accounts without a License assigned

Doctor Scripto

Summary: Using PowerShell to identify users who are Synchronized to AzureAD but not yet licensed Hey, Doctor Scripto! I'd love to be able to identify users Synchronized to AzureAD that haven't yet had their licenses assigned.   Help a friend out? No problem at all!  You can target that information with two parameters in the Get-Msoluser Cmdlet! Get-MsolUser -UnlicensedUsersOnly -Synchronized PowerShell, Doctor Scripto, PowerTip, AzureAD  

Reporting on Microsoft 365 Licensing using PowerShell – Part 3
Aug 14, 2019
Post comments count 1
Post likes count 0

Reporting on Microsoft 365 Licensing using PowerShell – Part 3

Doctor Scripto

Summary: Will Martin finalizes his discussion on how to report on Microsoft 365 licensing in the cloud. Previous Posts on this article can be found here for continuity Reporting on Microsoft 365 Licensing using PowerShell – Part 1 Reporting on Microsoft 365 Licensing using PowerShell – Part 2 Dr. Scripto here! When last we saw Will Martin, he was deep in a script pulling down licensing tables and produced a lovely hash table. Let’s watch for the exciting conclusion! From last week, we placed our data in a hash table. Now, let’s swap it from a hash table to CSV format by changing our last active lin...

PowerTip: Identify the last time Users changed passwords in AzureAD
Aug 7, 2019
Post comments count 0
Post likes count 0

PowerTip: Identify the last time Users changed passwords in AzureAD

Doctor Scripto

Summary: Using PowerShell to report on Users and the last time Passwords were changed Hey, Doctor Scripto! I need to report on users and when they updated their passwords In AzureAD. Could you show me how ? Most certainly, I love to provide a helping hand however I can. Using the Get-Msoluser Cmdlet just target the LastPasswordChangeTimeStamp Attribute. Here's an example of it in use. Get-MsolUser | Select-Object DisplayName, UserPrincipalName, LastPasswordChangeTimeStamp PowerShell, Doctor Scripto, PowerTip, AzureAD  

Reporting on Microsoft 365 Licensing using PowerShell – Part 2
Aug 7, 2019
Post comments count 0
Post likes count 0

Reporting on Microsoft 365 Licensing using PowerShell – Part 2

Doctor Scripto

Summary: Will Martin continues his discussion on how to report on Microsoft 365 licensing in the cloud. Previous Posts on this article can be found here for continuity Reporting on Microsoft 365 Licensing using PowerShell – Part 1 Remember from last week we showed the results of what a user licensed in Microsoft 365 looked like in the web portal? So, what does this look like if we try to access it in PowerShell? Well, we have the user, and the service plan. Can we get this into a usable format? Well, let’s see what we can do – let’s try pulling this info for our last three users and see what we...

PowerTip: Identify the last time a User was Synchronized to AzureAD
Jul 31, 2019
Post comments count 0
Post likes count 0

PowerTip: Identify the last time a User was Synchronized to AzureAD

Doctor Scripto

Summary: Use PowerShell to identify the property in AzureAD with the Synchronization time in AzureAD Hey, Doctor Scripto. Is there a way with PowerShell to identify when a user was last synchronized with AzureAD? Absolutely! We just need to examine the LastDirSyncTime when using the Get-Msoluser cmdlet. Here’s an example below (Get-MsolUser -UserPrincipalName 'drscripto@contoso.com').LastDirSyncTime PowerShell, Doctor Scripto, PowerTip, Microsoft 365    

Reporting on Microsoft 365 Licensing using PowerShell – Part 1
Jul 31, 2019
Post comments count 0
Post likes count 0

Reporting on Microsoft 365 Licensing using PowerShell – Part 1

Doctor Scripto

Summary: Will Martin discusses how to report on Microsoft 365 licensing in the cloud. Hello everyone, Doctor Scripto here today to introduce you to a good friend of mine. Will Martin is a PFE in Messaging here at Microsoft and he wanted to share a wonderful solution he found on reporting on Microsoft 365 licensing with PowerShell. Will my friend, the Blog is now in your most capable hands! Thanks for the introduction Doctor Scripto! I came across an interesting problem recently. I was asked by my large Office 365 customer if I could give them a script that would output all their user account licensing...

PowerTip: Show files with expired Digital Certificates
Jul 24, 2019
Post comments count 0
Post likes count 0

PowerTip: Show files with expired Digital Certificates

Doctor Scripto

Summary: Targeting Expired Certificates with Get-AuthenticodeSignature Question: Hey Doctor Scripto! Is there an easy way to visually identify Digitally signed files with an Expired status on the Digital Certificate? Answer: Absolutely! We just need to filter on the “Status” property and show those without the value ‘Valid’. As an added bonus it would also identify files that are not digitally signed. Get-Childitem C:\Folder\*.* -Recurse | Get-AuthenticodeSignature | Where-Object { $_.Status -ne 'Valid' } PowerShell, Doctor Scripto, PowerTip  

Reporting on Digitally Signed Files with PowerShell
Jul 24, 2019
Post comments count 1
Post likes count 0

Reporting on Digitally Signed Files with PowerShell

Doctor Scripto

Summary: Using the Get-AuthenticodeSignature cmdlet to show if a file is Digitally Signed Q: Hey, Doctor Scripto! I was curious, since many new files are Digitally signed with a certificate if there was an easy way to see the status of the Digital Signatures of many files easily? —SH A: Hello SH your good friend Doctor Scripto is here today to help you along. One of the things which changed with PowerShell in version 3.0 was a beautiful little Cmdlet called Get-AuthenticodeSignature This Cmdlets task was very simple, examine a file and show the properties of the Digital Certificate on a file. He...

Clean up Domain Controller DNS Records with Powershell
Jul 17, 2019
Post comments count 1
Post likes count 3

Clean up Domain Controller DNS Records with Powershell

Doctor Scripto

Summary: Using Windows PowerShell to remove Stale / Dead Domain Controller records. Q: Hey, Doctor Scripto! How can I quickly clean up all my dead Domain Controller’s DNS records? A: That’s a great question. The good Doctor also knows the very person to answer it best. My good friend Patrick Mercier, An Active Directory PFE who loves working with PowerShell. Take it away Patrick! Whether it’s as part of Active Directory Disaster Recovery, or because you had an old Domain Controller you needed to get rid of, cleaning up all the DNS records of a now dead DC left behind can be tedious: that is, unl...

PowerShell PowerTip: Customizing your prompt
Nov 13, 2018
Post comments count 0
Post likes count 1

PowerShell PowerTip: Customizing your prompt

Kory Thacher

I've been taking a break from the blog for a while due to some personal reasons, but I had a few people ask me about my PowerShell prompt recently. I like extra horizontal space, so I removed the path from the prompt and put it in the window title bar. I also just display the current time in the prompt itself. You can customize your prompt by using your profile and overriding the "Prompt" function. A coworker of mine, Tony Radkiewicz, used a similar prompt and I really liked it so I've been using it since. That's all for now, I'll try to get some...

PowerTip: Use PowerShell to pick a random name from a list
Sep 15, 2018
Post comments count 2
Post likes count 0

PowerTip: Use PowerShell to pick a random name from a list

Doctor Scripto

Using the Get-Random Cmdlet to select a random list of names instead of numbers

Using PowerShell to create a folder of Demo data
Sep 15, 2018
Post comments count 2
Post likes count 2

Using PowerShell to create a folder of Demo data

Doctor Scripto

Creating sample files with random sizes and dates for use in a Lab

PowerShell PowerTip: searching and installing modules on the command line
Aug 21, 2018
Post comments count 0
Post likes count 1

PowerShell PowerTip: searching and installing modules on the command line

Kory Thacher

PowerShell 5+ ships with the module PowerShellGet, which lets us search and install modules from cmdlets. The default nuget repository is the PowerShell Gallery, but you could add others yourself (including custom ones for internal modules). There are a lot of reasons this could help you: There are a lot of cmdlets in the module, but the ones you'll use the most will be: You can also specify the scope on install-module and put it in your user module location for ones just for you on a machine. Hope that helps, tune in more often to get short and sweet PowerTips!

Regular Expressions (REGEX): Grouping & [RegEx]
Aug 14, 2018
Post comments count 1
Post likes count 2

Regular Expressions (REGEX): Grouping & [RegEx]

Kory Thacher

Welcome back to the RegEx crash course. Last time we talked about the basic symbols we plan to use as our foundation. This week, we will be learning a new way to leverage our patterns for data extraction and how to rip our extracted data into pieces we care about. [RegEx] The  data type has some cool static members,  but we're mostly going to play with the plural method  if you don't know what static members are you can check this post or this help data. A lot of the time, when we work with RegEx we are using it to extract everything that matches our pattern in a large amount of data. Using  like we did in t...

PowerShell PowerTip: History of commands with PSReadline
Aug 7, 2018
Post comments count 0
Post likes count 0

PowerShell PowerTip: History of commands with PSReadline

Kory Thacher

One of the really cool things PSReadline provides (module shipping on v5+) isn't as immediately obvious as the syntax highlighting. It offers a persistent history that is stored from session to session. This means if you run commands in a window, close it, and open a new one later you can still hit the up arrow and scroll through them. I use this feature quite a bit doing demos or just working on things where I want to clear out my whole scope and jump back in. If you want to opt out you can as well: Hope that helps, tune in more often to get short and sweet PowerTips!

Regular Expressions (REGEX): Basic symbols
Jul 31, 2018
Post comments count 0
Post likes count 2

Regular Expressions (REGEX): Basic symbols

Kory Thacher

Welcome back to the RegEx guide. Last post we talked a little bit about the basics of RegEx and its uses. I mentioned the most important thing is to understand the symbols. Today we'll ease in with some of the basics to get us going, but later we will expand on these and see some other options we have.  is used to represent any single character, aside from a newline, so it will feel very similar to the windows wildcard  is the escape character for RegEx, the escape character has two jobs: We can use  to specify quantity in a few different ways by attaching them to characters or symbols. ...

PowerShell PowerTip: What is the point of Out-Variable?
Jul 24, 2018
Post comments count 0
Post likes count 2

PowerShell PowerTip: What is the point of Out-Variable?

Kory Thacher

A lot of times people see others using the common parameter -OutVariable instead of the best practice $var = <value>. This leads to a lot of folks wondering why OutVariable  exists. The real use for OutVariable is to save your data off, while still letting it get sent along the output stream. What this means is that you could use it somewhere inside of a pipe to save some data for later re-use, but continue doing other work with that data. Notice that even though the data continued being pipped along, I could also reference it later when I asked for the count. Hope that helps, tune in more ...

PowerTip: Turn off the power to your computer with PowerShell
Jul 16, 2018
Post comments count 1
Post likes count 0

PowerTip: Turn off the power to your computer with PowerShell

Doctor Scripto

I’ve got a script that needs to power off a system after it’s done. How can I accomplish this with PowerShell?

Parse HTML and pass to Cognitive Services Text-to-Speech
Jul 16, 2018
Post comments count 0
Post likes count 0

Parse HTML and pass to Cognitive Services Text-to-Speech

Doctor Scripto

Having some fun with Abbott and Costello’s “Who’s on first?” comedy routine, and multiple voices with Bing Speech.

PowerShell PowerTip: What you should know about streams
Jul 10, 2018
Post comments count 0
Post likes count 0

PowerShell PowerTip: What you should know about streams

Kory Thacher

PowerShell has a concept called Streams, which are the different places data can go (output, error, verbose, etc). You usually don't have to worry too much about these streams if you're just writing simple scripts, but it helps a ton to know: What this means for you, as users, is that you can get a non-terminating error, and still do work on the successful output. Take a look at this: Notice that even though I received an error for the process "FAKE", only the non-errors were present in $procs. Using some basic error handling we could clean that up, hide the error message and log out wha...

Regular Expressions (REGEX): Introduction
Jul 5, 2018
Post comments count 0
Post likes count 0

Regular Expressions (REGEX): Introduction

Kory Thacher

Hi all, this week I'll be talking about Regular Expressions. I've got a few posts planned to get you set up and going with some basic Regex. Regex is used for extracting and validating data. Essentially, you can think of Regex as windows wild cards on steroids. Anytime we need to match data with a little more clarity than the *s and ?s that windows gives us, we have Regex. Regex has a reputation for being difficult and confusing, but it really isn't so bad when you get used to it. The biggest contributors to Regex's reputation are: With that in mind, let's take a look at a sample about why you ...

PowerTip: Determine your version of PowerShell and host operating system
Jun 29, 2018
Post comments count 0
Post likes count 0

PowerTip: Determine your version of PowerShell and host operating system

Doctor Scripto

Identify your PowerShell environment by making use of built-in PowerShell variables.

Windows PowerShell and the Text-to-Speech REST API (Part 5)
Jun 29, 2018
Post comments count 0
Post likes count 0

Windows PowerShell and the Text-to-Speech REST API (Part 5)

Doctor Scripto

Send and receive content to the Text-to-Speech API with PowerShell.

PowerShell PowerTip: Checking your PowerShell version
Jun 26, 2018
Post comments count 0
Post likes count 0

PowerShell PowerTip: Checking your PowerShell version

Kory Thacher

If there is one question I could say I get the most in PowerShell, it is: How do I check my version? Its not a hard thing, but its not an obvious thing. We can actually check our version with a build in variable called PSVersionTable Hope that helps, tune in more often to get short and sweet PowerTips!

PowerShell For Programmers: Here Strings, There Strings, Everywhere Some String Strings
Jun 19, 2018
Post comments count 0
Post likes count 0

PowerShell For Programmers: Here Strings, There Strings, Everywhere Some String Strings

Kory Thacher

There won't be much code in today's post, but this can be a useful feature to know about. In addition to the expandable and literal strings we talked about, we can also use something called a Here String. Here strings allow us to have quote characters inside of our string that match the quote characters we use to create that string. For example, you might want the double quote character to appear inside of your expandable-string. You could use the escape character on the internal quote to prevent it from closing your string, but if you had a massive amount of quotes this would be annoying. Here strings exis...

PowerTip: Use PowerShell to play WAV files
Jun 15, 2018
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to play WAV files

Doctor Scripto

Make use of the native features of Windows through PowerShell to play sound.

Windows PowerShell and the Text-to-Speech REST API (Part 4)
Jun 15, 2018
Post comments count 0
Post likes count 0

Windows PowerShell and the Text-to-Speech REST API (Part 4)

Doctor Scripto

Send and receive content to the Text-to-Speech API with PowerShell.

PowerShell PowerTip: Grabbing the location your script lives in
Jun 12, 2018
Post comments count 0
Post likes count 0

PowerShell PowerTip: Grabbing the location your script lives in

Kory Thacher

One super common thing in PowerShell is to design a script to consume particular files for data. Often times you are building the script right in the folder for your files. However, it can be annoying to give long, literal file paths to a file. Also, if you give that script to someone else, they need to edit that path to point at the right location-- how annoying! There is a built in variable to help with this scenario: $PSScriptRoot will provide the file path the script was run from, which can let you relatively point at files. You can see an example of this in an older blog post. I received a few questions ab...

Working with JSON data in PowerShell
Jun 5, 2018
Post comments count 1
Post likes count 7

Working with JSON data in PowerShell

Kory Thacher

Welcome back everyone! This week we will take another look at some common data types we might encounter in the real world: JSON data. JSON data is used pretty frequently on the web if you're hitting APIs. This not only includes external data (twitter, weather, marvel database), but often includes internal data to your company. It's nice to be able to leverage data from anywhere, and it can be frustrating for people to try to parse JSON data. Luckily, we have this all built in for you using ConvertFrom-JSON I'll get a response from an API online used for testing: The response data looks like this: A...

PowerTip: Ensure that errors in PowerShell are caught
May 31, 2018
Post comments count 0
Post likes count 1

PowerTip: Ensure that errors in PowerShell are caught

Doctor Scripto

Here’s how to make sure your errors get caught with <strong>Try Catch Finally</strong>.

Windows PowerShell and the Text-to-Speech REST API (Part 3)
May 31, 2018
Post comments count 0
Post likes count 0

Windows PowerShell and the Text-to-Speech REST API (Part 3)

Doctor Scripto

Use Windows PowerShell to access the Cognitive Services Text-to-Speech API.

PowerShell PowerTip: ISE crashing and auto complete not working
May 30, 2018
Post comments count 0
Post likes count 0

PowerShell PowerTip: ISE crashing and auto complete not working

Kory Thacher

Hi all, I'm going to start putting out these short PowerShell PowerTips every so often. They won't be full blog posts, but they will be short and useful! Have you been having issues with the ISE crashing and not auto completing since windows update 1803? From what I've seen there is a fix for this coming, but if you need these features now you can try the 2016 ISE preview To try it run as an admin and do this: Then go ahead and pin it while you wait for the fix. You can also check out VS Code Happy PowerShelling!

Run PowerShell code in Puppet
May 23, 2018
Post comments count 0
Post likes count 0

Run PowerShell code in Puppet

Doctor Scripto

Normally, it’s preferable to use specific Puppet and DSC Windows modules to manage systems in Puppet, but an alternative is running PowerShell commands and scripts by using the <strong>exec</strong> resource. This can be helpful for transitioning existing PowerShell code into Puppet quickly.

Doing more with functions: Verbose logging, Risk mitigation, and Parameter Sets
May 15, 2018
Post comments count 0
Post likes count 1

Doing more with functions: Verbose logging, Risk mitigation, and Parameter Sets

Kory Thacher

Welcome back to PowerShell for Programmers, this week I'm trying gitGist again for the code blocks. Let me know what you think about it vs the normal syntax highlighter I use :) As we've seen in the other posts about functions, attributes are a really cool thing to extend the features we have available to ourselves and for our users. This post is going to deal with an attribute for the function itself as well as ones for the individual parameters. This will let us make our functions behave more like any other cmdlet, by giving us access to the common parameters that users are used to seeing. Common Parameters...

PowerTip: Get all your local certificates by using PowerShell
May 9, 2018
Post comments count 0
Post likes count 0

PowerTip: Get all your local certificates by using PowerShell

Doctor Scripto

How can I use Windows PowerShell to enumerate all certificates on my Windows computer?

Get certificate info into a CSV by using PowerShell
May 9, 2018
Post comments count 3
Post likes count 0

Get certificate info into a CSV by using PowerShell

Doctor Scripto

Summary: Certificate management is always challenging. Let’s explore how to use PowerShell to export local certificate information to a comma-separated values (CSV) file on Windows 7 (or later) computers. Q: Hey, Scripting Guy! How can I get all my certificate info into a CSV on my Windows computers? —SH A: Hello SH, Patrick Mercier here, with my first “Hey, Scripting Guy!” post. This question has come up at multiple customer sites, as they plan a new PKI infrastructure or a revamp of their current one! There’s tons of resources on using PowerShell for querying certificates, but questions around finding exp...

Grabbing Excel (XLSX) values with PowerShell
May 8, 2018
Post comments count 0
Post likes count 1

Grabbing Excel (XLSX) values with PowerShell

Kory Thacher

The Goal: Import data from XLSX files conveniently like import-csv lets you do with simpler data. The preamble: Excel is a mainstay of the business world at this point, which means a lot of the data you might have to work with will come at you as an XLSX file or need to be one. This can be a bit annoying when scripting. If we're just working in PowerShell-land and we can choose to use simple CSV data we have the handy import-csv and export-csv cmdlets, and those CSV files can open up in excel just fine. However, when we are forced to work with XLSX files it can lead to headaches. If you search around ...

Doing More With Functions: Comment-Based Help
Apr 24, 2018
Post comments count 0
Post likes count 0

Doing More With Functions: Comment-Based Help

Kory Thacher

I just wanted to throw together a post highlighting how cool and easy it is to add help data to your own Functions and scripts. The help data gets added via comments. For functions the help data can go in three places: For scripts we just put it at the top of your script before you type the param() statement, or at the bottom, but the bottom will mess with code signing. Syntax just involves using a dot before the help keyword and then typing the help you want for it on the next line: Here is a list of all the keywords I found and short descriptions of them: For the most part, I recomm...

Inserting new elements into XML files
Apr 10, 2018
Post comments count 0
Post likes count 0

Inserting new elements into XML files

Kory Thacher

The Goal: Insert nodes into a specific place in XML config files The Motivation: I had a coworker a while back working with App Fabric. He needed to insert a particular chunk of XML into a specific spot inside of the config file. This had to be done on a bunch of different machines, but the kicker was that the config files might look different on all of them. We knew the node that needed to come before our new node, but that might be in a different spot in each file. When the configSections node ended ( </configSections> ) we needed to insert: This is the perfect place for PowerShell auto...

Introducing the DscLcm utility for PowerShell
Mar 30, 2018
Post comments count 0
Post likes count 0

Introducing the DscLcm utility for PowerShell

Doctor Scripto

Summary: Desired State Configuration is a great deployment tool to meet your organization’s infrastructure-as-code goals. I recently came across a situation for a project that uses the Push Service (as opposed to the Pull Service). It required me to be able to apply a new partial configuration to a node, without any knowledge of what partial configurations were already in place. This led to the development of the DscLcm module, which solved that problem for my team. DscLcm module The DscLcm PowerShell module is a utility that interacts with the Local Configuration Manager (LCM) of a target machine. You don’t have...

Doing More With Functions: Taking Parameters on the Pipe
Mar 27, 2018
Post comments count 0
Post likes count 1

Doing More With Functions: Taking Parameters on the Pipe

Kory Thacher

In an earlier post, I showed you how you could use the [parameter(mandatory)] attribute to force your parameters to behave  a bit more like you'd expect from other languages. We also have a bunch of other useful attributes we can use on our parameters to enable cool features. Pipelineing The pipe might feel pretty magical to you in PowerShell, as it just seems to work with our built in cmdlets. You can add this same kind of functionality to your own tools, and we give you two options to do so. First of all, here is what happens if you don't use this attribute: Pipeline By Value When we talk about stuff...

PowerTip: Build simple HTML with PowerShell
Mar 15, 2018
Post comments count 0
Post likes count 0

PowerTip: Build simple HTML with PowerShell

Doctor Scripto

Summary: Here’s how to use the ConvertTo-HTML cmdlet to build basic HTML content.   Hey, Scripting Guy! Occasionally I need to build basic HTML documents. I heard there was a way to do that with Windows PowerShell.   There most certainly is! Just use the ConvertTo-HTML cmdlet to save the day! For example:                           $SampleDoc=@'                           This is a simple text Document in PowerShell                           That I am going to make into a Tiny web page                           :)                           '@                           ConvertTo-Html -InputObject $SampleDoc      ...

Windows PowerShell and the Text-to-Speech REST API (Part 2)
Mar 15, 2018
Post comments count 0
Post likes count 0

Windows PowerShell and the Text-to-Speech REST API (Part 2)

Doctor Scripto

Summary: You can use Windows PowerShell to authenticate to the Text-to-Speech REST API. Q: Hey, Scripting Guy! I was reading up on the REST API for the Text-to-Speech component of Cognitive Services. I'm just starting to learn how to use REST and PowerShell. Could you spend a little bit of time and show me how to authenticate to the service? —SH A: Hello SH, Authentication is one of the biggest pieces you'll want to learn. Telling a system at the back end who you are, and knowing how to communicate with it, is very critical before you can do anything fun! Talking to the Text-to-Speech API is pretty easy onc...

PowerShell for Programmers: The Magic Switch!
Mar 14, 2018
Post comments count 0
Post likes count 2

PowerShell for Programmers: The Magic Switch!

Kory Thacher

Welcome back everyone, I'm trying out GitHub Gist for my code blocks this week. It lets you click and download them, as well as making them easy to edit. The downside is that I can't use my usual dark themed syntax highlighting. Let me know in the comments if you like gist or the old method better :) Switch statements in PowerShell are very cool, and by knowing some of the tricks it has in place it can save you a lot of time. Basic Syntax Let's start by taking a look at a basic switch statement. In C# you might write something like this: In PowerShell you could do this: Notice we don't use t...

PowerShell For Programmers: Strings, Quotes and Quirks
Mar 1, 2018
Post comments count 0
Post likes count 0

PowerShell For Programmers: Strings, Quotes and Quirks

Kory Thacher

Welcome back everyone! This will be a short, but important entry for the guide. The difference between quote characters is something I’m asked about all the time. It is important to understand in PowerShell, but most of the time it probably won’t make a difference. TLDR: If you're just typing a value like "alg" then it doesn't matter, but if you have any special symbols you can see the difference. Single vs. Double Quotes We refer to single quotes as Literal Strings and double quotes as Expandable Strings. Both create the same datatype (system.string), but a double quote will expand any special charact...

PowerTip: Create new authentication keys for AzureRM Cognitive Services
Feb 28, 2018
Post comments count 0
Post likes count 0

PowerTip: Create new authentication keys for AzureRM Cognitive Services

Doctor Scripto

Summary: Change the keys to authenticate to Azure RM Cognitive Services, by using Windows PowerShell.   Hey, Scripting Guy! I created the keys for my Rest API. I know I can change them in the web portal, but is there a faster way of doing it through Windows PowerShell?   There absolutely is! Just use the New-AzureRMCognitiveServicesAccountKey cmdlet to reset either Key1 or Key2 (or both). Here is an example, where we generate a new sequence for Key1: New-AzureRMCognitiveServicesAccountKey -ResourceGroup 'HSG' -Name 'Sample' -KeyName Key1

Windows PowerShell and the Azure Text-to-Speech Rest API (Part 1)
Feb 28, 2018
Post comments count 0
Post likes count 0

Windows PowerShell and the Azure Text-to-Speech Rest API (Part 1)

Doctor Scripto

Summary: You can use Windows PowerShell to authenticate to the Microsoft Cognitive Services Text-to-Speech component through the Rest API. Q: Hey, Scripting Guy! I heard about the cool Microsoft Cognitive Services, and had heard they have a REST API. Does that mean I can use PowerShell to consume them? Could you show me how to authenticate to it? —SH A: Hello SH, I just love waking up and saying "YES YOU CAN!" when people ask "Can you do that with Windows PowerShell?" So… ahem…. "Yes you can!" For those who didn't know, Cognitive Services are hosted in the Azure cloud, and they allow you to many things eas...

PowerTip: Use PowerShell to read an RSS feed
Feb 21, 2018
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to read an RSS feed

Doctor Scripto

Summary: “Hey, Scripting Guy!” shows you how to use Invoke-RestMethod to read a list of entries from an RSS feed.  How can I use Windows PowerShell to see the list of articles from an RSS feed?       Just use the Invoke-RestMethod and provide the full path to the link to the RSS feed. Here is an example:    Invoke-RestMethod -Uri 'https://blogs.technet.microsoft.com/heyscriptingguy/rss.aspx  

PowerShell and the REST API for the IT pro
Feb 21, 2018
Post comments count 0
Post likes count 0

PowerShell and the REST API for the IT pro

Doctor Scripto

Summary: This post provides a quick introduction to what the REST API is, and how it applies to Windows PowerShell. Q: Hey, Scripting Guy! I can see there is this cool cmdlet called Invoke-RestMethod. I've been told REST API's are all around, and this allows me to consume that data. Could you give me a hand getting started? —SH A: Hello SH, Glad to help out! I remember hearing about REST APIs the first time, thinking they might be a way to take a nap at work. Was I wrong on that one! What a "REST API" is at the most BASIC level is really just a very fancy web Endpoint. You could, if you were really creative, t...

PowerShell for Programmers: How to write a function the right way
Feb 15, 2018
Post comments count 0
Post likes count 3

PowerShell for Programmers: How to write a function the right way

Kory Thacher

Just like I mentioned in my first post, PowerShell supports a lot of stuff that makes it pretty easy to dive in and get stuff running. The following two examples are supported in PowerShell, but not something you should really be doing for any reusable tool set. Putting your parameters (arguments) next to the function name in parenthesis is pretty standard in most languages, but in PowerShell it will limit your functionality. Similarly, $args will stop working for you if you add some of those more useful features, but I’ll show you a way to mimic the functionality on your own later. So, how should you b...

PowerShell for Programmers: What happened to my operators?
Feb 1, 2018
Post comments count 0
Post likes count 2

PowerShell for Programmers: What happened to my operators?

Kory Thacher

Operators are one of the most frustrating things about learning PowerShell if you’re coming from just about any other language in existence. Operators like ==, <=, !=. etc. are almost ubiquitous in programming, but none of them are supported in PowerShell. This can lead to some pretty frustrating errors with things like If statements. You might see:   In PowerShell we are still going to have all these operators, they are just going to look different, using dashes and vaguely resembling parameters. I wondered the reason behind this myself for a while, and made a pretty inaccurate guess, but...

PowerShell for Programmers: Basic Syntax – Variables, Objects, and Data Types
Jan 18, 2018
Post comments count 0
Post likes count 2

PowerShell for Programmers: Basic Syntax – Variables, Objects, and Data Types

Kory Thacher

Variables Variables in PowerShell are going to be a bit different than they are for you in most languages. To start out the conversation, the basic way to create a variable is just by using a “$” and an “=”, but there are cmdlets and other ways to generate them.   Objects Objects are going to work how they do most places. Dot notation lets us dig into their properties and methods. If you want to see your object’s members, we have several options: 1. Get-Member: you’ll notice the definitions look a lot like you’re used to in C-based lang...

PowerShell for Programmers: A Quick Start Guide
Jan 4, 2018
Post comments count 0
Post likes count 3

PowerShell for Programmers: A Quick Start Guide

Kory Thacher

Now that my content has been migrated to the scripting blog, this will be the landing page for the series and I'll be trying to update all the links.  Learning PowerShell can be very useful for people with programming experience. Whether you’re currently a developer, dev-ops, or an admin you can get some serious use out of being familiar with PowerShell. You might think its just a version of command prompt with an eye-burning color scheme, but it really is a full scripting language with lots of nice tie ins. PowerShell is geared towards IT admins and made easy to learn with lots of nice shortcuts, and auto-...

PowerShell For Programmers: Basic Syntax — CMDLETs
Jan 4, 2018
Post comments count 0
Post likes count 4

PowerShell For Programmers: Basic Syntax — CMDLETs

Kory Thacher

PowerShell might look really strange to you. Many people assume PowerShell is basically CMD-prompt 2.0 because of the way it looks, but it really is a fully operational scripting language underneath. PowerShell has something called a cmdlet (command-let), which for the most part is the same idea as functions you're used to from other languages. I'll assume you're coming from a more classic language and you're used to calling functions like this: If you've been using cmdlets in PowerShell like this, you've been doing it wrong. This could cause you some serious problems down the line. "But I can type ...

Cross-platform PowerShell remoting in action
Dec 29, 2017
Post comments count 0
Post likes count 0

Cross-platform PowerShell remoting in action

Doctor Scripto

Summary: Learn how to configure and use cross-platform PowerShell remoting in PowerShell Core. I’m Christoph Bergmeister, a London-based full stack .NET software developer with a passion for DevOps. To enable product testing of .NET Core apps across non-Windows machines in CI, I was one of the first people to use the new cross-platform remoting capabilities based on an integration of OpenSSH with PowerShell Core. In the early days, setup was very tedious, and as part of my journey I had to experiment a lot to get everything working together nicely. Today, I want to share with you some of what I learned. Introduc...

Script Wars: The Farce Awakens (part V)
Dec 22, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part V)

Doctor Scripto

Summary: Rey is skilled in PowerShell, and new to Contoso Holly Jolly Hat Company. Already she has been a great boon to her new co-workers and had her sneakers become the subject of a hungry trash robot. She was just about to walk out to the hall with Ben Kerberosie, when suddenly an dominant figure has blocked them, with the following words booming through the hall: "WHO DO I SPEAK TO ABOUT CLEAR TEXT PASSWORDS in POWERSHELL!?!" ---------------------- That entity was none other than Katherine Phantampa! Head of IT Security, and also known as The Gatekeeper. The Protector of Data. The Guardian of all that was...

Script Wars: The Farce Awakens (part IV)
Dec 21, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part IV)

Doctor Scripto

Summary: A quick recap shall we? Newly graduated from IT training and future guru in the world of Windows PowerShell, Rey Skyworker has been hired on by her mentor, Ben Kerberosie. Already, she has helped peers from her team improve their PowerShell code to do some basic error trapping and cleanup of the data upon entry. Not bad for somebody on their first day, eh? Oh, almost forgot, her shoelaces have been chosen as lunch by a new Beta cleaning robot with more suction than common sense. Shall we continue? Let's! -------------------------- Tin has been left back to tend to the help desk, while Ben continues ...

Script Wars: The Farce Awakens (part III)
Dec 20, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part III)

Doctor Scripto

Summary: When last we saw our hero, Rey Skyworker, she was aiding her new co-worker, Tin. They managed to implement better error trapping by using the "Try Catch" statement in Windows PowerShell. The fact they could do this so easily it has tickled Tin's curiosity. ---------------------------- "Now Rey, I'm looking at this and as I see it, I could avoid the error altogether by trapping for those situations. Maybe adding in a few IF statements like this to the script." If (($First -or $Last)) -eq '') then { Write-Output 'Names cannot be blank } Else { ….rest of the script } Rey nodded. "You mean adding ...

Script Wars: The Farce Awakens (part II)
Dec 19, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part II)

Doctor Scripto

Summary: Yesterday, we met a newly graduated IT professional, Rey Skyworker, as she discussed the ways of "The Farce." It was during this discussion that her instructor, Ben Kerberosie, discovered she had a natural gift in understanding how to implement some good practices into writing her scripts. Today, we sit quietly (I mean all of you in the back too, no chattering and tossing about popcorn!), as Rey is about to embark on her new job. The position: on the help desk. The company: Contoso Holly Jolly Hat Company. She is being introduced to her new co-worker on the help desk, Jeremy Tinnison. ---------------...

Script Wars: The Farce Awakens (part I)
Dec 18, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part I)

Doctor Scripto

Summary: Seven years ago, “Hey, Scripting Guy!” was approached by a member of the community to see if we would be interested in doing something a little fun for the holidays.  The result was a seven-part series called “A PowerShell Carol.” So when we were approached continuously in following years, we allowed this madness to continue! The tradition continued on with the "Blues" in Blueville and Curly Blue, amongst others, doing a twist on popular holiday stories. The community even dared to touch upon classic tales, with "Oliver Script," a "twist" on another famous story by Mr. Dickens. And now, we bring you th...

PowerShell support for certificate credentials
Dec 15, 2017
Post comments count 0
Post likes count 0

PowerShell support for certificate credentials

Doctor Scripto

Summary: It's not a very well-known feature, but the PSCredential object, and the PowerShell Get-Credential cmdlet, both support certificate credentials (including PIN-protected certificates). In this post, we take a look at how a certificate credential is marshaled inside a PSCredential object, how you can do this marshaling yourself, and how you can retrieve the original certificate from a PSCredential object supplied to you. Most Win32 APIs that support the PSCredential object for credential validation already support certificates. However, if your code currently consumes a PSCredential, and you use the user ...

Visual Studio Updates for Office 365 APIs Tools
Dec 14, 2017
Post comments count 0
Post likes count 0

Visual Studio Updates for Office 365 APIs Tools

ScriptingGuy1

As we recently detailed on the Office Developer blog, we are making it simpler and easier for developers to connect to Office 365 through the Microsoft Graph. For Visual Studio developers currently using the Office 365 API Tools to create applications, you should plan to transition your apps to use Microsoft Graph to access Office 365 data directly. Call to Action You can use the Microsoft Graph Quick Start Guide to learn the quickest way to get started with Microsoft Graph for the platform of your choice. Or, you can use Office 365 Connected Services docs for Microsoft Graph if you have Visual Studio...

Connect(); 2017: SmartHotel360 Demo Apps and Architecture
Dec 13, 2017
Post comments count 0
Post likes count 0

Connect(); 2017: SmartHotel360 Demo Apps and Architecture

ScriptingGuy1

Last month we hosted Microsoft Connect(); in New York City. Connect(); is a three-day, in-person and online developer event. If you missed it, no worries! You can watch our keynotes, sessions, and on-demand videos on Channel 9. For the past five months our keynote demo team worked on a new set of reference apps. We used most of these apps and Azure backend for our keynote demos. As every year, today we are delighted to share the availability of our newest reference sample apps and Azure backend: SmartHotel360 in GitHub. SmartHotel360 is a fictitious smart hospitality company showcasing the future of connected...

Easily Create IoT Edge custom modules with Visual Studio Code
Dec 12, 2017
Post comments count 0
Post likes count 0

Easily Create IoT Edge custom modules with Visual Studio Code

ScriptingGuy1

At the recent Connect(); 2017 in November, we announced public preview of Azure IoT Edge. Now you can bring the intelligence of the Cloud right to the IoT Edge as well as easily create and manage business logic for your devices. The new Azure IoT Edge extension for Visual Studio Code along with the updated Azure IoT Toolkit extension will make your IoT Edge developments a real pleasure, providing a set of functionalities including: Get Started with IoT Edge in Visual Studio Code First things first, let’s start by answering the obvious question - What is IoT Edge? What can it do and how does i...

Sky’s the limit with Azure, ASP.NET Core, and Visual Studio for Mac
Dec 11, 2017
Post comments count 0
Post likes count 0

Sky’s the limit with Azure, ASP.NET Core, and Visual Studio for Mac

ScriptingGuy1

[Hello, we are looking to improve your experience on the Visual Studio Blog. It will be very helpful if you could share your feedback via this short survey that should take less than 2 minutes to fill out. Thanks!] Cloud services represent a huge leap in functionality, performance, and management simplicity for web apps, APIs, mobile backends, and more. To help you get started with cloud-based development in Visual Studio for Mac, today we're publishing two new hands-on labs: publishing your ASP.NET Core web app to Azure, and connecting your ASP.NET Core web app to Azure SQL Database. These two labs will help d...

Share UI Code in any iOS and Android App with .NET Embedding
Dec 11, 2017
Post comments count 0
Post likes count 0

Share UI Code in any iOS and Android App with .NET Embedding

ScriptingGuy1

One of the most exciting announcements during this year’s Connect(); event was the ability to embed .NET libraries into existing iOS (Objective-C/Swift) and Android (Java) applications with .NET Embedding. This is great because you can start to share code between your iOS and Android applications, and you can also share the user interface between your apps when you combine .NET Embedding with Xamarin.Forms Native Forms. This means that you can leverage your existing investments and apps without having to re-write them from scratch to start adding cross-platform logic and UI. In fact, during the Connect(); keynote...

Visual Studio 2017 Version 15.6 Preview
Dec 7, 2017
Post comments count 0
Post likes count 0

Visual Studio 2017 Version 15.6 Preview

ScriptingGuy1

[Hello, we are looking to improve your experience on the Visual Studio Blog. It will be very helpful if you could share your feedback via this short survey that should take less than 2 minutes to fill out. Thanks!] A few days ago we released Visual Studio 2017 version 15.5 and an update to Visual Studio for Mac, and today we are releasing the first preview of the next minor update: Visual Studio 2017 version 15.6. You can either download the Preview, or, if you already have it installed, click on the notification you’ll receive in the product informing you that the update is available. This latest preview conta...

Post-Connect(); 2017 Visual Studio Partner Webinar Series
Dec 7, 2017
Post comments count 0
Post likes count 0

Post-Connect(); 2017 Visual Studio Partner Webinar Series

ScriptingGuy1

[Hello, we are looking to improve your experience on the Visual Studio Blog. It will be very helpful if you could share your feedback via this short survey that should take less than 2 minutes to fill out. Thanks!] Earlier this week, we released 13 Visual Studio partner webinars that build off of some of the major announcement areas of Connect(); 2017 and provide applications of developer tools that, literally, 'connect' with the latest and greatest from Azure, SQL Server 2017, and Visual Studio. Developer Tools for Application Innovation Scott Guthrie introduced advancements in developer productivity in the c...

Snapshot Debugging with Visual Studio 2017: Now Ready for Production
Dec 6, 2017
Post comments count 0
Post likes count 0

Snapshot Debugging with Visual Studio 2017: Now Ready for Production

ScriptingGuy1

[Hello, we are looking to improve your experience on the Visual Studio Blog. It will be very helpful if you could share your feedback via this short survey that should take less than 2 minutes to fill out. Thanks!] Earlier this year we previewed the Snapshot Debugger, a tool that enables you to debug web apps running in production in Azure. With the general availability of Visual Studio 2017 Enterprise 15.5 this week, Snapshot Debugger is now available for you to get started. Read more about how here. Snapshot Debugging Overview If an issue happens in production, you may find yourself digging through logs or att...

Join Us to Learn How to Build Android 8.0 Oreo and iOS 11 apps with Visual Studio
Dec 5, 2017
Post comments count 0
Post likes count 0

Join Us to Learn How to Build Android 8.0 Oreo and iOS 11 apps with Visual Studio

ScriptingGuy1

[Hello, we are looking to improve your experience on the Visual Studio Blog. It will be very helpful if you could share your feedback via this short survey that should take less than 2 minutes to fill out. Thanks!] Visual Studio and Xamarin enable .NET developers everywhere to use their favorite language and full-featured IDE to create native Android, iOS, and UWP apps, even incorporating the latest and greatest from Android 8.0 Oreo and iOS 11. To help you get the most out of the new Google and Apple APIs, we’re hosting two webinars: one for all things Android 8.0 Oreo and one dedicated to iOS 11. In these web...

Visual Studio 2017 Version 15.5, Visual Studio for Mac Released
Dec 4, 2017
Post comments count 0
Post likes count 0

Visual Studio 2017 Version 15.5, Visual Studio for Mac Released

ScriptingGuy1

[Hello, we are looking to improve your experience on the Visual Studio Blog. It will be very helpful if you could share your feedback via this short survey that should take less than 2 minutes to fill out. Thanks!]   Today we released significant updates to both Visual Studio 2017 and Visual Studio for Mac. I’ll share some details in this post, but as always, there’s a lot more information in the release notes. If you’d like to jump right in, download Visual Studio 2017 version 15.5 and download Visual Studio for Mac. Visual Studio 2017 Version 15.5 This update contains major performance improvements, new ...

Announcing JUnit Support for Visual Studio Code
Dec 1, 2017
Post comments count 0
Post likes count 0

Announcing JUnit Support for Visual Studio Code

ScriptingGuy1

Today, we’re pleased to release a new extension to our Visual Studio Code Java extension family - Test Runner/Debugger for Java. It’s a lightweight test runner/debugger with below features we hope you will like. Same as the Debugger for Java, this is also an open source project. Please check out the github page https://github.com/Microsoft/vscode-java-test/ for more details and feedback. Along with the new extension, we’re also updating our Debugger extension with version 0.4.0. With this release, we’re adding a few useful tools to make Java debugger in VS Code more enjoyable. Launch in terminal ...

TFVC support and other enhancements hit Continuous Delivery Tools for Visual Studio
Nov 27, 2017
Post comments count 0
Post likes count 0

TFVC support and other enhancements hit Continuous Delivery Tools for Visual Studio

ScriptingGuy1

A year ago, we released the first preview of the Continuous Delivery Tools for Visual Studio (CD4VS) with support for configuring a continuous integration and continuous delivery pipeline for ASP.NET and ASP.NET Core projects with and without container support. With CD4VS you can always configure Continuous Delivery for solutions under source control to App Service, and Service Fabric Clusters. Today, we announce the support for configuring Continuous Delivery for solutions under TFVC source control on VSTS. When you click configure Continuous Delivery on the solution menu, CD4VS detects the source control prov...

Announcing Language Server Protocol Preview Release
Nov 21, 2017
Post comments count 0
Post likes count 0

Announcing Language Server Protocol Preview Release

ScriptingGuy1

Visual Studio is joining Visual Studio Code in offering support for the Language Server Protocol. As an extension author, you can now write Visual Studio extensions that leverage existing language servers to provide a rich editing experience for languages that initially had no native language support in Visual Studio. With these extensions, you can use Visual Studio to code in your favorite language! This is a preview release that is available as an extension on Visual Studio Marketplace and can only be installed on Visual Studio 2017 Preview. Read our documentation to find out more. What is an LSP? The Langua...

Overview of Visual Studio 2017 and Updates for .NET Developers
Nov 20, 2017
Post comments count 0
Post likes count 0

Overview of Visual Studio 2017 and Updates for .NET Developers

ScriptingGuy1

Visual Studio 2017 first released in March of this year. Since then, there have been five updates with each bringing more improvements and capabilities. Every improvement is geared towards making you more productive and this post aims to give you an overview of the culmination of features to date. Read on to see how you can get started working on your projects quickly and write better code faster. Download Visual Studio 2017 Preview today. New Install Experience, Performance and Reliability The first thing you’ll notice with Visual Studio 2017 is the new install experience which lets you pick and choose which de...

Large C# and VB solutions load significantly faster in 15.5 update
Nov 20, 2017
Post comments count 0
Post likes count 0

Large C# and VB solutions load significantly faster in 15.5 update

ScriptingGuy1

On average, 50 percent of all solutions opened by Visual Studio users open in ten seconds or less. However, large solutions can take longer to load because there are a lot of projects that Visual Studio needs to process. Over the last six months, we looked at ways to make solution load much faster, even for large solutions. We are happy to share that with update 15.5, Visual Studio 2017 loads C# and Visual Basic projects twice as fast as before. (C++ solution load was optimized earlier in Visual Studio 2017, as described here.) This video compares loading the Orchard Content Management System solution before an...

Managing Secrets Securely in the Cloud
Nov 17, 2017
Post comments count 0
Post likes count 0

Managing Secrets Securely in the Cloud

ScriptingGuy1

You’ve probably heard some version of the story about a developer who mistakenly checked in his AWS S3 key to Github. He pulled the key within 5 minutes but still racked up a multi-thousand dollar bill from bots that crawl open source sites looking for secrets. As developers we all understand and care about keeping dev and production secrets safe but managing those secrets on your own or especially in a team can be cumbersome. We are pleased to announce several new features that together will make detecting secrets in code and working with secrets stored securely on Azure easier than it’s ever been before. ...

Test Experience Improvements
Nov 16, 2017
Post comments count 0
Post likes count 0

Test Experience Improvements

ScriptingGuy1

There have been several significant improvements to the test experience that range across Visual Studio and Visual Studio Team Services. These efforts involved frameworks and tooling for both .NET and C++, but all had a common goal: make testing with our developer tools a great experience. .NET Side-by-side Performance Comparison These improvements are best shown in a side-by-side comparison of Visual Studio 2017 15.4 and Visual Studio 2017 15.5 Preview 2 with the Real Time Test Discovery feature flag turned on. Wow! How did you get that performance?! The performance improvements are thanks to work in a few dif...

Spend more time working on the interesting stuff
Nov 16, 2017
Post comments count 0
Post likes count 0

Spend more time working on the interesting stuff

ScriptingGuy1

There’s a reason that each day thousands of developers take advantage of the rich set of extensions offered by our growing family of VS and VSTS Partners and the broader VS community. Collectively these offerings can save you and your team time in many different ways, from helping find bugs faster, to making it easier to work with data, to helping create great UX. I’m excited to be here at Connect(); this week where our partners are announcing a slew of exciting new products and updates for developers in tandem with our own developer productivity announcements. Here's a quick overview of these updated and new a...

Keep Your Skills Up to Date: New Training and Azure Resources
Nov 15, 2017
Post comments count 0
Post likes count 0

Keep Your Skills Up to Date: New Training and Azure Resources

ScriptingGuy1

Finding better ways to upskill is a consistent topic that comes up when we talk to you about what’s top of mind. It’s no wonder when the one constant in our industry is change with new techniques, frameworks, tools, and languages emerging all the time. Developers by nature are extremely self-reliant when it comes to dealing with this change. Over 90% of the respondents on StackOverflow’s 2017 Developer Survey indicated that they were at least partially self-taught. Whether through coding boot camps, online courses, online forums/Q+A, or joining an OSS project, you are using a variety of ways to level up your ski...

The Latest in Developer Productivity and App Experiences
Nov 15, 2017
Post comments count 0
Post likes count 0

The Latest in Developer Productivity and App Experiences

ScriptingGuy1

Whatever the language or platform, developers want the same thing - to create app experiences that are high-quality, intelligent and personalized. Experiences that delight users and keep them engaged. To do that, we need tools that increase our productivity, so that we spend more time on what matters most to our app's success. At Connect(); 2017 we are showcasing new tools and services that demonstrate Microsoft’s commitment to developer productivity and incredible app experiences. Visual Studio App Center – Build, Test, Deploy, Engage, Repeat. Today we announced the General Availability of Visual Studio App Cen...

Run and Debug Java 9 in Visual Studio Code
Nov 10, 2017
Post comments count 1
Post likes count 0

Run and Debug Java 9 in Visual Studio Code

ScriptingGuy1

In the past 3 weeks, we’ve continued to see a lot of people installing and trying our tools, reading our documents, and visiting our repository. We’ve also seen a number of new issues opened by the Java community. Thank you all for trying our tools and providing feedback, all of which is motivating us to make VS Code a better tool for Java developer. With our new 0.3.0 release, we have added a few new capabilities and addressed your top feedback. Java 9 Support Java 9 was officially out just weeks after the initial release of our debugger. To allow more and more developers to try the new version of Java with VS C...

Visual Studio IDE extensions now published and managed at Marketplace
Nov 9, 2017
Post comments count 0
Post likes count 0

Visual Studio IDE extensions now published and managed at Marketplace

ScriptingGuy1

Consumers of Visual Studio IDE extensions visit Visual Studio Marketplace to discover and acquire extensions. But extension publishers visit Visual Studio Gallery to publish and manage their Visual Studio IDE extensions. Henceforth, extension publishing and management will also be in Marketplace. In this process, all extensions in Gallery will be automatically moved over to Marketplace. Marketplace now serves as a single place for extension publishers and consumers to publish, manage or acquire extensions. Benefits of publishers moving to Marketplace   To publish and manage an exte...

Reverse Desired State Configuration: How it works
Oct 27, 2017
Post comments count 0
Post likes count 0

Reverse Desired State Configuration: How it works

Doctor Scripto

Nik Charlebois is a Premier Field Engineer based out of Canada. He is the author of several books on SharePoint automation, and he writes blog posts on a regular basis about all things PowerShell. You can find out more about his work here. ReverseDSC PowerShell Desired State Configuration (DSC) has been around for a few years now, and many organizations are using it to help them automate parts of their DevOPS pipeline. There are now several hundred DSC modules available in the PowerShell Gallery. This enables organizations to create a complex automation solution that allows them to manage, via DSC, different comp...

Use Docker to automate testing of PowerShell Core scripts
Oct 3, 2017
Post comments count 0
Post likes count 0

Use Docker to automate testing of PowerShell Core scripts

Doctor Scripto

  Summary: Learn the basics about Docker, and see how to use it for PowerShell Core script testing on different operating systems. I'm Dan Ward, a Boston-based .NET software engineer who is just plum crazy about PowerShell and automation. Earlier this year, I uploaded my first GitHub project—a PowerShell whitespace cleaner that also replaces aliases with commands and fixes casing issues. Like any manager of a new project, I was excited to see people using it and providing feedback and enhancement requests. But I became concerned when bug reports started coming in: "But I tested this on my machine before up...

PowerTip: Remove calendar events from a mailbox
Aug 31, 2017
Post comments count 0
Post likes count 0

PowerTip: Remove calendar events from a mailbox

Doctor Scripto

Summary: Remove calendar events within an Exchange Online mailbox.     Is there an easy way to remove calendar events from within an Exchange Online mailbox?         Yes there is. There is a newly deployed cmdlet to Office 365 tenants: Remove-CalendarEvents. This cmdlet is currently only available in Exchange Online, but it does allow administrators to remove calendar events, with an attendee, from an owner's mailbox. Here are three examples: Remove-CalendarEvents -Identity chris@contoso.com -CancelOrganizedMeetings This example cancels every meeting in the mailbox chris@contoso.com that occurs on or after today...

Weekend Scripter: Exchange add-in module
Aug 11, 2017
Post comments count 0
Post likes count 0

Weekend Scripter: Exchange add-in module

Doctor Scripto

Summary: Mike O'Neill, Microsoft Senior Premier Field Engineer, created an Exchange add-in module. This is a PowerShell module for Exchange engineers. The module takes into account both on-premises and hybrid deployed Exchange environments. It is a combination of several other scripts that are either on the internet, or are action items you might need help with in your day-to-day tasks. By combining several lines of code into a single verb-noun cmdlet, it makes repeatable, mundane tasks much easier. In fact, once you have the hang of them, you could delegate them out to other team members with a few minutes of ...

Hey, Scripting Guy! update
Jul 26, 2017
Post comments count 0
Post likes count 0

Hey, Scripting Guy! update

Doctor Scripto

Ed Wilson retired, but we are continuing his legacy of friendly tutorials on solving common problems. We will also help IT professionals expand their skill set beyond what might be their comfort zone. Examples of this include incorporating continuous integration/continuous deployment (CI/CD) tools into core infrastructure management, and hybrid cloud operations. Ed actively recruited contributors to submit new content.  We are continuing that tradition by making "Hey, Scripting Guy!" a community effort. In the spirit of getting people started in the wide world of scripting for the cloud, we are asking that propo...

Debugging PowerShell script in Visual Studio Code – Part 2
Feb 13, 2017
Post comments count 1
Post likes count 2

Debugging PowerShell script in Visual Studio Code – Part 2

Doctor Scripto

Welcome to Part 2 of the series about how to debug PowerShell in Visual Studio Code. In Part 1, we looked at the debugging features of Visual Studio Code with the PowerShell extension installed.  Now we will examine the various ways that you can start to debug PowerShell script with Visual Studio Code. Single file debugging With the 1.9 release of Visual Studio Code, you can now debug a PowerShell script with no debugger configuration required and no need to open a workspace. That is, you can open a single PowerShell file instead of a folder and still debug it. In the following example, I open a single script fi...

Cloud operating system deployment: WinPE in Azure
Feb 9, 2017
Post comments count 0
Post likes count 0

Cloud operating system deployment: WinPE in Azure

Doctor Scripto

Jason Ryberg is a Consultant for Microsoft, where he writes PowerShell code and provides DevOps support.  Have you ever wanted to boot to WinPE in Azure and select an Microsoft Deployment Toolkit (MDT) Task Sequence?  As part of an informal cloud-readiness evaluation, I was asked to deploy a server image to Azure. The image that I was given would run the MDT Deployment Wizard to allow for the selection of deployment options. But, how could I choose deployment options if I could not reach the Azure virtual machine in the boot environment? Read on to find out how to interact with an Azure virtual machine in a prebo...

Announcing the 2016 Honorary Scripting Guys
Feb 7, 2017
Post comments count 0
Post likes count 0

Announcing the 2016 Honorary Scripting Guys

Doctor Scripto

Summary: The Honorary Scripting Guys for 2016 are announced. Microsoft Scripting Guy, Ed Wilson, is here. Well, it has been an awesome year for Windows PowerShell and for the community. The Scripting Wife and I had the opportunity to speak at lots of user groups and conferences last year. This involved many, many miles of travel. Luckily, the community pitched in and helped – a lot – with the Scripting Guys blog … and so, once again, it was the top Microsoft blog. The cool thing about a strong community – and of community contributions to the blog is that we can get lots of different views about how we can use W...

Debugging PowerShell script in Visual Studio Code – Part 1
Feb 6, 2017
Post comments count 6
Post likes count 3

Debugging PowerShell script in Visual Studio Code – Part 1

Doctor Scripto

Summary: Here's a look at the many features of the PowerShell debugger for Visual Studio Code. In previous blog posts, we covered how to get started with PowerShell development in Visual Studio Code and the editing features of Visual Studio Code and the PowerShell extension.  If you don’t already have Visual Studio Code configured with the PowerShell extension, read those blog posts to get caught up. In the first of this two-part series, we will cover the many features of the PowerShell debugger for Visual Studio Code.  These features are provided by the PowerShell extension, or, more accurately, by the PowerSh...

PowerTip: Get a list of security patches installed in the last 90 days
Feb 3, 2017
Post comments count 0
Post likes count 0

PowerTip: Get a list of security patches installed in the last 90 days

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to get a list of all the security patches installed in the last three months. How can I list all the security patches that I’ve installed in the last 90 days? There’s a class for that! Just use , and you can retrieve this information. Here is an example:

PSScriptAnalyzer deep dive – Part 4 of 4
Feb 3, 2017
Post comments count 3
Post likes count 1

PSScriptAnalyzer deep dive – Part 4 of 4

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows how to write a custom PSScriptAnalyzer rule. Hello! I’m Thomas Rayner, a Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a four-part series about how to use PSScriptAnalyzer. Part 1 – Getting started with PSScriptAnalyzer Part 2 – Suppressing, including, excluding rules Part 3 - Wrapping PSScriptAnalyzer with Pester to get formatted results Part 4 – Writing custom rules This ...

PowerTip: Get a list of suspended Azure Automation jobs
Feb 2, 2017
Post comments count 0
Post likes count 0

PowerTip: Get a list of suspended Azure Automation jobs

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how get a list of all your suspended Azure Automation jobs. I think I have an Azure Automation job that is getting suspended for running too long. How can I verify this? You can use the cmdlet and its flag to get this information. Here is an example: You can also use other values like , , and in that place.

PSScriptAnalyzer deep dive – Part 3 of 4
Feb 2, 2017
Post comments count 0
Post likes count 1

PSScriptAnalyzer deep dive – Part 3 of 4

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows how to use Pester to get nUnit formatted results out of PSScriptAnalyzer. Hello! I’m Thomas Rayner, a Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a four-part series about how to use PSScriptAnalyzer. Part 1 – Getting started with PSScriptAnalyzer Part 2 – Suppressing, including, excluding rules Part 3 - Wrapping PSScriptAnalyzer with Pester to get formatted results Part 4 ...

PowerTip: Convert from UTC to my local time zone
Feb 1, 2017
Post comments count 0
Post likes count 0

PowerTip: Convert from UTC to my local time zone

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how write a function to convert from UTC to your local time zone. I have a time that I’d like to convert from UTC to my local time zone. How can I do this? You can write your own function to do this, and use the [System.TimeZoneInfo] .NET class and associated methods to make this conversion easily. Here is an example: { param( [parameter(Mandatory=$true)] [String] $UTCTime ) $strCurrentTimeZone = (Get-WmiObject win32_timezone).StandardName $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone) $LocalTime = [System.TimeZoneInf...

PSScriptAnalyzer deep dive – Part 2 of 4
Feb 1, 2017
Post comments count 0
Post likes count 1

PSScriptAnalyzer deep dive – Part 2 of 4

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows how to suppress, include, and exclude PSScriptAnalyzer rules. Hello! I’m Thomas Rayner, a Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a four-part series about how to use PSScriptAnalyzer. Part 1 – Getting started with PSScriptAnalyzer Part 2 – Suppressing, including, excluding rules Part 3 - Wrapping PSScriptAnalyzer with Pester to get formatted results Part 4 – Writing cu...

PowerTip: Find all the Azure Automation jobs that will run in the next two days
Jan 31, 2017
Post comments count 0
Post likes count 0

PowerTip: Find all the Azure Automation jobs that will run in the next two days

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to find all the Azure Automation jobs that will run in the next two days. Is there a way to find all the Azure Automation jobs that will run in the next two days? Use the cmdlet, and check out the attribute. Here is an example:

PSScriptAnalyzer deep dive – Part 1 of 4
Jan 31, 2017
Post comments count 0
Post likes count 2

PSScriptAnalyzer deep dive – Part 1 of 4

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics about how to use PSScriptAnalyzer. Hello! I’m Thomas Rayner, a Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a four-part series about how to use PSScriptAnalyzer. Part 1 – Getting started with PSScriptAnalyzer Part 2 – Suppressing, including, excluding rules Part 3 - Wrapping PSScriptAnalyzer with Pester to get formatted results Part 4 – Writing custom rules This...

Nearly everything has changed for SQL Server PowerShell
Jan 25, 2017
Post comments count 0
Post likes count 1

Nearly everything has changed for SQL Server PowerShell

Doctor Scripto

2016 was the best year in SQL PowerShell history! I guess I should have mentioned that here sooner. Wired® Magazine recently said that Microsoft SQL Server was the surprise hit of the year. The primary cited reason is the SQL Server port to Linux, but there are several other reasons to be really excited about SQL Server and SQL Server PowerShell is one of them. Independent, frequent releases of SSMS Thanks to the new release cycle of SQL Server Management Studio (SSMS), which comes out nearly every month, the SQL Tools team could deliver even more without making us wait until the next major release of SQL Server...

View passwords of wireless profiles without using netsh.exe
Jan 13, 2017
Post comments count 0
Post likes count 0

View passwords of wireless profiles without using netsh.exe

Doctor Scripto

Ever since the GUI lost the ability to view the password of a wireless profile, I wanted to provide this functionality in PowerShell. A search of the Internet for how to view the password of a Wi-Fi profile returns numerous examples of how to use netsh.exe to accomplish this. I wrote a previous blog post about how to view Wi-Fi profiles, and the method I used returned objects, but still relied on netsh.exe. I had some free time, and I wanted to learn about p/invoke, so I wrote a PowerShell module to do this. Let’s look at how to do this without netsh. If there isn’t a cmdlet or method in .NET to get what you wan...

Visual Studio Code editing features for PowerShell development – Part 2
Jan 12, 2017
Post comments count 0
Post likes count 4

Visual Studio Code editing features for PowerShell development – Part 2

Doctor Scripto

Summary: Editing features for Visual Studio Code that use the PowerShell extension. Welcome to Part 2 about editing features of Visual Studio Code. Everything that we  examined in Part 1 of this series is about Visual Studio Code editing features that are available without the PowerShell extension installed! They apply to your markdown, JSON, XML, and YAML files. Now, let’s look at additional editing features the PowerShell extension provides. IntelliSense With the PowerShell extension, you get IntelliSense for commands, command parameters, .NET type names, member names, and method parameter information as shown...

Visual Studio Code editing features for PowerShell development – Part 1
Jan 11, 2017
Post comments count 0
Post likes count 2

Visual Studio Code editing features for PowerShell development – Part 1

Doctor Scripto

Summary: The editing features of Visual Studio Code come in handy as you develop your PowerShell scripts. Note: This post includes animated gifs. For best results, view the post in Internet Explorer or Microsoft Edge. In the previous blog post, we explained how to get started with PowerShell development in Visual Studio Code. If you don’t have Visual Studio Code configured with the PowerShell extension, read that blog post first to get caught up. Since that blog post, there have been two important updates. First, Visual Studio Code has been updated to 1.8. One significant new feature in Visual Studio Code 1.8 is ...

SharePoint Online cmdlets to help your migration
Jan 9, 2017
Post comments count 0
Post likes count 0

SharePoint Online cmdlets to help your migration

Doctor Scripto

Summary: Use these PowerShell cmdlets to migrate to SharePoint Online. Today’s post is from Christopher Weaver, who is a Microsoft Premier Field Engineer (PFE) and focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys backpacking, hiking, kite surfing, and spending time with his kids and dog. You can follow him on his blog at https://blogs.technet.microsoft.com/christwe/. As we prepare our SharePoint Online environment for migration, we will need to be able to manage site coll...

Where[-Object] clauses for people who use SQL Server
Jan 4, 2017
Post comments count 0
Post likes count 1

Where[-Object] clauses for people who use SQL Server

Doctor Scripto

Summary: Learn about the power of the Where[-Object] cmdlet in PowerShell. Can I do a WHERE clause with an IN, in PowerShell?  Yes! Today’s post is from Aaron Nelson ( blog | twitter ), who is a Microsoft MVP for SQL Server (Data Platform), leads the PowerShell Virtual Chapters of PASS, volunteers for the local PASS Chapter AtlantaMDF, and helps organize SQL Saturday events in Atlanta. The PowerShell Virtual Chapter of PASS hosts monthly sessions on SQL Server + PowerShell, and you can find the recordings of those sessions on their YouTube channel. is an extremely important cmdlet. Those of us who use SQL are...

PowerTip: Get the Notes field when accessing users or groups in Active Directory
Dec 25, 2016
Post comments count 0
Post likes count 0

PowerTip: Get the Notes field when accessing users or groups in Active Directory

Doctor Scripto

Summary: Use the Active Directory Module to get the information from the “Notes” field.  I’m trying to find the Active Directory property to use to access the Notes field when I’m viewing a user or a group. Could you lend me a hand? No problem at all. The property you are looking for is and can be added when you use or . I like to add as well to pull in most of the descriptive details. Here is an example:

Curly Blue and the meaning of scripting – Part 5
Dec 25, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 5

Doctor Scripto

Summary: Curly Blue learns the true meaning of scripting in PowerShell. When we last saw our hero, Curly Blue, he had discovered not only the ease of use of PowerShell but also the vast community resources provided by Github. Because of this one reason alone, his co-workers, Loopy and Codestock, had no need to fret over the upcoming holiday weekend. Their task was solved in a quick and cost-effective manner. Curly sat down to reflect upon his past 24 hours of “intensive PowerShell training” with his co-workers. “At first I came in and was apprehensive about scripting. I personally didn’t find it useful due to...

PowerTip: Get a list of local Users in Windows 10 / Windows Server 2016
Dec 24, 2016
Post comments count 0
Post likes count 0

PowerTip: Get a list of local Users in Windows 10 / Windows Server 2016

Doctor Scripto

Summary: Use the cmdlets provided in PowerShell 5.1 to manage local user accounts on a system. I remember having to use the Active Directory Service Interfaces (ADSI) accelerator to access a list of local users in PowerShell. Is there a cmdlet that could do this now? Yes.  In the most recent version of Windows 10 / Windows Server 2016 with PowerShell 5.1, you can run just one cmdlet to pull up a list of local users.

Curly Blue and the meaning of scripting – Part 4
Dec 24, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 4

Doctor Scripto

Summary: Curly Blue learns how to use GitHub resources on PowerShell to clean out old office installations. When we last saw our hero, Curly Blue, he had been hanging around the office of Azura and discovering the simple ways he could use Windows PowerShell with minimal learning. In the past few days, he’s seen how easy it is to work and access files by date and time, use features that are built into the Active Directory Administrative Center (ADAC) to identify samples of PowerShell, and pull data by using the Common Information Model (CIM) cmdlets. He was blinking in disbelief. Although he was a master of usi...

PowerTip: Use PowerShell to determine active CIM sessions
Dec 23, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to determine active CIM sessions

Doctor Scripto

Summary: Use the Common Information Model (CIM) cmdlets to pull a list of active sessions to remote workstations. How can I find active CIM sessions on my workstation? Just use this one cmdlet to list all active CIM sessions, and you’re done for the day!

Curly Blue and the meaning of scripting – Part 3
Dec 23, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 3

Doctor Scripto

Summary: Curly Blue discovers the raw power of Cim-Instance combined with PowerShell remoting. We continue with Curly Blue as he searches understand the meaning of scripting. He is still sitting in the office with Azura. The co-op student, Hermie, has run off to chase something that wandered into his phone. Virus or virtual creature, nobody can ever tell. A new request has just made its way across her desk. The CIO would like a complete inventory of all serial numbers of the company’s workstations. Curly just rolled his eyes. “Over 5,000 workstations! Just where do we even start?” Azura noted his displeasure...

PowerTip: List locked-out accounts in Active Directory with PowerShell
Dec 22, 2016
Post comments count 0
Post likes count 0

PowerTip: List locked-out accounts in Active Directory with PowerShell

Doctor Scripto

Summary: Use Active Directory cmdlets to identify locked-out user accounts and computer accounts. Is there a quick and easy way to find all users who are locked out in Active Directory by using PowerShell?   You’ll love this. The answer is just one cmdlet away with the ActiveDirectory module. Just use Search-ADAccount, and you’ll have a complete list on your screen.

Curly Blue and the meaning of scripting – Part 2
Dec 22, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 2

Doctor Scripto

Summary: Curly Blue learns how to use built-in PowerShell script examples in Windows. Yesterday we met our new friends, Curly Blue and Linux. Curly had started his new job as a IT Professional at Contoso. The challenge for poor Curly was that he had never learned scripting or, for that matter, gotten into the spirit of it. He had mastered a unique talent of hyper-active data entry skills combined with keyboard shortcuts. He was now walking to the Office of Azura. She is in charge of managing the migration of the company resources to the cloud. Today she is working with a co-op student, Hermie. “Our big challe...

PowerTip: Limit Get-Childitem to a limited depth in the tree
Dec 21, 2016
Post comments count 0
Post likes count 1

PowerTip: Limit Get-Childitem to a limited depth in the tree

Doctor Scripto

Summary: Use the new -depth parameter to control how far down a directory you can search. I have a large file structure to search but I only want to go two folders deep on the search.  Is there a way to do this in PowerShell? Certainly!  In PowerShell 5.0, you can use the -depth parameter to specify how many branches deep you’d like to limit from the search root. Here, we can search the C:\Users\CurlyBlue folder for DOCX files but only go to two levels below. Here is an example:

Curly Blue and the meaning of scripting – Part 1
Dec 21, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 1

Doctor Scripto

Summary: Curly Blue learns how to automate cleaning of old data files by using PowerShell. This week, in the spirit of the holidays (and of course the previous six years!), Hey, Scripting Guy is honored to bring forth a repeat of a tradition: The “Hey, Scripting Guy!” holiday special. This year, we are pleased to offer a week of fun and Windows PowerShell with a new story produced as a collaboration of two MVPs, Honorary Scripting Guys, Thomas Rayner and Sean Kearney. This year’s special is about a fellow named Curly Blue who has just started his new job with only a week remaining before the holiday weekend. C...

Make Visual Studio Code more like the integrated scripting environment
Dec 7, 2016
Post comments count 0
Post likes count 0

Make Visual Studio Code more like the integrated scripting environment

Doctor Scripto

Summary: Learn some handy tips to make Visual Studio Code work more like the ISE. I was very intrigued with the release of Visual Studio Code last year. An editor that is light-weight and integrated with Git is something worth considering. Well, any new tool that could be added to the tool box is worth considering. In the past, I used the integrated scripting environment (ISE) as my tool of choice to develop and edit PowerShell scripts but I’m always looking for ways and tools to improve my PowerShell skills. There is a learning curve to Visual Studio Code. The ISE is very intuitive. I have never had much troub...

Get started with PowerShell development in Visual Studio Code
Dec 5, 2016
Post comments count 0
Post likes count 0

Get started with PowerShell development in Visual Studio Code

Doctor Scripto

Summary: Learn about the features in Visual Studio Code that help you write PowerShell code. Since the PowerShell integrated scripting environment (ISE) shipped with Windows PowerShell 2.0 in 2009, the PowerShell landscape has changed significantly. In November 2014, Microsoft took .NET open source and cross-platform. Given PowerShell’s dependence on .NET, this was an important prerequisite before taking PowerShell cross-platform. And, indeed, nine months later, Microsoft made PowerShell available cross-platform, supporting Linux and macOS in addition to Windows. To the surprise of many, Microsoft also open-sour...

PowerTip: Capture the output of a Linux application in PowerShell
Nov 25, 2016
Post comments count 0
Post likes count 0

PowerTip: Capture the output of a Linux application in PowerShell

Doctor Scripto

Summary: Use the built-in features of PowerShell to obtain data produced by a Linux application. Can I run a Linux application like ls and capture its output in PowerShell? You certainly can!  It’s no different from when you normally grab output from any other command in Windows.   To grab the output of the ls command, for example, just assign it to a PowerShell object as you normally would. The captured output will be all text, and you can run standard methods, Search-String and regular expressions against it.

Open Source PowerShell – Part 4
Nov 25, 2016
Post comments count 0
Post likes count 0

Open Source PowerShell – Part 4

Doctor Scripto

Summary: Install and Configure SSH for Open Source PowerShell remoting. With PowerShell, up to this point, one thing that I love is the ability to connect various systems in my environment and run cmdlets on them remotely.  Can we do this with Open Source PowerShell?  Honorary Scripting Guy, Sean Kearney, is here today to go over how to get Open Source PowerShell set up to do remoting.  Because this, my friends, this is the big game changer. When Linux admins presently need to work with a Windows Server, they need to play with a few options: A Windows admin could typically just download a utility l...

PowerTip: Return a status code to Linux from PowerShell
Nov 18, 2016
Post comments count 0
Post likes count 0

PowerTip: Return a status code to Linux from PowerShell

Doctor Scripto

Summary: Pass a result code back to a calling Linux environment from Open Source PowerShell. How can I pass a numeric value back to a calling Bash Shell to indicate an error? Just simply supply the EXIT command and a numeric value at the point where the error is flagged. For example, the following code is a PowerShell script that returns a value of 76 if the script does not match the value of . If ($Value -eq ‘Something Good’) { Write-Output ‘It’s Good, it’s very Good’ } Else { Exist 76 }

Open Source PowerShell – Part 3
Nov 18, 2016
Post comments count 0
Post likes count 0

Open Source PowerShell – Part 3

Doctor Scripto

Summary: Pass and return data correctly between Bash and Open Source PowerShell. Could you show me some examples of actually passing and returning values between PowerShell and Bash? Honorary Scripting Guy, Sean Kearney, is here today and we’ll do exactly that. It isn’t difficult to actually to do this either, but there are two things to keep in mind to make all of this easier. When working with data: If you keep this in mind, much of the challenge is in just understanding that when PowerShell parameters are set, they should be typed correctly by using the appropriate .NET class. You’ll also need to...

PowerTip: Get the status code of a PowerShell script in Bash
Nov 11, 2016
Post comments count 0
Post likes count 0

PowerTip: Get the status code of a PowerShell script in Bash

Doctor Scripto

Summary: Identify the results of a script running in Open Source PowerShell in a Bash environment. Is there any way to see the results of a PowerShell script? For example, if somebody sent an “Exit 42”, could I see it in Linux? All you need to do is examine the $? variable in Linux, just like any other Linux application. Here is an example:

Open Source PowerShell – Part 2
Nov 11, 2016
Post comments count 0
Post likes count 0

Open Source PowerShell – Part 2

Doctor Scripto

Summary: Use PowerShell scripts within Python and Bash (and those within PowerShell). I am curious just how much I can use Open Source PowerShell within Linux and macOS.  Is it an isolated environment, or can it interact with other shells? Thanks for your question.  Our good friend, Honorary Scripting Guy, Sean Kearney, is here today to show you just how well it interacts. Let’s consider something. Most shells, whether it is Bash or CMD.EXE, are just that, a shell. They normally can run some processes and send output to the console. In many cases, those same shells can call up other shells and launch others...

Manage SharePoint Online site collections and the web templates with PowerShell
Nov 10, 2016
Post comments count 0
Post likes count 0

Manage SharePoint Online site collections and the web templates with PowerShell

Doctor Scripto

Summary: PowerShell commands can manage site collections and the web templates that create site collections. Christopher Weaver is a Microsoft Premier Field Engineer (PFE) who focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys backpacking, hiking, kite surfing, and spending time with his kids and dog. You can follow him on his blog at https://blogs.technet.microsoft.com/christwe/. Hello All, As we prepare our SharePoint Online environment for migration, we will need to be ...

Part 3 – Use Azure Automation DSC to Configure Linux and execute PowerShell scripts
Nov 9, 2016
Post comments count 0
Post likes count 0

Part 3 – Use Azure Automation DSC to Configure Linux and execute PowerShell scripts

Doctor Scripto

Summary: Learn how to configure and use PowerShell, Bash, and DSC with Linux. Hi, my name is Stefan Roth (Blog: http://stefanroth.net / Twitter: @stefanroth_net), and I am a Cloud and Datacenter MVP. In my last post of this three-part series, I would like to show you how we are able to hook up the previously installed Linux system to Azure Automation desired state configuration (DSC), deploy a DSC configuration, and apply it to our Linux system. What we are actually going to do is create a cronjob on Linux via Azure Automation DSC. This cronjob will run a PowerShell script on Linux every five minutes to send the...

How to avoid reinventing the wheel in Azure Automation
Nov 8, 2016
Post comments count 0
Post likes count 0

How to avoid reinventing the wheel in Azure Automation

Doctor Scripto

Summary: Take advantage of existing scripts to create your own solutions.   Automation is the number one technical skill that IT needs to have to thrive in today’s quickly changing world. My recommendation is that anything you do for automation you should do in PowerShell, and you should use Azure Automation as your go-to automation solution. (PoSH Wizard illustration courtesy of myITforum.com) The Microsoft Operations Management Suite provides functionality around log analysis, backup and recovery, security and compliance, and IT automation. IT automation uses Azure Automation and is described as a met...

PowerTip:  Capture error code of a PowerShell session in Linux or macOS
Nov 4, 2016
Post comments count 0
Post likes count 0

PowerTip: Capture error code of a PowerShell session in Linux or macOS

Doctor Scripto

Summary: Capture the status code of a PowerShell session in Linux or macOS. Could you show me how to run a PowerShell script in Linux or macOS and capture the status of whether that script succeeded or failed? No problem, my friend. Just run the PowerShell session, and start the script as in the following example. You can view the status in the built-in variable in Linux and macOS.

Open Source PowerShell – Part 1
Nov 4, 2016
Post comments count 0
Post likes count 0

Open Source PowerShell – Part 1

Doctor Scripto

Summary: Find and install the Open Source PowerShell software for Linux or Windows. I was reading up about a great new change in PowerShell. I heard that the newest version was Open Sourced on GitHub. Any chance you could give me a quick run-through to check it out? Honorary Scripting Guy, Sean Kearney, is here today to bring you up to pace with the coolest new change that was introduced ever. The newest version of Windows PowerShell (version 6.0) is on GitHub.com as an Open Source project! Don’t believe me? Check it out right now at https://github.com/PowerShell/PowerShell. To say, “This is big,” is a very...

PowerTip: Know the difference between the .split() method and ‘-split’
Oct 28, 2016
Post comments count 0
Post likes count 0

PowerTip: Know the difference between the .split() method and ‘-split’

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to split a string by using a string instead of just a character. I am trying to split the string “this is my amazing string” on the pattern “my” by using “this is my amazing string”.split(“my”) but it’s giving me a bunch of garbled stuff back. How do I accomplish my goal?  You’ll have to use –split instead of .split(). Methods like .split() and .trim() take arrays of characters instead of strings. What happened to you is that your pattern, “my”, was treated as an array of characters and “this is my amazing string” was split on all of the “m”...

PowerShell regex crash course – Part 5 of 5
Oct 28, 2016
Post comments count 0
Post likes count 2

PowerShell regex crash course – Part 5 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremely ...

Join the PowerShell tenth birthday celebration
Oct 25, 2016
Post comments count 0
Post likes count 0

Join the PowerShell tenth birthday celebration

I_am_mr_ed

SUMMARY: Microsoft Scripting Guy Ed Wilson announces November 14, 2016 as date for PowerShell 10th anniversary celebration Can you believe that PowerShell is nearly 10 years old (that is a long time in 'internet time')? On November 14, 2016 we will celebrate the occasion with a day-long event that will run from 8 in the morning until 4 in the afternoon (PST). We will stream this live event on the Channel 9 homepage. This is going to be a day long extravaganza befitting the most awesome management, tool ever shipped. We will have segments on SQL and PowerShell, Azure Automation and PowerShell, the future of Powe...

PowerTip: How to use regular expressions to split a string without losing the character you split on
Oct 21, 2016
Post comments count 0
Post likes count 0

PowerTip: How to use regular expressions to split a string without losing the character you split on

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to split a string without losing the character you split on. I’m splitting this file name some file.txt into its name and extension by going “some file.txt” –split “.”. It’s giving me some file and txt, but I want to keep the dot and get .txt instead. How can I do this? You can split on a regex lookahead and split on the space between characters where the character on the right is a dot

PowerShell regex crash course – Part 4 of 5
Oct 21, 2016
Post comments count 0
Post likes count 2

PowerShell regex crash course – Part 4 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremel...

Speed up remote PowerShell connection to Exchange
Oct 17, 2016
Post comments count 0
Post likes count 0

Speed up remote PowerShell connection to Exchange

Doctor Scripto

Summary: Speed up the connection to Exchange by importing only the cmdlets that you need. Is there a way to speed up the initial PowerShell connection to Exchange? Yes, of course! With a little modification to Import-PSSession, we can speed up the connection. Normally, you would connect to Exchange 2010/2013/2016 like this: $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'http://ex01/PowerShell/?SerializationLevel=Full' -Authentication Kerberos Import-PSSession -Session $session This would import all available cmdlets in the local PowerShell session. But, consider the next...

PowerTip: How to detect a valid Active Directory user name using regular expressions
Oct 14, 2016
Post comments count 0
Post likes count 0

PowerTip: How to detect a valid Active Directory user name using regular expressions

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how use regex to detect if a string is a valid Active Directory user name. The invalid characters for an Active Directory user name are and . How do I tell if a string is a valid Active Directory user name?   You can treat this array of characters as a pattern and see if they exist within the string You’ll have to manually escape and because is a bit quirky.

PowerShell regex crash course – Part 3 of 5
Oct 14, 2016
Post comments count 0
Post likes count 1

PowerShell regex crash course – Part 3 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud & Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extrem...

PowerTip: How to detect phone numbers using regular expressions
Oct 7, 2016
Post comments count 0
Post likes count 0

PowerTip: How to detect phone numbers using regular expressions

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to use regex to detect if a string is a phone number. I have an array like , and I need to know which array items are phone numbers. How can I do this? You can compare each item in the array with all its non-digit characters removed and see if that matches your requirements for a phone number. Here in Canada, our phone numbers are 10 digits. Here is an example:

PowerShell regex crash course – Part 2 of 5
Oct 7, 2016
Post comments count 0
Post likes count 1

PowerShell regex crash course – Part 2 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremely ...

Part 2 – Install .NET Core and PowerShell on Linux Using DSC
Oct 5, 2016
Post comments count 0
Post likes count 0

Part 2 – Install .NET Core and PowerShell on Linux Using DSC

Doctor Scripto

Summary: Learn how to configure and use PowerShell, Bash, and desired state configuration (DSC) with Linux. Today, Cloud and Data Center MVP Stefan Roth returns for Part 2 of his three-part series about how to configure and use PowerShell, Bash, and desired state configuration (DSC) with Linux. Take it away Stefan … My previous post installed the foundation for this second part. It installed the OMI CIM server and DSC on Linux. In this part, the goal is to run a DSC configuration on Linux to download and install .NET core libraries and Windows PowerShell for Linux. There is a multi-step process to get this don...

PowerTip: How to escape characters in a string using regular expressions
Sep 30, 2016
Post comments count 0
Post likes count 0

PowerTip: How to escape characters in a string using regular expressions

Doctor Scripto

Summary: Cloud & Datacenter Management MVP, Thomas Rayner, shows how escape characters for use in regex. Is there a way to escape characters in a string automatically for use in regex?  Use the method to automatically escape characters in a string so you can use them in regex.

PowerShell regex crash course – Part 1 of 5
Sep 30, 2016
Post comments count 0
Post likes count 1

PowerShell regex crash course – Part 1 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner) or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremely u...

Part 1 – Install Bash on Windows 10, OMI CIM Server, and DSC for Linux
Sep 28, 2016
Post comments count 0
Post likes count 0

Part 1 – Install Bash on Windows 10, OMI CIM Server, and DSC for Linux

Doctor Scripto

Summary: Learn about the Windows Subsystem for Linux that runs on top of Windows 10. Today we have a guest article written by Stefan Roth. Take it away Stefan … Hi, my name is Stefan Roth, and I am a Cloud and Datacenter MVP. In a couple of posts, I would like to show you how cool it is that Microsoft is touching the Linux world. Myself, I am a 100% Microsoft fan, but, as you can read all over the Internet…Microsoft loves Linux. This is not just a one-night stand. Microsoft is really serious about Linux support in all cloud scenarios (private, public, and hybrid). Therefore, we start with something really cool....

Scripting Guys at Ignite 2016 in Atlanta
Sep 26, 2016
Post comments count 0
Post likes count 0

Scripting Guys at Ignite 2016 in Atlanta

I_am_mr_ed

SUMMARY: Ed Wilson, Microsoft Scripting Guy, talks about the Scripting Guys booth at Ignite 2016 in Atlanta.Good morning everyone. Ed Wilson, Microsoft Scripting Guy, here. So, the day has finally arrived – after literally months and months of planning, Ignite 2016 in Atlanta has arrived. Well, actually it arrived earlier with the Pre-Con’s yesterday from the Operations Management Suite (OMS) team, and with MVP Days on Saturday. But today is the official kick off for Ignite. The Scripting Wife and I arrived yesterday at the conference center, and it is huge. Our shuttle bus drops us off at the far end of the buil...

PowerTip: Use PowerShell to retrieve the date and time of the given time zone ID
Sep 16, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to retrieve the date and time of the given time zone ID

Doctor Scripto

Summary: Use PowerShell to pull out specify TimeZone data from an object. I have data retrieved from an external source that contains different time zone IDs like W. Europe Standard Time, AUS Eastern Standard Time, etc. How can I get the current date time value of it by using PowerShell? In PowerShell, use [System.TimeZone] and invoke the ConvertTimeBySystemZoneID static method, which returns the date-time value of the given time zone!In PowerShell, use [System.TimeZone] and invoke the ConvertTimeBySystemZoneID static method, which returns the date-time value of the given time zone! For example, you need to kn...

Use PowerShell to integrate with the Lync 2013 SDK for Skype for Business – Part 2
Sep 16, 2016
Post comments count 0
Post likes count 0

Use PowerShell to integrate with the Lync 2013 SDK for Skype for Business – Part 2

Doctor Scripto

Summary: Learn how to extend PowerShell with Lync 2013 SDK to explore groups and contacts information in Skype for Business 2016 client. MVP Chendrayan Venkatesan is back again to show us how to get started with the Lync 2013 SDK to enable us to do some cool stuff with PowerShell and Skype for Business! Take it away Chen! Skype for Business 2016 client is great for business users for quick chat, sharing, presentation, organizing meetings, calls etc. Here is the Skype for Business client quick start guide. Please refer to it to understand and manage groups, contacts, and status (presence information). It’s a ve...

PowerTip: Use PowerShell to list all possible colors in the console
Aug 19, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to list all possible colors in the console

Doctor Scripto

Summary: Use PowerShell and enumeration to access all possible colors that you can use in the console. Is there a way to see all of the available colors that I can use when using Write-Host? We sure can! Why, with just one line in PowerShell, you’re all done! Here is an example:

Use PowerShell to integrate with the Lync 2013 SDK for Skype for Business – Part 1
Aug 19, 2016
Post comments count 0
Post likes count 0

Use PowerShell to integrate with the Lync 2013 SDK for Skype for Business – Part 1

Doctor Scripto

Summary: Get started with the Lync 2013 SDK by using PowerShell to manage Skype for Business 2016 client. How do I integrate Windows PowerShell with the Lync SDK to manage Skype For Business client? MVP Chendrayan Venkatesan is back again to show us how to get started with the Lync 2013 SDK and do some really cool stuff with PowerShell and Skype for Business! Take it away, Chen! The Skype for Business 2016 client helps you stay connected with known people by using instant messaging, audio, video call, email, persistent chat rooms, online meetings, and presentations. By using Skype for Business, you can send...

PowerTip: Identify the numeric value of a custom (dingbat) character using PowerShell
Aug 12, 2016
Post comments count 0
Post likes count 0

PowerTip: Identify the numeric value of a custom (dingbat) character using PowerShell

Doctor Scripto

Summary: Use PowerShell to determine the value of an Extended ASCII character to reproduce it for later use. I have a really simple question that’s been bugging me. I have a string with a special (Extended ASCII) character that I scraped from some output. I can’t find the ASCII value of it to reproduce it. How can I get the value of this silly “Dingbat”? In PowerShell, all you need to use is the [int] accelerator to get its numerical value! For example, if your special character is stored as a single character in a string called $char, you can find the value like this: For the hexadecimal value, just run the ...

Use PowerShell to report on SharePoint content with custom (dingbat) characters
Aug 12, 2016
Post comments count 0
Post likes count 0

Use PowerShell to report on SharePoint content with custom (dingbat) characters

Doctor Scripto

Summary: Learn how to use PowerShell to retrieve SharePoint list item values as dingbat symbols to make HTML reports simple and clean. Can you show me an example of how to report on my SharePoint data by using something other than the standard ASCII characters? Today we have a special guest MVP, Chendrayan Venkatesan, to help us out! Chendrayan Venkatesan (Chen V) is a SharePoint IT Professional, Cloud and Datacenter Management MVP, Microsoft Community Contributor, Author of Windows PowerShell 5.0 for .NET developers, speaker, blogger, Microsoft TechNet Wiki Ninja, and a fun-loving person. Chen V is a Powe...

Use PowerShell to maintain IIS logs
Aug 5, 2016
Post comments count 0
Post likes count 0

Use PowerShell to maintain IIS logs

Doctor Scripto

Summary: Learn how to use PowerShell to maintain and work with IIS logs. Welcome back guest blogger, Terri Donahue. Here are Terri’s previous blog posts. Terri is a Senior Customer Support Engineer for Dynamicweb NA and a Visual Studio and Development Technologies MVP. Twitter: @terrid_dw Internet Information Services (IIS) log maintenance has been a thorn in the side of web administrators for a while…basically since the first release of IIS. There isn’t a built-in utility to handle file compression, archival of log files, or deletion of log files. Depending on a site’s traffic, these logs can grow quite big ve...

PowerTip: Use PowerShell to remove a user from all site collections in SharePoint Online
Jul 27, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to remove a user from all site collections in SharePoint Online

Doctor Scripto

Summary: Learn how to use PowerShell to remove a corporate user from all site collections in SharePoint Online. How can I use Windows PowerShell to quickly remove a corporate user from all site collections in SharePoint Online? Use the following commands (change the login user name as required):

Manage your SharePoint Online tenant with PowerShell
Jul 27, 2016
Post comments count 0
Post likes count 0

Manage your SharePoint Online tenant with PowerShell

Doctor Scripto

Summary: Learn how to manage your SharePoint Online tenant installation by using Windows PowerShell cmdlets. Christopher Weaver is a Microsoft Premier Field Engineer (PFE) who focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys backpacking, hiking, kite surfing, and spending time with his kids and dog. You can follow him on his blog at https://blogs.technet.microsoft.com/christwe/. Hello All, Continuing with the topic of how to use PowerShell to migrate a site collection fr...

The Scripting Guy: coming to a town near you
Jul 18, 2016
Post comments count 0
Post likes count 0

The Scripting Guy: coming to a town near you

I_am_mr_ed

SUMMARY: The Microsoft Scripting Guys, Ed Wilson, upcoming live appearances. Hello Scripters, Teresa (aka. Scripting Wife) here. We have been really busy recently working with PowerShell user groups, and we want to provide you with a convenient listing of upcoming special events. Hope we will be able to see you at one or more of the events. By the way, these events are filling up quickly, so you may want to sign up today. Here is the list: July:  July 19, 2016   Tampa FL  SharePoint User Group Meeting July 21, 2016    Tampa FL   Tampa PowerShell User Group  August: August 17, 2016  Basel Switzerland   Base...

Get started with PowerShell and SharePoint Online
Jul 15, 2016
Post comments count 0
Post likes count 0

Get started with PowerShell and SharePoint Online

Doctor Scripto

Summary: Microsoft PFE Chris Weaver talks about getting started with Windows PowerShell and SharePoint Online. Welcome back Chris Weaver as guest blogger. You can see his previous guest blogs. Christopher Weaver is a Microsoft Premier Field Engineer (PFE) who focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys backpacking, hiking, kite surfing, and spending time with his kids and dog. You can follow him on his blog. Hello All, I’ve put the kids to bed, the dog is snoring o...

PowerTip: Find all devices connected to a computer
Jul 14, 2016
Post comments count 0
Post likes count 0

PowerTip: Find all devices connected to a computer

Doctor Scripto

Summary: Use PowerShell to find all devices that are connected to a computer. How can I use Windows PowerShell to list all devices that are connected to a computer? Use the Get-PnpDevice cmdlet and the -PresentOnly switch. Here is an example:

Passing through devices to Hyper-V VMs by using discrete device assignment
Jul 14, 2016
Post comments count 2
Post likes count 2

Passing through devices to Hyper-V VMs by using discrete device assignment

Doctor Scripto

Summary: Learn how to attach a device from your Hyper-V host to your VM by using a new feature of Windows Server 2016. Today we have a guest blogger, Rudolf Vesely, who has blogged here on previous occasions. Here is a link to his previous posts if you would like to read them. Here is what Rudolf says about himself. I am an Azure Solutions Architect at Rackspace in London. I believe that public cloud is the future for most organizations and this is why I specialize in public clouds (Amazon Web Services and Azure) and hybrid cloud strategy. My unique role at Rackspace is to guide our customers in their cloud st...

PowerTip: Get the public IP of an Azure VM with PowerShell
Jul 1, 2016
Post comments count 3
Post likes count 0

PowerTip: Get the public IP of an Azure VM with PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to get the public IP address of an Azure virtual machine.  How can I get the public IP address information for an Azure Resource Manager virtual machine (VM)? All you need to do is use Get-AzureRmVm to find the VM and pass it to Get-AzureRmPublicIPAddress as in the following example:

How to alter the public IP address of an Azure virtual machine
Jul 1, 2016
Post comments count 0
Post likes count 0

How to alter the public IP address of an Azure virtual machine

Doctor Scripto

Summary: Change the public IP address in Azure Resource Manager by using Windows PowerShell. Honorary Scripting Guy, Will Anderson, shares a personal challenge that he encountered when working with Azure and public IP addresses. He also shares the solution with the rest of us! Take it away, Will! Recently, I incorrectly configured an Azure Resource Manager virtual machine (VM) in my lab environment and needed to make some changes to the public IP settings. A brief look around the Internet came up empty, so I thought I'd share the challenge and the solution to this puzzle with you. The challenge If we take a lo...

PowerTip: Get a GUI interface for any PowerShell cmdlet
Jun 30, 2016
Post comments count 0
Post likes count 0

PowerTip: Get a GUI interface for any PowerShell cmdlet

Doctor Scripto

Summary: Use the Show-Command to build PowerShell cmdlets. I ran into a problem. Some cmdlets have too many parameters to list. Is there an easy way to build a cmdlet with its parameters for the console? You’ll love this trick! Just use the Show-Command cmdlet with any PowerShell cmdlet to get a GUI interface. In the following example, we use this with the Import-MDTDriver cmdlet. When you are done, you will have three options: Run, Copy (for the clipboard), or Cancel.

Find ready-to-use sample PowerShell scripts in the GUI
Jun 30, 2016
Post comments count 0
Post likes count 0

Find ready-to-use sample PowerShell scripts in the GUI

Doctor Scripto

Summary: Honorary Scripting Guy, Sean Kearney, goes over some often missed, easy-to-use PowerShell techniques for those who are starting out. I had heard a rumor that many of the management tools actually run PowerShell code in the backend. Is there any way to see what code it’s running? Honorary Scripting Guy, Sean Kearney, is here today, and, yes, it’s true. This hidden gem is one of the most frequently missed pieces by many people who use PowerShell. The GUI in many cases is calling up PowerShell. Let’s begin with something pretty simple: managing users in Active Directory and auditing groups. For me, tha...

PowerTip: List all available CIM classes by using PowerShell
Jun 29, 2016
Post comments count 0
Post likes count 0

PowerTip: List all available CIM classes by using PowerShell

Doctor Scripto

Summary: Use the Get-CimClass cmdlet to see all classes that you can query from. How can I find a list of Common Information Model (CIM) classes in Windows so that I can ask my computer useful questions? Just run the Get-CIMClass cmdlet to get a list of all available classes in the default namespace in Windows. If you’d like to filter on the list, you can use a wildcard. In the following example, we show all classes that begin with Win32 and have the word, Disk, in it. Get-CimClass Win32*Disk*

Use Windows PowerShell as an administrative console
Jun 29, 2016
Post comments count 0
Post likes count 0

Use Windows PowerShell as an administrative console

Doctor Scripto

Summary: Honorary Scripting Guy, Sean Kearney, shares his early use of PowerShell as a network administrator. I have a simple but irritating task each day around lunch time. A handful of people usually lock themselves out of Active Directory. Can you help me find an easy way to deal with this? Honorary Scripting Guy, Sean Kearney, is here to help you share the pain. I, too, once felt that prickly feeling on the back of my neck near the end of lunch hour. “Lock out Hell”, I called it. I know that everyone has experienced that, especially on Friday. A handful of people come in and for whatever reason have lock...

PowerTip: List all subfolders under a target path with PowerShell
Jun 28, 2016
Post comments count 0
Post likes count 0

PowerTip: List all subfolders under a target path with PowerShell

Doctor Scripto

Summary: Use Get-Childitem to provide a printable list of all folders under a path. I used to use tree.com to get a list of folders on a computer. Is there something close to that in PowerShell? Maybe something I could print? If you were to use Get-Childitem combined with Select-Object, you could get a pretty clean list. Here’s an example that targets drive c: and all hidden folders. It displays only directories and their full paths.

Erase files based on date by using PowerShell
Jun 28, 2016
Post comments count 0
Post likes count 0

Erase files based on date by using PowerShell

Doctor Scripto

Summary: Honorary Scripting Guy, Sean Kearney, relates his first experience with PowerShell. I was curious just how difficult it is to use Windows PowerShell. For example, how difficult is it to erase files based on the current date? Honorary Scripting Guy, Sean Kearney, is here today, and I can completely relate to exactly what you’ve said. I once had absolutely zero time to learn about scripting or automation. I was a field technician. You know the typical work for some field techs. You get in the car, go to the call, hop back in the car, off to the next call, lunch in a drive-thru, sleep in a parking lot....

PowerTip: Use a destructive PowerShell cmdlet safely
Jun 27, 2016
Post comments count 0
Post likes count 0

PowerTip: Use a destructive PowerShell cmdlet safely

Doctor Scripto

Summary: Use the –whatif parameter with PowerShell cmdlets to test code live. I heard that PowerShell has a built-in safety switch to many of its cmdlets. Could you show me an example of it in use? No problem. You’re referring to the –whatif parameter, which is meant to show you what would happen if you used a PowerShell cmdlet without actually executing the cmdlet. An example of this in action is in the following Remove-Item cmdlet. This will attempt to remove the document, HSG-Article-Sean-Should-Not-Lose.docx, without actually removing it.

Use Windows PowerShell to search for files
Jun 27, 2016
Post comments count 2
Post likes count 4

Use Windows PowerShell to search for files

Doctor Scripto

Summary: Use Get-Childitem to search the files system with PowerShell. I saved a file somewhere on my computer and can’t find it. Is there a way to use Windows PowerShell to find it? Honorary Scripting Guy, Sean Kearney, is here today to show you a cool trick I use all the time. I use PowerShell to search for things constantly! Why PowerShell? Well, to be honest, I have a bad, bad, bad habit of putting data where it shouldn’t be. Sometimes I’d use locations that the Indexer in Windows isn’t watching. In these situations, even Cortana can’t help me. We can use Get-Childitem to show a list of files and/or dir...

PowerTip: Remove trailing space from a string by using PowerShell
Jun 24, 2016
Post comments count 0
Post likes count 0

PowerTip: Remove trailing space from a string by using PowerShell

Doctor Scripto

Summary: Use the trim() method to remove leading and trailing spaces from a string. Could you do me a huge favor and show me how to get rid of spaces before and after a string in PowerShell? No problem at all. All you need to do is apply the trim() method to remove all the output. You can also use trimstart() to remove the start or trimend() to remove the end. Here is an example: $Data=’           Look at all of this wasted space on my screen. $Data $Data.trim() $Data.trimstart() $Data.trimend()

Build a hexadecimal clock in PowerShell – Part 5
Jun 24, 2016
Post comments count 0
Post likes count 0

Build a hexadecimal clock in PowerShell – Part 5

Doctor Scripto

Summary: Learn to split data in a Here-String and get a console beep. Honorary Scripting Guy, Sean Kearney, is here with our final day this week to wrap up building a hexadecimal clock in PowerShell. When we finished yesterday, we ran across a snag in our output. Most of our rows kept dropping to the immediate left of the screen as in the following image: For this, we will look at one of our Here-Strings to try and figure out the problem: If we look at a Here-String, you’ll notice it is literally a long string. It has an array count of 1 but a large length. The question is, how can I access the i...

PowerTip: Set the color of the progress bar with PowerShell
Jun 23, 2016
Post comments count 0
Post likes count 0

PowerTip: Set the color of the progress bar with PowerShell

Doctor Scripto

Summary: Use the $Host object to alter the color of the progress bar in PowerShell. I was curious if there’s a way to change the color of the progress bar in PowerShell. Do you know how this could be done? Glad you asked! You can do this by altering the values for ProgressBackGroundColor and ProgressForegroundColor under $Host.PrivateData. To change to a bright green background with a black foreground, use the following code in PowerShell: $Host.PrivateData.ProgressBackgroundColor=’Green’ $Host.PrivateData.ProgressForegroundColor=’Black’

Build a hexadecimal clock in PowerShell – Part 4
Jun 23, 2016
Post comments count 0
Post likes count 0

Build a hexadecimal clock in PowerShell – Part 4

Doctor Scripto

Summary: Use PowerShell to navigate the neutral zone. Honorary Scripting Guy, Sean Kearney, is here today to continue forth (not COBOL nor even Visual BASIC) into our silly yet fun quest to build a hexadecimal clock by using the PowerShell console. It does seem silly, doesn’t it? Yet, consider some of the things that we’ve learned in PowerShell during our quest. So, although the quest seems silly, we have learned quite a bit. Actually, it's much like any quest. The goal isn’t the point. It’s what you learn or experience while getting there. Our next part is to figure out how to draw this silly thi...

PowerTip: Set a default value in a switch statement
Jun 22, 2016
Post comments count 0
Post likes count 0

PowerTip: Set a default value in a switch statement

Doctor Scripto

Summary: Use the default field in switch statement to have an assumed value. I was playing with Select-String and would like to have it default to a value if none was trapped for. How can I do that? Just use the Default keyword, and you can have an assumed value in the script block. In the following example, the switch is listening for the $DogSeesSquirrel object. If no values match, it returns ‘Squirrel runs free’. { 'Back door' { $Response=’Bark!’} 'Couch'     { $Response=’Growl a bit.’} 'Food bowl' { $Response=’Bark! Bark! Bark!’} Default    { $Response=’Squirrel runs free’ } } My apologies to our little d...

Build a hexadecimal clock in PowerShell – Part 3
Jun 22, 2016
Post comments count 0
Post likes count 0

Build a hexadecimal clock in PowerShell – Part 3

Doctor Scripto

Summary: Use Select-String in PowerShell to identify data and match it to an array. Honorary Scripting Guy, Sean Kearney, is here today to play more with our funky, nerdy, cool hexadecimal clock. Yesterday we built out a small function named Get-HexTime to give us the current time that displays hex digits instead of decimal for hours, minutes, and seconds. One of our challenges is going to be matching up the individual hex digits to our positions in the array. We can step through the list of characters in HexTime with a pretty simple loop: $Hextime=Get-Hextime For ($Count=0; $Count -lt ($HexTime.Length); $Coun...

PowerTip: Use PowerShell to identify a leap year
Jun 21, 2016
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to identify a leap year

Doctor Scripto

Summary: Use PowerShell and Math to identify a leap year. Is there a way to use PowerShell to identify whether this year is a leap year? Actually there is! You can use a combination of Get-date to find out the year and the Modulus function in PowerShell. If the value is zero, the current year is a leap year!

Build a hexadecimal clock in PowerShell – Part 2
Jun 21, 2016
Post comments count 0
Post likes count 0

Build a hexadecimal clock in PowerShell – Part 2

Doctor Scripto

Summary: Manipulate string data from Get-Date in PowerShell. Honorary Scripting Guy, Sean Kearney, is here today to have a little more fun with our silly project to build a hexadecimal clock in the PowerShell console. Well, after all, who said scripting wasn’t allowed to be fun? That’s usually how I learn, by playing about! Yesterday, we defined a cool array of Here-Strings that contain all the characters that we’d like to display in our clock. Today, we’re going to access the properties of the current time and see how we could put that to use. The very first thing that we’ll need to do is pull up the date an...

PowerTip: Extend a string array in PowerShell
Jun 20, 2016
Post comments count 0
Post likes count 0

PowerTip: Extend a string array in PowerShell

Doctor Scripto

Summary: Use the built in features of PowerShell to easily add new Element to a string array. I created an array of strings in PowerShell, but I need to add to it. Is there a simple way to do this? Absolutely. Just use += to add an element to your string array. In the following example, we add a new element to the array that’s named $HSG

Build a hexadecimal clock in PowerShell – Part 1
Jun 20, 2016
Post comments count 0
Post likes count 0

Build a hexadecimal clock in PowerShell – Part 1

Doctor Scripto

Honorary Scripting Guy, Sean Kearney, is here today, and I’m going to sit down and have some fun this week. Today I was feeling a bit bored and, for some reason, the thought “hexadecimal clock” entered my head. Don’t ask why because I’m not quite sure about the “Why” part. But, it just did. Then, I sat down and thought, what’s involved? Really? As a script, from a pseudo-code standpoint, it’s pretty simple Only I wanted this to be…well…b-i-g. In my head, I wanted a clock as wide as my console. That started my head spinning. “Big letters. How can I draw big letters and numbers?” In the “old world” ...

PowerTip: Export Azure resource group as JSON by using PowerShell
Jun 10, 2016
Post comments count 0
Post likes count 0

PowerTip: Export Azure resource group as JSON by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to export a resource group as a JSON configuration. I’ve heard that JSON is used to define features in Azure Resource Manager. Is there a way to export a resource group in JSON format? Just use the Export-AzureRMResourceGroup cmdlet and provide the resource group name. It will automatically save a JSON file that matches the resource group name in your current folder. Here is an example:

Create Azure Resource Manager virtual machines by using PowerShell – Part 5
Jun 10, 2016
Post comments count 0
Post likes count 0

Create Azure Resource Manager virtual machines by using PowerShell – Part 5

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to assign credentials and create the virtual machine. This blog post is part of a series about how to create Azure Resource Manager virtual machines by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to start with the two series that precede this series: Now that I’ve built all the objects for the virtual machine (VM), what’s left before we spin up the machine in Azure Resource Manager? Honorary Scripting Guy, Sean Kearney, is here to finish up our three-week session abo...

PowerTip: Search Azure Resource Manager image publishers by using PowerShell
Jun 9, 2016
Post comments count 0
Post likes count 0

PowerTip: Search Azure Resource Manager image publishers by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to search publishers for a match. Could you show me an example of how to search through the list of publishers for Azure images? Just use the Get-AzureRMVMImagePublisher cmdlet, and filter on the PublisherName property. The following example searches for all publishers that contain the name, Windows.

Create Azure Resource Manager virtual machines by using PowerShell – Part 4
Jun 9, 2016
Post comments count 0
Post likes count 0

Create Azure Resource Manager virtual machines by using PowerShell – Part 4

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to select the operating system image for a virtual machine. This blog post is part of a series about how to create Azure Resource Manager virtual machines by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to start with the two series that precede this series: I’ve got most of that virtual machine (VM) assembled, but I was having quite a time trying to pull together the operating system image with PowerShell. Nudge me in the right direction, could you? Honorary Scripting...

PowerTip: Change current Azure Resource Manager subscription by using PowerShell
Jun 8, 2016
Post comments count 0
Post likes count 0

PowerTip: Change current Azure Resource Manager subscription by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to alter the current active subscription in use. I have about a dozen different subscriptions in my Azure Resource Manager account. How can I change it from the default one to one of my others? You can do this very task by using the Select-AzureRMSubscription cmdlet and providing either the name of the subscription or the SubscriptionId (which is probably more accurate). Here are examples: *or*

Create Azure Resource Manager virtual machines by using PowerShell – Part 3
Jun 8, 2016
Post comments count 0
Post likes count 0

Create Azure Resource Manager virtual machines by using PowerShell – Part 3

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to create and attach a virtual network card to a virtual machine. This blog post is part of a series about how to create Azure Resource Manager virtual machines by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to start with the two series that precede this series: I’m trying to find some guidance about how to use PowerShell to create a virtual network card. Would you be so kind as to lend me a hand? Honorary Scripting Guy, Sean Kearney, is here today continuing forth (...

PowerTip: Get the time and date as a string of numbers by using PowerShell
Jun 7, 2016
Post comments count 0
Post likes count 0

PowerTip: Get the time and date as a string of numbers by using PowerShell

Doctor Scripto

Summary: Use the –format option in Get-Date to change the output. I’d like to build some log files and have the date and time as part of the name. Is there a way to show the date and time in a format where it’s all numbers? Absolutely! Just use the –format option with Get-Date and supply a format for the output. To see the format as month, day, year, hour, minutes, and seconds, use this example:

Create Azure Resource Manager virtual machines by using PowerShell – Part 2
Jun 7, 2016
Post comments count 0
Post likes count 0

Create Azure Resource Manager virtual machines by using PowerShell – Part 2

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to define the operating system disk on a storage blob for a virtual machine. This blog post is part of a series about how to create Azure Resource Manager virtual machines by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to start with the two series that precede this series: Would you help me, please?  I need to know how to define storage for my virtual machine in Azure Resource Manager by using PowerShell.  Honorary Scripting Guy, Sean Kearney, is here as we happily go...

PowerTip: Find available virtual machine size by using PowerShell
Jun 6, 2016
Post comments count 0
Post likes count 0

PowerTip: Find available virtual machine size by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to get the proper name for a virtual machine size. Is there a way to see the proper name for a virtual machine size without creating a virtual machine first? Just use the Get-AzureRMVMSize cmdlet, and filter on the Name property. You just need to supply a location first. In this example, we are looking at available sizes in the ‘eastus’ location that have ‘S2’ in the name.

Create Azure Resource Manager virtual machines by using PowerShell – Part 1
Jun 6, 2016
Post comments count 0
Post likes count 0

Create Azure Resource Manager virtual machines by using PowerShell – Part 1

Doctor Scripto

Summary: Use PowerShell cmdlets to start to create a virtual machine in Azure Resource Manager. This blog post is part of a series about how to create Azure Resource Manager virtual machines by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to start with the two series that precede this series: How do I create virtual machines (VMs) in Azure Resource Manager by using PowerShell? Where do I start? Honorary Scripting Guy, Sean Kearney, is here, and we’re going to give you some basic step-by-step guidance this week abou...

PowerTip: List all virtual network subnets by using PowerShell
Jun 3, 2016
Post comments count 0
Post likes count 0

PowerTip: List all virtual network subnets by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to identify all the available subnets in a particular virtual network. I’m trying to figure out a way to list all the subnet configurations in a virtual network in Azure Resource Manager. Got any tips? How about the answer? It’s a matter of combining the Get-AzureRMVirtualNetwork cmdlet and Get-AzureRMVirtualNetworkSubnetConfig. Here is an example:

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 5
Jun 3, 2016
Post comments count 0
Post likes count 0

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 5

Doctor Scripto

Summary: Use PowerShell to retrieve Azure Resource Manager virtual machine properties. This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to first read the preceding five-part series about how to work with Azure Resource Manager cmdlets. After you finish this series, move on to the next series to learn more about the Azure Resource Manager cmdlets. There’s one thing I couldn’t figure out that I really need your help...

PowerTip: List all Azure Resource Manager storage accounts by using PowerShell
Jun 2, 2016
Post comments count 0
Post likes count 0

PowerTip: List all Azure Resource Manager storage accounts by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to identify available storage accounts. I’m working a client site, and they’d like me to document the configuration of their Azure Resource Manager environment. I’m in desperate need of a list of the storage accounts. Help me, please? One cmdlet and you’re done. Just use the Get-AzureRMStorageAccount cmdlet. If you run this, you’ll only get the list, but you can export it to a .csv file named StorageAccounts.csv. Here is an example:

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 4
Jun 2, 2016
Post comments count 0
Post likes count 0

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 4

Doctor Scripto

Summary: Find storage groups by using PowerShell. This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to first read the preceding five-part series about how to work with Azure Resource Manager cmdlets. After you finish this series, move on to the next series to learn more about the Azure Resource Manager cmdlets. Could you lend me a hand? I’m trying to find properties, like the current storage group that a virtual ma...

PowerTip: List Azure Resource Manager resources assigned to a resource group by using PowerShell
Jun 1, 2016
Post comments count 0
Post likes count 0

PowerTip: List Azure Resource Manager resources assigned to a resource group by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to show resources that are assigned under a resource group. I looked at the console for Azure Resource Manager and can see all the resources for a particular resource group. Is there a way to see that by using PowerShell? There sure is! Just use the Get-AzureRMResource cmdlet and filter on the ResourceGroupName property. Here’s an example:  

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 3
Jun 1, 2016
Post comments count 0
Post likes count 0

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 3

Doctor Scripto

Summary: Identify properties for the operating system of a virtual machine. This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to first read the preceding five-part series about how to work with Azure Resource Manager cmdlets. After you finish this series, move on to the next series to learn more about the Azure Resource Manager cmdlets. Can you show me how to identify the properties for the operating system so that...

PowerTip: Get Azure Virtual Machine Diagnostics by using PowerShell
May 31, 2016
Post comments count 0
Post likes count 0

PowerTip: Get Azure Virtual Machine Diagnostics by using PowerShell

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to retrieve diagnostic data within Azure Resource Manager virtual machines.  Our QA department was asking a very specific question that I didn’t know how to answer. Is there anything in an Azure virtual machine (VM) to show the quality of the boot and its startup?  Maybe this will help. You can access the boot diagnostics data with a single cmdlet. To retrieve the data for a single machine, use the Get-AzureRmVMBootDiagnosticsData cmdlet and add a parameter to target whether the machine is a Windows VM or Linux VM. Here is an example:

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 2
May 31, 2016
Post comments count 0
Post likes count 0

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 2

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to get the machine size from a virtual machine. This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to first read the preceding five-part series about how to work with Azure Resource Manager cmdlets. After you finish this series, move on to the next series to learn more about the Azure Resource Manager cmdlets.  I remember that yesterday we created a virtual machine (VM)...

PowerTip: Show Azure Resource Manager virtual machine status with PowerShell
May 30, 2016
Post comments count 0
Post likes count 0

PowerTip: Show Azure Resource Manager virtual machine status with PowerShell

Doctor Scripto

Summary: Using the Azure Resource Manager cmdlets to see the running state of a virtual machine.  I remember using the old cmdlets for Azure, and they would show the status of my virtual machines.  How can I do that with the new cmdlets?  Use the Get-AzureRM cmdlet with the –Status parameter to expand the available properties. Here’s a simple example to pull the statuses of a virtual machine: Here is an example:

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 1
May 30, 2016
Post comments count 0
Post likes count 0

Retrieve Azure Resource Manager virtual machine properties by using PowerShell – Part 1

Doctor Scripto

Summary: Use the Azure Resource Manager cmdlets to create a virtual machine. This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order. If you’re new to PowerShell, you might want to first read the preceding five-part series about how to work with Azure Resource Manager cmdlets. After you finish this series, move on to the next series to learn more about the Azure Resource Manager cmdlets.  I was curious about something. Could you show me a simple example to create a ...

PowerTip: List Azure Resource Manager virtual networks with PowerShell
May 27, 2016
Post comments count 0
Post likes count 0

PowerTip: List Azure Resource Manager virtual networks with PowerShell

Doctor Scripto

Summary: Use the AzureRM cmdlets to list all available virtual networks in a subscription.  I’m doing work for a client who forgot to give me a list of the virtual networks in the client's Azure subscription. Could you save me some time and show me how to get that list?  Just use the Get-AzureRMVirtualNetwork cmdlet. This will dump the output to the screen in a long list. If you’d like something more readable, such as the name, location and the subnet that it controls, try this one liner:

Work with the Azure Resource Manager cmdlets – Part 5
May 27, 2016
Post comments count 0
Post likes count 0

Work with the Azure Resource Manager cmdlets – Part 5

Doctor Scripto

Summary: Here's how to use PowerShell to create a virtual network and a network security group. This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order. After you finish this series, move on to the next two series to learn more about the Azure Resource Manager cmdlets.  I’ve heard that networking is far more powerful in Azure Resource Manager. Could you take a few minutes to show me how to use PowerShell to set up a basic network for virtual machines (VMs) in Azure?  Honorary Scripting Guy, Sean K...

PowerTip: View properties from a storage account with PowerShell
May 26, 2016
Post comments count 0
Post likes count 0

PowerTip: View properties from a storage account with PowerShell

Doctor Scripto

Summary: View and access the SKU from a storage account for future use.  I went to work with the New-AzureRMStorageAccount cmdlet but was confused about how to know which name to use for the SKU. Is there an easy way to know which one to use?  There most certainly is! Just create your storage account in the Azure portal first. Then you use the Get-AzureRMStorageAccount cmdlet to access the SKU property. Here is an example to access ‘hsgstorageaccount’.

Work with the Azure Resource Manager cmdlets – Part 4
May 26, 2016
Post comments count 0
Post likes count 0

Work with the Azure Resource Manager cmdlets – Part 4

Doctor Scripto

Summary: Learn how to use PowerShell to create storage accounts. This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order. After you finish this series, move on to the next two series to learn more about the Azure Resource Manager cmdlets.  Now that we know how to create resource groups, what is our next step to prepare the Azure Resource Manager infrastructure for virtual machines (VMs)?  Honorary Scripting Guy, Sean Kearney, is here today with a wee bit more PowerShell for your Azure Resource Man...

PowerTip: Get all Azure Resource Manager resource groups with PowerShell
May 25, 2016
Post comments count 1
Post likes count 0

PowerTip: Get all Azure Resource Manager resource groups with PowerShell

Doctor Scripto

Summary: Using the AzureRM cmdlets to get a list of resource groups.  I have a client who has a large list of resource groups. Can you show me how to get a filtered list?  Just use the Get-AzureRMResourceGroup cmdlet and pipe the results to Where-Object. To identify all resource groups that start with HSG in the name, try this;

Work with the Azure Resource Manager cmdlets – Part 3
May 25, 2016
Post comments count 0
Post likes count 0

Work with the Azure Resource Manager cmdlets – Part 3

Doctor Scripto

Summary: Create and access resource groups with the AzureRM cmdlets. This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order. After you finish this series, move on to the next two series to learn more about the Azure Resource Manager cmdlets.  I’m happily sitting here logged into Azure with the AzureRM cmdlets and would like to start with resource groups.  Could you show me where to start?  Honorary Scripting Guy, Sean Kearney, is here again. Yesterday we discovered how to automate authentication ...

PowerTip: Get a list of all subscriptions in your Azure Resource Manager account
May 24, 2016
Post comments count 0
Post likes count 0

PowerTip: Get a list of all subscriptions in your Azure Resource Manager account

Doctor Scripto

Summary: Use the Get-AzureRMSubscription cmdlet.  How can I see all of the available subscriptions when I am logged into Azure Resource Manager?  Just run the Get-AzureRMSubscription cmdlet to get a complete list available to your UserID. Get-AzureRMSubscription

Work with the Azure Resource Manager cmdlets – Part 2
May 24, 2016
Post comments count 0
Post likes count 0

Work with the Azure Resource Manager cmdlets – Part 2

Doctor Scripto

Summary: Authenticate to Azure with the AzureRM cmdlets. This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order. After you finish this series, move on to the next two series to learn more about the Azure Resource Manager cmdlets.  I’ve got the new AzureRM cmdlets installed, but I’m just not sure where to start! Could you give me a nudge in the right direction?  Honorary Scripting Guy, Sean Kearney, is here to help you out. The first real piece you need is to get authenticated to Azure Resource Ma...

PowerTip: Find a module in the PowerShell Gallery
May 23, 2016
Post comments count 0
Post likes count 1

PowerTip: Find a module in the PowerShell Gallery

Doctor Scripto

Summary: Use the PowerShell Find module to search for modules.  I was trying to use the Find-module. Can you show me how to find all modules that have the word, Azure, in them?  Just use a wildcard in the search like in the following example to return modules with the name Azure in the beginning:

Work with the Azure Resource Manager cmdlets – Part 1
May 23, 2016
Post comments count 0
Post likes count 0

Work with the Azure Resource Manager cmdlets – Part 1

Doctor Scripto

Summary: Obtain and install the AzureRM cmdlets. This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order. After you finish this series, move on to the next two series to learn more about the Azure Resource Manager cmdlets.  I heard Microsoft introduced some new cmdlets to work with Azure Resource Manager.   Could you show me how I could install them?  Honorary Scripting Guy, Sean Kearney, is here today to introduce you to the newest cmdlets to manage the Azure Resource Manager environment. Most o...

The Scripting Guys and Scripting Wife summer tour
May 16, 2016
Post comments count 0
Post likes count 0

The Scripting Guys and Scripting Wife summer tour

I_am_mr_ed

SUMMARY: Ed Wilson talks about his summer of PowerShell tour with dates and links to live appearances. Hello everyone,  Hope you are having a fantastic day. Ed and I have been busy as usual and are ready to get busier.  Here are the dates and links to upcoming events we will be attending and Ed speaking. There is a trip to Europe that some items are planned and have a link and others that are on the planning board. We will post links as they are available but for now I will just reference the city/country and for the link I will just write to be determined. Hope to see you at one of these events.   May 23...

The top three tips for effective sorting in PowerShell
May 3, 2016
Post comments count 0
Post likes count 0

The top three tips for effective sorting in PowerShell

Doctor Scripto

Summary: Learn the top three tips to effectively use Windows PowerShell to sort data in this blog post by the Microsoft Scripting Guy, Ed Wilson. One of the fundamental things that I need to do when I look at any kind of data is sort it so that I can make sense of what I am looking at. It doesn’t matter if I am looking at Yelp for restaurant recommendations (I want to sort by distance from me and by average rating) or at my Facebook timeline (I want to sort by time, as in, when an update was posted). Yes, sorting is one thing that makes the difference between, say, looking for books at the library via the online...

PowerTip: Specify that a script requires admin privileges to run
Apr 25, 2016
Post comments count 0
Post likes count 0

PowerTip: Specify that a script requires admin privileges to run

Doctor Scripto

Summary: Learn how to require admin privileges to run a Windows PowerShell script.  How can I make sure that my Windows PowerShell script has administrator privileges to run?  Use the #Requires directive and specify RunAsAdministrator. Here is an example:

How to answer a technical question: A guide for presenters
Apr 25, 2016
Post comments count 0
Post likes count 0

How to answer a technical question: A guide for presenters

Doctor Scripto

Summary: Learn how to properly answer a technical question in a presentation in this step-by-step post by PowerShell MVP June Blender. Today we have another blog post by PowerShell MVP June Blender. June is an Honorary Scripting Guy and a technical evangelist for the SAPIEN Technologies, Inc. She has been working with PowerShell for a long time. When she worked for Microsoft, she wrote the PowerShell help documentation. If you have ever used Get-Help in your life, more than likely you have seen some of her work. Take it away June … How to Answer a Technical Question Like many people, I look forward to the Power...

Use a script block to create custom groupings in PowerShell
Apr 19, 2016
Post comments count 0
Post likes count 0

Use a script block to create custom groupings in PowerShell

Doctor Scripto

Summary: Learn how to use a script block with the Group-Object cmdlet in Windows PowerShell to create custom groupings in this article by Microsoft Scripting Guy Ed Wilson. Good morning. Ed Wilson the Microsoft Scripting Guy is here. This week, I have been hanging out with a group of writers. It has been both fun and educational. It is always good to see how other people solve standard types of problems. As I look around, I can see nearly a dozen other writers huddled into little conversation groups as they discuss problems of craft. Anyway, with Windows PowerShell, there are also standard problems of craft wit...

Discover relationships by using Group-Object in PowerShell
Apr 18, 2016
Post comments count 0
Post likes count 0

Discover relationships by using Group-Object in PowerShell

Doctor Scripto

Summary: Learn how to use one of the most basic Windows PowerShell cmdlets, the Group-Object cmdlet, to see relationships among different objects. There are some things in life that just seem to always go together: jasmine flowers and green tea, scones and English breakfast tea, or even peanut butter and apples. In the world of Windows PowerShell, there are things that go together as well. It seems that I always do the same kinds of things: For the next few days, I want to focus on the second and third items, grouping data and sorting data. Group-Object: A basic cmdlet No matter what I am doing with Wi...

PowerTip: Use PowerShell to display a percentage that has two decimal places
Apr 17, 2016
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to display a percentage that has two decimal places

Doctor Scripto

Summary: Use Windows PowerShell to display a percentage as a two place number.  How can I use Windows PowerShell to display a number as a percentage that has two decimal places?  Use the -f format specifier, and specify a pattern as “{0:p2}”. On the other side of the -f format specifier, perform your percentage calculation. Here is an example: PS C:\> "{0:p2}" -f (1/10) 10.00 %

PowerTip: Use a regular expression pattern to remove nonalphabetic characters
Apr 15, 2016
Post comments count 0
Post likes count 0

PowerTip: Use a regular expression pattern to remove nonalphabetic characters

Doctor Scripto

Summary: Learn how to use a regular expression pattern to remove non-alphabetic characters from a string by using Windows PowerShell.  How can I use Windows PowerShell to remove non-alphabetic characters from a string?  To remove nonalphabetic characters from a string, you can use the -Replace operator and substitute an empty string ‘’ for the nonalphabetic character. The secret to doing this is to create a pattern on characters that you want to include and then using the not (^) in the series symbol. Here is an example: $string = 'abcdefg12345HIJKLMNOP!@#$%qrs)(*&^TUVWXyz' $pattern = '[^a-zA-Z]' $string -re...

Additional resources for text analysis by using PowerShell
Apr 15, 2016
Post comments count 0
Post likes count 0

Additional resources for text analysis by using PowerShell

Doctor Scripto

Summary: This is a summary of some of the additional resources for working with text and Windows PowerShell. Good day. Microsoft Scripting Guy, Ed Wilson, is here. So, here's the deal. We are going along and decide to write a simple Windows PowerShell script. Before we know it, the thing has morphed into dozens of lines. And, also before we know it, we quickly find ourselves in the weeds. It begins like a day at the beach, perhaps like the one here. And suddenly, before we know it, we are in the weeds, look around and, lo and behold, alligators. Dude! And, all of a sudden, we are feeling as exposed as a bu...

Calculate percentage character frequencies from a text file by using PowerShell
Apr 14, 2016
Post comments count 0
Post likes count 0

Calculate percentage character frequencies from a text file by using PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to calculate the percentage of how often a character appears in a text file. This is the fifth post in a multi-part series of blog posts that deal with how to determine letter frequency in text files. To fully understand this post, you should read the entire series in order. Here are the posts in the series: Okay, I will admit that I am just playing around, but I wanted to calculate the percentages of letter frequencies in a text file. For this example, I am using A Tale of Two Cities as a text file. You should refer to earlier blog articles about this ...

Compare the letter frequency of two text files by using PowerShell
Apr 13, 2016
Post comments count 0
Post likes count 0

Compare the letter frequency of two text files by using PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to compare the letter frequency of two different text files. This is the fourth post in a multi-part series of blog posts that deal with how to determine letter frequency in text files. To fully understand this post, you should read the entire series in order. Here are the posts in the series: One thing that is kind of cool is that with Windows PowerShell you can do all kinds of stuff and never have to write a script. This also means that it is easy to forget your scripting skills after a few years of never writing scripts. You may say, "WOOHOO!!!" But,...

Read a text file and do frequency analysis by using PowerShell
Apr 12, 2016
Post comments count 0
Post likes count 0

Read a text file and do frequency analysis by using PowerShell

Doctor Scripto

Summary: Learn how to read a text file and do a letter-frequency analysis using Windows PowerShell in this article written by the Microsoft Scripting Guy, Ed Wilson. This is the third post in a multi-part series of blog posts that deal with how to determine letter frequency in text files. To fully understand this post, you should read the entire series in order. Here are the posts in the series: Today I am going to put the script I wrote yesterday together with the script that I wrote on Friday. After I do that, I will be able to get a more accurate letter-frequency analysis of a text file. The co...

How to skip the beginning and ending of a file by using PowerShell
Apr 11, 2016
Post comments count 0
Post likes count 1

How to skip the beginning and ending of a file by using PowerShell

I_am_mr_ed

Summary: Learn how to skip the beginning and ending portions of a text file by using Windows PowerShell in this article by the Microsoft Scripting Guy Ed Wilson. This is the second post in a multi-part series of blog posts that deal with how to determine letter frequency in text files. To fully understand this post, you should read the entire series in order. Here are the posts in the series: Good morning, Microsoft Scripting Guy Ed Wilson is here. At this very moment, the Scripting Wife (PowerShell MVP Teresa Wilson) and I are heading back to Central Florida after an absolutely incredible week in...

Letter frequency analysis of text by using PowerShell
Apr 8, 2016
Post comments count 0
Post likes count 0

Letter frequency analysis of text by using PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to do letter frequency analysis of a text enabling one to see how often a letter occurs. This is the first post in a multi-part series of blog posts that deal with how to determine letter frequency in text files. To fully understand this post, you should read the entire series in order. Here are the posts in the series: So, the other night I was watching a show about cryptography. In the episode, the moderator said that all forms of encryption involve some form or type of letter substitution, and they went back over ...

PowerShell 5 MVA coming soon to a computer near you
Apr 6, 2016
Post comments count 0
Post likes count 0

PowerShell 5 MVA coming soon to a computer near you

I_am_mr_ed

SUMMARY: Microsoft Scripting Guy, Ed Wilson talks about recording a new Microsoft Virtual Academy series of videos with PFE Ashley McGlone. Hello everyone, Microsoft Scripting Guy Ed Wilson here. Well, I can tell you this week has been absolutely incredible. The Scripting Wife and I are out in Seattle (Bellevue, Redmond, Puget Sound ... whatever region) for the PowerShell Dev/Ops summit. This sold out event has been awesome ... and it is not over yet. With more than 150 PowerShellers from around the world, the electricity, the buzz, the overall awesomeness factor is rocking. Well, anyway, Microsoft PFE Ashley M...

PowerTip: Create a nested PowerShell custom object
Apr 5, 2016
Post comments count 0
Post likes count 1

PowerTip: Create a nested PowerShell custom object

Doctor Scripto

Summary: Learn how to create a nested PowerShell custom object.  How do I create a nested PowerShell custom object to store layers (nested) of information? Use a hashtable with the PSCustomObject type accelerator, and specify PSCustomObject as the value to the Property Name (Key): [PSCustomObject]@{ PropertyName = [PSCustomObject]@{ NestedPropertyName = ‘NestedPropertyValue’ } }

Next steps for the official PowerShell documentation
Apr 4, 2016
Post comments count 0
Post likes count 0

Next steps for the official PowerShell documentation

Doctor Scripto

Summary: Learn about changes that we’ve already made for PowerShell content and what’s planned for the near future. Hello scripters! My name is Don Gill, and I am the new documentation manager for Windows PowerShell. With the 2016 PowerShell and DevOps Summit quickly approaching, I thought it would be a fantastic opportunity to introduce myself to the PowerShell community and share some changes that we are putting in place to help you stay more connected with the PowerShell development team, share your feedback and suggestions, and even contribute directly to improving the PowerShell documentation. While I am ...

Use PowerShell 5.0 to create temporary files in the temp folder
Mar 31, 2016
Post comments count 0
Post likes count 0

Use PowerShell 5.0 to create temporary files in the temp folder

I_am_mr_ed

Summary: Microsoft Scripting Guy Ed Wilson talks about using Windows PowerShell 5.0 on Windows 10 to create temporary files in the temporary folder.   Sometimes it is the little things that make life easier. You know, like a cereal bar … it’s not like a major technological breakthrough but it is much more convenient than getting a bowl of milk and opening a box of cereal and dumping it in the bowl. Or a peanut butter cup is easier to use than getting two bars of chocolate and a jar of peanut butter … neater too. Well in Windows PowerShell 5.0 there are lots of these stealth features that make life easier ...

Use PowerShell 5 to empty the recycle bin
Mar 30, 2016
Post comments count 0
Post likes count 0

Use PowerShell 5 to empty the recycle bin

I_am_mr_ed

Summary: Microsoft Scripting Guy Ed Wilson talks about using Windows PowerShell 5.0 to empty the recycle bin on Windows 10   It seems that now days when I talk to someone about Windows PowerShell 5.0 they get all excited and go on and on about Desired State Configuration (DSC). Now, I will agree, DSC is awesome. DSC rocks! Even on Windows PowerShell 4.0 DSC was great, but on Windows PowerShell 5.0 it is even better. But … and this is huge … but, there is so much more in Windows PowerShell 5.0 than simply improvements to DSC. In fact, there is lots and lots of stuff in Windows PowerShell 5.0 that have been...

Using the new PowerShell ISE transcript tool
Mar 29, 2016
Post comments count 0
Post likes count 0

Using the new PowerShell ISE transcript tool

I_am_mr_ed

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using the new Windows PowerShell 5.0 ISE Transcript tool.   One of my favorite features for Windows PowerShell has always been the transcript tool. I mean, it seems like it was made for Windows PowerShell … I guess it was. What am I talking about? Well, one of my favorite ways to spend time is plugging in various Windows PowerShell commands to see what they might do. Then I try to shorten them, make them leaner, or more powerful, or modify them to better suit my needs. Back when I used to do this on other systems, I would end up copying the command, ...

PowerTip: Find your version of PowerShell
Mar 14, 2016
Post comments count 0
Post likes count 0

PowerTip: Find your version of PowerShell

Doctor Scripto

Summary: Learn how to find your Windows PowerShell version easily.  How can I use Windows PowerShell to tell me what version of Windows PowerShell I am running?  Use the $PsVersionTable automatic variable. To see the major, minor, build, and revision of Windows PowerShell, use the following: $PSVersionTable.PSVersion  

Control management pack updates between MS OMS and Operations Manager
Mar 14, 2016
Post comments count 0
Post likes count 0

Control management pack updates between MS OMS and Operations Manager

Doctor Scripto

Summary: Learn how to disable automatic management pack updates from MS OMS to Operations Manager and limit updates to a specific time window. Hi all, Brian Wren here. I usually spend my time writing documentation for TechNet and Azure.com, but I’ve been hearing about an issue from a few customers that I wanted to address. We’re going to get some detailed documentation out on this, but a quick blog entry should suffice in the meantime. When you connect a management group in System Center Operations Manager (SCOM) to Log Analytics in Operations Management Suite (OMS), several management packs are automatically i...

For the love of Pi
Mar 14, 2016
Post comments count 0
Post likes count 0

For the love of Pi

Doctor Scripto

Summary: In honor of Pi Day today, we have a guest blog post written by PowerShell MVP, Doug Finke. It's that time of year again when lovers of math, geometry, Albert Einstein, food, and Windows PowerShell can stop and reflect on that transcendental irrational number, Pi. It's the ratio of a circle's circumference to its diameter or "Hey, can I get a slice of that Pi?". Approximate Pi The best we can do is approximate Pi, 22/7 (go ahead, type that into a PowerShell console). The first recorded algorithm for rigorously calculating the value of π was a geometrical approach using polygons, which was devised aroun...

PowerTip:  Use PowerShell to configure BranchCache to run in local mode
Mar 12, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to configure BranchCache to run in local mode

Doctor Scripto

Summary: Learn how to use Windows PowerShell to configure BranchCache to run in local caching mode.  How can I use Windows PowerShell to configure BranchCache to run in local caching mode?  Open Windows PowerShell in an elevated prompt, and use the Enable-BCLocal cmdlet. Here is an example: Enable-BCLocal

PowerTip: Configure a client to listen for content requests by using PowerShell when powered on battery
Mar 12, 2016
Post comments count 0
Post likes count 0

PowerTip: Configure a client to listen for content requests by using PowerShell when powered on battery

Doctor Scripto

Summary: Learn how to configure a client to listen for content discovery requests even when running on battery with Windows PowerShell.  How can I use Windows PowerShell to configure a client to listen for content discovery requests even when my computer's running on battery?  Open Windows PowerShell with elevated permissions, and use the Enable-BCServeOnBattery cmdlet. Here is an example: Enable-BCServeOnBattery    

PowerTip: Use PowerShell to dismount a disk image
Mar 12, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to dismount a disk image

Doctor Scripto

Summary:  Learn how to use Windows PowerShell to dismount a virtual disk or ISO.  How can I use Windows PowerShell to dismount a virtual disk?  Use the Dismount-DiskImage cmdlet. It will dismount either an ISO or a virtual hard disk. Specify the path then using -imagepath. Here is an example: Dismount-DiskImage -imagepath “C:\fso\myisodisk.iso”

PowerTip: Use PowerShell to disconnect virtual disk
Feb 28, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to disconnect virtual disk

Doctor Scripto

Summary: Learn how to use Windows PowerShell to disconnect from a virtual disk.  How can I use Windows PowerShell to disconnect from a virtual disk?  Use the Disconnect-VirtualDisk cmdlet and specify the friendly name, for example: Disconnect-VirtualDisk -FriendlyName VirtualDisk01

PowerTip: Disconnect sessions to ISCSI target with PowerShell
Feb 28, 2016
Post comments count 0
Post likes count 0

PowerTip: Disconnect sessions to ISCSI target with PowerShell

Doctor Scripto

Summary: Learn how to disconnect sessions to a specified ISCSI target with Windows PowerShell.  How can I use Windows PowerShell to disconnect sessions to a ISCSI target object?  Use the Get-ISCSITarget cmdlet to retrieve the target, and then supply it as a node address for Disconnect-ISCSITarget, for example: Get-IscsiTarget $Tar = Get-IscsiTarget Disconnect-IscsiTarget -NodeAddress $Tar.NodeAddress

PowerTip: Enable and disable ODBC performance counter settings with PowerShell
Feb 27, 2016
Post comments count 0
Post likes count 0

PowerTip: Enable and disable ODBC performance counter settings with PowerShell

Doctor Scripto

Summary: Learn how to enable and disable a collection of ODBC performance counter settings for troubleshooting.  How can I use Windows PowerShell to enable the ODBC performance counters, run commands in a script, and then disable the counters?  You can store a returned object for later use when you enable the performance counters by using the -PassThru parameter, for example: $perfCounter = Enable-OdbcPerfCounter -Platform 32-bit -PassThru <Execute some ODBC applications that are using ODBC pooling> Disable-OdbcPerfCounter $perfCounter

PowerTip: Enable PerfMon counters for ODBC connection pooling with PowerShell
Feb 27, 2016
Post comments count 0
Post likes count 0

PowerTip: Enable PerfMon counters for ODBC connection pooling with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to enable Windows Performance Monitor counters for ODBC connection pooling.  How can I use Windows PowerShell to enable Windows Performance Monitor (PerfMon) counters so I can troubleshoot Open Database Connectivity (ODBC) connection pooling?  Use the Enable-ODBCPerfCountger cmdlet and specify the platform (32 bit or all). Here is an example: Enable-OdbcPerfCounter -Platform 32-bit

PowerTip: Use PowerShell to disable constrained delegation
Feb 26, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to disable constrained delegation

Doctor Scripto

Summary: Learn how to use Windows PowerShell to disable constrained delegation.  How can I use Windows PowerShell to disable constrained delegation authorization so that a user who is remotely connected to a SMB server cannot configure resources?  Use the Disable-SmbDelegation cmdlet, and specify the client and the SMB server, for example: Disable-SmbDelegation –SmbServer "FileServer01" –SmbClient "HVSVR01"  

PowerTip: Use PowerShell to disable all scheduled tasks in folder
Feb 26, 2016
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to disable all scheduled tasks in folder

Doctor Scripto

Summary: Use Windows PowerShell to disable all scheduled tasks in a specific folder.  How can I use Windows PowerShell to disable all scheduled tasks in a particular folder?  Use the Get-ScheduledTask cmdlet to enumerate the scheduled tasks in the folder, and then pipe the objects to the Disable-ScheduledTask cmdlet, for example: Get-ScheduledTask -TaskPath "\UpdateTasks\" | Disable-ScheduledTask

PowerTip: Use PowerShell to disable scheduled task
Feb 25, 2016
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to disable scheduled task

Doctor Scripto

Summary: Learn how to use Windows PowerShell to disable a scheduled task.  How can I use Windows PowerShell to disable a scheduled task?  Use the Disable-ScheduledTask cmdlet and specify the task name, for example: Disable-ScheduledTask -TaskName "SystemScan"

PowerTip: Disable plug and play device with PowerShell
Feb 25, 2016
Post comments count 0
Post likes count 0

PowerTip: Disable plug and play device with PowerShell

Doctor Scripto

Summary: Learn how to disable a plug and play device with Windows PowerShell.  How can I use Windows PowerShell to disable a plug and play device?  Use the Disable-PNPDevice cmdlet and specify the instance ID, for example: Disable-PnpDevice -InstanceID  'USB\VID_5986&;PID_0266&;MI_00\7&;1E5D3568&;0000'

PowerTip: Find DSC resources with PowerShell
Feb 24, 2016
Post comments count 0
Post likes count 0

PowerTip: Find DSC resources with PowerShell

Doctor Scripto

Summary: Learn how to find DSC resources with Windows PowerShell.  How can I use Windows PowerShell to find DSC resources that are available in the PowerShell Gallery?  Use the Find-DSCResource command.  

Overview of the PowerShellGet module to find scripts
Feb 23, 2016
Post comments count 0
Post likes count 0

Overview of the PowerShellGet module to find scripts

Doctor Scripto

Summary: In this blog post, I provide a quick overview of the PowerShellGet module and its various commands. Believe it or not, the Windows PowerShell Saturday event in Tampa, Florida is coming up pretty quickly. There are still some tickets available, but they have been going pretty quickly lately. There are some awesome speakers coming to Tampa for this event and I am looking forward to seeing all of them. Something really cool is that Ashley McGlone is coming from Columbus, Ohio for the event. I was his mentor for a couple of years, and it is really great to see how successful he has become. In fact, we are g...

PowerTip: Find PowerShell modules that are installed by PowerShell Get command
Feb 22, 2016
Post comments count 0
Post likes count 1

PowerTip: Find PowerShell modules that are installed by PowerShell Get command

Doctor Scripto

Summary: Learn how to find modules that were installed by the Windows PowerShell Get command.  How can I use Windows PowerShell to find modules that have been installed by the Get command?  Use the Get-InstalledModule command.

PowerShell Spotlight: February 2016
Feb 22, 2016
Post comments count 0
Post likes count 0

PowerShell Spotlight: February 2016

Doctor Scripto

Summary: Microsoft MVP, Teresa Wilson, talks about Windows PowerShell Saturday in this month’s PowerShell Spotlight. Hello scripters, I hope everyone had a marvelous weekend and is planning on an awesome week. I have been working on some of the last of the preparations for PowerShell Saturday #010 coming up in less than a month (March 19) in Tampa, FL. There are still seats available, so you have time to register. As a special favor to me, if you plan to attend, the quicker you sign up, the faster I know how many are attending and I can order the correct amount of food. Here’s a little background (in case you ...

PowerTip: Add Hyper-V network switch to network packet capture session
Feb 21, 2016
Post comments count 0
Post likes count 0

PowerTip: Add Hyper-V network switch to network packet capture session

Doctor Scripto

Summary: Learn how to add a Hyper-V virtual switch as a filter for a remote packet capture session.  How can I use Windows PowerShell to add a Hyper-V Virtual switch as a provider for a remote packet capture session?  Use the Add-NetEventVmSwitch cmdlet and specify the name of the switch. In the following commands, I create a new event session, specify a packet capture provider, and then add the Hyper-V switch: PS C:\>New-NetEventSession -Name "NESession01" PS C:\> Add-NetEventPacketCaptureProvider -SessionName "NESession01" PS C:\> Add-NetEventVMSwitch -Name "Network Adapter 2 - Virtual Switch"  

PowerTip: Add virtual network adapter to packet capture session
Feb 21, 2016
Post comments count 0
Post likes count 0

PowerTip: Add virtual network adapter to packet capture session

Doctor Scripto

Summary: Learn how to use Windows PowerShell to add a virtual network adapter to a network packet capture session.  How can I use Windows PowerShell to add a virtual network adapter to a network packet capture session?  Use the Add-NetEventVmNetworkAdapter cmdlet and specify the name of the adapter. In the following example, I create a net event session, add a capture provider, and then specify the virtual network adapter: PS C:\>New-NetEventSession -Name "NESession01" PS C:\> Add-NetEventPacketCaptureProvider -SessionName "NESession01" PS C:\> Add-NetEventVMNetworkAdapter -Name "LargeGuid"

PowerTip: Use PowerShell to add ETW provider to a session
Feb 20, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to add ETW provider to a session

Doctor Scripto

Summary: Use Windows PowerShell to add an ETW provider to a session.  How can I use Windows PowerShell to add an ETW provider to a session?  Use the Add-NetEventProvider cmdlet and specify the name of the session and the provider. In the following example, first a net event session is created, and then the TCPIP ETW provider is added to the session: PS C:\>New-NetEventSession -SessionName "Session01" PS C:\> Add-NetEventProvider -Name "Microsoft-Windows-TCPIP" -SessionName  "Session01"

PowerTip: Add network adapter to packet capture session
Feb 20, 2016
Post comments count 0
Post likes count 0

PowerTip: Add network adapter to packet capture session

Doctor Scripto

Summary: Learn to use Windows PowerShell to add a network adapter to a capture session.  How can I use Windows PowerShell to add a network adapter to a packet capture session? Use the Add-NetEventNetworkAdapter cmdlet and specify the name of the adapter. In the following example, I create a network capture session, add a provider, and then add the network adapter: PS C:\>New-NetEventSession -Name "Session38" PS C:\> Add-NetEventPacketCaptureProvider -SessionName "Session38" PS C:\> Add-NetEventNetworkAdapter -Name "Ethernet01"

PowerTip: Set ErrorActionPreference to original value
Feb 19, 2016
Post comments count 0
Post likes count 0

PowerTip: Set ErrorActionPreference to original value

Doctor Scripto

Summary: Cloud & Datacenter Management MVP, Thomas Rayner, shows how to work with the ErrorActionPreference variable in Windows PowerShell.  I have a script that requires me to change the ErrorActionPreference variable, but how can I set it to its original value after the script is done?  Store the current value of $ErrorActionPreference and set it again later: $OldEAP = $ErrorActionPreference $ErrorActionPreference = 'silentlycontinue' #Your script runs in here $ErrorActionPreference = $OldEAP

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 5
Feb 19, 2016
Post comments count 0
Post likes count 0

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud & Datacenter Management MVP, shows how to modify the registry for SHA-256 as a part of migrating a Windows certification authority from CSP to KSP and from SHA-1 to SHA-256. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner) or on my blog, Working Sysadmin: Figuring stuff out at work. I recently had the chance to work with Microsoft PFE, Mike MacGillivray, on an upgrade of some Windows certification authorities, and I want to share some information ...

PowerTip: Count backwards in array
Feb 18, 2016
Post comments count 0
Post likes count 0

PowerTip: Count backwards in array

Doctor Scripto

Summary: Cloud & Datacenter Management MVP, Thomas Rayner, shows how to count backwards in a Windows PowerShell array.  I know I can access the first, second, and third items in an array by using $Array[0], $Array[1], and $Array[2], but how can I count backwards?  Use negative numbers, for example: $Array = @('first','second','third') $Array[0] $Array[1] $Array[2] $Array[-1] $Array[-2] $Array[-3] This will output the following: first second third third second first

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 4
Feb 18, 2016
Post comments count 0
Post likes count 0

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 4

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud & Datacenter Management MVP, shows how to import a certificate into a KSP and bring it into the certificate store. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner) or on my blog, Working Sysadmin: Figuring stuff out at work. I recently had the chance to work with Microsoft PFE, Mike MacGillivray, on an upgrade of some Windows certification authorities, and I want to share some information about it with you. This script has only been tested on Wind...

PowerTip: Prompt user for value but provide default
Feb 17, 2016
Post comments count 0
Post likes count 0

PowerTip: Prompt user for value but provide default

Doctor Scripto

Summary: Cloud & Datacenter Management MVP, Thomas Rayner, shows how to set a variable to a default value in PowerShell.  How can I use Windows PowerShell to prompt a user for a value for a variable, but provide a default value if the user doesn’t enter anything?  First prompt the user for the value to the variable and then detect if the response was empty. If the response is empty, set the value of the variable. You can validate parameters for a function more conveniently than this. This code is for inline variables in an interactive script: $Interesting = Read-Host -Prompt 'Give me a value [some-value]' if...

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 3
Feb 17, 2016
Post comments count 0
Post likes count 0

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 3

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud & Datacenter Management MVP, shows how to delete your Windows CA certificates and crypto provider as a part of migrating a Windows certification authority from CSP to KSP and from SHA-1 to SHA-256. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner) or on my blog, Working Sysadmin: Figuring stuff out at work. I recently had the chance to work with Microsoft PFE, Mike MacGillivray, on an upgrade of some Windows certification authorities, and I want to...

PowerTip: Use positional parameters
Feb 16, 2016
Post comments count 0
Post likes count 0

PowerTip: Use positional parameters

Doctor Scripto

Summary: Cloud & Datacenter Management MVP, Thomas Rayner, shows how to use positional parameters in Windows PowerShell.  I always see people pass variables or data to a function without specifying the parameter name that the data is for, for example: “copy-item $source $destination” acts like “copy-item –path $source –destination $destination” How do I do that in my functions, and how does the function know which variable is the path and destination?  In functions, you declare parameters before doing much else. When declaring your parameter, indicate the Position starting with 0, for example: Function Invok...

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 2
Feb 16, 2016
Post comments count 0
Post likes count 0

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 2

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud & Datacenter Management MVP, shows how to back up your Windows certification authority as a part of migrating from CSP to KSP and from SHA-1 to SHA-256. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner) or on my blog, Working Sysadmin: Figuring stuff out at work. I recently had the chance to work with Microsoft PFE, Mike MacGillivray, on an upgrade of some Windows certification authorities, and I want to share some information about it with you. Th...

PowerTip: Send output to file and screen at the same time
Feb 15, 2016
Post comments count 0
Post likes count 0

PowerTip: Send output to file and screen at the same time

Doctor Scripto

Summary: Cloud & Datacenter Management MVP, Thomas Rayner, shows how to easily send data to the output of a script.  How can I use Windows PowerShell to send the same data that I’m writing to a file to the standard output of my script?  In Windows PowerShell 5.0, use Tee-Object, for example: PS C:\WINDOWS\system32> Tee-Object -InputObject 'Some text' -FilePath 'C:\temp\some file.txt' Some text PS C:\WINDOWS\system32> Get-Content -Path 'C:\temp\some file.txt' Some text

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 1
Feb 15, 2016
Post comments count 1
Post likes count 0

Migrate Windows CA from CSP to KSP and from SHA-1 to SHA-256: Part 1

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud & Datacenter Management MVP, shows how to start the migration of a Windows certification authority from CSP to KSP and from SHA-1 to SHA-256. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy this week. You can find me on Twitter (@MrThomasRayner) or on my blog, Working Sysadmin: Figuring stuff out at work. I recently had the chance to work with Microsoft PFE, Mike MacGillivray, on an upgrade of some Windows certification authorities, and I want to share some information about it with you. This script h...

PowerTip: Use PowerShell to add exclusion folder to Windows Defender
Feb 14, 2016
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to add exclusion folder to Windows Defender

Doctor Scripto

Summary: Use Windows PowerShell to add an exclusion folder to Windows Defender.  How can I add the C:\temp folder to the exclusion list so it is not scanned by Windows Defender?  Use the Add-MpPreference cmdlet and specify the exclusion path, for example: Add-MpPreference -ExclusionPath "C:\Temp" Note  You must run Windows PowerShell with elevated permissions when you execute this command or an error arises.

PowerTip: Flush file system cache by using PowerShell
Feb 14, 2016
Post comments count 0
Post likes count 0

PowerTip: Flush file system cache by using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to forcibly write the file system cache to a drive.  How can I use Windows PowerShell to forcibly flush the volume cache by writing it to a drive?  Use the Write-VolumeCache cmdlet and specify the drive letter, for example: Write-VolumeCache c Note  There is no colon following the drive letter.

PowerTip: Use PowerShell to remove app package from image
Feb 13, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to remove app package from image

Doctor Scripto

Summary: Use Windows PowerShell to remove an app package from a Windows image.  How can I use Windows PowerShell to remove an app package from a Windows image?  Use the Remove-AppxProvisionedPackage cmdlet, for example: Remove-AppxProvisionedPackage –Path c:\offline –PackageName MyAppxPkg

PowerTip: Fully format drive using PowerShell
Feb 13, 2016
Post comments count 0
Post likes count 0

PowerTip: Fully format drive using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to do a full format of a drive.  How can I use Windows PowerShell to do a full format of a drive?  Use the Format-Volume cmdlet and specify the -FullFormat parameter, for example: Format-Volume -DriveLetter C -FileSystem FAT32 -FullFormat –Force

PowerTip: Use PowerShell to format drive
Feb 12, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to format drive

Doctor Scripto

Summary: Learn how to use Windows PowerShell to quickly format a drive.  How can I use Windows PowerShell to quickly format a drive?  Use the Format-Volume cmdlet and specify the drive letter, for example: Format-Volume -DriveLetter D

Finding WMI classes that contain methods
Feb 12, 2016
Post comments count 0
Post likes count 0

Finding WMI classes that contain methods

Doctor Scripto

Summary: Learn how to find methods from WMI classes. Sometimes when working with WMI, it might seem as if you are entering a strange territory with dangers lurking around every corner. Unfortunately, there might not even be a sign such as the following to alert you to the hidden dangers: But by using the CIM cmdlets, we can bring a bit of order to an otherwise messy situation. If I do not know the name of a WMI method, I can use a wildcard character to find the method. If I use the *, my command will return all WMI classes that have a method defined: Get-CimClass -MethodName * The command and output from the...

PowerTip: List all WMI classes
Feb 11, 2016
Post comments count 1
Post likes count 0

PowerTip: List all WMI classes

Doctor Scripto

Summary: Use the Get-CimClass cmdlet to easily list all classes in current WMI namespace.  How can I use Windows PowerShell to list all of the WMI classes in the current WMI namespace?  Use the Get-CimClass cmdlet.

Use CIM cmdlets to find WMI classes
Feb 11, 2016
Post comments count 0
Post likes count 0

Use CIM cmdlets to find WMI classes

Doctor Scripto

Summary: Learn how to locate the right WMI class by using the Get-CimClass cmdlet to work through the class schema. Windows Management Instrumentation (WMI) came into the Windows world around the time of the Windows NT 4.0 Service Pack 4—that’s about the same time as the release of Star Wars 1: The Phantom Menace. One of the really cool things about WMI was that I could (with some difficulty) write VBScript scripts that accessed the WMI schema. Therefore, I could use script to search through the WMI classes to help me locate and find information that I would later use in other VBScript scripts. In this way, it wa...

PowerTip: Find default PowerShell modules
Feb 10, 2016
Post comments count 0
Post likes count 0

PowerTip: Find default PowerShell modules

Doctor Scripto

Summary: Find Windows PowerShell modules that load by default.  How can I easily find what modules are loading in my Windows PowerShell console by default?  Open your Windows PowerShell console, and before doing anything, type Get-Module.

Using the PowerShell CIM cmdlets for fun and profit
Feb 10, 2016
Post comments count 0
Post likes count 0

Using the PowerShell CIM cmdlets for fun and profit

Doctor Scripto

Summary: Learn how to use CIM cmdlets for better speed, security, and data return as opposed to the WMI cmdlets in Windows PowerShell. The other day, Windows PowerShell MVP, Richard Siddaway, posted Should I use CIM or WMI with Windows PowerShell? Today, I would like to continue that discussion a little bit. You should read Richard’s blog post before you read mine today. In the old days (like way back in Windows PowerShell 1.0), if you wanted to do anything on a remote computer, you were pretty much limited to using WMI—kind of like things were in the VBScript days. Sure, there were some things that you could d...

PowerTip: Use PowerShell to get only the date
Feb 9, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to get only the date

Doctor Scripto

Summary: Learn how to find only the date by using the Get-Date cmdlet.  How can I use Windows PowerShell to easily display only the date (not the time)?  Use the Get-Date cmdlet and specify a display hint of date, for example: Get-Date -DisplayHint date

PowerTip: Use Get-Command to resolve PowerShell alias
Feb 9, 2016
Post comments count 0
Post likes count 1

PowerTip: Use Get-Command to resolve PowerShell alias

Doctor Scripto

Summary: Learn how to use the Get-Command cmdlet to resolve an alias to a Windows PowerShell command.  How can I find if a Windows PowerShell command is an alias?  Use the Get-Command cmdlet, for example: gcm gwmi Note: gcm is an alias for Get-Command.

PowerTip: Find schema of a WMI class
Feb 8, 2016
Post comments count 0
Post likes count 0

PowerTip: Find schema of a WMI class

Doctor Scripto

Summary: Learn how use Windows PowerShell to find the schema of a WMI class.  How can I use Windows PowerShell to look at the schema of a WMI class?  Use the Get-CIMClass cmdlet, for example: Get-CimClass win32_bios

Should I use CIM or WMI with Windows PowerShell?
Feb 8, 2016
Post comments count 0
Post likes count 0

Should I use CIM or WMI with Windows PowerShell?

Doctor Scripto

Summary: Richard Siddaway explains the differences between the CIM cmdlets and the WMI cmdlets, and details use cases.  Hey, Scripting Guy! Should I use the WMI cmdlets or the newer CIM cmdlets? —NR  Hello NR, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. The simple answer is that you can use either Windows Management Instrumentation (WMI) or Common Information Model (CIM) cmdlets, but there are (to my mind) some significant advantages to using the newer CIM cmdlets. Before I show you why I think you should use the CIM cmdlets, let’s do a little recap....

PowerTip: Hide a PowerShell ISE add-on
Feb 7, 2016
Post comments count 0
Post likes count 0

PowerTip: Hide a PowerShell ISE add-on

Doctor Scripto

Summary: Learn how to programmatically hide a Windows PowerShell ISE add-on.  How can I use code to hide one of the Windows PowerShell ISE add-ons?  Use the Windows PowerShell ISE object model, and set the IsVisible property of the add-on to False, for example: $psISE.PowerShellTabs.VerticalAddOnTools.Item(0).isvisible = $false  

PowerTip: Display Windows PowerShell ISE add-ons
Feb 7, 2016
Post comments count 0
Post likes count 0

PowerTip: Display Windows PowerShell ISE add-ons

Doctor Scripto

Summary: Display the Windows PowerShell ISE add-ons that are available.  How can I programmatically display the Windows PowerShell ISE add-ons that are available and show their status?  Use the Windows PowerShell ISE object model to display the VerticalAddonTools collection from the PowerShellTabs collection: $psISE.PowerShellTabs.VerticalAddOnTools

PowerTip: List all scripts open in Windows PowerShell ISE
Feb 6, 2016
Post comments count 0
Post likes count 0

PowerTip: List all scripts open in Windows PowerShell ISE

Doctor Scripto

Summary: List all the scripts that are open in the Windows PowerShell ISE.  How can I find which scripts are open in the Windows PowerShell ISE and if they are saved?  Use the ISE object model and display the Files collection from the PowerShellTabs collection: $psISE.PowerShellTabs.Files

PowerTip: Open a script in PowerShell ISE
Feb 6, 2016
Post comments count 0
Post likes count 0

PowerTip: Open a script in PowerShell ISE

Doctor Scripto

Summary: Automatically open a script in the Windows PowerShell ISE.  How can I automatically open a script in the Windows PowerShell ISE from within a script?  Use the Windows PowerShell ISE automation model, and use the Add method for the Files collection on the current PowerShell tab, for example: $psISE.CurrentPowerShellTab.Files.Add("C:\fso\backup.ps1")  

PowerTip: Update a PowerShell module
Feb 5, 2016
Post comments count 0
Post likes count 0

PowerTip: Update a PowerShell module

Doctor Scripto

Summary: Learn how to update an installed Windows PowerShell module.  I used Install-Module to install a Windows PowerShell module, but how can I update it?  Use the Update-Module cmdlet, for example: Here are a couple of other examples: find-module *ise-preview | Update-Module Update-Module *ise-preview

Playing with PowerShell ISE Preview
Feb 5, 2016
Post comments count 0
Post likes count 0

Playing with PowerShell ISE Preview

Doctor Scripto

Summary: This blog post explores the features and functionality of the newly released Windows PowerShell ISE Preview edition that runs on Windows PowerShell 5.0. After you install the Windows PowerShell ISE preview from the PowerShell Gallery and take a look at the modules and functions it provides, it is time to fire up the new ISE and play a bit. I click the new shortcut in my All Apps section on my laptop running Windows 10. (To make it a bit more accessible, I drag the shortcut to my tool bar. I mean, I rarely go searching through the All Apps section.) I add a blank page to the ISE, and it looks pretty muc...

PowerTip: Install module from PowerShell Gallery
Feb 4, 2016
Post comments count 0
Post likes count 0

PowerTip: Install module from PowerShell Gallery

Doctor Scripto

Summary: Learn how to install a module from the PowerShell Gallery.  How can I easily install a module from the PowerShell Gallery?  Use the Install-Module cmdlet in Windows PowerShell 5.0, and specify the name of the module.

A first look at Windows PowerShell ISE Preview
Feb 4, 2016
Post comments count 0
Post likes count 0

A first look at Windows PowerShell ISE Preview

Doctor Scripto

Summary: Take a first look at the newly released Windows PowerShell ISE Preview. Good morning everyone. Ed Wilson here. I can tell you that the list of speakers for PowerShell Saturday on in Tampa March 19, 2016 looks really impressive. There are going to be seven MVPs and six Microsoftees there! When it comes to Microsoft Automation, this is going to be the place to be in March. Registration is still open, but it is starting to fill up quickly. Yesterday in Install the PowerShell ISE Preview from the PowerShell Gallery, I looked at downloading and installing Windows PowerShell ISE Preview. Because this installs...

PowerTip: Find published modules in the PowerShell Gallery
Feb 3, 2016
Post comments count 0
Post likes count 0

PowerTip: Find published modules in the PowerShell Gallery

Doctor Scripto

Summary: Learn how to find Published Windows PowerShell modules in the PowerShell Gallery.  How can I use Windows PowerShell to find modules that are published in the Windows PowerShell Gallery?  Use the Find-Module cmdlet in Windows PowerShell 5.0. This example finds modules related to the ISE: Find-Module *ISE*

Install the PowerShell ISE Preview from the PowerShell Gallery
Feb 3, 2016
Post comments count 0
Post likes count 0

Install the PowerShell ISE Preview from the PowerShell Gallery

Doctor Scripto

Summary: Learn how to install the Windows PowerShell ISE Preview edition from the PowerShell Gallery to Windows PowerShell 5.0 by using a one-line command. One of the way cool things is that the Windows PowerShell ISE is released to the PowerShell Gallery. “PowerShell Gallery?” you might ask. Yeah, the PowerShell Gallery. Although this version of the PowerShell ISE is currently still under limited preview, this does not mean that you can’t use it. In fact, you should be using it. I go to the PowerShell Gallery page, and type ISE in the Search box, and what comes back is a bunch of stuff related ...

PowerTip: Learn about PowerShell default parameter values
Feb 2, 2016
Post comments count 0
Post likes count 0

PowerTip: Learn about PowerShell default parameter values

Doctor Scripto

Summary: Learn about the default parameter values in Windows PowerShell.  How can I find more about default parameter values in Windows PowerShell?  Use the Get-Help cmdlet and search for *defaultParameter*. The following command returns a            list of Help topics that provide this information: help *DefaultParameter*

Convert a web page into objects for easy scraping with PowerShell
Feb 2, 2016
Post comments count 1
Post likes count 1

Convert a web page into objects for easy scraping with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell 5.0 to scrape a web page so that you can easily return parsable objects. Good morning. Ed Wilson here, and today I have a guest blog post by Doug Finke... When surfing the PowerShell Gallery, you'll find that each module has a web page with a version history, for example: Wouldn't it be great if you could get this information at the command line? Click here for a 20 second video that shows the code to do it. How to do web scrapping This approach will only work in Windows PowerShell 5.0, because it uses the new ConvertFrom-String function to convert the...

PowerTip: Get password from PowerShell credential object
Feb 1, 2016
Post comments count 0
Post likes count 0

PowerTip: Get password from PowerShell credential object

Doctor Scripto

Summary: Learn how to retrieve the password from a Windows PowerShell credential object.  I am having a problem connecting to an application via Windows PowerShell. How can I verify the user name and password that was supplied to the credential object?  Assuming you have permissions to the object, you can use the GetNetworkCredential method, for example: $a = Get-Credential $a.GetNetworkCredential() | fl *

PowerShell spotlight: February 2016
Feb 1, 2016
Post comments count 0
Post likes count 0

PowerShell spotlight: February 2016

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, shares her roundup of Windows PowerShell activities for the coming months. Hello scripters, Teresa Wilson here. I hope you had a marvelous weekend and are ready to tackle this week. Ed is finally getting back to normal and we have a few trips coming up—all Windows PowerShell related. Arizona PowerShell User Group March 1 in Phoenix First of all, we will be in Phoenix, AZ on March 1, 2016 for the Arizona PowerShell User Group (AZPOSH) meeting. I also heard from a little birdie that my good friend Jason Helmick will be there. The signup is not available yet (they are ...

PowerTip: Use PowerShell to view properties and their values for a .NET Framework class
Jan 31, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to view properties and their values for a .NET Framework class

Doctor Scripto

Summary: Learn how to view properties and the associated values of those properties of .NET Framework classes with Windows PowerShell.  How can I use Windows PowerShell to view the properties and their values from a .NET Framework class,            such as System.String?  Use the Type accelerator [string], pipe the output to the Format-List cmdlet, and use an asterisk to            select all properties: [string] | fl * Note: fl is an alias for Format-List.

PowerTip: Find properties of .NET Framework class with PowerShell
Jan 31, 2016
Post comments count 0
Post likes count 0

PowerTip: Find properties of .NET Framework class with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display properties of a .NET Framework class.  How can I use Windows PowerShell to easily display properties of a .NET Framework class?  Pipe the type accelerator to the Get-Member cmdlet and specify the MemberType property,            for example: [string] | gm -MemberType Properties Note: gm is an alias for Get-Member.

PowerTip: Find information about .NET Framework method with PowerShell
Jan 30, 2016
Post comments count 0
Post likes count 0

PowerTip: Find information about .NET Framework method with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find information about a .NET framework method.  How can I use Windows PowerShell to find basic information about a particular .NET Framework method?  Use the GetMethod method from the class, for example:  [math].GetMethod("Tan") Note  The method name is case sensitive and it must be in double quotation marks.

PowerTip: Use PowerShell to find all methods from .NET Framework class
Jan 30, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to find all methods from .NET Framework class

Doctor Scripto

Summary: Learn how to find all methods from a .NET Framework class by using Windows PowerShell.  How can I use Windows PowerShell to show both static and dynamic methods for a .NET Framework class?  Use the GetMethods method from the class. This example uses the System.Math class to return the            method name and if the method is static: [math].GetMethods() | Select Name, IsStatic -Unique

PowerTip: Return remainder after dividing two numbers
Jan 29, 2016
Post comments count 0
Post likes count 0

PowerTip: Return remainder after dividing two numbers

Doctor Scripto

Summary: Use Windows PowerShell to return the remainder after dividing two numbers.  How can use Windows PowerShell to divide two numbers and only return the remainder (called a modulo operation)?  In Windows PowerShell, the modulo operator is the % sign. Here are a few examples of how to use it: PS C:\> 3 % 2 1 PS C:\> 5 % 2 1 PS C:\> 11 % 2 1

How to contribute to PowerShell documentation
Jan 29, 2016
Post comments count 0
Post likes count 0

How to contribute to PowerShell documentation

Doctor Scripto

Summary: Learn how to contribute to Windows PowerShell documentation via various community initiatives. Today’s guest blog post is by Microsoft premier field engineer, Ashley McGlone. He will be speaking at PowerShell Saturday, so come join us for a great day of PowerShell learning. For more information, see PowerShell Saturday in Tampa, FL, March 19, 2016. Follow Ashley through his TechNet blog, Goatee PFE, and Twitter. Here’s Ashley… How many times have you found PowerShell documentation that was not up-to-date? Or maybe you could not even find the documentation you needed. Today I’ll be discussing ways that ...

PowerTip: Add number to existing variable value
Jan 28, 2016
Post comments count 0
Post likes count 0

PowerTip: Add number to existing variable value

Doctor Scripto

Summary: Learn how to easily add a number to an existing value stored in a variable and update the value of the variable.  How can I use Windows PowerShell to add a number to a value stored in a variable so that I can update the            value in that variable with the number and store the number back into the variable?  Use the += operator. This example adds 3 to the value stored in the $a variable and then stores the new            value back into the variable: PS C:\> $a = 5 PS C:\> $a += 3 PS C:\> $a 8

Use PowerShell to parse event log for shutdown events
Jan 28, 2016
Post comments count 0
Post likes count 0

Use PowerShell to parse event log for shutdown events

Doctor Scripto

Summary: Using the Windows PowerShell Get-EventLog cmdlet makes it easy to parse the system event log for shutdown events. One of the great things about central Florida during this time of the year is that there are certain fruits, such as red grapefruit, that are in season. This is also true of a certain variety of tangelo that is super sweet. However, as sweet as both of these are, neither is a sweet as parsing the event log with Windows PowerShell. It makes it easy to gain insights into what is going on with your computer, server, or whatever device. Using Get-EventLog cmdlet is super easy There are two basic ...

PowerTip: Use PowerShell to create repeating letters
Jan 27, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to create repeating letters

Doctor Scripto

Summary: Learn how to easily create duplicate letters by using Windows PowerShell.  How can I use Windows PowerShell to easily create a specific number of letters in a repetitive fashion?  To create repetitive letters, all you need to do is to “multiply” them, for example: PS C:\> "a"*5 aaaaa

Using Desired State Configuration and Chef to deploy System Center
Jan 27, 2016
Post comments count 0
Post likes count 0

Using Desired State Configuration and Chef to deploy System Center

Doctor Scripto

Summary: Learn how to use Chef and DSC in Windows PowerShell to deploy System Center in this guest blog post by Jason Morgan.Ed Wilson, here. Today I have a guest blog post by Jason Morgan in which he will talk about using Desired State Configuration (DSC) and Chef to deploy System Center. Welcome back, Jason…Hello again. Today I’m writing to analyze the deployment of System Center by using Desired State Configuration and Chef. I’ve been using Chef heavily for the last six months because I decided that using DSC to run my System Center deployments was a too heavy lift on its own. Adding Chef ha...

PowerTip: Import colon-delimited file with PowerShell
Jan 26, 2016
Post comments count 0
Post likes count 0

PowerTip: Import colon-delimited file with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to import a file that uses a colon as a delimiter.  How can I use Windows PowerShell to import a file that is delimited with a colon instead of a comma?  Use the Import-CSV cmdlet and specify the colon as the delimiter, for example: import-csv -Path C:\fso\applog.csv -Delimiter ':'

Announcing the 2015 Honorary Scripting Guys
Jan 26, 2016
Post comments count 0
Post likes count 0

Announcing the 2015 Honorary Scripting Guys

Doctor Scripto

Summary: The Honorary Scripting Guys for 2015 are announced in this blog post. Microsoft Scripting Guy, Ed Wilson, is here. I have been pretty busy—I missed work because of my ear surgery and the holidays, so I have enlisted the help of the Scripting Wife, Teresa Wilson, to write this post to announce the 2015 Honorary Scripting Guys. I gave her the names and she did the rest. Wow, that is almost exactly what I wrote last year, and it holds true for this year. The main difference is that the recovery time from my ear surgery was quite a bit longer than I anticipated. Hopefully that is the last ear surgery for m...

PowerTip: Find running services with PowerShell
Jan 25, 2016
Post comments count 0
Post likes count 1

PowerTip: Find running services with PowerShell

mredwilson

Summary: Use Windows PowerShell to find running services.  How can I use Windows PowerShell to quickly produce a sortable list of running services on my computer?  Use the Get-Service cmdlet to return the services, and the Out-GridView to produce a sortable list: gsv | ogv Note   gsv is an alias for Get-Service, and ogv is an alias for Out-GridView.

Introducing the top five Hey, Scripting Guy! Blog posts in 2015
Jan 24, 2016
Post comments count 0
Post likes count 0

Introducing the top five Hey, Scripting Guy! Blog posts in 2015

mredwilson

Summary: See which Hey, Scripting Guy! Blog posts were the top five in 2015.Today I feature Honorary Scripting Guy and Windows PowerShell MVP, Teresa Wilson, aka The Scripting Wife. Take it away Teresa…Hello everyone, with over 700 new posts a year on the Hey, Scripting Guy! Blog, the number one thing I hear at conferences and user group meetings is that it is practically impossible to keep up with the blog. I happen to have an RSS feed that comes to Outlook, so I am able to keep up fairly well. The exception is when I go on vacation, or am otherwise not as connected to the Internet as I might wish.Anyway,...

PowerTip: Find disk status with PowerShell and Windows 10
Jan 24, 2016
Post comments count 0
Post likes count 0

PowerTip: Find disk status with PowerShell and Windows 10

Doctor Scripto

Summary: Use Windows PowerShell in Windows 10 to find disk status.  How can I use Window PowerShell in Windows 10 to check the status information (such as the health status,            operational status, and if the disks are offline or read-only) on multiple disks?  Use the Get-DiskStorageNodeView cmdlet: Get-DiskSNV Note  Get-DiskSNV is an alias for Get-DiskStorageNodeView.

PowerTip: Create list of approved PowerShell verbs
Jan 23, 2016
Post comments count 0
Post likes count 0

PowerTip: Create list of approved PowerShell verbs

Doctor Scripto

Summary: Learn how to easily produce a list of approved Windows PowerShell verbs.  How can I find what verbs are approved for use in a Windows PowerShell function?  Use the Get-Verb cmdlet, and to make it easy to peruse, send the output to the Out-GridView cmdlet: get-verb | Out-GridView

PowerTip: Find single-name PowerShell functions
Jan 22, 2016
Post comments count 0
Post likes count 0

PowerTip: Find single-name PowerShell functions

Doctor Scripto

Summary: Learn how to find Windows PowerShell functions that do not have a hyphen in the name.  How can I easily find Windows PowerShell functions that do not have a hyphen in the name, but instead are single words, such as the Prompt function?  Use the Get-Command cmdlet and return only functions. Filter out function names that do not contain a hyphen, for example: gcm -CommandType function | where name -notmatch '-' Note gcm is an alias for the Get-Command cmdlet.

PowerTip: Find top PowerShell cmdlet nouns
Jan 21, 2016
Post comments count 0
Post likes count 0

PowerTip: Find top PowerShell cmdlet nouns

Doctor Scripto

Summary: Learn how to find the top five nouns in Windows PowerShell cmdlets.  How can I find which nouns are the most prevalent in Windows PowerShell cmdlets?  You need to find all of the cmdlet names, group them by noun, sort them by count, and then select only           the first five, for example: gcm * -CommandType cmdlet | group noun -noelement | sort count -Descending | select -First 5 Note gcm is an alias for Get-Command.

PowerTip: Use PowerShell to return first two lines of file
Jan 20, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to return first two lines of file

Doctor Scripto

Summary: Learn how to use Windows PowerShell to return the first two lines of a text file. How can I use Windows PowerShell to easily return the first two lines of a text file? Use the Get-Content cmdlet and specify the TotalCount parameter. In this example, TotalCount is set           to 2 and the file is named AMoreComplete.txt:Get-Content 'C:\fso\AMoreComplete.txt' -TotalCount 2

PowerTip: Use PowerShell to return first two lines of file
Jan 20, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to return first two lines of file

Doctor Scripto

Summary: Learn how to use Windows PowerShell to return the first two lines of a text file. How can I use Windows PowerShell to easily return the first two lines of a text file? Use the Get-Content cmdlet and specify the TotalCount parameter. In this example, TotalCount is set           to 2 and the file is named AMoreComplete.txt:Get-Content 'C:\fso\AMoreComplete.txt' -TotalCount 2

PowerTip: Find related cmdlet aliases
Jan 19, 2016
Post comments count 0
Post likes count 0

PowerTip: Find related cmdlet aliases

Doctor Scripto

Summary: Learn how to find aliases related to a series of cmdlets.  How can I find aliases that are related to a series of Windows PowerShell cmdlets, such as processes?  Use the Get-Alias cmdlet and specify a wildcard character for the definition parameter, for example: Get-Alias -Definition "*process"

PowerTip: Find related cmdlet aliases
Jan 19, 2016
Post comments count 0
Post likes count 0

PowerTip: Find related cmdlet aliases

Doctor Scripto

Summary: Learn how to find aliases related to a series of cmdlets. How can I find aliases that are related to a series of Windows PowerShell cmdlets, such as processes? Use the Get-Alias cmdlet and specify a wildcard character for the definition parameter, for example:Get-Alias -Definition "*process"

PowerTip: Find cmdlets and functions related to DSC
Jan 18, 2016
Post comments count 0
Post likes count 0

PowerTip: Find cmdlets and functions related to DSC

Doctor Scripto

Summary: Use Windows PowerShell to find cmdlets and functions related to Desired State Configuration.  How can I use Windows PowerShell to quickly find a list of cmdlets and functions related to            Desired State Configuration (DSC)?  Use the Get-Command cmdlet and specify a noun of *dsc*: Get-Command -Noun *DSC*

PowerTip: Find cmdlets and functions related to DSC
Jan 18, 2016
Post comments count 0
Post likes count 0

PowerTip: Find cmdlets and functions related to DSC

Doctor Scripto

Summary: Use Windows PowerShell to find cmdlets and functions related to Desired State Configuration.  How can I use Windows PowerShell to quickly find a list of cmdlets and functions related to            Desired State Configuration (DSC)?  Use the Get-Command cmdlet and specify a noun of *dsc*: Get-Command -Noun *DSC*

PowerTip: Find Amount of Time Between Two Dates
Jan 17, 2016
Post comments count 0
Post likes count 0

PowerTip: Find Amount of Time Between Two Dates

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find the amount of time between two dates.  How can I use Windows PowerShell to determin how many days until            Windows PowerShell Saturday on March 19, 2016 in Tampa?  There are many ways to find the difference between two dates. I use the [datetime] type accelerator            and subtraction, for example: [datetime]'3/19/16' - [datetime]::now  

Weekend Scripter: Find Information on the Hey, Scripting Guy! Blog
Jan 17, 2016
Post comments count 0
Post likes count 0

Weekend Scripter: Find Information on the Hey, Scripting Guy! Blog

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about how to find stuff on the Hey, Scripting Guy! Blog. Microsoft Scripting Guy, Ed Wilson, is here. It is hard to imagine that it is 2016. It’s even harder to imagine that I have been writing the Hey, Scripting Guy! Blog since 2008! With the current pace of twice a day posts, 7 days a week, there are literally thousands of Hey, Scripting Guy! Blog posts—plus there was a team writing Scripting Guy content before there was a Hey, Scripting Guy! Blog. One of my first major projects after becoming the Microsoft Scripting Guy was to work with my editor a...

PowerTip: Find Processes by Using Wildcard Characters
Jan 16, 2016
Post comments count 0
Post likes count 0

PowerTip: Find Processes by Using Wildcard Characters

Doctor Scripto

Summary: Learn how to use wildcard characters and Windows PowerShell to find processes.  How can I use Windows PowerShell to easily see all processes that contain the letters SV in the process name?  Use the Get-Process cmdlet and a simple wildcard pattern, for example: gps *sv* Note   gps is an alias for Get-Process.

Weekend Scripter: PowerShell Saturday in Tampa,FL, March 19, 2016
Jan 16, 2016
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell Saturday in Tampa,FL, March 19, 2016

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about Windows PowerShell Saturday in Tampa Florida on March 19, 2016. Microsoft Scripting Guy, Ed Wilson, is here. There are worse places to be in March than in Tampa, Florida. If you come to Florida, you might see the elusive and endangered Florida panther. You could see a bear. If you get out on the water, you will more than likely see a dolphin. You will probably see a gator, especially if you hang around swamps and creeks. What I can say for sure, is that if you are in Tampa on March 19, 2016, you will definitely see some awesome Windows PowerShell. The othe...

PowerTip: Use PowerShell to Find Command Line of Processes
Jan 15, 2016
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to Find Command Line of Processes

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find the command line of processes.  How can I find the command line that was used to launch a process that is running on my system?  Use the Get-CimInstance cmdlet, the Win32_Process WMI class, and the CommandLine property: gcim win32_process | select commandline Note  gcim is an alias for Get-CimInstance.

Working with Windows Startup Processes and PowerShell
Jan 15, 2016
Post comments count 0
Post likes count 0

Working with Windows Startup Processes and PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to examine startup processes in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am playing with the Xbox One Smart Glass app on Windows 10. I have used the app since it was in beta, and I just got my Xbox One. But I have started using the Pandora app on my Xbox One, and I like to do stuff like mute advertisements, skip boring songs, change stations, and otherwise control the app. Yeah, I can use my Xbox controller, and with a recent firmware update, it does connect faster, and has better battery life, bu...

PowerTip: Find PowerShell Cmdlets that Work with CSVs
Jan 14, 2016
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Cmdlets that Work with CSVs

Doctor Scripto

Summary: Learn how to find Windows PowerShell cmdlets that work with CSVs.  How can I find Windows PowerShell cmdlets that I can use to work with a CSV file?  Use the Get-Command cmdlet and look for cmdlets that have a noun of CSV: Get-Command -Noun csv*

Use PowerShell to Work with Data from MS OMS
Jan 14, 2016
Post comments count 0
Post likes count 0

Use PowerShell to Work with Data from MS OMS

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to parse data obtained from Microsoft Operations Management Suite. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I have been working on a lot the past month is the new Microsoft Operations Management Suite Blog. For one thing, it is on the new blogging platform we using at Microsoft, so the blog is like a new toy with lots of fun things for a geek to play with. In addition, Microsoft Operations Management Suite (MS OMS) is a tremendously powerful platform that uses Windows PowerShell in the background, so it is also...

PowerTip: Find Help about PowerShell Pipelines
Jan 13, 2016
Post comments count 0
Post likes count 0

PowerTip: Find Help about PowerShell Pipelines

mredwilson

Summary: Learn how to find Windows PowerShell Help about pipelines.  How can I find information so that I can read about Windows PowerShell pipelines?  Use the Get-Help cmdlet, specify the category of HelpFile, then type the word pipeline, for example: Get-Help -Category HelpFile pipeline

Incorporating Pipelined Input into PowerShell Functions
Jan 12, 2016
Post comments count 0
Post likes count 0

Incorporating Pipelined Input into PowerShell Functions

mredwilson

Summary: Microsoft MVP, Adam Bertram, talks about accepting pipelined input into Windows PowerShell advanced functions. Microsoft Scripting Guy, Ed Wilson, is here. Today Microsoft MVP, Adam Bertram, returns to talk about accepting pipeline input into advanced Windows PowerShell functions. Note   This is the second post in a series. Don’t miss Introduction to Advanced PowerShell Functions. When you begin to learn Windows PowerShell, you'll soon find yourself neck-deep in objects. Objects are one of the fundamental concepts of what makes PowerShell so user-friendly—and powerful at t...

PowerTip: Find List of PowerShell Functions
Jan 12, 2016
Post comments count 0
Post likes count 0

PowerTip: Find List of PowerShell Functions

mredwilson

Summary: Easily find a list of Windows PowerShell functions.  How can I produce a list of the Windows PowerShell functions that are currently available?  Use the Function PS Drive and the Get-ChildItem cmdlet: Get-ChildItem function:

Introduction to Advanced PowerShell Functions
Jan 11, 2016
Post comments count 0
Post likes count 0

Introduction to Advanced PowerShell Functions

mredwilson

Summary: Guest blogger, Microsoft MVP, Adam Bertram, talks about advanced Windows PowerShell functions.Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post by Microsoft MVP, Adam Bertram. Take it away Adam…I'm a Pluralsight author and I develop online training courses that are mostly about Windows PowerShell. I recently had the opportunity to develop a course about building advanced PowerShell functions and modules, and a big topic in that course was about advanced functions.With that topic fresh on my mind, I thought how to build advanced functions would make a great post for the Hey, S...

PowerTip: Identify PowerShell Version
Jan 11, 2016
Post comments count 0
Post likes count 0

PowerTip: Identify PowerShell Version

Doctor Scripto

Summary: Learn how to easily find the version of Windows PowerShell, CLR, and WSMan.  How can I use Windows PowerShell to identify the version of Windows PowerShell that is running on my system?  Use the $PSversionTable automatic variable (you can use Tab expansion to avoid some typing).            The command and output are shown here:

PowerTip: Identify PowerShell Version
Jan 11, 2016
Post comments count 0
Post likes count 0

PowerTip: Identify PowerShell Version

mredwilson

Summary: Learn how to easily find the version of Windows PowerShell, CLR, and WSMan. How can I use Windows PowerShell to identify the version of Windows PowerShell that is running on my system? Use the $PSversionTable automatic variable (you can use Tab expansion to avoid some typing).            The command and output are shown here:

Where’s Waldo (and Where’s Ed)?
Jan 10, 2016
Post comments count 0
Post likes count 0

Where’s Waldo (and Where’s Ed)?

mredwilson

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the future of the Hey, Scripting Guy! Blog and other stuff. Microsoft Scripting Guy, Ed Wilson, is here. If you are a regular reader of the Hey, Scripting Guy! Blog, you will no doubt have noticed that I have not been very active these past several weeks. However, it is a testament to the Windows PowerShell community—especially to Microsoft MVP, Sean Kearny and the Scripting Editor, Dia Reeves—that the blog has not missed a single day of posts. Sean did an excellent job of rounding up guest bloggers, and Dia did a tremendous job of ensuring that...

PowerTip: Use PowerShell to Perform Case-Sensitive Comparison
Jan 10, 2016
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to Perform Case-Sensitive Comparison

mredwilson

Summary: Learn how to perform a case-sensitive comparison in Windows PowerShell.  I need to compare two strings while taking case sensitivity into account. I try using -eq, but it does not work.             How can I use Windows PowerShell to perform a case-sensitive comparison?  Use the -ceq operator instead of -eq. Here are two examples that compare the results of -eq and -ceq: PS C:\> 'scripting guys' -eq 'Scripting Guys' True PS C:\> 'scripting guys' -ceq 'Scripting Guys' False PS C:\>

Weekend Scripter: Unexpected Case Sensitivity in PowerShell
Jan 9, 2016
Post comments count 1
Post likes count 0

Weekend Scripter: Unexpected Case Sensitivity in PowerShell

mredwilson

Summary: PowerShell MVP, Mike F Robbins, discusses case sensitivity in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Mike Robbins. Mike F Robbins is a Microsoft MVP for Windows PowerShell and a SAPIEN Technologies MVP. He is a co-author of Windows PowerShell TFM 4th Edition, and is a contributing author of a chapter in the PowerShell Deep Dives book. Mike has written guest blog posts for the Hey, Scripting Guy! Blog, PowerShell Magazine, and PowerShell.org. He is the winner of the advanced category in the 2013 PowerShell Scripting Games. Mike is also the leader and ...

PowerTip: Check PowerShell Scripts Against Rules
Jan 9, 2016
Post comments count 0
Post likes count 0

PowerTip: Check PowerShell Scripts Against Rules

mredwilson

Summary: Learn how to easily check your Windows PowerShell scripts against various rules.  How can I quickly check my Windows PowerShell scripts with preconfigured rules?  Download the latest version of the Script Analyzer from the Microsoft PowerShell Gallery: PSScriptAnalyzer 1.2.0.            It snaps into the Windows PowerShell ISE is a good free tool.

PowerShell Spotlight: January 2016
Jan 8, 2016
Post comments count 0
Post likes count 0

PowerShell Spotlight: January 2016

mredwilson

Summary: PowerShell MVP and the Scripting Wife, Teresa Wilson, talks about upcoming events in the PowerShell community for January 2016.Microsoft Scripting Guy, Ed Wilson, is here. Today we have back guest blogger, Teresa Wilson. Teresa, as you probably know, is my real-life wife, and she is also known as the Scripting Wife. She once said that it was meant to be because her initials in real life are TSW, and if you shortened The Scripting Wife to initials it would be TSW. Take it away, TSW...Hello everyone, my apologies for not writing the PowerShell Spotlight for the last two months. I’ve been a little pre...

PowerTip: Automatically Enable PowerShell ISE Toolbar
Jan 8, 2016
Post comments count 0
Post likes count 0

PowerTip: Automatically Enable PowerShell ISE Toolbar

Doctor Scripto

Summary: Ensure that the Windows PowerShell ISE toolbar is always enabled.  How can I use Windows PowerShell to turn on the ISE toolbar?  Turn on the toolbar with the following command: $psISE.Options.ShowToolBar=$True To turn it off, change the value to $False.

A Favorite PowerShell ISE Feature: Remote Text File Editing
Jan 8, 2016
Post comments count 0
Post likes count 0

A Favorite PowerShell ISE Feature: Remote Text File Editing

Doctor Scripto

Summary: Sean Kearney shows you how to edit files remotely in the Windows PowerShell ISE.        Honorary Scripting Guy, Sean Kearney, is here today to show you the last of the little nuggets I love to use in the Windows PowerShell ISE—that is editing files remotely.   Note   This is a five-part series that includes the following posts about features in the Windows PowerShell ISE: In Windows PowerShell 5.0, there is a unique cmdlet called PSEdit. This cmdlet is also unique to the PowerShell ISE. The goal of PSEdit is to bring file editing for any PowerShel...

PowerTip: List All Files Open in PowerShell ISE
Jan 7, 2016
Post comments count 1
Post likes count 0

PowerTip: List All Files Open in PowerShell ISE

Doctor Scripto

Summary: Get a list of all files that are currently open in the Windows PowerShell ISE.  How can I pull a list of anything that I am currently editing in the Windows PowerShell ISE?  Use this command to get the entire list of files (including the full file path) that are currently open             in the PowerShell ISE: $psISE.PowerShellTabs.files.FullPath

A Favorite PowerShell ISE Feature: Snippets
Jan 7, 2016
Post comments count 1
Post likes count 0

A Favorite PowerShell ISE Feature: Snippets

Doctor Scripto

Summary: Sean Kearney shows you how to get sample code in the Windows PowerShell ISE. Honorary Scripting Guy, Sean Kearney, is here today to show you a really cool feature that has been in Windows PowerShell ISE for a while, but you might have overlooked it! It’s called Snippets.    Note   This is a five-part series that includes the following posts about features in the Windows PowerShell ISE: I love using the Snippets feature on a regular basis, because although I can work in PowerShell, I don’t memorize code. I’m an IT pro, not a dev. Even my good developer friends don’t memorize...

PowerTip: Determine Which Files in ISE Are Saved
Jan 6, 2016
Post comments count 0
Post likes count 0

PowerTip: Determine Which Files in ISE Are Saved

Doctor Scripto

Summary: Easily identify which files have been saved in the PowerShell ISE.  How can I see which of my open files in the Windows PowerShell ISE been saved?  To show a list of files that have been saved, run the following code in the ISE. $psISE.PowerShellTabs.files | where { $_.IsSaved } | Select-Object DisplayName  

A Favorite PowerShell ISE Feature: Module Browser
Jan 6, 2016
Post comments count 0
Post likes count 0

A Favorite PowerShell ISE Feature: Module Browser

Doctor Scripto

Summary: Sean Kearney shows you how to access modules in the PowerShell Gallery. Honorary Scripting Guy, Sean Kearney, is here today to introduce you to a feature you may not have heard of called the Module Browser for the PowerShell ISE.    Note   This is a five-part series that includes the following posts about features in the Windows PowerShell ISE: One of the newest things coming out of Microsoft is a central website called the PowerShell Gallery. This is a central repository of scripts that the community can use programmatically. A perfect example of this in action is Desired...

PowerTip: Set Zoom Level in PowerShell ISE
Jan 5, 2016
Post comments count 0
Post likes count 0

PowerTip: Set Zoom Level in PowerShell ISE

Doctor Scripto

Summary: Automatically set the zoom level in the Windows PowerShell ISE.  How can I programmatically adjust the zoom for my font size in the Windows PowerShell ISE?  Set the Zoom property—for example, to adjust the font to 150%, run: $pSISE.Options.Zoom=150

A Favorite PowerShell ISE Feature: Script Browser
Jan 5, 2016
Post comments count 0
Post likes count 0

A Favorite PowerShell ISE Feature: Script Browser

Doctor Scripto

Summary: Sean Kearney shows you how to browse the TechNet Script Repository from the PowerShell ISE. Honorary Scripting Guy, Sean Kearney, is here today to introduce you to a pretty cool feature that is available in the Windows PowerShell ISE. It’s an add-on called the Script Browser.    Note   This is a five-part series that includes the following posts about features in the Windows PowerShell ISE: The Script Browser came with my installation yesterday when I dropped in the Script Analyzer. I referenced its existence, but I didn’t show it to you. After the installation...

PowerTip: Edit Profile for PowerShell ISE
Jan 4, 2016
Post comments count 0
Post likes count 0

PowerTip: Edit Profile for PowerShell ISE

Doctor Scripto

Summary: Identify and edit the autostart features for the Windows PowerShell ISE.  Is there something similar to the $Profile feature in the Windows PowerShell console that I can use to customize            my Windows PowerShell ISE environment?  The variable name is the same in the PowerShell ISE, but the file name it references is different, for example: Notepad $Profile If you are using the Windows PowerShell 5.0 ISE, you can use: PSEdit $Profile

A Favorite PowerShell ISE Feature: Script Analyzer
Jan 4, 2016
Post comments count 0
Post likes count 0

A Favorite PowerShell ISE Feature: Script Analyzer

Doctor Scripto

Summary: Sean Kearney introduces a free tool for examining your script. Honorary Scripting Guy, Sean Kearney, is here. This week I’m going to introduce you to my favorite Windows PowerShell ISE features.    Note   This is a five-part series that includes the following posts about features in the Windows PowerShell ISE: Today, I’m talking about a free add-on called the Script Analyzer. In the past, I’ve written some scripts that literally “just worked,” but I still wondered if there was something I missed. More recently I wrote a couple of modules for t...

PowerTip: Restore PowerShell ISE to Default Settings
Jan 3, 2016
Post comments count 0
Post likes count 0

PowerTip: Restore PowerShell ISE to Default Settings

Doctor Scripto

Summary: Learn how to restore the Windows PowerShell ISE to its default configurations.  How can I restore the Windows PowerShell ISE to its default configurations?  Use the four built-in RestoreDefault methods with the PSise object to bring back everything in the ISE to the original settings: $PSise.Options.RestoreDefaults()$PSise.Options.RestoreDefaultConsoleTokenColors()$PSise.Options.RestoreDefaultTokenColors()$PSise.Options.RestoreDefaultXMLTokenColors()

Weekend Scripter: Customize PowerShell Title and Prompt
Jan 3, 2016
Post comments count 0
Post likes count 0

Weekend Scripter: Customize PowerShell Title and Prompt

Doctor Scripto

Summary: Learn how to interactively update the Windows PowerShell prompt and title. Honorary Scripting Guy, Sean Kearney, is here today to have a little bit of fun with the Windows PowerShell console. Why not? It’s a Sunday, it’s the last day of my time off, and I feel like playing. There have been many posts online about the fun you can have with the $Host.UI.RawUI object in Windows PowerShell. You can use it to edit cursor locations, flip colors about…almost anything your little heart desires. Another fun little thing we’re going to play with is the Windows PowerShell prompt. Yes! You&r...

PowerTip: Set Personal Environment Variable from PowerShell
Jan 2, 2016
Post comments count 0
Post likes count 0

PowerTip: Set Personal Environment Variable from PowerShell

Doctor Scripto

Summary: Access the $ENV object in Windows PowerShell to alter personal environment settings.  How can I use Windows PowerShell to change a system environment variable such as the user %TEMP%?  You can read any personal environment settings by using $ENV:VariableName, then assigning a value.            For example, to change your personal %TEMP% to a new location, use: $ENV:Temp=C:\Foo Note This presumes C:\Foo exists and will alter the variable for the present PowerShell session.

Learn Easier Way to Build Command for PowerShell.exe
Jan 2, 2016
Post comments count 0
Post likes count 0

Learn Easier Way to Build Command for PowerShell.exe

Doctor Scripto

Summary: Learn how to parse a here-string with Windows PowerShell.Honorary Scripting Guy, Sean Kearney, is here to show you a neat little trick.Anyone who has ever scheduled a PowerShell task knows that if you want to launch a cmdlet directly in PowerShell, you would launch it like this:PowerShell.exe –ExecutionPolicy Bypass –command ‘Get-ChildItem’No challenge there. It also does not end there. You can add some down-right complex stuff in there, for example:PowerShell.exe –executionpolicy Bypass –command ‘Set-ExecutionPolicy Bypass;Import-Module DeployImage; New-WindowsP...

PowerTip: Save Help Content for Module
Jan 1, 2016
Post comments count 0
Post likes count 0

PowerTip: Save Help Content for Module

Doctor Scripto

Summary: Learn how to target content to save with the Save-Help cmdlet.  How can I use Windows PowerShell to save the Help content for a single module?  Use the –module parameter with the Save-Help cmdlet, for example: Save-Help –module Dism –destination C:\Foo\

‘Tis the Season…for Giving Back
Jan 1, 2016
Post comments count 0
Post likes count 0

‘Tis the Season…for Giving Back

Doctor Scripto

Summary: Guest blogger, Don Jones, discusses how you can share with the worldwide community.Today, special guest blogger, Don Jones offers ideas about how we all can increase the power of the PowerShell community…How’s your 2015 been? Hopefully, you’ve been taking advantage of some of the wonderful, free resources that are available in the global PowerShell community. Hopefully you’ve learned a new thing or two, solved a problem or two, and hoisted yourself up another rung of the PowerShell ladder.And hey…maybe in 2016, it’s time to give back a little. Oh, I know, it’s ...

PowerTip: Use Here-Strings with PowerShell
Dec 31, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Here-Strings with PowerShell

Doctor Scripto

Summary: Learn the basic use of a here-string in Windows PowerShell.  What is a here-string and how do I use it? In PowerShell, you can use here-strings to declare blocks of text. They’re declared just like regular strings except they have an @ on each end. Instead of being limited to one line, you can declare an entire block or a multiple line string. Here-strings are also useful for making a string composed of the text to execute a command. Try these examples: $String1 = @" Get-ChildItem c:\temp "@ $String2 = @" This is somemultiple line text! "@...

Sounds of the Holidays–Part 2
Dec 31, 2015
Post comments count 0
Post likes count 0

Sounds of the Holidays–Part 2

Doctor Scripto

Summary: MVP, Thomas Rayner, continues to inspire holiday spirit by using PowerShell to trigger multimedia. Yesterday in Sounds of the Holidays–Part 1, I tried to inspire my coworker, Matthew, with some cool holiday messages. Unfortunately, Matthew is still being a Grinch and I need to step up my game. Instead of some spoken messages from “Ebenezer Script,” I’m going to play him some holiday music every time he signs in to his workstation. I’m a fan of the Charlie Brown holiday jazz album by the Vince Guaraldi Trio, and they’ve been kind enough to upload some of their music to YouTube. I’ve chosen this great pi...

PowerTip: Launch Minimized Application with PowerShell
Dec 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Launch Minimized Application with PowerShell

Doctor Scripto

Summary: Learn how to specify the launch state of an application through Windows PowerShell.  How can I launch a minimized application in Windows PowerShell instead of opening the window in the foreground?  Use the –WindowStyle parameter with the Start-Process cmdlet, and select Minimized, for example: Start-Process -WindowStyle Minimized 'iexplore.exe'  Note   You can also choose Hidden, Maximized, or Normal, but not all applications support all modes.

Sounds of the Holidays–Part 1
Dec 30, 2015
Post comments count 0
Post likes count 0

Sounds of the Holidays–Part 1

Doctor Scripto

Summary: MVP, Thomas Rayner, inspires holiday spirit by using Windows PowerShell to trigger some multimedia.Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for the Scripting Guy for a couple days. You can find me on Twitter (@MrThomasRayner), or posting biweekly on my blog, WorkingSysadmin: Figuring stuff out at work. I’m enjoying some time off from work this holiday season by playing around with some of the multimedia resources that come with Windows.Do you have a coworker who you wish was a little more festive? I do. His name is Matthew, and I’m go...

PowerTip: Get Status of a DSC File in Azure
Dec 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Status of a DSC File in Azure

Doctor Scripto

Summary: Use the Azure cmdlets to get the current status of a Desired State Configuration file on a virtual machine.  How can I use Windows PowerShell to determine if a Desired State Configuration (DSC) file that I applied to an            Azure virtual machine is successful?  Get the Azure virtual machine and pipe the object to Get-AzureVMDscExtensionStatus. The following example            checks the status on the virtual machine called Hitchy01 on the service called AzureVMNetwork: Get-AzureVM –service ‘AzureV...

PowerTip: How to Upload DSC File to Azure
Dec 28, 2015
Post comments count 0
Post likes count 0

PowerTip: How to Upload DSC File to Azure

Doctor Scripto

Summary: Use Azure PowerShell cmdlets to send a Desired State Configuration file to be used later by a virtual machine.  How can I use Windows PowerShell to send a DSC file to be used later by a virtual machine?  Use the Publish-AzureVMDscConfiguration cmdlet and specify the path to your DSC script.            The following example targets the DSC script called FileServer.ps1: Publish-AzureVMDscConfiguration -ConfigurationPath ".\FileServer.ps1"

PowerTip: How to Upload DSC File to Azure
Dec 28, 2015
Post comments count 0
Post likes count 0

PowerTip: How to Upload DSC File to Azure

Doctor Scripto

Summary: Use Azure PowerShell cmdlets to send a Desired State Configuration file to be used later by a virtual machine. How can I use Windows PowerShell to send a DSC file to be used later by a virtual machine? Use the Publish-AzureVMDscConfiguration cmdlet and specify the path to your DSC script.            The following example targets the DSC script called FileServer.ps1:Publish-AzureVMDscConfiguration -ConfigurationPath ".\FileServer.ps1"

PowerTip: Display Hidden Files in PowerShell
Dec 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Display Hidden Files in PowerShell

Doctor Scripto

Summary: Boe Prox shows how to use Windows PowerShell to display hidden files.  How can I use Windows PowerShell to display hidden files and folders? There are a couple of approaches that use Get-ChildItem:

Weekend Scripter: Remove a Long Path File
Dec 27, 2015
Post comments count 1
Post likes count 0

Weekend Scripter: Remove a Long Path File

Doctor Scripto

Summary: Boe Prox shows how to remove a file with a long path. Honorary Scripting Guy and Cloud and Datacenter Management MVP, Boe Prox, here today filling in for my good friend, the Scripting Guy. This is a continuation of this weekend series on working with PowerShell and PInvoke to do things that you normally couldn’t do natively. Also see Manage Window Placement by Using PInvoke. Today I am continuing my approach of working with PInvoke by using Add-Type to compile C# code that contains the PInvoke signatures to show that it can be pretty easy to pull together and use a Windows API when we need it. Yest...

PowerTip: Display Titles of Windows
Dec 26, 2015
Post comments count 1
Post likes count 0

PowerTip: Display Titles of Windows

Doctor Scripto

Summary: Boe Prox shows how to use Windows PowerShell to find the titles of windows. How can I use Windows PowerShell to find the titles of windows? Use Get-Process and display the title of the processes for windows by looking at            the MainWindowTitle property, for example:Get-Process | Where {    $_.MainWindowTitle} |Select-Object ProcessName, MainWindowTitle ProcessName          MainWindowTitle              &nb...

Weekend Scripter: Manage Window Placement by Using PInvoke
Dec 26, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Manage Window Placement by Using PInvoke

Doctor Scripto

Summary: Boe Prox shows us how to manage window placement in Windows PowerShell. Honorary Scripting Guy and Cloud and Datacenter Management MVP, Boe Prox, here today filling in for my good friend, the Scripting Guy. Today I start a little weekend fun by using a technique known as platform invoke, or PInvoke for short. What is PInvoke, you ask? Well, PInvoke allows us to utilize the low-level Windows API to call functions that would normally not be available to us natively. This allows us to do some pretty cool things, such as looking at files with a file path that is greater than the MAX_PATH allowed when using n...

PowerTip: Find Scripts in Script Center Repository from PowerShell ISE
Dec 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Scripts in Script Center Repository from PowerShell ISE

Doctor Scripto

Summary: Use a free add-on to directly access scripts and modules from the Windows PowerShell ISE.  In Windows PowerShell 5.0, I can access the TechNet Gallery for PowerShell modules, but is there an easy way            to access and search the older Script Center Repository from the PowerShell ISE?  In the PowerShell ISE, click Add-ons, select Script Browser Add-on Tool, and then follow the            step-by-step instructions.

A Holiday Special: Rusty the Red-Eyed Scripter, Part 5
Dec 25, 2015
Post comments count 0
Post likes count 0

A Holiday Special: Rusty the Red-Eyed Scripter, Part 5

Doctor Scripto

Summary: Rusty discovers the power of classes and enums in Windows PowerShell 5.0.    Note   This is a five-part series that includes the following posts: When last we ran into our good friend Rusty, he had encountered the infamous Scripting Guy, Ed Wilson, and listened to his introduction about the ConvertFrom-String cmdlet. Now he was about to hear a session about classes. What could that possibly be about? “For many of us, this will be a new concept—the ability to create classes and other types of new and more powerful custom objects in PowerShell.” Ed looked a...

PowerTip: Convert Data to Hexadecimal Output in PowerShell 5
Dec 24, 2015
Post comments count 1
Post likes count 0

PowerTip: Convert Data to Hexadecimal Output in PowerShell 5

Doctor Scripto

Summary: Use the Format-Hex cmdlet to produce hexadecimal output.  How can I use Windows PowerShell to put data in a binary key in the registry?  In Windows PowerShell 5.0, you can use the Format-Hex cmdlet, for example: ‘This is meant to be binary’ | Format-Hex $DataForRegistry=(‘This is meant to be binary’ | Format-Hex).Bytes

A Holiday Special: Rusty the Red-Eyed Scripter, Part 4
Dec 24, 2015
Post comments count 0
Post likes count 0

A Holiday Special: Rusty the Red-Eyed Scripter, Part 4

Doctor Scripto

Summary: Rusty the Red-Eyed Scripter learns how PowerShell can convert raw string data to an object.    Note   This is a five-part series that includes the following posts: Yesterday, our good friend Rusty found his head spinning with ideas after getting shown some new PowerShell cmdlets—cmdlets he could immediately put to work when using Windows PowerShell 5.0. He decided to move to the front row with Thomas to get a better view. There was some powerful stuff coming on the screen, and he didn’t want to miss a bit. “And now we have a special treat for you folks,&r...

PowerTip: Clear Recycle Bin with PowerShell 5
Dec 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Clear Recycle Bin with PowerShell 5

Doctor Scripto

Summary: Easily purge the Recycle Bin on a targeted drive with PowerShell 5.  How can I use Windows PowerShell to easily flush out the Recycle Bin?  In Windows PowerShell 5.0, use the Clear-RecycleBin cmdlet. For example, run the            following command with elevated rights to purge the Recycle Bin on drive C: Clear-RecycleBin –DriveLetter C -force

PowerTip: Clear Recycle Bin with PowerShell 5
Dec 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Clear Recycle Bin with PowerShell 5

Doctor Scripto

Summary: Easily purge the Recycle Bin on a targeted drive with PowerShell 5. How can I use Windows PowerShell to easily flush out the Recycle Bin? In Windows PowerShell 5.0, use the Clear-RecycleBin cmdlet. For example, run the            following command with elevated rights to purge the Recycle Bin on drive C:Clear-RecycleBin –DriveLetter C -force

A Holiday Special: Rusty the Red-Eyed Scripter, Part 3
Dec 23, 2015
Post comments count 0
Post likes count 0

A Holiday Special: Rusty the Red-Eyed Scripter, Part 3

Doctor Scripto

Summary: Rusty the Red-Eyed Scripter learns how to unblock files and tweak event logs with Windows PowerShell 5.0.   Note   This is a five-part series that includes the following posts: Our story continues as we observe Rusty and getting his first real taste of Windows PowerShell 5.0 and discovering the power and ease-of-use it brings. Rusty and Thomas have been watching the PowerShell Saturday speaker get deeper into PowerShell—until a quick pizza break is called. Everybody ambles to the back of the room to scoop up some pizza and sodas, and the chatting begins. Rusty is ch...

A Holiday Special – Rusty the Red-Eyed Scripter: Part 3
Dec 23, 2015
Post comments count 0
Post likes count 0

A Holiday Special – Rusty the Red-Eyed Scripter: Part 3

Doctor Scripto

Summary: Rusty the Red-Eyed Scripter learns how to unblock files and tweak event logs with Windows PowerShell 5.0.Note This is Part 3 in a five-part series. To catch up, read: Our story continues as we observe Rusty and getting his first real taste of Windows PowerShell 5.0 and discovering the power and ease-of-use it brings.Rusty and Thomas have been watching the PowerShell Saturday speaker get deeper into PowerShell—until a quick pizza break is called.Everybody ambles to the back of the room to scoop up some pizza and sodas, and the chatting begins. Rusty is chatting with Thomas, “I’d l...

PowerTip: Uninstall Module with PowerShell 5
Dec 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Uninstall Module with PowerShell 5

Doctor Scripto

Summary: Learn how to uninstall a Windows PowerShell module. How can I easily uninstall a Windows PowerShell module? Use the Uninstall-Module cmdlet to remove anything discovered by using Find-Module. For example,            to permanently remove the LocalAccount module, use:Uninstall-Module LocalAccount

PowerTip: Uninstall Module with PowerShell 5
Dec 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Uninstall Module with PowerShell 5

Doctor Scripto

Summary: Learn how to uninstall a Windows PowerShell module. How can I easily uninstall a Windows PowerShell module? Use the Uninstall-Module cmdlet to remove anything discovered by using Find-Module. For example,            to permanently remove the LocalAccount module, use:Uninstall-Module LocalAccount

A Holiday Special: Rusty the Red-Eyed Scripter, Part 2
Dec 22, 2015
Post comments count 0
Post likes count 0

A Holiday Special: Rusty the Red-Eyed Scripter, Part 2

Doctor Scripto

Summary: Rusty the Red-Eyed Scripter discovers how Windows PowerShell 5.0 can pull modules from a central repository.   Note   This is a five-part series that includes the following posts: We return with Rusty sitting beside his new friend Thomas from Edmonton, all invigorated to check out Windows PowerShell 5.0. Rusty was quite interested in this PowerShell Saturday presentation about PowerShell 5 because it seems to offer a stronger level of ease-of-use from the PowerShell 1.0 version he had tried years ago. The speaker began discussing how PowerShell provides a new method ...

A Holiday Special: Rusty the Red-Eyed Scripter, Part 2
Dec 22, 2015
Post comments count 0
Post likes count 0

A Holiday Special: Rusty the Red-Eyed Scripter, Part 2

Doctor Scripto

Summary: Rusty the Red-Eyed Scripter discovers how Windows PowerShell 5.0 can pull modules from a central repository.   Note  This is Part 2 in a five-part series. To get started, read Rusty the Red-Eyed Scripter, Part 1.We return with Rusty sitting beside his new friend Thomas from Edmonton, all invigorated to check out Windows PowerShell 5.0.Rusty was quite interested in this PowerShell Saturday presentation about PowerShell 5 because it seems to offer a stronger level of ease-of-use from the PowerShell 1.0 version he had tried years ago.The speaker began discussing how PowerShell provides a new ...

PowerTip: Eliminate Duplicates in PowerShell History
Dec 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Eliminate Duplicates in PowerShell History

Doctor Scripto

Summary: Use an option in the PSReadLine module to control Windows PowerShell 5.0 history duplication. How can I make sure that there are no duplicates in my history? In Windows PowerShell 5.0 with the PSReadLineModule loaded, use the Set-PSReadLineOption            cmdlet as follows:Set-PSReadLineOption –HistoryNoDuplicates:$True

PowerTip: Eliminate Duplicates in PowerShell History
Dec 21, 2015
Post comments count 0
Post likes count 1

PowerTip: Eliminate Duplicates in PowerShell History

Doctor Scripto

Summary: Use an option in the PSReadLine module to control Windows PowerShell 5.0 history duplication.  How can I make sure that there are no duplicates in my history?  In Windows PowerShell 5.0 with the PSReadLineModule loaded, use the Set-PSReadLineOption            cmdlet as follows: Set-PSReadLineOption –HistoryNoDuplicates:$True

A Holiday Special: Rusty the Red-Eyed Scripter, Part 1
Dec 21, 2015
Post comments count 0
Post likes count 0

A Holiday Special: Rusty the Red-Eyed Scripter, Part 1

Doctor Scripto

Summary: Rusty the Red-Eyed Scripter discovers compressing files and working with the Clipboard in PowerShell 5.0. It’s that time again folks—time for the long awaited holiday tradition on the Hey, Scripting Guys! Blog. Get ready for some horrible music and a fun story involving PowerShell. This is our sixth year running the holiday special, so grab a relaxing beverage of your choice and sit back as we begin the watch the journey of an IT pro who has yet to use PowerShell…   Note   This is a five-part series that includes the following posts: Let me tell you a tale of...

PowerTip: Determine Size of Folder with PowerShell
Dec 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine Size of Folder with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to determine the size of a folder. How can I use Windows PowerShell to easily get the size of a folder structure? Use a combination of Get-Childitem and Measure-Object. For example, to see the size of the C:\Foo folder            structure in Windows PowerShell 5.0 or 4.0, use:Get-Childitem C:\Foo –file –recurse | Measure-Object –property Length -sum

PowerTip: Determine Size of Folder with PowerShell
Dec 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine Size of Folder with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to determine the size of a folder.  How can I use Windows PowerShell to easily get the size of a folder structure?  Use a combination of Get-Childitem and Measure-Object. For example, to see the size of the C:\Foo folder            structure in Windows PowerShell 5.0 or 4.0, use: Get-Childitem C:\Foo –file –recurse | Measure-Object –property Length -sum

Build a Better Copy-Item Cmdlet
Dec 20, 2015
Post comments count 0
Post likes count 0

Build a Better Copy-Item Cmdlet

Doctor Scripto

Summary: Sean Kearney investigates how to navigate file system content. Honorary Scripting Guy, Sean Kearney, is here with an early holiday gift—a way to deal with copying many files and getting some kind of progress on the update. I ran into this problem when I was duplicating file structures onto USB keys for Windows to Go a few months ago. Maybe “problem” is not the correct word. When I execute Copy-Item to duplicate a file structure, it works properly. There is, of course, some “finicky” issues. As one reader correctly pointed out the other week, one issue arises if the folder...

Build a Better Copy-Item Cmdlet
Dec 20, 2015
Post comments count 0
Post likes count 0

Build a Better Copy-Item Cmdlet

Doctor Scripto

Summary: Sean Kearney investigates how to navigate file system content.Honorary Scripting Guy, Sean Kearney, is here with an early holiday gift—a way to deal with copying many files and getting some kind of progress on the update.I ran into this problem when I was duplicating file structures onto USB keys for Windows to Go a few months ago. Maybe “problem” is not the correct word. When I execute Copy-Item to duplicate a file structure, it works properly. There is, of course, some “finicky” issues.As one reader correctly pointed out the other week, one issue arises if the folder name ...

PowerTip: Use PowerShell to Change Colors in PSReadline Module
Dec 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Change Colors in PSReadline Module

Doctor Scripto

Summary: Learn how to use Windows PowerShell access color options in the PSReadline module. How can I use Windows PowerShell to alter the colors in the PSReadline module? Use the Set-PSReadlineOption cmdlet to alter pretty much any item.            For example, to provide a white foreground for error messages, use:Set-PSReadlineOption –ErrorForegroundColor White

Introducing the PowerShell Extension for Visual Studio Code
Dec 19, 2015
Post comments count 0
Post likes count 0

Introducing the PowerShell Extension for Visual Studio Code

Doctor Scripto

Summary: Doug Finke, Microsoft MVP, introduces a new way to edit code. There’s a new editor in town and as with any new shiny toy, it’s a good to download, kick the tires, and give it the seven day test. The seven day test is when you install it, try it, and see if you consistently come back to it over seven days. If you don’t, then uninstall it and move on. Microsoft Visual Studio Code is code editing, redefined. It’s free, cross-platform, extensible, and it is open source. Plus, Microsoft has released PowerShell language support for it (see PowerShell Language Support for Visual Studio...

Introducing the PowerShell Extension for Visual Studio Code
Dec 19, 2015
Post comments count 0
Post likes count 0

Introducing the PowerShell Extension for Visual Studio Code

Doctor Scripto

Summary: Doug Finke, Microsoft MVP, introduces a new way to edit code.There’s a new editor in town and as with any new shiny toy, it’s a good to download, kick the tires, and give it the seven day test. The seven day test is when you install it, try it, and see if you consistently come back to it over seven days. If you don’t, then uninstall it and move on.Microsoft Visual Studio Code is code editing, redefined. It’s free, cross-platform, extensible, and it is open source. Plus, Microsoft has released PowerShell language support for it (see PowerShell Language Support for Visual Studio Cod...

PowerTip: Contribute to the Pester Project
Dec 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Contribute to the Pester Project

Doctor Scripto

Summary: Learn how you can add to the Pester solution. How can I contribute to Pester? On the project’s GitHub site, submit bug reports or feature requests in the Issues log,            or submit your code via a Pull Request.

PowerTip: Contribute to the Pester Project
Dec 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Contribute to the Pester Project

Doctor Scripto

Summary: Learn how you can add to the Pester solution.  How can I contribute to Pester?  On the project’s GitHub site, submit bug reports or feature requests in the Issues log,            or submit your code via a Pull Request.

More Pester Features and Resources
Dec 18, 2015
Post comments count 0
Post likes count 0

More Pester Features and Resources

Doctor Scripto

Summary: Dave Wyatt wraps up his week teaching us about Pester with information about more resources.    Note   This is a five-part series that includes the following posts: I hope that this series has convinced you that writing Pester tests for your code can be easy and valuable—even if I had to be fairly brief in my examples of the most essential parts of the module. Today, I want to show you a few of the other features that the module has to offer. First, coverage analysis! The term “code coverage” refers to how much of your code is actually tested. Pester can ...

More Pester Feature and Resources
Dec 18, 2015
Post comments count 1
Post likes count 0

More Pester Feature and Resources

Doctor Scripto

Summary: Dave Wyatt wraps up his week teaching us about Pester with information about more resources.   Note   This is a five-part series that includes the following posts: I hope that this series has convinced you that writing Pester tests for your code can be easy and valuable—even if I had to be fairly brief in my examples of the most essential parts of the module. Today, I want to show you a few of the other features that the module has to offer.First, coverage analysis! The term “code coverage” refers to how much of your code is actually tested. Pester can help...

PowerTip: Use Pester to Test Functions in Module
Dec 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Pester to Test Functions in Module

Doctor Scripto

Summary: Use Pester to test new functions in your module. How can I unit test a non-exported function in my script module? Use the InModuleScope command to execute some or all of your Pester script within the scope of            the module you’re testing.

PowerTip: Use Pester to Test Functions in Module
Dec 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Pester to Test Functions in Module

Doctor Scripto

Summary: Use Pester to test new functions in your module.  How can I unit test a non-exported function in my script module?  Use the InModuleScope command to execute some or all of your Pester script within the scope of            the module you’re testing.

Testing Script Modules with Pester
Dec 17, 2015
Post comments count 0
Post likes count 0

Testing Script Modules with Pester

Doctor Scripto

Summary: Dave Wyatt discusses using Pester for testing PowerShell modules.    Note   This is a five-part series that includes the following posts: Yesterday, we looked at how to use the Mock and Assert-MockCalled commands in Pester to unit test the logic in your PowerShell code without having any external dependencies. This can get a little bit trickier when you start to store your code in script modules (.psm1 files). To demonstrate this, I’ve taken the code from yesterday’s Active Directory example, placed it into a .psm1 file, and added a small change to introduce an internal function: The Tests.p...

PowerTip: Test Active Directory Script with Pester
Dec 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Test Active Directory Script with Pester

Doctor Scripto

Summary: Use Pester to safely test script changes to Active Directory.  How can I test my Active Directory script without having it make changes to my live domain?  Use Pester’s mocking feature to test your code without using the actual Active Directory cmdlets.

Unit Testing PowerShell Code with Pester
Dec 16, 2015
Post comments count 0
Post likes count 1

Unit Testing PowerShell Code with Pester

Doctor Scripto

Summary: Guest blogger, Dave Wyatt, discusses using Pester to analyze small pieces of Windows PowerShell code.    Note   This is a five-part series that includes the following posts: Before we get into the technical details today, let’s define a few terms. There are several categories of automated testing, all of which are used in a continuous delivery pipeline. For the purposes of Windows PowerShell code, I tend to refer to three: Unit tests A unit test is the smallest and fastest type, and it is the first thing that will be run in your pipeline. It can ...

PowerTip: Connect Pester to Automated System
Dec 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Connect Pester to Automated System

Doctor Scripto

Summary: Learn how to incorporate Pester into an automated system.  How do I incorporate Pester into an automated system?  Use one of the features in Pester that are built for this purpose: NUnit XML export, -PassThru switch, or the            –EnableExit switch in conjunction with powershell.exe’s exit code, for example: $testResults = Invoke-Pester -PassThru -OutputFormat NUnitXml -OutputFile .\TestResults.xml

Getting Started with Pester
Dec 15, 2015
Post comments count 0
Post likes count 0

Getting Started with Pester

Doctor Scripto

Summary: Guest blogger, Dave Wyatt explains how to get information back from Pester.    Note   This is a five-part series that includes the following posts: At the end of yesterday’s post, I showed this brief example of a .Tests.ps1 file: Today, we’ll go into more detail about what goes into these tests, and how to get information back from Pester. In the example screenshot, there are four new commands that are not part of the PowerShell language: Describe, Context, It, and Should. Describe    Defines a group of tests, and all Pester tests files must contain ...

PowerTip: Get Started with Pester Tests and PowerShell
Dec 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Started with Pester Tests and PowerShell

Doctor Scripto

Summary: Learn how to start a Pester test.  How do I run Pester tests?  Place your tests into a file with a name that ends with .Tests.ps1, and then run the Invoke-Pester cmdlet.

What is Pester and Why Should I Care?
Dec 14, 2015
Post comments count 0
Post likes count 0

What is Pester and Why Should I Care?

Doctor Scripto

Summary: Guest blogger, Dave Wyatt introduces a new test framework for PowerShell called Pester. This week we are honored to have one of the authors of Pester here with us on the Hey, Scripting Guys! Blog. It’s Dave Wyatt himself, a Cloud and Datacenter MVP. Dave, tell us all about Pester…    Note   This is a five-part series that includes the following posts: What is Pester? That’s easy to answer… Pester is a test framework for PowerShell. It provides a language that allows you to define test cases, and the Invoke-Pester cmdlet to execute these tests and ...

PowerTip: Find List of PowerShell About Topics
Dec 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Find List of PowerShell About Topics

Doctor Scripto

Summary: Find a list of Windows PowerShell About topics.  How can I find Help topics so I can learn about various Windows PowerShell concepts?  Use Get-Help and a wildcard character, for example: Get-Help about*

Weekend Scripter: Conceptual PowerShell Help
Dec 13, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Conceptual PowerShell Help

Doctor Scripto

Summary: Guest blogger, Tim Warner, talks about using Windows PowerShell conceptual Help.Microsoft Scripting Guy, Ed Wilson, is here. Welcome back Timothy Warner as our guest blogger today.Tim is an author and evangelist for Pluralsight, a premier online IT pro and development training company. Tim is the author of Windows PowerShell in 24 Hours, Sams Teach Yourself, a contributor at PowerShell.org, and co-organizer of the Nashville PowerShell User Group.Here’s Tim…Let’s say you need to identify and extract all email addresses from a huge text file. To solve the issue, you decide to employ the ...

PowerTip: Time How Long PowerShell Command Takes to Complete
Dec 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Time How Long PowerShell Command Takes to Complete

Doctor Scripto

Summary: Easily time how long a Windows PowerShell command takes to complete.  How can I time how long a command takes to complete in Windows PowerShell?  Use the Measure-Command cmdlet—for example, to time how long it takes to Get-Process (gps is an alias)            to complete, put the command in a script block and call Measure-Command: Measure-Command {gps}

Weekend Scripter: PowerShell ASCII Bar Charts
Dec 12, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell ASCII Bar Charts

Doctor Scripto

Summary: Microsoft PFE, Wei Hao Lim, presents a script that creates ASCII bar charts. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger. Please welcome Wei Hao Lim. Wei is a Microsoft PFE from Australia who works primarily with enterprise customers helping to configure, deploy, maintain, and customize System Center implementations. In his spare time, he enjoys video editing, swimming, playing with board games, and video games. He writes a very popular blog named Wei Out There with System Center. Here’s Wei… This article features a sample PowerShell script that generates a...

PowerTip: Find Module Path with Windows PowerShell
Dec 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Module Path with Windows PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to determine the location of a module.  How can I use Windows PowerShell to find the location of a module that I am using from a vendor?  Use the Path property of the module with Split-Path to show the parent: $ModuleName=(Get-Module –module DeployImage) $ModulePath=Split-Path $ModuleName

Using DeployImage and Windows PowerShell to Build a Nano Server: Part 5
Dec 11, 2015
Post comments count 0
Post likes count 0

Using DeployImage and Windows PowerShell to Build a Nano Server: Part 5

Doctor Scripto

Summary: Use the DeployImage module to build bootable Windows PE media with deployment content.Honorary Scripting Guy, Sean Kearney, is here today to show you one of my favorite pieces of my DeployImage module—building a piece of bootable USB media that has everything I need to deploy Nano Server.   Note   This is a five-part series that includes the following posts: Last week in the series, Build a PowerShell-Enabled Windows PE Key, I talkedl about building a Windows PE USB key with Windows PowerShell. This week, I explored how to use the new DeployImage module to build out Na...

PowerTip: Escape Parsed Content in PowerShell String
Dec 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Escape Parsed Content in PowerShell String

Doctor Scripto

Summary: Use the backtick character to insert data normally parsed by Windows PowerShell in a string.  Certain characters (such as the colon and double quotation marks) are special in Windows PowerShell.            How can I use those in a parsed string?  Use the backtick character (usually under the tilde, and it’s also ASCII character 96), for example: $OSDrive=’C’ $DriveLetter=”$OSDrive`:”

Using DeployImage and Windows PowerShell to Build a Nano Server: Part 4
Dec 10, 2015
Post comments count 0
Post likes count 0

Using DeployImage and Windows PowerShell to Build a Nano Server: Part 4

Doctor Scripto

Summary: Use the new cmdlets in the DeployImage module to simplify the deployment of a Nano Server.Honorary Scripting Guy, Sean Kearney, is here to get into the really fun part of deploying a Nano Server—the actual deployment part.   Note   This is a five-part series that includes the following posts: Yesterday, I showed you the New-UnattendXMLContent cmdlet to help you name the Nano Server and provide direct settings, such as the time zone. Today we’re going to look at creating partitions and applying the image—our actual process.If you were to try to apply Nano Se...

PowerTip: Use PowerShell to Create Module Manifest
Dec 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Module Manifest

Doctor Scripto

Summary: Use Windows PowerShell to build a module manifest for GitHub.  How can I use Windows PowerShell to build a module manifest for my module in GitHub?  In Windows PowerShell 5.0 use the New-ModuleManifest cmdlet—for example, to create a sample            manifest in the C:\Foo folder, type: New-ModuleManifest –path C:\Foo\Sample.PSD1 Note This creates a full module manifest, including comments. This cmdlet also accepts parameters for some key points of data.

Use DeployImage Module and PowerShell to Build a Nano Server: Part 3
Dec 9, 2015
Post comments count 0
Post likes count 0

Use DeployImage Module and PowerShell to Build a Nano Server: Part 3

Doctor Scripto

Summary: Sean Kearney uses the New-UnattendXMLContent cmdlet in his DeployImage module to automate naming the Nano Server. Honorary Scripting Guy, Sean Kearney, is here today to continue with our work in easing the deployment of a Nano Server or other WIM files with the DeployImage module.    Note   This is a five-part series that includes the following posts: But most of us are used to going to a computer, swapping in the computer name, and joining the domain via the GUI. But this is not the only way to do it. If you’re just getting into deploying Windows or images, there is...

PowerTip: Add CAB Package to Windows Image with PowerShell
Dec 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Add CAB Package to Windows Image with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to update a Windows image with a CAB package. How can I use Windows PowerShell to update a Windows image with a new CAB package?Supply the path to the package and use the Add-WindowsPackage cmdlet. For example, to add a            package to a previously mounted offline installation in the C:\Media\Mount folder, use:Add-WindowsPackage –PackagePath C:\Foo\Somepackage.CAB –Path C:\Media\Mount

Use DeployImage Module and PowerShell to Build a Nano Server: Part 2
Dec 8, 2015
Post comments count 0
Post likes count 0

Use DeployImage Module and PowerShell to Build a Nano Server: Part 2

Doctor Scripto

Summary: Sean Kearney uses the New-NanoServerWim cmdlet from the DeployImage module to build an updated Nano Server WIM file. Honorary Scripting Guy, Sean Kearney, is here today continuing forward with creating a new Nano Server with the DeployImage module.    Note   This is a five-part series that includes the following posts: I’m presuming that you have the media for the Nano Server ready, and it is sitting off the NanoServer folder at the root of the Windows Server 2016 TP4 media. To customize the Nano Server WIM file, we use the same process as customizing any other WIM f...

PowerTip: Use PowerShell to Remove Drive Letter
Dec 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Remove Drive Letter

Doctor Scripto

Summary: Learn how to use Windows PowerShell to remove an assigned drive letter from a partition.  How can I use Windows PowerShell to remove a drive letter from a partition?  Use a combination of three cmdlets with the drive letter—for example, to remove drive letter X from the drive            it is assigned to, use $DriveLetter=’XGet-Volume -Drive $DriveLetter | Get-Partition | Remove-PartitionAccessPath -accesspath "$DriveLetter`:\"

Use DeployImage Module and PowerShell to Build a Nano Server: Part 1
Dec 7, 2015
Post comments count 0
Post likes count 0

Use DeployImage Module and PowerShell to Build a Nano Server: Part 1

Doctor Scripto

Summary: Sean Kearney introduces his DeployImage module and the cmdlets for Nano Server.Honorary Scripting Guy, Sean Kearney, is here this week giving Ed a little early holiday rest and showing you a bit about Nano Server.   Note   This is a five-part series that includes the following posts: One of the challenges we all need to deal with in our environments is security. One of the biggest security headaches is patching. Patching means one big headache: rebooting the server. The reason rebooting that server is a headache is that it often means an interruption in business operations o...

PowerTip: Get Author Information about PowerShell Session Configuration
Dec 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Author Information about PowerShell Session Configuration

Doctor Scripto

Summary: Use Windows PowerShell to get session owner information.  How can I get more information about which Windows PowerShell session configurations came with            my system and which were set up by another administrator?  Use Get-PssessionConfiguration and target the Name and Author properties, for example: Get-PssessionConfiguration | Select-Object –Property Name,Author | Format-Table -autosize

Weekend Scripter: Taking JEA for a Spin—Part 2
Dec 6, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Taking JEA for a Spin—Part 2

Doctor Scripto

Summary: Thomas Rayner explores how to restrict Active Directory management with JEA in Windows Server 2016. Thomas Rayner, Cloud and Datacenter Management MVP, continues his two-part series about an exciting new feature in Windows Server 2016, Just Enough Admin (JEA). Today we’ll investigate how JEA can be applied in a situation where a limited user has permissions to run specific Active Directory queries. Yesterday in Taking JEA for A Spin—Part 1, I tackled code promotion. I showed how to configure JEA so that a connecting user could run only a specially crafted script. Today, the example use case I...

PowerTip: Use PowerShell to Identify Endpoints on Server
Dec 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Identify Endpoints on Server

Doctor Scripto

Summary: Learn how to identify endpoints on a server.  How can I use Windows PowerShell to see the available endpoints on a server if I have the necessary rights?  Use the Get-PSSessionConfiguration cmdlet.

Weekend Scripter: Taking JEA for a Spin—Part 1
Dec 5, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Taking JEA for a Spin—Part 1

Doctor Scripto

Summary: Thomas Rayner explores code promotion with Just Enough Admin (JEA) in Windows Server 2016. Hello! I’m Thomas Rayner, a proud Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy this weekend. You can find me on Twitter (@MrThomasRayner). I also post my blog bi-weekly: Working Sysadmin—Figuring stuff out at work. The temperature is dropping and the snow is starting to fly here in Alberta, Canada so I’m going to stay in this weekend and take an awesome new feature in Windows Server 2016, Just Enough Admin (JEA), for a spin. I’ll explore how it can be ...

PowerTip: Use PowerShell to List All Volumes
Dec 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List All Volumes

Doctor Scripto

Summary: Use Windows PowerShell to identify all partitions on a disk drive.  How can I use Windows PowerShell to easily see all of the partitions on a disk drive?  Pipe the Disk object through Get-Partition (to identify its partitions), then pipe that through Get-Volume to get            the volume data. Here is an example of using this on the default hard drive (drive 0): Get-Disk –number 0 | Get-Partition | Get-Volume

Build a PowerShell-Enabled Windows PE Key: Part 5
Dec 4, 2015
Post comments count 0
Post likes count 0

Build a PowerShell-Enabled Windows PE Key: Part 5

Doctor Scripto

Summary: Populate a bootable USB key with content from Windows PE. Honorary Scripting Guy, Sean Kearney, is here today sharing all you need to know about having a Windows PE key with Windows PowerShell.   Note   This is a five-part series that includes the following posts: Let’s remember that we’ve got that bootable USB key—a complete structure from Windows PE—sitting on our hard drive…a full tank of gas! (Oops! Sorry! I was watching Blues Brothers last night.) Our folder structure in question sits in the Media folder under the structure defined by $WinPEtemp. ...

PowerTip: Duplicate File Structure with PowerShell
Dec 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Duplicate File Structure with PowerShell

Doctor Scripto

Summary: Use Copy-Item to duplicate content with Windows PowerShell.  How can I use Windows PowerShell to duplicate content?  Use Copy-Item—for example, to duplicate all files and folders from C:\Foo to D:\Foo, run: Copy-Item C:\Foo D:\Foo -recurse

Build a PowerShell-Enabled Windows PE Key: Part 4
Dec 3, 2015
Post comments count 0
Post likes count 0

Build a PowerShell-Enabled Windows PE Key: Part 4

Doctor Scripto

Summary: Build out the necessary file structure for a Windows PE environment.Honorary Scripting Guy, Sean Kearney, is here today to give you all you need to build out your own Windows PE file structure.   Note   This is a five-part series that includes the following posts: Let’s think about what we’ve developed in the first three parts of this series: Our next task is to pull all of this together into a file structure for Windows PE.Confused?Normally, we would take a Windows image file and expand it directly to the target file system. But not with Windows PE. A Windows PE e...

PowerTip: Use PowerShell to Build Simple Menu
Dec 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Build Simple Menu

Doctor Scripto

Summary: Use the Out-Gridview cmdlet to easily build a GUI menu.  How can I easily build a GUI menu in Windows PowerShell so I can select items from a list?  Pipe any array to the Out-Gridview cmdlet and you can capture the results! ‘AddUser’,’RemoveUser’,’DeleteUser’,’ExitSystem’ | Out-Gridview -passthru

Build a PowerShell-Enabled Windows PE Key: Part 3
Dec 2, 2015
Post comments count 0
Post likes count 0

Build a PowerShell-Enabled Windows PE Key: Part 3

Doctor Scripto

Summary: Identify available USB keys and make them bootable devices. Honorary Scripting Guy, Sean Kearney, is here to continue delving into having a cool PowerShell experience in a Windows PE environment. Today I’m going to show you how to use Windows PowerShell to identify USB keys and make them bootable devices.    Note   This is a five-part series that includes the following posts: With Windows PowerShell finding a USB key is actually quite easy. We just use the Get-Disk cmdlet. This will show us all disks on the computer. There is a property we can filter on called BusType. A ...

PowerTip: See All Images Contained in Windows Image File
Dec 1, 2015
Post comments count 0
Post likes count 0

PowerTip: See All Images Contained in Windows Image File

Doctor Scripto

Summary: Use Windows PowerShell to identify all available images in a WIM file.  How can I use Windows PowerShell to see what images are stored in a WIM file?  Use the Get-WindowsImage cmdlet and target the WIM file, for example: Get-WindowsImage –imagepath Install.wim

Build a PowerShell-Enabled Windows PE Key: Part 2
Dec 1, 2015
Post comments count 0
Post likes count 0

Build a PowerShell-Enabled Windows PE Key: Part 2

Doctor Scripto

Summary: Customize a Windows PE environment to contain Windows PowerShell and DISM modules.Honorary Scripting Guy, Sean Kearney, is here again today with some early holiday gifts! A little PowerShell in a mean, lean green environment!   Note   This is a five-part series that includes the following posts: Now that we have the necessary software installed in Windows to build out a Windows PE environment, let’s take a look at building it.The Windows PE environment is pretty neat because most of the actual boot environment is ready for you. But the actual “live environment” ...

PowerTip: Determine Windows Architecture with PowerShell
Nov 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine Windows Architecture with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to identify whether you are running a 32-bit or 64-bit version of Windows.  How can I use Window PowerShell to see if my version of Windows is 32-bit or 64-bit?  Use Get-CimInstance and query the OSArchitecture property: (Get-CimInstance Win32_operatingsystem).OSArchitecture  

Build a PowerShell-Enabled Windows PE Key: Part 1
Nov 30, 2015
Post comments count 0
Post likes count 0

Build a PowerShell-Enabled Windows PE Key: Part 1

Doctor Scripto

Summary: Sean Kearney explores installing the Windows ADK and validating its presence with Windows PowerShell. Honorary Scripting Guy, Sean Kearney, here filling in for The Scripting Guy. This week, I’m going to help you out with Windows PE.    Note   This is a five-part series that includes the following posts: First, we need to explore “what is Windows PE?” Windows Preinstallation Environment (Windows PE) is a very light version of Windows that is intended for deployment solutions. A perfect example (and one we’ll delve into next week) is when you need to deploy Nan...

PowerTip: Update Module from PowerShell Gallery
Nov 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Update Module from PowerShell Gallery

Doctor Scripto

Summary: Boe Prox shows how to update a module from the Windows PowerShell Gallery. How can I update a module from the Windows PowerShell Gallery? Run the following command to check for an update to the module and install the update if one is found:Update-Module –Name PoshRSJob –VerboseVERBOSE: Checking for updates for module 'PoshRSJob'.VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2/' and PackageManagementProvider is 'NuGet'.VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.VERBOSE: The specified Location is 'https://www.powershell...

Weekend Scripter: A Look at the PoshRSJob Module
Nov 29, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: A Look at the PoshRSJob Module

Doctor Scripto

Summary: Boe Prox presents a module for working with runspaces. Honorary Scripting Guy and Cloud and Datacenter Management MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. Today I finish up my series about using runspaces in PowerShell by showing you a module that I put together that makes working with runspaces a lot easier. Note   This is a four-part series that includes the following posts: There are some great scripts out there that provide a tool to work with runspaces, such as Invoke-Parallel. I wanted to come up with something that would provide a famil...

PowerTip: Add Custom Function to Runspace Pool
Nov 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Add Custom Function to Runspace Pool

Doctor Scripto

Summary: Boe Prox shows how to add a custom function to a runspace pool. How can I use Windows PowerShell to add a custom function to a runspace pool? Use the following approach:#Custom FunctionFunction ConvertTo-Hex {    Param([int]$Number)    '0x{0:x}' -f $Number}#Get body of function$Definition = Get-Content Function:\ConvertTo-Hex -ErrorAction Stop#Create a sessionstate function entry$SessionStateFunction = New-Object System.Management.Automation.Runspaces.SessionStateFunctionEntry -ArgumentList 'ConvertTo-Hex', $Definition#Create a SessionStateFunction$InitialSessionSt...

Beginning Use of PowerShell Runspaces: Part 3
Nov 28, 2015
Post comments count 8
Post likes count 0

Beginning Use of PowerShell Runspaces: Part 3

Doctor Scripto

Summary: Boe Prox shows us some tips about using runspace pools for multithreading. Honorary Scripting Guy and Cloud and Datacenter Management MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. Note   This is a four-part series that includes the following posts: After spending the past couple of days working with runspaces and looking at how we can use parameters and arguments to supply variables to our runspaces, we are taking the next step in our journey by looking at runspace pools to do some multithreading with multiple commands. The process for working with...

PowerTip: Get the Async Object Created by BeginInvoke
Nov 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Get the Async Object Created by BeginInvoke

Doctor Scripto

Summary: Boe Prox shows how retrieve a seemingly lost Async object from a runspace. How can I get the seemingly lost Async object created by BeginInvoke? Use Reflection to pull this information out of a Runspace object and get the Async object, which is required            to use with EndInvoke().$Runspace = [runspacefactory]::CreateRunspace()$PowerShell = [powershell]::Create()$Runspace.Open()$PowerShell.Runspace = $Runspace[void]$PowerShell.AddScript({    [pscustomobject]@{        Name = 'Boe ...

Beginning Use of PowerShell Runspaces: Part 2
Nov 27, 2015
Post comments count 0
Post likes count 0

Beginning Use of PowerShell Runspaces: Part 2

Doctor Scripto

Summary: Boe Prox presents some tips about beginning use with runspaces. Honorary Scripting Guy and Cloud and Datacenter Management MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. Note   This is a four-part series that includes the following posts: Yesterday, we spent some time looking at how we can create a runspace that can be used to run a command in the background while leaving our console wide open for us to continue running commands. Although using what we have learned will make it easier to push commands to the background, we are currently limited to o...

PowerTip: Find Current Runspaces in PowerShell
Nov 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Current Runspaces in PowerShell

Doctor Scripto

Summary: Boe Prox shows how to find the current runspaces in Windows PowerShell.  How can I list all of the currently running runspaces in Windows PowerShell? Use the Get-Runspace cmdlet in Windows PowerShell 5.0:Get-RunspaceId Name      ComputerName    Type      State       Availability--   ----            ------------            ----        -----         ------------ 1 Runspace1  ...

Beginning Use of PowerShell Runspaces: Part 1
Nov 26, 2015
Post comments count 0
Post likes count 0

Beginning Use of PowerShell Runspaces: Part 1

Doctor Scripto

Summary: Boe Prox presents some tips about beginning use with runspaces. Honorary Scripting Guy and Cloud and Datacenter Management MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. Note   This is a four-part series that includes the following posts: Let's say you are working in PowerShell and you want to kick off something to run in the background while you are working on some other things in the console. You would usually use something related to PSJobs, such as the *-Job cmdlets. Or you might use the –Asjob parameter that you see in some cmdlets, such as Get...

PowerTip: Create Function List and Find PowerShell Files
Nov 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Create Function List and Find PowerShell Files

Doctor Scripto

Summary: Use Windows PowerShell to create a function list and find files.  How can I use Windows PowerShell to avoid repetitively typing “ls . –r *.ps1” to get a list of PowerShell files and then           “ls . –r *.ps1 | sls function” to search the content of those files for a string?  Add this function to your PowerShell profile: function fps ($find) {         "Get-ChildItem . -Recurse *.ps1 $(if($find) { "| Select-String $find" })" |        ...

Introducing the PowerShell Excel Module
Nov 25, 2015
Post comments count 0
Post likes count 0

Introducing the PowerShell Excel Module

Doctor Scripto

Summary: Guest blogger, Doug Finke talks about his PowerShell Excel module. The PowerShell Excel Module is a brand new, exciting, and better way to interact with Microsoft Excel from Windows PowerShell. Plus for bonus points, you don’t need Excel installed on the target machine to create the spreadsheet. Many users of this module generate Excel spreadsheets on servers, and then others in the company pick up the reports from a central server. Or for the last step in their script, they can mail the .xlsx file. The challenge Until now, there have been a few ways to get data into Excel. One way is to creat...

Introducing the PowerShell Excel Module
Nov 25, 2015
Post comments count 0
Post likes count 1

Introducing the PowerShell Excel Module

Doctor Scripto

Summary: Guest blogger, Doug Finke talks about his PowerShell Excel module.The PowerShell Excel Module is a brand new, exciting, and better way to interact with Microsoft Excel from Windows PowerShell. Plus for bonus points, you don’t need Excel installed on the target machine to create the spreadsheet. Many users of this module generate Excel spreadsheets on servers, and then others in the company pick up the reports from a central server. Or for the last step in their script, they can mail the .xlsx file.The challengeUntil now, there have been a few ways to get data into Excel. One way is to create a comm...

PowerTip: Store Current Pipeline Value in Variables with PowerShell
Nov 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Store Current Pipeline Value in Variables with PowerShell

Doctor Scripto

Summary: Use PowerShell to store current pipeline values in variables. How can I use Windows PowerShell to improve my code by storing the current pipeline value into variables? Use the new PipelineVariable common parameter, for example:Get-Counter -ListSet 'LogicalDisk','SQLServer:Buffer Manager','SQLServer:Memory Manager' -PipelineVariable CounterCategory | Select-Object -ExpandProperty Counter -PipelineVariable CounterName |Where-Object {$CounterName -match '(sec/Transfer|Avg. Disk Queue Length|Buffer Cache|CheckPoint|Target Server|Total)'} | Select-Object   @{E={$CounterCategory.Counte...

Automating Index Fragmentation Reports
Nov 24, 2015
Post comments count 0
Post likes count 0

Automating Index Fragmentation Reports

Doctor Scripto

Summary: Guest blogger, Laerte Junior discusses how to use PowerShell to automate an index fragmentation report and generate an Excel file.One of the day-to-day tasks of a DBA is to maintain your environment. This task includes checking the fragmentation of indexes. In this post, I will show how to automate this collection and generate an Excel file.Environment considerationsFor this particular script, I am assuming that like me, you use a central “collector” machine. For that, you have installed SQL Server 2012 or later, Excel, and Windows PowerShell 4.0 or later. Yes! I will use some coding features...

Automating Index Fragmentation Reports
Nov 24, 2015
Post comments count 0
Post likes count 0

Automating Index Fragmentation Reports

Doctor Scripto

Summary: Guest blogger, Laerte Junior discusses how to use PowerShell to automate an index fragmentation report and generate an Excel file.One of the day-to-day tasks of a DBA is to maintain your environment. This task includes checking the fragmentation of indexes. In this post, I will show how to automate this collection and generate an Excel file.Environment considerationsFor this particular script, I am assuming that like me, you use a central “collector” machine. For that, you have installed SQL Server 2012 or later, Excel, and Windows PowerShell 4.0 or later. Yes! I will use some coding features...

PowerTip: Use PowerShell to Generate Object with Two Property Types
Nov 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Generate Object with Two Property Types

Doctor Scripto

Summary: Use Windows PowerShell to generate an object with two property types. How can I use Windows PowerShell to generate an object with two property types from simply splitting a string? Use the ConvertFrom-String cmdlet to pipe a string, and then specify the desired property types, for example:PS C:\>“123 456” | ConvertFrom-String –PropertyType String,Int 

PowerTip: Use PowerShell to Generate Object with Two Property Types
Nov 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Generate Object with Two Property Types

Doctor Scripto

Summary: Use Windows PowerShell to generate an object with two property types.  How can I use Windows PowerShell to generate an object with two property types from simply splitting a string?  Use the ConvertFrom-String cmdlet to pipe a string, and then specify the desired property types, for example: PS C:\>“123 456” | ConvertFrom-String –PropertyType String,Int  

Get Wireless Network SSID and Password with PowerShell
Nov 23, 2015
Post comments count 0
Post likes count 0

Get Wireless Network SSID and Password with PowerShell

Doctor Scripto

Summary: Jason Walker explores using Windows PowerShell to get the SSID and password for a wireless network. Ed Wilson, Microsoft Scripting Guy is here. Today I'm turning over the keyboard to Jason Walker. Jason is an Office 365 deployment consultant, who assists customers in the public sector arena. Here's Jason... Let me start off with a scenario. You are somewhere, anywhere, and a friend of yours asks you for the password to a wireless network. This could be the wireless network at your house or a hotspot. What do you do? In Windows 7, you could easily get that from a viewable preferred wireless netw...

PowerTip: Find Expiring Certificates by Using PowerShell
Nov 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Expiring Certificates by Using PowerShell

Doctor Scripto

Summary: Boe Prox shows how you can find certificates that are expiring.  How can I find if I have any certificates on my system that are expiring within 30 days?  Use the ExpiringInDays dynamic parameter when working with the certificate provider, for example: Get-ChildItem Cert:\LocalMachine\My\ -ExpiringInDays 30 | Select-Object Thumbprint, Subject, NotAfter

Weekend Scripter: Report on Network Level Authentication
Nov 22, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Report on Network Level Authentication

Doctor Scripto

Summary: Boe Prox shows how to use Windows PowerShell to report on Network Level Authentication. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. I plan to spend this Sunday showing you how you can report on whether your systems are enabled for Network Level Authentication. By using PowerShell, we can make some amazing scripts and functions that can do a variety of things. Whether we want to build a complex workflow to provision a system, use Desired State Configuration to configure many systems, or even build a UI, we can pretty much do any...

PowerTip: Find Free Commands in PowerShell 5
Nov 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Free Commands in PowerShell 5

Doctor Scripto

Summary: Learn how to find free commands in Windows PowerShell 5.0.  I would like to customize my command line experience in Windows PowerShell 5.0, but I don’t want to write            a lot of code. How can I find available commands that are not bound to any keyboard chord sequence?  Use the Get-PSReadlineKeyHandler and look for unbound commands: (Get-PSReadlineKeyHandler).where({$_.key -eq 'unbound'})

Weekend Scripter: The Case of the Disappearing PowerShell Console
Nov 21, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: The Case of the Disappearing PowerShell Console

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about fixing a problem where his Windows PowerShell console disappears. Microsoft Scripting Guy, Ed Wilson, is here. So there I was, on a two week trip, out of time, with only my laptop, and I needed to use Windows PowerShell. Most of the time, I use the Windows PowerShell console, but I do occasionally use the Windows PowerShell ISE. At home, I have a nice-sized second monitor that is attached to my laptop—but I do not—actually the truth is, I rarely travel with my second monitor. I have been known to take it with me on a road trip. So I click to ope...

PowerTip: Use PowerShell to Show Deployment Types for Application
Nov 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show Deployment Types for Application

Doctor Scripto

Summary: Use the Configuration Manager cmdlets to identify all deployment types for an application.  How can I use Windows PowerShell to pull up a list of all deployment types for one of my applications?  Use the Get-CmDeploymentType cmdlet and supply the application name in question, for example: Get-CmDeploymentType –ApplicationName ‘HSG Application’ | Select-Object LocalizedDisplayName

PowerShell and Configuration Manager 2012 R2–Part 5
Nov 20, 2015
Post comments count 0
Post likes count 0

PowerShell and Configuration Manager 2012 R2–Part 5

Doctor Scripto

Summary: Use the Configuration Manager cmdlets to create an application. Oh, Scripting Guy! I want to get home at a decent hour today, but I need to bring this massive list of applications into Configuration Manager. I heard the Configuration Manager cmdlets can do this, but I need some help. So…er…*Cough*...HELP! —TR Hello TR, Honorary Scripting Guy, Sean Kearney, is here today to help you. I know vividly what you’re talking about. I’ve had to do the same thing.  Note  This is a five-part series that includes the following posts: Configuration Manager is a great environme...

PowerTip: Use PowerShell to Identify Network Drivers in Configuration Manager
Nov 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Identify Network Drivers in Configuration Manager

Doctor Scripto

Summary: Use the Configuration Manager cmdlets in Windows PowerShell to identify all network drivers.  I deal with drivers detection issues in Windows PE because we have too many network card drivers.           How can I use Windows PowerShell to quickly show all of the network drivers in Configuration Manager?  Use the Get-CmDriver cmdlet and filter on the DriverClass property, for example: $DriverClass=’Net’ Get-CmDriver | Where { $_.DriverClass –match $DriverClass } You can pipe this object to Select-Object to choose the in...

PowerShell and Configuration Manager 2012 R2–Part 4
Nov 19, 2015
Post comments count 0
Post likes count 0

PowerShell and Configuration Manager 2012 R2–Part 4

Doctor Scripto

Summary: Use the Configuration Manager cmdlets to work with driver packages.  Hey, Scripting Guy! My current job involves creating packages in Configuration Manager 2012. Is there some way to automate the process? It’s not that it’s actually difficult, but it is a very repeatable process. I thought to myself, “Repeatable? This sounds like a job for PowerShell!" Help out a friend and tell me there are cmdlets to do this. —KB  Hello KB, Honorary Scripting Guy, Sean Kearney, is here today with relief for you. Yes, there are cmdlets for that! If you’ve been following along this week, you have seen t...

PowerTip: Get List of Distribution Points with PowerShell
Nov 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Get List of Distribution Points with PowerShell

Doctor Scripto

Summary: Use the PowerShell cmdlets in Configuration Manager to pull a list of all distribution points.  How can I get an easy-to-read list of the distribution points in a site?  Load the Configuration Manager 2012 cmdlets, and run the following one-liner in PowerShell: Get-CMDistributionPoint | Select-Object NetworkOsPath,RoleName,SiteCode

PowerShell and Configuration Manager 2012 R2–Part 3
Nov 18, 2015
Post comments count 0
Post likes count 0

PowerShell and Configuration Manager 2012 R2–Part 3

Doctor Scripto

Summary: Use the Configuration Manager cmdlets to update applications in distribution points.  Hey, Scripting Guy! I’m forever having the nightmare of going clickity, click, click, click when I’m working with my distribution points—especially when updating applications and packages. There must be some way to do this in Windows PowerShell. Can you help me? —DS  Hello DS, Honorary Scripting Guy, Sean Kearney, is here, shedding more light on the Configuration Manager cmdlets!  Note  This is a five-part series that includes the following posts: I feel your pain. Whenever I ...

PowerTip: List Collections in Configuration Manager
Nov 17, 2015
Post comments count 0
Post likes count 0

PowerTip: List Collections in Configuration Manager

Doctor Scripto

Summary: Use the Configuration Manager cmdlets to show all available User and Device collections.  How can I use Windows PowerShell to list all the available User and Device collections in Configuration Manager 2012,            and then export the list to a file?  Use the Get-CMCollection cmdlet with Export-CSV, for example: Get-CMCollection | Export-CSV Collectionlist.csv

PowerShell and Configuration Manager 2012 R2–Part 2
Nov 17, 2015
Post comments count 0
Post likes count 0

PowerShell and Configuration Manager 2012 R2–Part 2

Doctor Scripto

Summary: Use the Configuration Manager cmdlets to work with site collections.  Hey, Scripting Guy! I deal with Configuration Manager on a regular basis, and I have to manage User and Device collections. I’d like an easier way to add and remove members and audit the memberships of site collections. Could you show me how to do that with the cmdlets in Configuration Manager? —RL A: Hello RL, Honorary Scripting Guy, Sean Kearney, is here to further delve into some basic uses of those ever so magical Configuration Manager cmdlets.  Note  This is a five-part series that includes the following posts: ...

PowerTip: Find Version of Configuration Manager
Nov 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Version of Configuration Manager

Doctor Scripto

Summary: Use PowerShell cmdlets to identify the current version and build number of a Configuration Manager site.  How can I use Windows PowerShell to find the current version and build number for a client's            Configuration Manager site?  When you have the cmdlets for Configuration Manager 2012 or later loaded into the Windows PowerShell            console, execute this line to display the information: Get-CmSite | Select-Object Servername,SiteCode,BuildNumber,Version

PowerShell and Configuration Manager 2012 R2–Part 1
Nov 16, 2015
Post comments count 0
Post likes count 0

PowerShell and Configuration Manager 2012 R2–Part 1

Doctor Scripto

Summary: Load the Configuration Manager cmdlets and make a basic site connection.  Hey, Scripting Guy! I’ve been doing a lot of work in the Configuration Manager 2012 R2 console and it’s beautiful. But I find I spend a lot of my time clicking all over the place and repeating tasks. Are there PowerShell cmdlets available that I can use? —SH  Hello SH, Honorary Scripting Guy, Sean Kearney, is here today to give you the answer you want, which is, “Yes!” There absolutely are cmdlets for Windows PowerShell in Configuration Manager 2012 R2, and boy, are they cool! I’ve had to do some repetitive tasks in ...

PowerTip: Move PowerShell ISE Command Pane Left
Nov 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Move PowerShell ISE Command Pane Left

Doctor Scripto

Summary: Show the Windows PowerShell ISE command pane on the left side of the screen.  How can I split the PowerShell ISE screen vertically so I can see the screen pane on the right and the            command pane on the left?  To show a vertical configuration, select Show Script Pane Right from the View menu. Or use <CTRL-2>            to show the script pane on the right, and use <CTRL-1>to go back to the horizontal configuration.

Weekend Scripter: Great PowerShell ISE Features for Beginners
Nov 15, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Great PowerShell ISE Features for Beginners

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about some of the greatest Windows PowerShell ISE features for beginners. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about the Windows PowerShell ISE is that it can help a wide level of scripters. For example, if you are very experienced with Windows PowerShell, there is an API that can be used to create your own add-ons for the Windows PowerShell ISE. This can help to smooth many of the rough spots that sometimes annoy users of the Windows PowerShell ISE. I love this feature. But when I am teaching Windows PowerShell to beginners, I don...

PowerTip: Toggle Command Add-on in PowerShell ISE
Nov 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Toggle Command Add-on in PowerShell ISE

Doctor Scripto

Summary: Learn how to enable the Command Add-on for the Windows PowerShell ISE.  I use different computers, and the Command Add-on is displayed only sometimes. I would like to display            this add-on as required. How can I do this?  Select Show Command Add-on from the View menu in the Windows PowerShell ISE.

Weekend Scripter: PowerShell ISE Not Only for Scripts
Nov 14, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell ISE Not Only for Scripts

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about why you may want to use the Windows PowerShell ISE instead of the console.Microsoft Scripting Guy, Ed Wilson, is here. I was speaking at a Windows PowerShell user group recently. After the presentation, someone came up to me and said that the Windows PowerShell ISE was rather confusing. Because he did not write scripts, he had not taken the time to learn how to use the ISE. Instead, if any Windows PowerShell needed “to be done,” he simply opened the Windows PowerShell console, typed away—and that was that.Cool. I use the Windows PowerShell...

PowerTip: Revert PowerShell ISE Token Values
Nov 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Revert PowerShell ISE Token Values

Doctor Scripto

Summary: Learn how to revert Windows PowerShell ISE token values to default values.  I have been playing with token colors in the Windows PowerShell ISE and things are confused.            How can I use Windows PowerShell to change back to default values.?  Use the RestoreDefaultTokenColors method from the Options object: $psISE.Options.RestoreDefaultTokenColors()

Set PowerShell ISE to Default Values
Nov 13, 2015
Post comments count 0
Post likes count 0

Set PowerShell ISE to Default Values

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about resetting the Windows PowerShell ISE settings to the defaults. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about Windows PowerShell is that it is highly configurable. Not only the things that I can configure, but Windows PowerShell itself. The behaviors in the Windows PowerShell console and the Windows PowerShell ISE can be quickly changed. One of the best ways to do this is to use a Windows PowerShell profile. I like to create specific profiles for certain environments instead of one big monolithic profile. In fact, I like to use m...

PowerTip: Toggle Outlining View in PowerShell ISE
Nov 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Toggle Outlining View in PowerShell ISE

Doctor Scripto

Summary: Toggle between outlining view in the Windows PowerShell ISE. How can I switch to the outlining view in the Windows PowerShell ISE to collapse           the functions so it is easier to read the code?   Use the ToggleOutliningExpansion function from the Editor object, for example:$psise.CurrentFile.Editor.ToggleOutliningExpansion()

PowerTip: Toggle Outlining View in PowerShell ISE
Nov 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Toggle Outlining View in PowerShell ISE

Doctor Scripto

Summary: Toggle between outlining view in the Windows PowerShell ISE.  How can I switch to the outlining view in the Windows PowerShell ISE to collapse           the functions so it is easier to read the code?    Use the ToggleOutliningExpansion function from the Editor object, for example: $psise.CurrentFile.Editor.ToggleOutliningExpansion()

Use Regions in PowerShell ISE
Nov 12, 2015
Post comments count 0
Post likes count 0

Use Regions in PowerShell ISE

Radhika Tadinada

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using regions in the Windows PowerShell ISE.  Hey, Scripting Guy! I like using the Windows PowerShell ISE. The price is right I guess. There is one thing that kind of bugs me, however.  When I am writing a long script, there is too much scrolling, and things seem to slow down. I wish there was a way that I did not have to deal with lines and lines of script. I guess I can move the functions into a module, but that adds more complexity than I want in my life right now. Is there something that can help? —RR  Hello RR, Microsoft Scripting Guy, Ed W...

Use Regions in PowerShell ISE
Nov 12, 2015
Post comments count 0
Post likes count 0

Use Regions in PowerShell ISE

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using regions in the Windows PowerShell ISE. Hey, Scripting Guy! I like using the Windows PowerShell ISE. The price is right I guess. There is one thing that kind of bugs me, however.  When I am writing a long script, there is too much scrolling, and things seem to slow down. I wish there was a way that I did not have to deal with lines and lines of script. I guess I can move the functions into a module, but that adds more complexity than I want in my life right now. Is there something that can help?—RR Hello RR,Microsoft Scripting Guy,...

PowerTip: Find the PowerShell ISE Default Options
Nov 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Find the PowerShell ISE Default Options

Doctor Scripto

Summary: Learn how to find the Windows PowerShell ISE default options. How can I find the default options for  the Windows PowerShell ISE object model? Use the ISEOptions object:$psise.Options.DefaultOptions

Ed Wilson Joins the PowerScripting PodCast Tonight
Nov 11, 2015
Post comments count 0
Post likes count 0

Ed Wilson Joins the PowerScripting PodCast Tonight

Doctor Scripto

Summary: Tune-in to the PowerScripting PodCast tonight to hear the Scripting Guy!Ed Wilson, Microsoft Scripting Guy, will be on the PowerScripting PodCast tonight, November 11, 2015. He will talk about his new PowerShell Step-by-Step book, his new job, and lots of other things.Although the show will be recorded, you can tune-in live to chat with Hal, Jon, Ed, and others during the PodCast recording. It will be great fun, informative, and much better than watching an old rerun of Scooby Doo.For more information, see Tonight: Ed Wilson returns to the PowerScripting Podcast!

PowerTip: Find the PowerShell ISE Default Options
Nov 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Find the PowerShell ISE Default Options

Doctor Scripto

Summary: Learn how to find the Windows PowerShell ISE default options.  How can I find the default options for  the Windows PowerShell ISE object model?  Use the ISEOptions object: $psise.Options.DefaultOptions

Automatically Keep Log of PowerShell ISE Commands
Nov 11, 2015
Post comments count 0
Post likes count 0

Automatically Keep Log of PowerShell ISE Commands

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using the new transcript command in the Windows PowerShell ISE.  Hey, Scripting Guy! I might be alone in this, but I love using the transcript tool in the Windows PowerShell console. I really wish I could have a transcript in the Windows PowerShell ISE because that is what I use to write scripts. But every time I try to use it, I get a bogus error message that says basically, "Go jump in a lake." How rude. I am just complaining, and I really don’t expect that there is anything you can actually do about this sad state of affairs. Oh, yea...

PowerTip: Change Font Size in PowerShell ISE
Nov 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Change Font Size in PowerShell ISE

Doctor Scripto

Summary: Learn how to change the font size in the Windows PowerShell ISE.  How can I use a Windows PowerShell command to change the font size in my Windows PowerShell ISE?  Use the $psISE object option, and assign a new number for FontSize property, for example: $psISE.Options.FontSize = 12

Use PowerShell to Set Up the ISE
Nov 10, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Set Up the ISE

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to set up the ISE. Hey, Scripting Guy! I am so excited—really excited! I have been selected to speak at a SQL Saturday event about Windows PowerShell. I could not have done it without you. I read your stuff every day, actually twice a day, and I come back to it during the day to help me with things I need to do. I never thought I would be talking about Windows PowerShell.So I have a question, naturally. I would like to set up the ISE in my first script. I know how to run a script to set up my scratch folder, my working fo...

PowerTip: Change PowerShell ISE Foreground Color
Nov 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Change PowerShell ISE Foreground Color

Doctor Scripto

Summary: Programatically change the foreground color in the Windows PowerShell ISE. How can I change the foreground color in the Windows PowerShell ISE? Use $Host.UI.RawUI.ForegroundColor and assign a new color. For example, to change it to cyan, use:$Host.UI.RawUI.ForegroundColor = 'cyan'

PowerTip: Change PowerShell ISE Foreground Color
Nov 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Change PowerShell ISE Foreground Color

Doctor Scripto

Summary: Programatically change the foreground color in the Windows PowerShell ISE.  How can I change the foreground color in the Windows PowerShell ISE?  Use $Host.UI.RawUI.ForegroundColor and assign a new color. For example, to change it to cyan, use: $Host.UI.RawUI.ForegroundColor = 'cyan'

Change Display Output Colors in PowerShell ISE
Nov 9, 2015
Post comments count 0
Post likes count 0

Change Display Output Colors in PowerShell ISE

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about changing the output console colors in the Windows PowerShell ISE. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I like about using the Write-Host cmdlet is that I can change the color of a line that writes to the Windows PowerShell console. But, what if I want to change the entire output console so that the output is really obvious? I can also do that on the fly by using the $host object. As shown here, the $host object returns a number of properties, and it contains a number of other objects: PS C:\Users\mredw> $host Name  ...

Change Display Output Colors in PowerShell ISE
Nov 9, 2015
Post comments count 0
Post likes count 0

Change Display Output Colors in PowerShell ISE

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about changing the output console colors in the Windows PowerShell ISE.Microsoft Scripting Guy, Ed Wilson, is here. One of the things I like about using the Write-Host cmdlet is that I can change the color of a line that writes to the Windows PowerShell console. But, what if I want to change the entire output console so that the output is really obvious? I can also do that on the fly by using the $host object. As shown here, the $host object returns a number of properties, and it contains a number of other objects:PS C:\Users\mredw> $hostName   ...

PowerTip: Display Numeric ASCII Value of Letter
Nov 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Display Numeric ASCII Value of Letter

Doctor Scripto

Summary: Use Windows PowerShell to display the numeric ASCII value of a letter. How can I use Windows PowerShell to find the numeric ASCII value associated with a letter? Use [byte] and [char] together. The following example will display the numeric ASCII value of the capital letter A:[byte][char]'A'

Improve Your Writing for Blogs and Technical Articles
Nov 8, 2015
Post comments count 0
Post likes count 0

Improve Your Writing for Blogs and Technical Articles

Doctor Scripto

Summary: The Scripting Editor, Dia Reeves, offers tips to help you improve your writing. Microsoft Scripting Guy, Ed Wilson, is here. Today, I'm enlisting my editor, Dia Reeves, to help you write clear, concise, and consistent blog posts and feature documentation. Take it away Dia... Hello to all of you who have lost your content team (or never had one) and have discovered that you are now writers! Gone are the days where PMs wrote specs, devs wrote code, technical writers documented how to use features, and editors made everything cohesive. Let's hear it...group sighhhh... Additionally, blog writin...

Improve Your Writing for Blogs and Technical Articles
Nov 8, 2015
Post comments count 0
Post likes count 0

Improve Your Writing for Blogs and Technical Articles

Doctor Scripto

Summary: The Scripting Editor, Dia Reeves, offers tips to help you improve your writing.Microsoft Scripting Guy, Ed Wilson, is here. Today, I'm enlisting my editor, Dia Reeves, to help you write clear, concise, and consistent blog posts and feature documentation. Take it away Dia...Hello to all of you who have lost your content team (or never had one) and have discovered that you are now writers! Gone are the days where PMs wrote specs, devs wrote code, technical writers documented how to use features, and editors made everything cohesive.Let's hear it...group sighhhh...Additionally, blog writing has become commo...

PowerTip: Replace Non-Alphabetic Characters in String
Nov 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Replace Non-Alphabetic Characters in String

Doctor Scripto

Summary: Use Windows PowerShell to replace non-alphabetic characters in a string. How can I use Windows PowerShell to replace a string that contains non-alphabetic characters            (such as commas and periods)? Use the –Replace operator, and specify a regex pattern '[^a-zA-Z]', for example:$a = 'Never a foot too far, even.'$a -Replace '[^a-zA-Z]',''

PowerTip: Replace Non-Alphabetic Characters in String
Nov 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Replace Non-Alphabetic Characters in String

Doctor Scripto

Summary: Use Windows PowerShell to replace non-alphabetic characters in a string.  How can I use Windows PowerShell to replace a string that contains non-alphabetic characters            (such as commas and periods)?  Use the –Replace operator, and specify a regex pattern '[^a-zA-Z]', for example: $a = 'Never a foot too far, even.' $a -Replace '[^a-zA-Z]',''

Weekend Scripter: Exploring Palindrome Sentences with PowerShell
Nov 7, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Exploring Palindrome Sentences with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about identifying palindromes that are more than a single word. Microsoft Scripting Guy, Ed Wilson, is here. One of the coolest things about palindromes is that they can be formed with sentences. It is also what makes them the most subtle. For example, whereas it is pretty obvious that mom, dad, and the name bob are all the same forward and backward, it is not so obvious that the sentence “Never a foot too far, even” is also considered a palindrome. I mean, if I stand on my head, and hold my ear just so, maybe I get it. Clearly, this is a job for Win...

Weekend Scripter: Exploring Palindrome Sentences with PowerShell
Nov 7, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Exploring Palindrome Sentences with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about identifying palindromes that are more than a single word.Microsoft Scripting Guy, Ed Wilson, is here. One of the coolest things about palindromes is that they can be formed with sentences. It is also what makes them the most subtle. For example, whereas it is pretty obvious that mom, dad, and the name bob are all the same forward and backward, it is not so obvious that the sentence “Never a foot too far, even” is also considered a palindrome. I mean, if I stand on my head, and hold my ear just so, maybe I get it. Clearly, this is a job for Windo...

PowerTip: Find if Variable Is Array
Nov 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Find if Variable Is Array

Doctor Scripto

Summary: Use Windows PowerShell to find if a variable is an array.  How can I use Windows PowerShell to find if a variable contains an array?  Use the –is operator, and test to see if it is a type of [array], for example: $a = 1,2,4,5,6,7 $a -is [array]

PowerTip: Find if Variable Is Array
Nov 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Find if Variable Is Array

Doctor Scripto

Summary: Use Windows PowerShell to find if a variable is an array.  How can I use Windows PowerShell to find if a variable contains an array?  Use the –is operator, and test to see if it is a type of [array], for example: $a = 1,2,4,5,6,7 $a -is [array]

Use PowerShell to Find Palindromes
Nov 6, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Find Palindromes

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to find palindromes. Microsoft Scripting Guy, Ed Wilson, is here. I enjoy playing around with words. I like words that sound similar to each other, such as to, too, and two. I also like words that look alike, and sound alike but have different meanings depending on the context, such as might and might. Of course, there is also mite, which goes back into the previous category of words that sound alike. There are also words that look alike, but are pronounced differently depending on the context (which also, of course, alters the mean...

PowerTip: Use PowerShell to Display ASCII Characters
Nov 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display ASCII Characters

Doctor Scripto

Summary: Use Windows PowerShell to display ASCII characters.  How can I use Windows PowerShell to quickly display printable ASCII characters when I am not connected            to the Internet?  Use the range operator to create a range of numbers 1 through 128, pipe it to Foreach-Object (% is the alias),            and display the current object and the [char] value on the pipeline, for example: 1..128 | %{"$_ $([char]$_)"}

Generate Random Letters with PowerShell
Nov 5, 2015
Post comments count 0
Post likes count 0

Generate Random Letters with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about generating random letters with Windows PowerShell.  Hey, Scripting Guy! I need to generate a string of random letters. These letters need to be five characters long, and they should be either upper case or lower case. I do not need any numbers or special characters. In fact, my strings should not contain any special characters—only upper case and lower case letters. I have spent several days on this, and it is not working. I am not looking for a random password generator; I have a rather special application for this. Can you help me? —BG &n...

PowerTip: Use PowerShell to Mount ISO Image
Nov 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Mount ISO Image

Doctor Scripto

Summary: Learn how to use Windows PowerShell to mount ISO images. How can I use Windows PowerShell to mount an ISO image so I can see what it contains? Use the Mount-DiskImage cmdlet and specify a path to the ISO file, for example:Mount-DiskImage -ImagePath C:\Data\en_office_professional_plus_2016_x86_x64_dvd.iso

PowerTip: Use PowerShell to Mount ISO Image
Nov 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Mount ISO Image

Doctor Scripto

Summary: Learn how to use Windows PowerShell to mount ISO images.  How can I use Windows PowerShell to mount an ISO image so I can see what it contains?  Use the Mount-DiskImage cmdlet and specify a path to the ISO file, for example: Mount-DiskImage -ImagePath C:\Data\en_office_professional_plus_2016_x86_x64_dvd.iso

PowerTip: Use PowerShell to Mount ISO Image
Nov 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Mount ISO Image

Doctor Scripto

Summary: Learn how to use Windows PowerShell to mount ISO images.  How can I use Windows PowerShell to mount an ISO image so I can see what it contains?  Use the Mount-DiskImage cmdlet and specify a path to the ISO file, for example: Mount-DiskImage -ImagePath C:\Data\en_office_professional_plus_2016_x86_x64_dvd.iso

Reverse Strings with PowerShell
Nov 4, 2015
Post comments count 0
Post likes count 1

Reverse Strings with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to reverse strings. Hey, Scripting Guy! I am working with Windows PowerShell, and I need to reverse a string. I am surprised there is no reverse method in the string class. It seems like a major oversight. Anyway, can you show me how to do this easily?—SS Hello SS,Microsoft Scripting Guy, Ed Wilson, is here. This week is an awesome week. The MVP Summit is going on, and the Scripting Wife is in Bellevue/Redmond/Seattle hanging with thousands of MVPs from around the world. She keeps sending me text messages, like, "Dud...

PowerTip: Display Network Adapter Binding
Nov 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Display Network Adapter Binding

Doctor Scripto

Summary: Use Windows PowerShell to display network adapter binding.  How can I use Windows PowerShell to display a list of network adapter binding?  In Windows 10, use the Get-NetworkAdapterBinding cmdlet in Windows PowerShell 5.0.

Long String Running
Nov 3, 2015
Post comments count 0
Post likes count 0

Long String Running

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using a compound string command. Microsoft Scripting Guy, Ed Wilson, is here. The other day, the Scripting Wife and I headed to Nashville for a couple of speaking engagements. We decided to head through Alabama instead of going through Atlanta for a couple of reasons. We have never driven the length of Alabama, so we were looking for a bit of different scenery. Secondly, because we always spend a couple of hours trying to drive through Atlanta and all of the associated communities in the greater Atlanta metropolitan area (hmmmm….Gamma)? Anyway, it wa...

PowerTip: Create Pop-up Message with PowerShell
Nov 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Create Pop-up Message with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to easily create a pop-up message.  How can I use Windows PowerShell to create a pop-up message?  Use Out-GridView, and pipe your message string to it, for example: "popup message" | Out-GridView -Title "message box"

Creating Pop-ups by Using PowerShell
Nov 2, 2015
Post comments count 0
Post likes count 0

Creating Pop-ups by Using PowerShell

Doctor Scripto

Summary: Guest blogger and PowerShell MVP, Chrissy LeMaire, talks about creating pop-ups with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Welcome today a brand new guest blogger, Chrissy LeMaire. Chrissy is a systems engineer and PowerShell MVP. Always an avid scripter, she attended the Monad session at the Microsoft Professional Developers Conference in Los Angeles in 2005. She has worked and played with PowerShell ever since. You can follow her on Twitter at @cl, and read more about her work with PowerShell on her blog, blog.netnerds.net:\>. Here’s Chrissy… A few weeks ago, I built ...

PowerTip: Reverse an Array with PowerShell
Nov 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Reverse an Array with PowerShell

Doctor Scripto

Summary: Learn how to reverse an array with Windows PowerShell.  How can I use Windows PowerShell to reverse the order of an array stored in a variable?  Use the static reverse method from the Array class, for example: $a = @(1,2,3) [array]::reverse($a)

Weekend Scripter: Exploring PowerShell Arrays
Nov 1, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Exploring PowerShell Arrays

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about Exploring Windows PowerShell arrays. Microsoft Scripting Guy, Ed Wilson, is here. One of the problems I had with Windows PowerShell when I first learned it was handling arrays. Why? Because they were so easy. Well, they are easy, but they are also a bit confusing. Why? Because Get-Member seems to hide the type, so I may have an array, and it will report string. But that is something I will talk about in a minute. First, let's look at creating an array. Create an array in PowerShell The easiest way to create an array is to simply create a variable and a...

PowerTip: Combine Arrays in PowerShell
Oct 31, 2015
Post comments count 0
Post likes count 0

PowerTip: Combine Arrays in PowerShell

Doctor Scripto

Summary: Learn how to combine two arrays in Windows PowerShell.  How can I use Windows PowerShell to combine two arrays stored in two different variables?  Use the + operator, for example:  [array]$a = @('a','b','c')  [array]$b = @(1,2,3)  [array]$c = $a + $b

PowerShell Spotlight: November 2015
Oct 31, 2015
Post comments count 0
Post likes count 0

PowerShell Spotlight: November 2015

Doctor Scripto

Summary: Guest blogger and PowerShell MVP, Teresa Wilson talks about Windows PowerShell community events.Microsoft Scripting Guy, Ed Wilson, is here. It is the last Saturday of October, and that means it is PowerShell Spotlight day with guest blogger, Teresa Wilson.Hello everyone. I hope you are having a scriptastic day! The MVP Summit starts tomorrow. I am looking forward to being in Washington with other MVPs and speaking with the PowerShell team.I know of three events on the horizon to let you know about. The first is on November 11. Ed Wilson will be the guest on the PowerScripting Podcast hosted by MVPs Hal ...

PowerTip: Use PowerShell to Back Up System Databases
Oct 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Back Up System Databases

Doctor Scripto

Summary: Use Windows PowerShell to back up system databases.  How can I use Windows PowerShell to dynamically back up all of the system databases on my servers?  Combining provider lookups with the Backup-SqlDatabase cmdlet makes this simple: $instances = @(‘KIRK’,’SPOCK’,’PICARD’,’RIKER’) foreach($instance in $instances){             $dbs = Get-ChildItem SQLSERVER:\SQL\$instance\DEFAULT\Databases -Force | Where-Object {$_.IsSystemObject -eq $true -and $_.Name -ne 'TempDB'}    ...

Use SQL Server PowerShell Provider for Fun and Profit
Oct 30, 2015
Post comments count 0
Post likes count 0

Use SQL Server PowerShell Provider for Fun and Profit

Doctor Scripto

Summary: Guest blogger, Mike Fal, talks about leveraging the SQL Server PowerShell provider. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Mike Fal. He blogged yesterday (see Getting Information from the SQL Server Provider with PowerShell), and he continues today... In my previous post, I covered how to gather and view data for our SQL Server components by using the SQL Server provider. Gathering this information is simple, just like looking up files in a directory. Being able to grab collection of SQL Server objects and display their properties exposes things quickly and easily for Po...

PowerTip: Use PowerShell to Find Versions of SQL Server
Oct 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Versions of SQL Server

Doctor Scripto

Summary: Use Windows PowerShell to find versions of SQL Server. How can I use Windows PowerShell to see all the versions of SQL Server I have installed? Use the provider and a list of instances to look them up as if they were files in a directory:$instances = @(‘KIRK’,’SPOCK’,’PICARD’,’RIKER’)$instances | ForEach-Object {Get-Item “SQLSERVER:\SQL\$_\DEFAULT”} | Select-Object Name,VersionString

PowerTip: Use PowerShell to Find Versions of SQL Server
Oct 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Versions of SQL Server

Doctor Scripto

Summary: Use Windows PowerShell to find versions of SQL Server.  How can I use Windows PowerShell to see all the versions of SQL Server I have installed?  Use the provider and a list of instances to look them up as if they were files in a directory: $instances = @(‘KIRK’,’SPOCK’,’PICARD’,’RIKER’) $instances | ForEach-Object {Get-Item “SQLSERVER:\SQL\$_\DEFAULT”} | Select-Object Name,VersionString

Getting Information from the SQL Server Provider with PowerShell
Oct 29, 2015
Post comments count 0
Post likes count 0

Getting Information from the SQL Server Provider with PowerShell

Doctor Scripto

Summary: Guest blogger, Mike Fal, talks about using the SQL Server provider with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. We have a new guest blogger today. Please welcome Mike Fal. Mike Fal. Mike has over 15 years of experience as a database administrator. He has worked for many different industries, including healthcare, software development, marketing, and manufacturing, and he has experience supporting databases from 1 GB to 5 TB in size. To follow him on Twitter, use @mike_fal. Windows PowerShell providers are an integral part of PowerShell, but their use is so subtle that s...

PowerTip: Use PowerShell to List all Azure Subscription Websites
Oct 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List all Azure Subscription Websites

Doctor Scripto

Summary: Use Windows PowerShell to list all of your Azure subscription websites.  How can I use Windows PowerShell to list all the websites in my Azure subscription that are using the new preview module?  After you have authenticated (Add-AzureRmAccount), run: Get-AzureRmResource -ResourceType Microsoft.Web/sites

Use PowerShell to Scale Azure Websites
Oct 28, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Scale Azure Websites

Doctor Scripto

Summary: Anders Wahlqvist talks about using Windows PowerShell to scale Azure websites. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post from Anders Wahlqvist. Anders is really active on Twitter—as a matter of fact, that is where we met. I saw references to his blog, read it, and found that he was a good writer and had a lot of excellent stuff to say. So I contacted him and asked if he would like to write for the Hey, Scripting Guy! Blog. Here is more about Anders: I work as a consultant at Lumagate focusing on automation and PowerShell. I have a very strong passion about automation a...

PowerTip: Encode String and Execute with PowerShell
Oct 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Encode String and Execute with PowerShell

Doctor Scripto

Summary: Learn how to encode a string into base64 and execute it with Windows PowerShell.  How can I encode a string into base64 and then run it via Windows PowerShell?  Use these commands: $string = {(Get-WindowsFeature).Where{$PSItem.Installed}}.ToString() $encodedcommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($string)) powershell.exe -EncodedCommand $encodedcommand

Using WinRM on Linux
Oct 27, 2015
Post comments count 0
Post likes count 0

Using WinRM on Linux

Doctor Scripto

Summary: Microsoft MVP, David O’Brien, talks about using the pywinrm module to execute Windows PowerShell from Linux. Microsoft Scripting Guy, Ed Wilson, is here. Today Windows PowerShell MVP, David O’Brien, talks about executing Windows PowerShell on Linux. Hi. I’m David O’Brien, Microsoft MVP for Windows PowerShell, and I was asked by Ed if I wanted to share some of my knowledge on his blog. Sure, cool idea! If you want to read more from me, head over to my personal blog or follow me on Twitter @david_obrien. I recently changed jobs. I am now not only managing and implementing the Window...

PowerTip: Use PowerShell Get-Command to Show Syntax
Oct 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell Get-Command to Show Syntax

Doctor Scripto

Summary: Use the Windows PowerShell Get-Command cmdlet to show syntax of cmdlets.  How can I use Windows PowerShell to explore the allowed syntax for a specific cmdlet?  Use the Get-Command cmdlet, and use the –syntax switch, for example: Get-Command Get-WinEvent -Syntax

Spelunking with Show-Object
Oct 26, 2015
Post comments count 0
Post likes count 0

Spelunking with Show-Object

Doctor Scripto

Summary: Guest blogger, Tim Warner, talks about using the Show-Object cmdlet. Microsoft Scripting Guy, Ed Wilson, is here. Today I have another guest post by Tim Warner. By the way, you can meet Tim and other PowerShell enthusiasts at the Nashville PowerShell user group meeting on Wednesday, October 28. I will be there making the presentation. The Scripting Wife will also be in attendance. Also in Nashville this week is Killer Nashville. I will be speaking at that conference too, but not about PowerShell. Hope to see you in Nashville. Take it away Tim... Spelunk [spi-luhngk], verb. To explore caves, especial...

PowerTip: Group PowerShell Cmdlet Count by Version
Oct 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Group PowerShell Cmdlet Count by Version

Doctor Scripto

Summary: Learn how to group Windows PowerShell cmdlet counts by version.  How can I see the version of the modules that contain various cmdlets in Windows PowerShell 5.0?  Use the Get-Command cmdlet to return all of the cmdlets, and then pipe the results to the Group-Object            cmdlet and group and sort by version. gcm | group version | sort version -Descending Note  gcm is an alias for Get-Command, group is an alias for Group-Object, and sort is an alias for Sort-Object.

Weekend Scripter: Test Performance of Event Log Queries—The Video
Oct 25, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Test Performance of Event Log Queries—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about comparing the performance of various Windows PowerShell event log queries.Microsoft Scripting Guy, Ed Wilson, is here. Today I present a video where I talk about examining the performance of various queries from the event log.Note  For more information about this technique, see Check Performance of Event Log Queries.Here is the video:  [View: is a link to the video if you would like to download it or watch it on another device: Use PowerShell to Measure the Performance of event log queries.I invite you to follow me on Twitter and Facebook. If...

PowerTip: Prompt for Input for PowerShell Script
Oct 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Prompt for Input for PowerShell Script

Doctor Scripto

Summary: Learn how to prompt for input for your Windows PowerShell script.  How can I use Windows PowerShell as an easy way to prompt a user for information for my script?  Use Read-Host, for example: $a = Read-Host -Prompt "enter your input" The users input is stored in the $a variable. Note  Depending on what you are doing, using unchecked user input for your script can be dangerous. It is best to limit user input to prespecified actions. The second best thing is to check the user input to ensure that it meets certain requirements.

Filtering Event Log Entries with PowerShell—The Video
Oct 24, 2015
Post comments count 0
Post likes count 0

Filtering Event Log Entries with PowerShell—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video that explores filtering event log entries with Windows PowerShell.Microsoft Scripting Guy, Ed Wilson, is here. Today I present a video where I talk about using a filter hash table to filter events from the event log.Note  For more information about this technique, see Filtering Event Log Events with PowerShell.Here is the video:  [View: is a link to the video if you would like to download it or watch it on another device: Using a Filter HashTable to parse event logs by Ed Wilson.Join me tomorrow when I will present a video about comparin...

PowerTip: Record Commands and Output from PowerShell
Oct 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Record Commands and Output from PowerShell

Doctor Scripto

Summary: Learn how to easily record commands and output from commands in Windows PowerShell.    How can I create a text file all commands and output from the commands that I use in Windows PowerShell?  Use the Start-Transcript cmdlet. To stop the transcript, use Stop-Transcript. Note  In Windows PowerShell 5.0 on Windows 10, Start-Transcript also works inside the Windows PowerShell ISE. In Windows PowerShell 4.0 and earlier it only works in the console.

Parsing Event Log Messages—The Video
Oct 23, 2015
Post comments count 0
Post likes count 0

Parsing Event Log Messages—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video about parsing Windows event log messages.Microsoft Scripting Guy, Ed Wilson, is here. Today I present a video where I talk about using a cmdlet to parse event log messages.     Note  For more information about this technique, see Easy Parsing of Messages with PowerShell.Here is the video:  [View: is a link to the video from YouTube if you would like to download it or play it offline in a different video player: Parse Event Log Messages with PowerShell by Ed Wilson.Join me tomorrow when I will present a video about using fi...

PowerTip: Measure Performance of PowerShell Command
Oct 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Measure Performance of PowerShell Command

Doctor Scripto

Summary: Measure how long it takes for a Windows PowerShell command to complete.    If I change one command to try to improve the speed of my Windows PowerShell script , how can I see if            that command is faster than the one I changed?  Use the Measure-Command cmdlet. For example, to see if Get-Date or [datetime]::now is faster,            place the command in a script block as shown here: Measure-Command -Expression {get-date} Measure-Command -Expression {[datetime]::now}

Check Performance of Event Log Queries
Oct 22, 2015
Post comments count 0
Post likes count 0

Check Performance of Event Log Queries

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about checking the performance of various event log queries. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about Windows PowerShell is that I can use Windows PowerShell to see how it is doing and how to optimize it. Sometimes the difference between one query and another query can be remarkable. So how can I do performance monitoring for a command? I use the Measure-Command cmdlet. Here is an example of such a command: Measure-Command -Expression {Get-EventLog -LogName application} This command uses the Get-EventLog cmdlet to read the entire...

PowerTip: Query Multiple Event Logs at Once
Oct 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Query Multiple Event Logs at Once

Doctor Scripto

Summary: Learn how to use Windows PowerShell to query multiple event logs at one time.  How can I use Windows PowerShell to query events that happened and may be in multiple event logs?  Use the Get-WinEvent cmdlet, specify the LogName parameter for both logs, and specify today            for the StartTime, for example: Get-WinEvent @{logname='application','system';starttime=[datetime]::today }

Event Log Queries Using PowerShell
Oct 21, 2015
Post comments count 0
Post likes count 0

Event Log Queries Using PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to query event logs. Microsoft Scripting Guy, Ed Wilson, is here. Today I talk a bit more about using Windows PowerShell to make queries from the event log. Although most large enterprises already have an event log monitoring application, at times it is useful to do these types of queries on your own. Keep in mind that this can generate a lot of network traffic and a decent amount of load if you are not cognizant of what is really going on. As I mentioned yesterday, this can be an area of hidden danger, such as the alligator that th...

PowerTip: Find PowerShell Superheroes
Oct 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Superheroes

Doctor Scripto

Summary: Follow the adventures of PowerShell superheroes.  How can I follow the adventures of a couple of PowerShell superheroes as they use PowerShell commands to solve            real world problems?  You want to follow the adventures of BATCHman and Cmdlet (the boy blunder) as they battle Tapeworm, the evil Hextor, and other problems that real-world admins face. You can find the series, written by Windows PowerShell MVP, Sean Kearney, on the Hey, Scripting Guy! Blog: BATCHman Series. To watch the video, see The Adventures of BATCHman and Cmdlet.

Filtering Event Log Events with PowerShell
Oct 20, 2015
Post comments count 0
Post likes count 0

Filtering Event Log Events with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about filtering event log events with the Get-WinEvent cmdlet.  Hey, Scripting Guy! I try to use the Get-WinEvent cmdlet to search event logs, but it is pretty hard to do. Also, I don’t see the nice switches that I had with Get-EventLog, so I don’t see why I should use the other cmdlet and have to pipe everything to Select-Object or Where-Object. —EG  Hello EG, Microsoft Scripting Guy, Ed Wilson, is here. One of the things that you need to realize is that with Windows PowerShell, one should always filter to the left of the pipeline. Th...

PowerTip: Get File System errors on NTFS Volumes with PowerShell
Oct 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Get File System errors on NTFS Volumes with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to get file system errors on all NTFS volumes.  How can I use Windows PowerShell to check your NTFS volumes for file system errors?  On Windows 10 with Windows PowerShell 5.0, use the Get-Volume cmdlet to retrieve all volumes and           pipe the output to the Get-VolumeCorruptionCount cmdlet, for example: Get-Volume | Get-VolumeCorruptionCount             Note  This command requires elevation.

Easy Parsing of Messages with PowerShell
Oct 19, 2015
Post comments count 0
Post likes count 0

Easy Parsing of Messages with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about parsing event message strings with Windows PowerShell.  Hey, Scripting Guy! I have seen people using different tools to find stuff in strings in Windows PowerShell, but it always looks complicated. Why is that? I thought Windows PowerShell was supposed to make things easier, but this looks really complicated. Where is the PowerShell advantage in all this? —BR  Hello BR, Microsoft Scripting Guy, Ed Wilson, is here. It is about a week away (actually October 28, 2015) that the Scripting Wife (Windows PowerShell MVP, Teresa Wilson) and I will be...

PowerTip: Produce List of Unique Processes with PowerShell
Oct 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Produce List of Unique Processes with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to filter out duplicate process names.  How can I use Windows PowerShell to easily get a unique list of processes running on my local computer?  Use Get-Process to retrieve the processes and pipe the output to Get-Unique: Get-Process | Get-Unique

Dude It’s a String—The Video
Oct 18, 2015
Post comments count 0
Post likes count 0

Dude It’s a String—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video to talk about working with strings in Windows PowerShell.Microsoft Scripting Guy, Ed Wilson, is here. Today I present a video where I talk about working with strings—in particular empty or null strings. I talk about the differences between empty, null, and white space in strings and present two static string methods that are always available to deal with the problem.   Note  For more information on these techniques, see Dude, a String Is a String in PowerShell.[View: is a link to the video from YouTube if you would like to download...

PowerTip: Use PowerShell to Display Number of Minutes in a Day
Oct 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Number of Minutes in a Day

Doctor Scripto

Summary: Use Windows PowerShell to display the number of minutes in a day.  How can I use Windows PowerShell to easily display how many minutes are in a day?  Create a timespan equal to one day, and then select the total minutes from it: (New-TimeSpan -Days 1).totalminutes

Use PowerShell to Parse Network Trace Logs—The Video
Oct 17, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Parse Network Trace Logs—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video to show how to use Windows PowerShell to parse network trace logs. Microsoft Scripting Guy, Ed Wilson, is here. Today I am presenting a video where I show how to use Windows PowerShell to parse network traces. The steps I show are common commands that will normally be run to set up and collect network tracing. I will talk about the following:    Note  For more information about this technique, see Use PowerShell to Parse Network Trace Logs. Also check out yesterday's video, Use PowerShell to Collect Network Traces. Here is the video:    [View:...

PowerTip: Find Information about Operations Management Suite
Oct 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Information about Operations Management Suite

Doctor Scripto

Summary: Learn how to find information about Microsoft Operations Management Suite.  How can I easily find the latest and coolest blogs and information about Operations Management Suite?  On Twitter, create a filter for #MSOMS.

Use PowerShell to Collect Network Traces—The Video
Oct 16, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Collect Network Traces—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video that shows how to use Windows PowerShell to collect network traces.Microsoft Scripting Guy, Ed Wilson, is here. Today I'm present a video where I show how to use Windows PowerShell to collect network traces. The steps I show are common commands that will normally be run to set up and collect network tracing. I talk about the following:    Note  For more information about this technique, see Use PowerShell to Parse Network Trace Logs.Here is the video:  [View: is a link to the video from YouTube if you would like to downlo...

Now Available! Windows PowerShell Step by Step, Third Edition
Oct 15, 2015
Post comments count 0
Post likes count 0

Now Available! Windows PowerShell Step by Step, Third Edition

Doctor Scripto

We’re pleased to announce the availability of Windows PowerShell Step by Step, Third Edition (ISBN 9780735675117), by Ed Wilson. Purchase from these online retailers: Microsoft Press Store Amazon.com Barnes & Noble Independent booksellers – Shop local Your hands-on guide to Windows PowerShell scripting fundamentals Expand your expertise—and teach yourself the fundamentals of Windows PowerShell scripting, including features available in Windows PowerShell 5.0. If you are an IT professional, power user, or consultant, you’ll get the guidance, exercises, and code you need to master core tec...

PowerTip: Get Unique Numbers from Array
Oct 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Unique Numbers from Array

Doctor Scripto

Summary: Learn how to get unique numbers from an array.  How can I use Windows PowerShell to return only the numbers that are unique in an array?  Sort the array of numbers, then pipe the output to the Get-Unique cmdlet, for example: $a = 1,2,7,6,4,3,3,2,9 $a | sort | Get-Unique Note  Sort is an alias for the Sort-Object cmdlet.

Use PowerShell to Parse Network Trace Logs
Oct 15, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Parse Network Trace Logs

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to analyze packet trace logs. Microsoft Scripting Guy, Ed Wilson, is here. Today I want to finish my discussion about analyzing a network trace log that was captured by using the cmdlets from the NetEventPacketCapture module.    Note  To start my network trace, I need to use the following four commands: Remove-NetEventSession $session = New-NetEventSession -Name "Session1" Add-NetEventProvider -Name "Microsoft-Windows-TCPIP" -SessionName "Session1” Start-NetEventSession -Name "...

PowerTip: Sort an Array of Numbers with PowerShell
Oct 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Sort an Array of Numbers with PowerShell

Doctor Scripto

Summary: Learn how to sort an array of numbers with Windows PowerShell.  How can I use Windows PowerShell to easily sort an array of numbers?  Pipe the array to the Sort-Object (sort is an alias) cmdlet, for example: $a = 1,2,7,6,4,3,3,2,9 $a | sort

Packet Sniffing with PowerShell: Looking at Messages
Oct 14, 2015
Post comments count 0
Post likes count 0

Packet Sniffing with PowerShell: Looking at Messages

Doctor Scripto

Summary: Microsoft Scripting Guy Ed Wilson talks about looking at the message field in a packet log with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Yesterday I begin analyzing a packet trace log. Note  For more information about setting up and making a packet trace, see Packet Sniffing with PowerShell: Getting Started. For more information about doing basic analytics, see Use PowerShell to Parse Network Log. You may be surprised if you have rebooted your computer, logged off and back on, and opened and closed Windows PowerShell. If you go to create a new net event session, and you call ...

Use PowerShell to Parse Network Log
Oct 13, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Parse Network Log

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to parse a network trace log.Microsoft Scripting Guy, Ed Wilson, is here. Today I want to talk a little bit about using Windows PowerShell to parse a network trace log. In yesterday’s blog post, Packet Sniffing with PowerShell: Getting Started, I talked using Windows PowerShell to do a network trace.Yesterday, I created a network trace log. I can use that log, or I can create a new log.            Note  These commands require that Windows PowerShell is elevated.When I...

PowerTip: Send Message to Information Stream in PowerShell
Oct 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Send Message to Information Stream in PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to send information for a command to a separate information stream.  How can I use Windows PowerShell to send information to a user via a separate information stream,            without changing the default information preference variable?  In Windows PowerShell 5.0, use the new Write-Information cmdlet, for example: gps ; Write-Information "process information" -InformationAction continue Note  gps is an alias for the Get-Process cmdlet.

PowerTip: Display Every PowerShell Example in Help
Oct 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Display Every PowerShell Example in Help

Doctor Scripto

Summary: Display every Windows PowerShell example that Help contains.  How can I use Windows PowerShell to display every Help example that Windows PowerShell contains?  Use Get-Command to retrieve all of the cmdlet names, pipe the output to Foreach-Object,            and call Get-Help with the –Example switch, for example: gcm | % {get-help $_.name -ex} Note  GCM is an alias for Get-Command and % is an alias for Foreach-Object.

Packet Sniffing with PowerShell: Getting Started
Oct 12, 2015
Post comments count 1
Post likes count 0

Packet Sniffing with PowerShell: Getting Started

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about getting started with packet sniffing in Windows PowerShell.Microsoft Scripting Guy, Ed Wilson, is here. One of the way cool things that happened with Windows 8.1 and Windows Server 2012 R2 was the ability to do network traces with Windows PowerShell. I have found network tracing extremely useful and helpful in troubleshooting and diagnostics ever since I wrote my book, Network Monitoring and Analysis: A Protocol Approach to Troubleshooting.In the past, I have used batch files, automated the NetMon API, and done all kinds of crazy things to tr...

PowerTip: Find Windows Capabilities with PowerShell
Oct 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Windows Capabilities with PowerShell

Doctor Scripto

Summary: Find Windows capabilities with Windows PowerShell on Windows 10.  How can I use Windows PowerShell 5.0 on Windows 10 to determine capabilities such as handwriting,            optical character recognition (OCR), speech, and text-to-speech on my installation?  Use the Get-WindowsCapability cmdlet, specify the -Online parameter, and filter for a state of Installed,            for example: Get-WindowsCapability -Online | where state -eq 'Installed'         &nb...

Playing with JSON and PowerShell—The Video
Oct 11, 2015
Post comments count 0
Post likes count 0

Playing with JSON and PowerShell—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video where he describes converting JSON data with Windows PowerShell.Microsoft Scripting Guy, Ed Wilson, is here. Today I present a video where I talk about using the ConvertFrom-JSON cmdlet to parse information returned via Invoke-WebRequest. I am using Windows PowerShell 5.0 on Windows 10 to illustrate this technique. It is powerful and useful, and it makes for a better experience than having to parse XML.            Note  For more information about this technique, see Playing with JSON and Power...

PowerTip: Find Latest Events in Windows Event Log
Oct 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Latest Events in Windows Event Log

Doctor Scripto

Summary: Learn how to quickly find the latest events in a Windows event log.  How can I use Windows PowerShell to look in the Application log to see the latest events?  Use the Get-Eventlog cmdlet, specify the log name, and select newest events, for example: Get-EventLog application -Newest 5

Troubleshooting WinRM—The Video Part 2
Oct 10, 2015
Post comments count 0
Post likes count 0

Troubleshooting WinRM—The Video Part 2

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video about troubleshooting WinRM (part 2). Microsoft Scripting Guy, Ed Wilson, is here. Today I present part two of my troubleshooting WinRM video. In this video, I talk about five basic commands that are used in troubleshooting WinRM. Note  For more information about these commands see this Hey, Scripting Guy Blog post: Troubleshooting WinRM with PowerShell—Part 2. I hope you enjoy this video. [View: Here is a link to the video from YouTube if you would like to download it or play it offline in a different video player (like stream it on your Xbox...

PowerTip: Use PowerShell to Get Windows Home Location
Oct 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Windows Home Location

Doctor Scripto

Summary: Use Windows PowerShell to get the Windows home location setting.  How can I get the Windows GeoID home location setting for the current user account with            Windows PowerShell 5.0 on Windows 10?  Use the Get-WinHomeLocation cmdlet.

Troubleshoot WinRM—The Video Part 1
Oct 9, 2015
Post comments count 0
Post likes count 0

Troubleshoot WinRM—The Video Part 1

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video about troubleshooting WinRM (part 1). Microsoft Scripting Guy, Ed Wilson, is here. Today I present a video where I talk a bit about troubleshooting WinRM. First I talk about looking at the WinRM logs, and then I talk about checking specific things such as:    Note  For more information about this technique, refer to: Here is the video... [View: Here is a link to the video from YouTube if you would like to download it or play it offline in a different video player (like stream it on your Xbox One like I do): Troubleshooting WinRM Part 1 ...

PowerTip: Find Win32 Type Data in PowerShell
Oct 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Win32 Type Data in PowerShell

Doctor Scripto

Summary: Learn how to find Win32 WMI classes in Windows PowerShell that have type data.  How can I easily find which WMI classes in Windows PowerShell have their own type data?  Use the Get-TypeData cmdlet and filter for types that contain Win32, for example: Get-TypeData -TypeName *win32*

Playing with JSON and PowerShell
Oct 8, 2015
Post comments count 0
Post likes count 0

Playing with JSON and PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about playing with JSON and Windows PowerShell 5.0. Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife has an updated shopping list. It includes a Microsoft Band 2 and a Surface Pro 4. The launch was a mouthwatering event and really well done. One of the cool cmdlets in Windows PowerShell 5.0 on Windows 10 is the ConvertFrom-JSON cmdlet. One reason it is cool is that it will convert a Java Script Object Notation (JSON) string into a custom Windows PowerShell object. This is a cool way to interact with web services, and it can save...

PowerTip: Concatenate String Array with PowerShell
Oct 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Concatenate String Array with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to concatenate elements of a array.  How can I use Windows PowerShell to concatenate the elements of a string array?  Use the static Concat method from the String class, for example: $a = "string a" $b = "string b" $arr = @($a,$b) [string]::Concat($arr)

Dude, a String Is a String in PowerShell
Oct 7, 2015
Post comments count 0
Post likes count 0

Dude, a String Is a String in PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using string methods to determine null or empty in Windows PowerShell.  Hey, Scripting Guy! I have a problem with a script. It is used to write data to another application, but sometimes the variables in it are empty. I have tried to detect this by checking to see if the variable is equal to $null, but this does not work very well. I need a different way to do this. Can you help? —JB  Hello JB, Microsoft Scripting Guy, Ed Wilson, is here. When I was looking out the window this morning, I saw a squirrel drop from a tree, look up, and then bun...

PowerTip: Enable PowerShell Remoting
Oct 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Enable PowerShell Remoting

Doctor Scripto

Summary: Learn how to enable Windows PowerShell remoting.  How can I turn on Windows PowerShell remoting on my workstation so it will run remote commands?  Use the Enable-PSRemoting cmdlet.

Troubleshooting WinRM with PowerShell—Part 2
Oct 6, 2015
Post comments count 0
Post likes count 0

Troubleshooting WinRM with PowerShell—Part 2

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about troubleshooting WinRM.  Hey, Scripting Guy! So I thought that Windows PowerShell remoting was supposed to just work. Well, it doesn't. I am confused, and don’t even know where to begin. I am pretty sure that it should be enabled, but it is not working. Can you help? —EG  Hello EG, Microsoft Scripting Guy, Ed Wilson, is here. This morning it is rather foggy outside. To be honest, I am not really certain if it is fog or low lying clouds. The weather stations are talking about a hurricane, but we are in central Florida, so we will no...

PowerTip: Produce List of Disabled Windows Features
Oct 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Produce List of Disabled Windows Features

Doctor Scripto

Summary: Use Windows PowerShell to produce a list of disabled Windows features.  How can I use Windows PowerShell to see what Windows features are disabled in my installation? Open an elevated Windows PowerShell console, use the Get-WindowsOptionalFeatures cmdlet, and specify            that you want to run the command online. You may also want to filter the list by disabled state and sort the list,            for example: Get-WindowsOptionalFeature -Online | ? state -eq 'disabled' | select featurename | sort -Descending Note&nbs...

Troubleshoot WinRM with PowerShell—Part 1
Oct 5, 2015
Post comments count 0
Post likes count 0

Troubleshoot WinRM with PowerShell—Part 1

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to look at WinRM logs.  Hey, Scripting Guy! I am having problems with WinRM. When I use the Get-CimInstance cmdlet, it fails. When I specify the –DCOM protocol for Get-CimInstance, it works. I suspect I have a WinRM problem. How can I go about troubleshooting it? —TB  Hello TB, Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about Windows, regardless of the version, is that there are some awesome diagnostics and operational logs. I am not talking about the traditional event logs that have b...

PowerTip: Use PowerShell to Find System Uptime
Oct 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find System Uptime

Doctor Scripto

Summary: Use Windows PowerShell to find your system uptime.  How can I use Windows PowerShell to easily find how long my computer has been running?  Use the Get-Date cmdlet to return the current date and time, and then subtract the value            of the LastBootUpTime property that comes from the Win32_OperatingSystem, for example: (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime Note  GCIM is an alias for Get-CimInstance.

Weekend Scripter: That’s Not Very PowerShell-Like
Oct 4, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: That’s Not Very PowerShell-Like

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about what is Windows PowerShell-like scripting.Microsoft Scripting Guy, Ed Wilson, is here. Before Internet streaming, before Nabster, before CD-ROMs, before cassette tapes, and before 8-track tapes, there were things called records. Now it seems that all technology related to music (unless you are talking about live acoustic performances) are subject to some kind of something that will cause them to fail.With records, it was a scratches. Not the invisible sorts of scratches that cause DVDs to fail—no, I mean serious scratches that came from someone bumpin...

PowerTip: Create Sortable GUI List of Files with PowerShell
Oct 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Create Sortable GUI List of Files with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to display a filterable GUI list of files.  How can I use Windows PowerShell to filter a list of files using a graphical user interface?  Use the Get-ChildItem cmdlet to obtain a directory list, select all of the properties and pipe the output            to the Out-GridView cmdlet, for example: dir c:\fso | select * | ogv Note  Dir is an alias for Get-ChildItem and ogv is an alias for Out-GridView.

Weekend Scripter: Search and Filter Directory Lists with PowerShell
Oct 3, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Search and Filter Directory Lists with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to sort, search, and to filter through a directory list. Microsoft Scripting Guy, Ed Wilson, is here. One of my friends on Facebook posted a picture of a bunch of hardwood trees all decked out in fall colors. It was rather pretty. That is the down side to living in central Florida—I mean, I have never seen a palm tree in fall colors. Of course, it is 82 degrees Fahrenheit (28 degrees Celsius), so I guess we don’t really have fall. But the humidity is dropping (down to 55% instead of the usual 75%), so it feels cool outsi...

PowerTip: Use Non-Approved Cmdlet or App within PowerShell Workflow
Oct 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Non-Approved Cmdlet or App within PowerShell Workflow

Doctor Scripto

Summary: Learn how to use a basic inline script in Windows PowerShell workflows.  I’m trying to convert a Windows PowerShell script to a workflow, but I keep running into an error that suggests            the cmdlet cannot be used in a workflow. How can I get around this?  Wrap that section of the workflow as an inline script, and recapture your variables with the Using keyword,            for example: Inlinescript             {        &nbs...

Use PowerShell to Create Windows To Go Keys—Part 5
Oct 2, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Windows To Go Keys—Part 5

Doctor Scripto

Summary: Use a basic Windows PowerShell workflow to create multiple devices. Hey, Scripting Guy! I was wondering if there is an efficient way to use Windows PowerShell to create multiple Windows To Go keys at the same time.—TM Hello TM,Honorary Scripting Guy, Sean Kearney, is here today. I am going to wind up my week of posts by playing with that very idea.   Note  This is a five-part series that includes the following posts: Today I'm going to implement a basic Windows PowerShell workflow to image multiple Windows To Go keys from the same image. The process is actually ve...

PowerTip: Back up Drivers with PowerShell
Oct 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Back up Drivers with PowerShell

Doctor Scripto

Summary: Use the Export-WindowsDriver cmdlet to back up all of your Windows drivers elsewhere.  How can I use Windows PowerShell in Windows 10 to get a copy of the current drivers in my Windows            operating system when my computer is a clone system?  Use the Export-WindowsDriver cmdlet to back up all of your drivers to a folder or a USB device, for example: Export-WindowsDriver -Online -Destination I:\

Use PowerShell to Create Windows To Go Keys—Part 4
Oct 1, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Windows To Go Keys—Part 4

Doctor Scripto

Summary: Use Windows PowerShell to inject drivers and populate the data for Unattend.xml. Hey, Scripting Guy! I have a Windows To Go key. Is there a script to automatically give the key a proper workstation name or possibly even add some additional drivers?—TG Hello TG,Honorary Scripting Guy, Sean Kearney, is here, and the magical answer to your question, which is, "YES!"    Note  This is a five-part series that includes the following posts: Windows To Go isn’t really all that special. The ability to add drivers though DISM, automatically name a workstation, or ...

PowerTip: Launch Console Command Embedded in Powershell Variable
Sep 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Launch Console Command Embedded in Powershell Variable

Doctor Scripto

Summary: Use a variable to launch a Windows PowerShell cmdlet and maintain the value of $LastExitCode.  How can I use Windows PowerShell to launch a variable that contains the path to a console application            while retaining the error code?  Use the & character before the content in question. This example launches Tree.com in System32            by passing in the Environment variable for Windows: & "$ENV:Windir\system32\tree.com"   

Use PowerShell to Create Windows To Go Keys—Part 3
Sep 30, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Windows To Go Keys—Part 3

Doctor Scripto

Summary: Use Windows PowerShell to apply an image to a Windows To Go key and make it bootable. Hey, Scripting Guy! Now that I have a Windows To Go key partitioned and formatted for use, how do I apply the operating system image to it?—MR Hello MR,Honorary Scripting Guy, Sean Kearney, is here to continue forth and show you the next step in creating a Windows To Go key.   Note  This is a five-part series that includes the following posts: To use Windows To Go, we must have one of the following versions of the Windows operating system: The source of the image can be a gold...

PowerTip: Use PowerShell to Find Where Drive Letter is Stored
Sep 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Where Drive Letter is Stored

Doctor Scripto

Summary: Use the Get-Partition and Get-Disk cmdlets to identify data storage locations.  How can I use Windows PowerShell to easily figure out which disk a particular drive letter is on?  Use Get-Partition with the drive letter and pipe the results to Get-Disk, for example: Get-Partition –DriveLetter Z | Get-Disk

Use PowerShell to Create Windows To Go Keys—Part 2
Sep 29, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Windows To Go Keys—Part 2

Doctor Scripto

Summary: Use Windows PowerShell to partition a Windows To Go device. Hey, Scripting Guy! Am I able to use Windows PowerShell to set up the necessary partitions to prepare a Window To Go key?—LL Hello LL,Honorary Scripting Guy, Sean Kearney, is here. I'm continuing with my little chat about setting up Windows To Go keys through Windows PowerShell.   Note  This is a five-part series that includes the following posts: Yesterday, I talked about how to use the Get-Disk cmdlet to identify keys. Today I'm going to use that information to prepare the necessary partition structure....

PowerTip: Use PowerShell to Identify Bootable Disks
Sep 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Identify Bootable Disks

Doctor Scripto

Summary: Use the Get-Disk cmdlet to identify all bootable devices that are attached.  How can I use Windows PowerShell to see which USB devices are set to be bootable on my workstation?  Use the Get-Disk cmdlet and filter on the BootFromDisk and BusType properties, for example: Get-Disk | Where { $_.BusType -eq 'USB' -and $_.BootFromDisk -eq $TRUE }   

Use PowerShell to Create Windows To Go Keys—Part 1
Sep 28, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Windows To Go Keys—Part 1

Doctor Scripto

Summary: Use Windows PowerShell to identify Windows To Go devices.  Hey, Scripting Guy! I’ve heard a lot of talk about Windows To Go amongst the IT pros at our local user group. I was wondering how I would go about trying to create them with Windows PowerShell? —DM  Hello DM, Honorary Scripting Guy, Sean Kearney, is here today, and I’m happy to share that knowledge with you.       Note  This is a five-part series that includes the following posts: Before I start on the Windows PowerShell part, I’ll touch quickly on what Windows To Go is. It&rs...

PowerTip: Use PowerShell to Find Approved Verb
Sep 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Approved Verb

Doctor Scripto

Summary: Use Windows PowerShell to find an approved verb.  I want to write a new function that will connect a young Jedi Knight to the force by using the noun TheForce and            the verb Use. How can I use Windows PowerShell to find if Use is an approved verb?  Use the Get-Verb cmdlet and pass it to the verb: Get-Verb Use

Weekend Scripter: Parsing the DISM Log with PowerShell
Sep 27, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Parsing the DISM Log with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about parsing the DISM log with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I like to do on weekends is mess around. So I was intrigued when I found a DISM command that would supposedly export file associations (see DISM Default Application Association Servicing Command-Line Options). I thought, "Cool." Unfortunately, I was not able to find a “PowerShell way" of doing it, but then, hey, the cool thing about a command-line environment is that it makes command-line tools really easy-to-use. So I gave it a ...

PowerTip: Finding PowerShell User Groups
Sep 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Finding PowerShell User Groups

Doctor Scripto

Summary: Learn how to find out about Windows PowerShell user groups.  Where can I find out about local or virtual user groups?  Check out these sites to find information about when and where user groups are meeting,            in addition to the topics of conversation:

September PowerShell Spotlight
Sep 26, 2015
Post comments count 0
Post likes count 0

September PowerShell Spotlight

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about events happening in the world of PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. It is the last Saturday of the month again, and the day that the Scripting Wife, Microsoft PowerShell MVP, Teresa Wilson, takes over the keyboard to share upcoming community events and news. I like to call it PowerShell Spotlight. P.S. Speaking of spotlight...I may get in trouble for this, but oh well...HAPPY BIRTHDAY to you, Teresa! Greetings scripters, It appears that there is a lot going on in the next few weeks. First off, on Oct 3-4, there is the Silicon Valle...

PowerTip: Use PowerShell to Get Events for Specific Day
Sep 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Events for Specific Day

Doctor Scripto

Summary: Use Windows PowerShell to get event log events that occur on a specific day.  How can I use Windows PowerShell to get application event log events that occur only on Sept. 24, 2015?  Use the Get-EventLog cmdlet and specify the log name and the before and the after dates, for example: Get-EventLog -LogName application -After "9/24/15" -Before "9/25/15"

A Tale of Two PowerShell Cmdlets
Sep 25, 2015
Post comments count 0
Post likes count 0

A Tale of Two PowerShell Cmdlets

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to explore classic event logs. Microsoft Scripting Guy, Ed Wilson, is here. When you get to version five of anything, you already begin to see signs on strain and pain. I mean, take Windows NT 5.0, for example. Oh yeah. That one was delayed for about five years, and it eventually became Windows 2000. Part of the reason is that no matter how good the original version or vision was, things change. Priorities change. And more often than not, computers and technology change. Often, it is easier to create a new tool, than to retrofit an ...

PowerTip: Get Specific Service Information with PowerShell
Sep 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Specific Service Information with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to get specific service information.  How can I use Windows PowerShell to find information about services, if I do not want to include any service             that has a name that begins with the letter “s”?  Use the Exclude parameter from the Get-Service cmdlet, for example: gsv -Exclude s* Note  Gsv is an alias for the Get-Service cmdlet.

The Death of PowerShell Scripting
Sep 24, 2015
Post comments count 0
Post likes count 0

The Death of PowerShell Scripting

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the reduced need to use Windows PowerShell scripting. Microsoft Scripting Guy, Ed Wilson, is here. If you follow me on Twitter or Facebook, you already know that my new book, Windows PowerShell Step by Step, third edition, is on its way to the printers. I am not going to talk about that today—but it dawned on me as I was completing the final tasks for this book, that I did not talk about as much scripting in the book as I did, for example, in the Windows PowerShell 1.0 Step by Step book. This is not because I don’t like to script. In fact, ...

PowerTip: Get Week of Year with PowerShell
Sep 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Week of Year with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to get the week of the year.  How can I use Windows PowerShell to find how many weeks are left in the current year—without doing lot of math or            calendaring stuff?  Use the Get-Date cmdlet but specify a –uformat of %V: Get-Date -UFormat %V Note  Please remember that UFormat strings are case sensitive, so it is capital V, not lowercase v.

Extending Objects with PowerShell: Week of the Year
Sep 23, 2015
Post comments count 0
Post likes count 0

Extending Objects with PowerShell: Week of the Year

Doctor Scripto

Summary: Ed Wilson talks about adding members to an object with Windows PowerShell to get the week of the year.Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is that it is configurable. Not merely configurable, but amazingly flexible. For example, when I look at a DateTime object, I see the following:PS C:\Users\mredw> Get-Date | fl *DisplayHint : DateTimeDateTime    : Tuesday, September 22, 2015 11:48:25 AMDate        : 9/22/2015 12:00:00 AMDay         : 22DayOfWeek &nbs...

PowerTip: Find Number of Hours in Number of Days
Sep 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Number of Hours in Number of Days

Doctor Scripto

Summary: Use Windows PowerShell to find the number of hours in a number of days.  How can I use Windows PowerShell to easily figure out how many hours are in 30 days without            doing any multiplication?  Use New-TimeSpan to create a timespan object for 30 days. The output will tell the number of hours,            minutes, and seconds in the timespan. Here is an example: New-TimeSpan -Days 30 To return only the number of hours, retrieve the TotalHours property: PS C:\> (New-TimeSpan -Days 30).totalhours 720

Break Text File into Chunks with PowerShell
Sep 22, 2015
Post comments count 0
Post likes count 0

Break Text File into Chunks with PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about breaking the contents of a text file into chunks with Windows PowerShell.  Hey, Scripting Guy! The other day, you tweeted Get First 140 Characters from String with PowerShell. That is fine, but what about the rest of the text? I mean, if I want to break a text file into lines of 140 characters, how do I go about it? Can you provide a concrete example please? —BG  Hello BG, Microsoft Scripting Guy, Ed Wilson, is here. The markets are mixed, there is a chance of afternoon thunderstorms, and there is a lizard scampering about on the outside pat...

PowerTip: Use PowerShell to Determine Host
Sep 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Determine Host

Doctor Scripto

Summary: Use Windows PowerShell to find your PowerShell host.  How can I use Windows PowerShell to determine what PowerShell host is being used?  Use the Get-Host cmdlet. To get only the name of the host, use the following syntax: (Get-Host).name

Talk Like a Pirate—The Video
Sep 21, 2015
Post comments count 0
Post likes count 0

Talk Like a Pirate—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks a bit about the script he wrote to translate pirate speech by using Invoke-WebRequest.Microsoft Scripting Guy, Ed Wilson, is here. Today I present a video where I talk a bit about my script to submit data to a webpage and receive information back from that page. These sorts of web projects seem to take a lot of time—in fact, many times it seems like they take more time than they are worth.This is because each webpage can be different, and because they can change on a whim. It is much better to have a structured API or a web service to perform these types of...

PowerTip: Use PowerShell to Find Title of Foreground Word Document
Sep 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Title of Foreground Word Document

Doctor Scripto

Summary: Use Windows PowerShell to find the title of the foreground Word document.  How can I use Windows PowerShell to find the title of the Word document that is currently in the foreground when            I have several documents open?  The Get-Process cmdlet with the MainWindowTitle property will list the title of the Word document.            This example presents the main window title and the start time of the application: Get-Process winword | select starttime, MainWindowTitle

Weekend Scripter: A Way Cool DevOps Conference in London
Sep 20, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: A Way Cool DevOps Conference in London

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about a way cool DevOps conference in London.Microsoft Scripting Guy, Ed Wilson, is here. Sometimes, things are really crazy, and at other times, things are just normally crazy. One of the cool things about being the Scripting Guy is that I hear from people all over the world, and as time progresses, we become friends around a shared interest in automation.So, I received a way cool invitation the other day via scripter@microsoft.com to attend a DevOps conference in London. Unfortunately, I am not flying right now, but I talked to the organizer, and we decided tha...

PowerTip: Display Current Time with PowerShell
Sep 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Display Current Time with PowerShell

Doctor Scripto

Summary: Learn how to display the current time by using Windows PowerShell.  How can I  use Windows PowerShell to display the time with the hour, minute, and seconds?  Use the ToString method from the Get-Date cmdlet, and use the long time pattern format            string (see Standard Date and Time Format Strings) to overload the method, for example: (get-date).ToString('T')

Weekend Scripter: PowerShell for "Talk Like a Pirate" Day
Sep 19, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell for "Talk Like a Pirate" Day

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to translate for International Talk Like A Pirate day. Ahoy mates! Microsoft Scripting Guy, Ed Wilson, is here. It is one of my favorite holidays of the year—probably my favorite holiday. Yep, it is International Talk Like a Pirate day today. The Scripting Wife and I are heading to the coast for some authentic pirate reenactments and a fun day of culture and education. Arrrrrr... Here is a picture of the Scripting Wife trying out her pirate speak with a couple of nautical looking individuals. Well, me hearties...If you would ...

PowerTip: Find Effective AppLocker Policy with PowerShell
Sep 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Effective AppLocker Policy with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find the effective AppLocker policy.  How can I use Windows PowerShell to find the effective AppLocker policy after considering domain policies            and local policies?  Open Windows PowerShell with Admin rights, and use the Get-AppLockerPolicy cmdlet with the             –Effective switch: Get-AppLockerPolicy -Effective

How to Use Try/Catch/Finally for Non-Terminating Errors
Sep 18, 2015
Post comments count 0
Post likes count 0

How to Use Try/Catch/Finally for Non-Terminating Errors

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell and Try/Catch/Finally for non-terminating errors.Microsoft Scripting Guy, Ed Wilson, is here. Today I want to present a video about using Windows PowerShell Try/Catch/Finally with non-terminating errors—that is, Windows PowerShell can progress past the errors when they occur to the next line of code.Note  For more information, refer to Understanding Non-Terminating Errors in PowerShell.Here is the video: [View: is a link to the video from YouTube if you would like to download it or play it offline in a different vide...

PowerTip: Find Operating System Version and Installation Date with PowerShell
Sep 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Operating System Version and Installation Date with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find the operating system version and installation date.  How can I use Windows PowerShell to find the version of my Windows operating system, its installation date,            and the operating system architecture?  Use the Get-CimInstance cmdlet (GCIM is an alias) and query the Win32_OperatingSystem WMI class,            for example: gcim Win32_OperatingSystem | select Version, InstallDate, OSArchitecture

Understanding Two Types of PowerShell Errors—The Video
Sep 17, 2015
Post comments count 0
Post likes count 0

Understanding Two Types of PowerShell Errors—The Video

Doctor Scripto

Summary: In this video, Ed Wilson, Microsoft Scripting Guy, talks about two types of Windows PowerShell errors.Microsoft Scripting Guy, Ed Wilson, is here. Today I want to present a video I made about structured error handling, in specific, about terminating errors.Note  For more information, refer to Error Handling: Two Types of Errors.Here is the video:[View: is a link to the video from YouTube if you would like to download it or play it offline in a different video player: Intro To Error Handling in PowerShell by Ed Wilson.I invite you to follow me on Twitter and Facebook. If you have any questions, ...

PowerTip: Check What PowerShell Does When Error Occurs
Sep 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Check What PowerShell Does When Error Occurs

Doctor Scripto

Summary: See what Windows PowerShell will do when an error occurs.  How can I check the setting so I will know what Windows PowerShell will do if an error occurs?  Look for the value of the $ErrorActionPreference. By default, it is set to Continue, which means it will            attempt to execute the next command. Other values are Stop, Inquire, and Ignore.            Here is an example of the command: PS C:\> $ErrorActionPreferenceContinue

Understanding Non-Terminating Errors in PowerShell
Sep 16, 2015
Post comments count 0
Post likes count 2

Understanding Non-Terminating Errors in PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about understanding non-terminating errors in Windows PowerShell.  Hey, Scripting Guy! Yesterday in Error Handling: Two Types of Errors, you were talking about terminating errors and how you can use Try/Catch/Finally with those, but you did not really say what a non-terminating error is. Can you talk about that for a little bit please? —SK  Hello SK, Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sitting here sipping a cup of English Breakfast tea with a cinnamon stick in it, and munching on a piece of baklava. You see, we just cel...

PowerTip: Get First 140 Characters from String with PowerShell
Sep 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Get First 140 Characters from String with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to retrieve the first 140 characters from a string.  How can I use Windows PowerShell to retrieve the first 140 characters from a string?  Use the SubString method from a string. Specify the starting point (in this case 0) and the            number of characters to retrieve (in this case 140). The following example assumes that $a            contains a string with more than 140 characters: $a.SubString(0,140)

Error Handling: Two Types of Errors
Sep 15, 2015
Post comments count 0
Post likes count 0

Error Handling: Two Types of Errors

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about error handling and two types of errors.  Hey, Scripting Guy! I really don’t get it. Everyone tells me I need to use Try/Catch/Finally to catch errors, but it simply won’t work. I am not sure if there is a bug in Windows PowerShell, but I wish you guys would fix it because it doesn't work. Can you help me? —SH  Hello SH, Microsoft Scripting Guy, Ed Wilson, is here. It is becoming fall around here in central Florida. In fact, last night it got down to about 69 degrees Fahrenheit. I mean, it was cold. It is something to look fo...

PowerTip: Find PowerShell Exported Types
Sep 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Exported Types

Doctor Scripto

Summary: Learn how to find Windows PowerShell exported types.  How can I easily look at runspace exported types in Windows PowerShell?  Call the Assembly property from the [psobject] type accelerator, and then call the GetExportedTypes() method,            for example: [psobject].Assembly.GetExportedTypes()

Backwards Compatibility in PowerShell
Sep 14, 2015
Post comments count 0
Post likes count 0

Backwards Compatibility in PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about backwards compatibility in Windows PowerShell. Hey, Scripting Guy! I wrote a script on a system with Windows PowerShell 4.0 installed. Is there an easy way to find out the earliest version of Windows PowerShell on which it will run?—DH Hello DH,Microsoft Scripting Guy, Ed Wilson, is here. This question did not come in via the scripter@microsoft.com email alias. Instead, it came via Twitter to @ScriptingGuys. It doesn’t matter if the question is about Windows PowerShell 5.0, 4.0, 3.0, or even Windows PowerShell 2.0. The answer is t...

PowerTip: Use PowerShell to Create New Virtual Disk
Sep 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create New Virtual Disk

Doctor Scripto

Summary: Use Windows PowerShell to create a new virtual disk.  How can I use Windows PowerShell to create a new virtual disk?  Use the New-VirtualDisk cmdlet, for example: New-VirtualDisk -StoragePoolFriendlyName Data -FriendlyName MyData -Size 10GB

Weekend Scripter: PowerShell 5 Class Inheritance and Overrides—The Video
Sep 13, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell 5 Class Inheritance and Overrides—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video where he talks about class inheritance and property overrides in Windows PowerShell 5.0.Microsoft Scripting Guy, Ed Wilson, is here. The air show in Tampa was awesome. Today the Scripting Wife and I decided to head to the Magic Kingdom at Disney World. It is a lot of fun, and besides that, it is a beautiful weekend to have a birthday. Before we head out, however, I want to share a video I made where I talk a little bit about class inheritance in Windows PowerShell 5.0.Note  For more information about class inheritance and property overrides i...

PowerTip: Use PowerShell to Create New Partition
Sep 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create New Partition

Doctor Scripto

Summary: Use Windows PowerShell to create a new partition on a disk.  How can I use Windows PowerShell to create a new partition on a disk?  Use the New-Partition cmdlet, specify the disk number, and assign a new drive letter and size, for example: New-Partiton -DiskNumber 2 -UseMaximumSize -AssignDriveLetter

Weekend Scripter: Overloaded Class Constructors in PowerShell 5—The Video
Sep 12, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Overloaded Class Constructors in PowerShell 5—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, introduces a video about overloaded class constructors in Windows PowerShell 5.0 in Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. This is my birthday weekend, so today the Scripting Wife decided to take me to Tampa for the air show. As it turns out, my buddy and Microsoft evangelist, Blain Barton, is also going to show up at the air show.Blain and I are planning to make another IT Time video. Our last video became one of the most popular videos on Channel 9, and it was even featured on the front page of Channel 9 news for a while. Check it out: "Offshore...

PowerTip: Clone Virtual Disk with PowerShell
Sep 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Clone Virtual Disk with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to clone a virtual disk.  How can I use Windows PowerShell to clone a virtual disk?  Use the New-VirtualDiskClone cmdlet, for example: New-VirtualDiskClone –virtualDiskFriendlyName “mydata” –TargetVirtualDiskName “ClonedData” –TargetStoragePoolName “ClonePool”

Overriding Inheritance in PowerShell 5 Classes
Sep 11, 2015
Post comments count 0
Post likes count 0

Overriding Inheritance in PowerShell 5 Classes

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about overriding inheritance in Windows PowerShell 5.0 classes. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that is pretty cool about Windows PowerShell 5.0 classes, is that I can override the things I inherit from a base class. This offers a lot of flexibility because it means that when I inherit from a class, I can customize my new class based on my needs instead of being stuck with a lot of stuff that does not meet the requirements. One thing I need to do is to override a couple of the properties that I inherit from my Vehicle base class. Th...

PowerTip: Use PowerShell to Create New GUID
Sep 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create New GUID

Doctor Scripto

Summary: Use Windows PowerShell to create a new GUID.  How can I use Windows PowerShell to easily generate a new GUID for a project.?  Use the New-Guid cmdlet.   If you need to create more than one, you can use code such as the following (% is an alias for Foreach-Object): 1..4 | % {new-guid}

Use Inheritance in PowerShell 5 Classes
Sep 10, 2015
Post comments count 0
Post likes count 0

Use Inheritance in PowerShell 5 Classes

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using inheritance with Windows PowerShell 5.0 classes in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. Today I want to talk about class inheritance with Windows PowerShell 5.0 in Windows 10. In Introduction to PowerShell 5 Classes, I talked about class design and I mentioned how important it was to spend time designing classes before you begin the writing. As it turns out, I did not really do that. In PowerShell 5: Create Simple Class, I designed a Car class, but you know what? Nearly every property, method, and enum that I designed for the Car c...

PowerTip: Find Class Constructors in PowerShell 5
Sep 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Class Constructors in PowerShell 5

Doctor Scripto

Summary: Learn how to easily find class constructors.  How can I use Windows PowerShell 5.0 to find the constructor overloads for a new class I want to create?  Place the class in square brackets, and call the static New method with no parentheses, for example: [datetime]::new

PowerShell 5 Classes: Constructor Overloading
Sep 9, 2015
Post comments count 0
Post likes count 0

PowerShell 5 Classes: Constructor Overloading

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using the new Windows PowerShell 5.0 class feature in Windows 10 and doing constructor overloading. Microsoft Scripting Guy, Ed Wilson, is here. Today I want to talk about overloaded constructors. I know, I know, I know… It sounds like some sort of engineering failure. But that is not the case. In fact, constructor overloading makes your code much more flexible, and even easier to read—when you learn the trick. And today we are going to unmask the secrets of constructor overloading with Windows PowerShell 5.0 classes in Windows 10. This is way cool stuff...

PowerTip: Quickly Fix a Volume with PowerShell
Sep 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Quickly Fix a Volume with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to perform a quick fix on a volume.  How can I use Windows PowerShell to perform a quick fix on a volume that is somewhat suspect?  Use the Repair-Volume cmdlet and specify the drive letter and the SpotFix parameter, for example: Repair-Volume -DriveLetter E -SpotFix

Adding Methods to PowerShell 5 Classes—The Video
Sep 8, 2015
Post comments count 0
Post likes count 0

Adding Methods to PowerShell 5 Classes—The Video

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, presents a video about adding methods to Windows PowerShell 5 classes in Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. Today I am presenting a video where I talk about adding methods to Windows PowerShell 5.0 classes in Windows 10. To be honest, a class with no methods does not do too much. In the video, I talk about methods that are simply called with no parameters and about methods that require input parameters to work properly. This makes classes in Windows PowerShell 5.0 very powerful.Note For more information, refer to Adding Methods to a Power...

PowerTip: Use PowerShell to Check Volume for Errors
Sep 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Check Volume for Errors

Doctor Scripto

Summary: Learn how to use Windows PowerShell to check a volume for errors.  How can I use Windows PowerShell 5.0 to check a volume for errors on my Windows 10 computer?  Use the Repair-Volume cmdlet, and specify the Scan parameter, for example: Repair-Volume -DriveLetter E -Scan

Create PowerShell 5 Classes with Enums—The Video
Sep 7, 2015
Post comments count 0
Post likes count 0

Create PowerShell 5 Classes with Enums—The Video

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, presents a video about creating Windows PowerShell 5.0 classes by using enums in Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. Today, I continue my video series about creating classes. I create a couple of enums and use them as types for my properties of the Car class.Note  For more information, refer to Adding Enums to PowerShell 5 Classes.[View: is a link to the video from YouTube if you would like to download it or play it offline in a different video player: Using Enums In PowerShell Classes by Ed Wilson.Please join me tomorrow when I will prese...

PowerTip: Set Network Connection Profile with PowerShell
Sep 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Set Network Connection Profile with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to configure the network connection profile.  How can I use Windows PowerShell to set the network connection profile for my network adapter?  Use the Get-NetAdapter cmdlet to retrieve a network adapter, pipe it to the Set-NetConnectionProfile cmdlet,            and specify the network category, for example: Get-NetAdapter | Set-NetConnectionProfile -NetworkCategory Private

Weekend Scripter: Create a Simple PowerShell 5 Class—The Video
Sep 6, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Create a Simple PowerShell 5 Class—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video about adding members to Windows PowerShell 5.0 classes in Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. Today I want to present a video I made that illustrates how to create a simple Windows PowerShell 5.0 class. In the video, I cover using the Class and Static keywords, and how to constrain the types of properties. I also show a simple way to create an instance of the class and how to add values to the properties of the class. Note  For more information, refer to PowerShell 5: Create Simple Class.[View: is a link to the video ...

PowerTip: Use PowerShell to Determine Network Connection Profile
Sep 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Determine Network Connection Profile

Doctor Scripto

Summary: Learn how to use Windows PowerShell to determine the network connection profile.  How can I use Windows PowerShell to determine the network connection profile            my network adapter has picked up?  Use the Get-NetConnectionProfile cmdlet.

Weekend Scripter: Introduction to PowerShell 5 classes—The Video
Sep 5, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Introduction to PowerShell 5 classes—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video to introduce Windows PowerShell 5 classes in Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. It is a wonderful morning here in central Florida. The sun is already shining, and I am thinking about heading out to take some cool nature pictures. The land around here is quite impressive—wild, untamed, and seemingly unchanged for the last thousand years. In fact, some of the trees seem to have been around for about that long.One thing that does not remain static is Windows PowerShell. With Windows PowerShell 5.0, we now have some impressi...

PowerTip: Use PowerShell to Clean Up Temp Files
Sep 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Clean Up Temp Files

Doctor Scripto

Summary: Use Windows PowerShell to delete temporary files.  How can I use Windows PowerShell to clean up a bunch of files that are stored in my temp directory?  Use the Get-ChildItem cmdlet (dir is an alias), point it to the $env:temp directory, and pipe the results            to the Remove-Item cmdlet, for example: dir $env:TEMP -Recurse | Remove-Item -Force -Recurse

Adding Methods to a PowerShell 5 Class
Sep 4, 2015
Post comments count 0
Post likes count 0

Adding Methods to a PowerShell 5 Class

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about adding methods to a Windows PowerShell 5.0 class in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. Having a bunch of properties, although cool, is in the end, rather unsatisfying. I remember trying to teach VBScript and WMI in the old days. Although it was possible to glean lots of information, there were few things that actually did anything. I could easily find the name and the driver of the sound card, but I could not disable the sound card. I could find the screen resolution, but I could not change the screen resolution. I could find the curre...

PowerTip: Use PowerShell to Find ETW Providers
Sep 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find ETW Providers

Doctor Scripto

Summary: Use Windows PowerShell to find Event Trace for Windows (ETW) providers.  How can I use Windows PowerShell 5.0 to see what Event Trace for Windows (ETW) providers are installed            on my computer running Windows 10?  Open the Windows PowerShell console with Admin rights, and use the Get-ETWTraceProvider cmdlet.

Creating Instances of PowerShell 5 Classes
Sep 3, 2015
Post comments count 0
Post likes count 0

Creating Instances of PowerShell 5 Classes

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about creating instances of Windows PowerShell 5.0 classes in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. Today I am up early. I have the windows open, and I am enjoying the early morning breeze that precedes the midmorning sun and afternoon thunderstorms. I am looking over some of the comments about this week’s series of Hey, Scripting Guy! Blog posts, and I see that someone didn’t like the way I spelled Camero in my code. Oh well, I probably should have stuck with BMW Z-3 or Z-4. Someone else mentioned that there are three-wheel ca...

PowerTip: Use PowerShell to View Appx Log
Sep 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to View Appx Log

Doctor Scripto

Summary: Use Windows PowerShell to view the Appx log for deployment messages.  How can I use Windows PowerShell 5.0 in Windows 10 to examine the Appx log for deployment messages?  Use the Get-AppxLog cmdlet and filter on ID 603: Get-AppxLog | Where id -eq 603

Adding Enums to PowerShell 5 Classes
Sep 2, 2015
Post comments count 0
Post likes count 0

Adding Enums to PowerShell 5 Classes

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about adding enums to Windows PowerShell 5.0 classes in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. It is my birthday week...almost. It is the kind of thing that one needs to begin making plans and preparations for. I know that the Scripting Wife, aka Teresa, is busy working to make this birthday week one of the best ever—at least, I hope that is what she is up to. The cool thing is that after my birthday week, it will be time for her birthday week, so we take pretty much the entire month of September to celebrate birthdays. Then it is October,...

PowerTip: Verify Default Output Encoding in PowerShell
Sep 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Verify Default Output Encoding in PowerShell

Doctor Scripto

Summary: Learn how to verify your default output encoding in Windows PowerShell.  How can I use Windows PowerShell to verify my default output encoding?  Check the value of the $OutputEncoding automatic variable: PS C:\> $OutputEncoding

PowerShell 5: Create Simple Class
Sep 1, 2015
Post comments count 0
Post likes count 0

PowerShell 5: Create Simple Class

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about creating a simple class in Windows PowerShell 5.0 in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. The good news is that so far the weather person has been wrong—every single day for the last five days in a row. The bad news is that, well, unfortunately, I believed the weather person, and so I have been huddled in at home, looking out the windows for a storm that never arrived. We have had a little bit of rain, but not even the normal afternoon thunder storms. Guess I shouldn’t complain, but I was hoping to go take pictures of alligat...

PowerTip: Float PowerShell Help
Aug 31, 2015
Post comments count 0
Post likes count 0

PowerTip: Float PowerShell Help

Doctor Scripto

Summary: Learn how to display your Windows PowerShell Help in a new window.  How can I keep my Windows PowerShell Help open so I can look at it while I am trying my new code?  Use the ShowWindow parameter. It will open a new window that contains your Help and allow you to move            it around on your screen. More importantly, it returns your Windows PowerShell console back to you.            Here is such a command: Get-Help about_Classes -ShowWindow

Introduction to PowerShell 5 Classes
Aug 31, 2015
Post comments count 0
Post likes count 0

Introduction to PowerShell 5 Classes

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about Windows PowerShell 5 classes in Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. It is an interesting morning. We are up early, looking around, and trying to decide if the latest tropical storm is going to become a hurricane...and if it is going to hit or miss Florida.Of course, in Central Florida, we will get a miss, but still it could mean several days of high winds, lots of rain, a bit of flooding, and perhaps some power outages. So we need to stock up on food and water, and fill up the vehicles with petrol. I am thinking we need to make sure we h...

PowerTip: Retrieve Last Token with PowerShell
Aug 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Retrieve Last Token with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to retrieve the last token and avoid retyping. I used Get-Process to view a process I launched, and later I wanted to stop the process. How can I do this without            doing a lot of typing or creating new variables? The $$ automatic variable contains the last token submitted, so do the following:PS C:\> notepadPS C:\> gps $$Handles  NPM(K)    PM(K)    WS(K) VM(M)   CPU(s)   Id ProcessName-------     ------    -----  &nb...

Weekend Scripter: PowerShell 5 Enums—The Video
Aug 30, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell 5 Enums—The Video

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, presents a video where he recaps his blog posts about Windows PowerShell 5.0 enums.Microsoft Scripting Guy, Ed Wilson, is here. Today I decided to make a video to summarize my technique for working with enums in Windows PowerShell 5.0 in Windows 10.Note  For more information, refer to New PowerShell 5 Feature: Enumerations and Working with Enums in PowerShell 5.[View: is a link to the video from YouTube if you would like to download it or play it offline in a different video player: Windows PowerShell Enums by Ed Wilson.I invite you to follow me on Twitter an...

PowerTip: Find Specific Help Articles with PowerShell
Aug 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Specific Help Articles with PowerShell

Doctor Scripto

Summary: Learn how to easily find specific Help articles with Windows PowerShell.  How can I use Windows PowerShell to find a Help article about automatic variables, if I am not sure of the title?  Use the Get-Help cmdlet and begin with about_ , then press Tab expansion. It will cycle through matches.            If you think the article is about_automatic_Variables, you can begin with the following command: Help about_a<tab> To quickly find the specific article, when the title appears, press ENTER to retrieve the article.

Weekend Scripter: PowerShell Module Manifests—The Video
Aug 29, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell Module Manifests—The Video

Doctor Scripto

Summary: Ed Wilson presents a recap video where he talks about Windows PowerShell module manifests.Microsoft Scripting Guy, Ed Wilson, is here. It has been stormy for the last couple of days. It makes for a great time to spend offline playing around with my Windows 10 laptop or Surface Pro 3. Watching the power of the storms is great fun, especially if I am not directly in the path. The way the storm parades across the flat Florida plain makes it really easy to watch it approach. It is like watching a giant storm switch that is flipped from off to on, and then back again.Anyway, I decided to make a video rec...

PowerTip: See Number of Errors in PowerShell Session
Aug 28, 2015
Post comments count 0
Post likes count 0

PowerTip: See Number of Errors in PowerShell Session

Doctor Scripto

Summary: Learn how to determine how many errors there are in the Windows PowerShell session.  How can I determine how many current errors there are in my Windows PowerShell session?  Use the Count property from the Error object array: $error.count

August 2015 PowerShell Spotlight
Aug 28, 2015
Post comments count 0
Post likes count 0

August 2015 PowerShell Spotlight

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about community activities.Microsoft Scripting Guy, Ed Wilson, is here. In case you haven’t noticed, I have been turning the keyboard over to Teresa (PowerShell MVP, and my real life wife, aka the Scripting Wife) once a month so she can spotlight community happenings. Today is the day for her August post. Take it away Teresa...Greetings everyone.I hope you have had a scriptastic month. I have been looking at the calendar and checking the RAM in my head to share upcoming events with you.The first item is the Nashville PowerShell User Group meeting. The ...

PowerTip: Find Numeric Value of Enum in PowerShell
Aug 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Numeric Value of Enum in PowerShell

Doctor Scripto

Summary: Learn how to easily find the numeric value of an enum in Windows PowerShell.  How can I use Windows PowerShell to easily find the numeric value of an enumeration?  Use square brackets to call the enum, call the enumeration property as a static property, and reference3            the value__ property. Here is an example using the [fruit] enum created in yesterday’s post,            New PowerShell 5 Feature: Enumerations: [fruit]::apple.value__

Working with Enums in PowerShell 5
Aug 27, 2015
Post comments count 0
Post likes count 0

Working with Enums in PowerShell 5

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about working with enums in Windows PowerShell 5.0 in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. Yesterday, I talked about the new stealth feature in Windows PowerShell 5.0 in Windows 10 that permits me to easily create an enum. Enums are great because they provide a concise way for me to check parameters, a great way to make code easier to read, and many other things. Note  Today's post continues New PowerShell 5 Feature: Enumerations. You should read it prior to reading today's post. Awhile back, I wrote a function called Get-EnumVa...

PowerTip: See Enumeration Value in PowerShell
Aug 26, 2015
Post comments count 0
Post likes count 0

PowerTip: See Enumeration Value in PowerShell

Doctor Scripto

Summary: Learn how to retrieve an enumeration value in Windows PowerShell.  How can I see enumeration allowed values in Windows PowerShell? Place the enumeration name in square brackets, and use the double colon syntax to retrieve a specific property.          IntelliSense will show you permissible values. Here is an example using an enumeration called Fruit: [fruit]::pear

New PowerShell 5 Feature: Enumerations
Aug 26, 2015
Post comments count 0
Post likes count 0

New PowerShell 5 Feature: Enumerations

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about creating enumerations in Windows PowerShell 5.0. Microsoft Scripting Guy, Ed Wilson, is here. It is nearly a stealth feature in Windows PowerShell 5.0—there is an Enum keyword. Yep, that's right, there is an Enum keyword. I wonder what it does? Probably has something to do with creating enums. Is this a big deal? You betcha...as they may say in some places. Why? Because prior to Windows PowerShell 5.0, you had to basically create an enum by using C# kinds of code, and then adding it as a type. Did it work? Sure it did. Was it Windows PowerShell? ...

PowerTip: Find Custom Default PowerShell Parameter Values
Aug 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Custom Default PowerShell Parameter Values

Doctor Scripto

Summary: Learn how to find custom default Windows PowerShell parameter values.  How can I find what custom default Windows PowerShell parameter values I have set up on my            Windows PowerShell console?  Check the value of the $PSDefaultParameterValues variable, for example: PS C:\> $PSDefaultParameterValues

Add Default Values for PowerShell Module Manifest
Aug 25, 2015
Post comments count 0
Post likes count 0

Add Default Values for PowerShell Module Manifest

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about adding default values to your Windows PowerShell module manifest.  Hey, Scripting Guy! I kind of like the idea of creating a manifest for my Windows PowerShell module, but it seems like a lot of busy work. I mean, I seem to always be typing the same thing over and over. I wish there was an easy way to set default values for the module manifest. I thought about taking a blank module manifest, adding default values, and then manually editing the manifest when I needed to customize it… but that seems like a lot of work. Is there an easier way to do...

PowerTip: Find Path to PowerShell Module
Aug 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Path to PowerShell Module

Doctor Scripto

Summary: Easily find the path to a Windows PowerShell module.  How can I easily find the location where a Windows PowerShell module is installed?  Use the Path property from the PSModuleInfo object that returns from the Get-Module cmdlet, for example: (Get-Module Microsoft.PowerShell.Utility).path

Verify PowerShell Module Manifests
Aug 24, 2015
Post comments count 0
Post likes count 0

Verify PowerShell Module Manifests

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about verifying Windows PowerShell module manifests. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that is cool about Windows PowerShell is that it is self-describing. I can type Get-Member or Get-Command and find out what a Windows PowerShell cmdlet is all about. Then there is Get-Help, which also provides way cool information. When cmdlets ship in Windows PowerShell modules, there are additional tools available. I can use Get-Module to see what a module contains. But there is more… I can look at the module manifest. When I create a Windo...

PowerTip: Find Network Adapters that Are Up
Aug 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Network Adapters that Are Up

Doctor Scripto

Summary: Find your network adapters that are available.  How can I use Windows PowerShell to find which network adapters on my computer are up?  Use the Get-NetAdapter cmdlet and filter on the status, for example: (Get-NetAdapter).where{$_.status -eq 'up'} Note  This command works on Windows 8.1 and later.

Weekend Scripter: Parse NetStat with PowerShell 5—The Video
Aug 23, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Parse NetStat with PowerShell 5—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, shares a video he made that illustrates parsing NetStat with Windows PowerShell 5.0.Microsoft Scripting Guy, Ed Wilson, is here. For someone who loves working at the command line, the new ConvertFrom-String cmdlet is awesome. I mean, I can do things in a single line of code that in the past, took 15 or 20 lines of code. This means less scripting and more production work.Today, I am presenting a video to illustrate parsing the output of the NetStat command via Windows PowerShell, but this is simply the surface of how powerful this technique is.[View:https://www.youtube....

PowerTip: Use PowerShell to Find Current Connection Profile
Aug 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Current Connection Profile

Doctor Scripto

Summary: Use Windows PowerShell to find your current connection profile.  How can I use Windows PowerShell to see what connection profile my computer is using?  Use the Get-NetConnectionProfile cmdlet.

Weekend Scripter: Create Objects from Strings—The Video
Aug 22, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Create Objects from Strings—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell 5.0 to create objects from strings in this video.Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about Windows PowerShell is that it is object-oriented. This means that I can easily pipe objects, sort objects, and compare objects.In Windows PowerShell 5.0, this becomes even easier, because I can create objects from strings. Today I present a video to illustrate this technique:[View:https://www.youtube.com/watch?v=JQlOaRy0BMc&feature=youtu.be:550:0]Here is a link to the video from YouTube if you wou...

PowerTip: Use PowerShell Tab Expansion to Navigate Registry
Aug 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell Tab Expansion to Navigate Registry

Doctor Scripto

Summary: Use the Windows PowerShell tab expansion feature to quickly navigate the Windows registry.  How can I use Windows PowerShell to explore settings in the Windows registry?  Use a cmdlet like Get-Item, Get-ItemProperty, or Get-ItemPropertyValue, specify the drive (such as HKCU),             and then press the Tab key to navigate the registry, for example: Get-ItemProperty HKCU:\SOFTWARE\ <TAB>

New PowerShell 5 Feature Provids Better Registry Support
Aug 21, 2015
Post comments count 0
Post likes count 0

New PowerShell 5 Feature Provids Better Registry Support

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about a new feature in Windows PowerShell 5.0 that providers better registry support. Microsoft Scripting Guy, Ed Wilson, is here. The Windows PowerShell registry drive has always been somewhat of a love-hate relationship with me. I mean, it makes such great sense to be able to work with the registry via Windows PowerShell, but still, it always seemed a bit backwards. I know lots of people who stuck with using the .NET registry classes, the old RegRead and RegWrite methods from the VBScript days, or even WMI to work with the registry. Clearly, there was something...

PowerTip: See What Update-Help Does on Your System
Aug 20, 2015
Post comments count 0
Post likes count 0

PowerTip: See What Update-Help Does on Your System

Doctor Scripto

Summary: Learn how to see what the Update-Help cmdlet does on your system.  How can I see what Update-Help does on my Windows 10 computer—if anything?  Open the Windows PowerShell console with Admin rights, type Update-Help, and add the –Verbose switch.             It will list everything that it does, the versions of Help that are current, and which versions are updated.             Here is such a command: Hpdate-Help -Module * -Force -Verbose

The New Raw-File Version Information in PowerShell 5
Aug 20, 2015
Post comments count 0
Post likes count 0

The New Raw-File Version Information in PowerShell 5

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about looking at raw-file version information by using Windows PowerShell 5.0 in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here, and it is finally here. It seems like waiting for a major holiday to appear. Yes! It is nearly time for the Atlanta TechStravaganza. I just got an email yesterday from another Windows PowerShell MVP who will be attending. Cool. Tonight is the “speakers dinner.” By that, I guess they mean, speakers and others—that is, whoever happens to be around and whoever signed up for the dinner will be permitted to ha...

PowerTip: Find Running Services on Your Workstation
Aug 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Running Services on Your Workstation

Doctor Scripto

Summary: Use Windows PowerShell to easily find all running services on your workstation.  How can I use Windows PowerShell to find what services are running on my workstation?  Use the Get-Service cmdlet, filter the status on the word Running, and select the display name of the services,           for example: gsv | where status -eq 'running' | select displayname Note  gsv is an alias for the Get-Service cmdlet.

Parsing NetStat Information with PowerShell 5
Aug 19, 2015
Post comments count 1
Post likes count 0

Parsing NetStat Information with PowerShell 5

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about parsing output from NetStat with Windows PowerShell 5.0.  Hey, Scripting Guy! I need a good way to parse output from the NetStat command. I use it all the time, but it ends up requiring me to spend a lot of time looking through stuff. I am not sure if the command itself has a filter language or what, but I really need to be able to parse on the fly. I have even gone so far as run the command, copy it to the clipboard, paste it into Notepad, and then go through the Notepad file adding characters so I could import it into Excel and filter the output. But...

PowerTip: Find Processes with High Priority
Aug 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Processes with High Priority

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find processes that have a high priority.  How can I use Windows PowerShell to quickly see what processes have a high priority or an above normal priority?  Open Windows PowerShell with Admin rights, use the Get-Process cmdlet to return processes, and filter            processes that are using high or above normal priority, for example: gps | where {$_.priorityclass -eq 'AboveNormal' -OR $_.priorityclass -eq 'high'} | select name, priorityclass

Use New PowerShell 5 Cmdlet to Create Objects from Strings
Aug 18, 2015
Post comments count 0
Post likes count 0

Use New PowerShell 5 Cmdlet to Create Objects from Strings

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using a new Windows PowerShell cmdlet to create objects from strings.  Hey, Scripting Guy! It seems that even though Windows PowerShell 5.0 in Windows 10 has a lot of cool new stuff, I still end up using command-line utilities. I don’t know if it is just me, or if there are still some things that are missing. I can get useful information from these command-line utilities, but I miss the experience of having an object that I can easily sort and filter. I guess what I am really wishing is that I had either more Windows PowerShell cmdlets or a way t...

PowerTip: Recurse Specific Number of Levels with PowerShell 5
Aug 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Recurse Specific Number of Levels with PowerShell 5

Doctor Scripto

Summary: Learn how to recurse a specific number of levels in a directory with Windows PowerShell 5.0.  How can I recurse only three levels into a deeply nested directory structure?  In Windows PowerShell 5.0, the Get-ChildItem cmdlet has a new –Depth parameter            that will control how deeply to recurse, for example: Get-childitem c:\fso –recurse –depth 3

Use the PowerShell 5 Convert-String Cmdlet
Aug 17, 2015
Post comments count 0
Post likes count 0

Use the PowerShell 5 Convert-String Cmdlet

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using the new Convert-String cmdlet in Windows PowerShell 5.0 to manipulate strings. Microsoft Scripting Guy, Ed Wilson, is here. Over the weekend, the Scripting Wife and I headed out and about to explore central Florida. We found a really cool lake town that had an awesome tea shop. We also saw some pretty cool birds walking around. Here is one bird that was just hanging out—to be honest, I think he was bumming scones, but as it turned out he was out of luck—I ate all the scones I had. Anyway, exploring is lots of fun and an interesting way to...

PowerTip: Looking at Logs with PowerShell
Aug 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Looking at Logs with PowerShell

Doctor Scripto

Summary: Find logs that are not enabled with Windows PowerShell.  How can I use Windows PowerShell to quickly see which logs in the event log tool are not enabled by default?  Use the Get-WinEvent cmdlet to produce a list of all the logs, then pipe the results to the Where-Object cmdlet,            and specify that you want those that are not enabled, for example: Get-WinEvent -ListLog * -ea 0 | where {-not ($_.isenabled)} Note   Many logs require elevated permissions for access. Either launch Windows PowerShell with elevated rights, or sp...

Weekend Scripter: Expanding Compressed Archives—The Video
Aug 16, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Expanding Compressed Archives—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, created a video that illustrates expanding compressed archives with Windows PowerShell 5.0.Microsoft Scripting Guy, Ed Wilson, is here. There is a gigantic shaggy dog looking in the window at me. I think it is a North American slobber hound, but then I have never been great at identifying shaggy dogs. One canine pretty much looks like another. I mean, I can tell the difference between Lassie, Snoopy, and Marmaduke, but that is about the extent of my expertise in the doggie ID department.Ever since I received a rather painful bite on the back of the leg from a “fr...

PowerTip: Get Latest Entry from Event Log with PowerShell
Aug 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Latest Entry from Event Log with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to get the latest entry from an event log.  How can I use Windows PowerShell to see the most recent entry from the application log?  Use the Get-EventLog cmdlet, specify the log name, and use the –Newest 1 parameter, for example: Get-EventLog application -Newest 1

Weekend Scripter: Compressed Archives—The Video
Aug 15, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Compressed Archives—The Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, created a video to illustrate using Windows PowerShell 5.0 to create compressed archives.Microsoft Scripting Guy, Ed Wilson, is here. The sky is a deep blue, and the early morning haze on the horizon hides the fluffy white clouds causing them to blend into the sky like a brush stroke by an impressionist painter.I am sitting outside with my Surface Pro 3 under a huge oak tree that looks like it is a thousand years old. I brought a pot of Earl Grey tea with me. I added some lavender to the pot while my leaves were steeping. It is a beautiful morning to be out a...

PowerTip: Use PowerShell 5 to Compress Files
Aug 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell 5 to Compress Files

Doctor Scripto

Summary: Learn how to use the new Compress-Archive cmdlet to compress selected files in Windows PowerShell 5.0.  How can I compress a bunch of files on my computer that match a pattern I supply to Get-ChildItem?  Use Get-ChildItem to find the files you want to compress, and pipe the results to the Compress-Archive cmdlet,            for example (gci is an alias for Get-ChildItem): gci c:\fso\*.txt | Compress-Archive -DestinationPath c:\fso\myarchive.zip

Working with Compressed Files in PowerShell 5
Aug 14, 2015
Post comments count 0
Post likes count 0

Working with Compressed Files in PowerShell 5

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the new compressed file cmdlets in Windows PowerShell 5.0 on Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. It finally happened. I ran out of Gunpowder Green tea over the weekend. I have been making lots of Gunpowder Green tea with hibiscus flowers, rose hips, lemon grass, and other combinations, and then chilling it down. It works great for the central Florida August afternoons (and indeed sometimes early morning and even late at night).I still have lots of black tea, lots of herbs, and even a pound or so of Oolong tea. So I have decided I am goin...

PowerTip: Find Automatic Variables that Begin with Letter
Aug 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Automatic Variables that Begin with Letter

Doctor Scripto

Summary: Find automatic variables in Windows PowerShell that begin with a specific letter.  How can I find automatic variables in Windows PowerShell that begin with the letter P?  Use the drive Windows PowerShell variable provider with a wildcard character after the letter P: DIR variable:P*

New Feature in PowerShell 5: Compress Files
Aug 13, 2015
Post comments count 0
Post likes count 0

New Feature in PowerShell 5: Compress Files

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the compressing files feature in Windows PowerShell 5.0. Microsoft Scripting Guy, Ed Wilson, is here. This morning, the sun is shining, the air is dead calm, and I am sitting outside under a gigantic old oak tree with my Windows Surface Pro 3 that I upgraded to Windows 10. I am sipping a cup of English Breakfast tea with a bit of lemon grass, crushed mint leaves, and cinnamon stick while looking over Twitter. I see lots of people tweeting about Windows PowerShell 5.0. That is a good thing because there are lots of good things in Windows PowerShell 5.0....

PowerTip: View All Available Modules
Aug 12, 2015
Post comments count 0
Post likes count 0

PowerTip: View All Available Modules

Doctor Scripto

Summary: Boe Prox shows how to view all available modules in Windows PowerShell.  How can I view all of the available modules in my current Windows PowerShell session?  Run Get-Module with the –ListAvailable parameter: Get-Module –ListAvailable

Use PoshUSNJournal Module to Work with Change Journal
Aug 12, 2015
Post comments count 0
Post likes count 0

Use PoshUSNJournal Module to Work with Change Journal

Doctor Scripto

Summary: Boe Prox shows how to use the PoshUSNJournal module to work with the USN change journal. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today, filling in for my good friend, the Scripting Guy. I'm finishing up my three-day stint on the Hey, Scripting Guy! Blog. Be sure to catch up by reading: Today, I will demo my module called PoshUSNJournal and show you how to use it with the change journal. I have taken you on the journey of using Windows PowerShell along with PInvoke via reflection to hook into the Windows API to view the change journal and look at the entries to see what ...

PowerTip: Determine if PowerShell is Running x86 or x64
Aug 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine if PowerShell is Running x86 or x64

Doctor Scripto

Summary: Boe Prox shows how to determine if Windows PowerShell is running x86 or x64.  How can I use Windows PowerShell to determine if I am running x86 or x64?  Use [intptr]::Size as follows: Switch ([intptr]::Size) {     4 {"x86"}     8 {"x64"}       }

View Entries in USN Change Journal
Aug 11, 2015
Post comments count 0
Post likes count 0

View Entries in USN Change Journal

Doctor Scripto

Summary: Boe Prox shows us how to view the entries in the USN change journal. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today, filling in for my good friend, the Scripting Guy. Today I'm continuing on from yesterday’s post, Connect to USN Change Journal. In today’s post, I'll look at the actual entries of the journal, which will show us information about the files and folders that are being created, modified, and deleted. Much like yesterday, I need to create some methods through reflection in addition to some Structs and Enums to handle some of the work that I will b...

PowerTip: Use PowerShell to List Exported Types
Aug 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List Exported Types

Doctor Scripto

Summary: Boe Prox shows how to use Windows PowerShell to list exported types.  How can I use Windows PowerShell to list all of the exported types?  Use this command:  [appdomain]::CurrentDomain.GetAssemblies()|ForEach {     Try {         $_.GetExportedTypes()     } Catch {} }

Connect to USN Change Journal
Aug 10, 2015
Post comments count 0
Post likes count 0

Connect to USN Change Journal

Doctor Scripto

Summary: Honorary Scripting Guy, Boe Prox, shows us how to connect to the USN change journal by using Windows PowerShell. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today, filling in for my good friend, the Scripting Guy. Over the course of the next few days, I am going to be talking about a topic that many of you might not have heard about, which deals with the update sequence number (USN) change journal. We will use Windows PowerShell to take a walk-through, with help from PInvoke, to connect to the change journal and view the entries within the journal. First, a quick overview of the USN...

PowerTip: Find Commands and Descriptions from Module
Aug 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Commands and Descriptions from Module

Doctor Scripto

Summary: Find commands and their descriptions exported from a Windows PowerShell module.  How can I see the commands with their descriptions that are available in a new Windows PowerShell module?  Use the Get-Command (gcm is an alias) cmdlet and specify the module. Then select the name and create            a custom property to retrieve the description from Get-Help, for example: gcm -Module psreadline | select name, @{L='description'; E={(get-help $_).description.text}}

Weekend Scripter: PowerShell 5 Overview Video
Aug 9, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell 5 Overview Video

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, presents a video he made as an overview of Windows PowerShell 5.0.Microsoft Scripting Guy, Ed Wilson, is here. It has been a great week. It is a nice sunny day here in central Florida, and I am sipping a cup of Earl Grey tea. I decided to make a video to summarize the things I have been talking about with Windows PowerShell 5.0. Sometimes it is just easier to say things in a video. Windows PowerShell 5.0 Overview video by Ed WilsonI invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post ...

PowerTip: Find Commands Exported by PowerShell Module
Aug 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Commands Exported by PowerShell Module

Doctor Scripto

Summary: Find commands that are exported by a Windows PowerShell module.  How can I see what commands a Windows PowerShell module provides?  There are two quick ways to find commands exported by a Windows PowerShell module. The first expands the ExportedCommands property from a module (gmo is an alias for the Get-Module cmdlet): gmo PSReadline | select -ExpandProperty exportedcommands The second uses the Get-Command cmdlet (gcm is an alias for Get-Command): gcm -Module PSreadline

Weekend Scripter: A Week's Worth of Windows 10
Aug 8, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: A Week's Worth of Windows 10

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks more about his first impressions of Windows 10.Microsoft Scripting Guy, Ed Wilson, is here. I will admit that I am not a typical user—of anything, as far as that goes, but certainly not of desktop operating systems. So my thoughts about Windows 10 may or may not, be relevant.First of all, I can say that I have been "using" Windows 10 for about a year because I get the daily builds. But this is not all that true because installing Windows 10 and immediately launching Windows PowerShell hardly counts as using Windows 10. So in reality, my ...

PowerTip: Find Cmdlets with NoNewLine Parameter
Aug 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Cmdlets with NoNewLine Parameter

Doctor Scripto

Summary: Easily find Windows PowerShell 5.0 cmdlets with the NoNewLine parameter.  I heard that Windows PowerShell 5.0 introduces a NoNewLine parameter for some cmdlets, but how can I            find the cmdlets?  Use the Get-Command cmdlet (gcm is an alias), and search for the ParameterName of NoNewLine: gcm -ParameterName nonewline

The PowerShell 5 NoNewLine Parameter
Aug 7, 2015
Post comments count 0
Post likes count 0

The PowerShell 5 NoNewLine Parameter

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the NoNewLine parameter in Windows PowerShell 5.0 in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. In addition to new cmdlets in Windows PowerShell 5.0, there are also improvements to existing cmdlets. These improvements are often really cool because it means I can use the old cmdlets in new ways, which is just about like having a new cmdlet. These add-ons (if you will) are not as easy to find as a whole brand new cmdlet. I mean, a brand new cmdlet is pretty easy to find with Get-Command because all I need to do is type Get-Command, and search fo...

PowerTip: Find Alias for PowerShell Cmdlet
Aug 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Alias for PowerShell Cmdlet

Doctor Scripto

Summary: Learn how to find an alias for a specific Windows PowerShell cmdlet.  How can I find is there is an alias for a specific Windows PowerShell cmdlet that I use a lot?  Use the Get-Alias cmdlet, specify the –Definition parameter, and supply the name of the cmdlet, for example: Get-Alias -Definition Get-CimClass

Playing Around with Format-Hex
Aug 6, 2015
Post comments count 0
Post likes count 0

Playing Around with Format-Hex

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the Format-Hex cmdlet in Windows PowerShell 5.0. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is that it usually just works. Well of course, after you learn how, it just works. For example, it is largely self-describing, and it has standard parameters. Other cmdlets that use parameters with similar names generally take pains to ensure that those parameters work the same way. For example, the Path parameter is not a standard parameter. Yet, it is usually always called Path, and it generally points to the path t...

PowerTip: Create a GUID with PowerShell 5
Aug 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Create a GUID with PowerShell 5

Doctor Scripto

Summary: Learn how to create a new GUID with Windows PowerShell 5.0.  How can I use Windows PowerShell 5.0 in Windows 10 to create a new GUID?  Use the New-Guid cmdlet:

Create Temporary Files with PowerShell 5
Aug 5, 2015
Post comments count 0
Post likes count 0

Create Temporary Files with PowerShell 5

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about creating temporary files with Windows PowerShell 5.0 in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a nice Gunpowder Green tea with hibiscus leaves and rose hips in it. I also added a bit of lemon grass for taste. I made the tea last night and chilled it. The taste is surprisingly clean and refreshing. Along with some Belgium crisp chocolate sticks, it makes a delightful mid-morning snack. I am stilling playing around with Windows 10 and Windows PowerShell 5.0. I suspect this will probably be a task that will occupy me...

PowerTip: Use PowerShell 5 to Clear Recycle Bin
Aug 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell 5 to Clear Recycle Bin

Doctor Scripto

Summary: Learn how to clear the recycle bin by using Windows PowerShell 5.0 in Windows 10.  How can I use Windows PowerShell to clear the recycle bin in my laptop running Windows 10?  Use the Clear-RecycleBin cmdlet.

Use Transcript Tool in PowerShell ISE
Aug 4, 2015
Post comments count 0
Post likes count 0

Use Transcript Tool in PowerShell ISE

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using the Windows PowerShell ISE transcript in PowerShell 5.0 in Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. It is not a secret that I love Windows PowerShell. It is also not a secret that Windows PowerShell keeps getting better and better. One of the things about Windows PowerShell is that if I do not like the way it does something, or if there is a functionality that is missing, I can write my own commands and make my own modifications. In this way, Windows PowerShell extensible, and it is pretty awesome. Something that is also awes...

PowerTip: Find PowerShell Help Content
Aug 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Help Content

Doctor Scripto

Summary: Learn how to find all Windows PowerShell Help content.  I updated the Help files on my installation of Windows PowerShell. I can find the cmdlet Help,            but how can I see the Help text files?  Use the Get-Help cmdlet, search for the HelpFile category, select all of them with a wildcard            character, and then pipe the output to More: Get-Help –category helpfile * | more

Cool Stuff about PowerShell 5.0 in Windows 10
Aug 3, 2015
Post comments count 0
Post likes count 0

Cool Stuff about PowerShell 5.0 in Windows 10

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about cool stuff in Windows PowerShell 5.0 for Windows 10. Microsoft Scripting Guy, Ed Wilson, is here. Over the weekend, I installed Windows 10. It is way cool. I love what we have done with the charms bar…it is gone. I also like the streamlined user interface, the new Edge browser, and especially Windows PowerShell 5.0. I mean, it is awesome. It rocks. By the way, the easiest way to upgrade to Windows PowerShell 5.0 right now, is to upgrade to Windows 10—which by the way, is a free upgrade from Windows 7, 8, and 8.1. For now, that is what...

PowerTip: Install PowerShell Help on PowerShell 5.0
Aug 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Install PowerShell Help on PowerShell 5.0

Doctor Scripto

Summary: Update Help for Windows PowerShell 5.0.  I installed Windows 10 and opened Windows PowerShell, but how can I update the Help for Windows PowerShell 5.0?  Open Windows PowerShell as an Administrator, type Update-Help, select all of the modules, and use the –Force             parameter if you run the command more than once a day: Update-Help –module * -Force

Weekend Scripter: Exploring Windows PowerShell 5.0
Aug 2, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Exploring Windows PowerShell 5.0

Doctor Scripto

Summary: Teresa Wilson, Powershell MVP, talks about exploring Windows PowerShell 5.0 on Windows 10. Teresa Wilson, AKA the Scripting Wife, is here. The Microsoft Scripting Guy, Ed Wilson, is still missing in action. He downloaded Windows 10, and I haven’t seen him since. So I thought I would write about getting Windows PowerShell 5.0 running on Windows 10. The first thing I need to do is find Windows PowerShell 5.0. I type PowerShell in the Web and Windows search box on my task bar. Cortana comes up and locates the Windows PowerShell 5.0 executable. I click the top of the list for the Desktop...

PowerTip: Find What Version of PowerShell You Have
Aug 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Find What Version of PowerShell You Have

Doctor Scripto

Summary: Easily find what version of Windows PowerShell you are running.  I upgraded to Windows 10, but how can I confirm what version of Windows PowerShell I am running?  Use the $psversiontable automatic variable.

Weekend Scripter: Upgrade to Windows 10
Aug 1, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Upgrade to Windows 10

Doctor Scripto

Summary: Teresa Wilson, Windows PowerShell MVP, talks about upgrading to Windows 10. Teresa Wilson, AKA the Scripting Wife, is here. I first wanted to mention that Ed and I will be in Atlanta on August 21 for TechStravaganza. At the time I am writing this there are 22 tickets remaining, so hurry and sign-up if you would like to attend. It is a free event. Ed is somewhere playing with Windows 10, and he left me on my own to upgrade my computer. He says it will be a good experience for me. I am not sure what he really means by that. But I am quite confidant that I can do this, and it will be a good experience. Step...

PowerTip: Download Links from Webpage with PowerShell
Jul 31, 2015
Post comments count 0
Post likes count 0

PowerTip: Download Links from Webpage with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to download links from a webpage.  How can I use Windows PowerShell to easily download links from a webpage that has a lot of links I want?  Use Invoke-WebRequest and select Links and href, for example: (Invoke-WebRequest -Uri "http://www.scriptingguys.com").Links.Href

What’s My PID?
Jul 31, 2015
Post comments count 0
Post likes count 0

What’s My PID?

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, creates a function to capture the process ID of a Windows PowerShell host. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I like to know is the process ID (PID) of specific processes. Often this is trivial. I can use the Get-Process cmdlet and, for example, look to see what the process ID of Notepad.exe is. But what if I have four or five instances of Notepad running? Then it becomes somewhat an exercise in trial and error. This is also true for Windows PowerShell. For example, the Windows PowerShell console process name is PowerShell. No problem. Excep...

PowerTip: Find Most Recent Event Log Entry
Jul 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Most Recent Event Log Entry

Doctor Scripto

Summary: Use Windows PowerShell to find the most recent event log entry.  How can I use Windows PowerShell to see the most recent event log entry from my application log?  Use the Get-EventLog cmdlet and select the application log and the Newest 1 entry: Get-EventLog application -Newest 1

Launch Elevated PowerShell Shell
Jul 30, 2015
Post comments count 0
Post likes count 0

Launch Elevated PowerShell Shell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about launching an elevated Windows PowerShell shell. Microsoft Scripting Guy, Ed Wilson, is here. Today I had a great talk with Steve, the Scripting Manager. One of the things we talked about was the importance of community, and how the Windows PowerShell community seems to be really engaged with the Windows PowerShell team and with other documentation efforts. One of the great things that I love about the Windows PowerShell community is the interaction I have with them at user groups, conferences, and community events (such as the Atlanta TechStravaganza that i...

PowerTip: Use PowerShell to Check Logon Server for Client
Jul 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Check Logon Server for Client

Doctor Scripto

Summary: Use Windows PowerShell to check the logon server of your clients.  How can I use Windows PowerShell to verify if my users are trying to sign in to their computers with a Windows account            instead of using their domain credentials?  Check the value of the environmental LOGONSERVER variable: $env:LOGONSERVER If it reports \\MicrosoftAccount, they are using their Windows account to sign in instead of domain credentials. You can check this by using the IF statement as shown here: if($env:LOGONSERVER -match "MicrosoftAccount")...

Use Function to Determine Elevation of PowerShell Console
Jul 29, 2015
Post comments count 0
Post likes count 0

Use Function to Determine Elevation of PowerShell Console

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using a function to determine if a Windows PowerShell console is elevated. Microsoft Scripting Guy, Ed Wilson, is here. I had a friend tell me that nearly half of all the cmdlets, functions, and whatever’s in Windows PowerShell 4.0 on Windows Server 2012 R2 required elevation to Admin rights. I can neither confirm nor deny this assertion, and I have not seen any official documentation about this. But I can tell you, that there are quite a few of these things that do require elevation. For example, the Hyper-V functions (even in Windows&...

PowerTip: Read File with Backtick in Name
Jul 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Read File with Backtick in Name

Doctor Scripto

Summary: Read the content of a text file with a backtick ( ` ) in the name.  How can I use Windows PowerShell to read the content of a file that has a backtick ( ` ) in the file name?  Use single quotation marks around the name when you supply the path to Get-Content, for example: Get-Content 'c:\fso\a file with a `in the name.txt' The following examples fail: Get-Content "c:\fso\a file with a `in the name.txt" Get-Content c:\fso\a file with a `in the name.txt

One of My Favorite PowerShell Functions
Jul 28, 2015
Post comments count 0
Post likes count 0

One of My Favorite PowerShell Functions

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, discusses one of his favorite functions: Get-EnumValues. Microsoft Scripting Guy, Ed Wilson, is here. Today I am working on my presentation for Atlanta TechStravaganza 2015, which will happen on August 21. It will be a really cool event, and the Scripting Wife and I are looking forward to attending it. Unfortunately we were unable to attend last year due to a scheduling conflict, so we are really looking forward to this year. It is always a great event with top-flight speakers. Anyway, I am still messing around with my Windows PowerShell profile... One of my favor...

PowerTip: Find PowerShell Variables Defined for AllScope
Jul 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Variables Defined for AllScope

Doctor Scripto

Summary: Find Windows PowerShell variables that are defined for all scopes.  How can I find  what variables are defined as AllScope in my Windows PowerShell environment?  Get a list of all your variables, and filter for options that include AllScope, for example: (dir variable:).where({$_.options -match 'allscope'})

Describe Your PowerShell Variables
Jul 27, 2015
Post comments count 0
Post likes count 0

Describe Your PowerShell Variables

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about adding a description to variables. Microsoft Scripting Guy, Ed Wilson, is here. There is a “water feature” outside that keeps running and running and running. It is a bit strange, and to be honest, it makes me think that it is raining all the time. In central Florida in the summer, it is generally a safe bet that it will rain, but even when the sun is outside, without a cloud in the sky, the giant frog keeps spitting water into a pond. I don’t get it. It is not relaxing like a Zen pond, and it does not keep bugs at bay like a real frog wou...

PowerTip: Open Temporary Copy of PowerShell Profile
Jul 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Open Temporary Copy of PowerShell Profile

Doctor Scripto

Summary: Open a temporary copy of your Windows PowerShell profile.  How can I look at a temporary copy of my Windows PowerShell profile to ensure that I don’t            accidentally make any changes?  Copy your Windows PowerShell profile to a temporary file, and then open it in the            Windows PowerShell ISE, for example: Copy-Item $PROFILE $([io.path]::GetTempFileName()) -PassThru | % { ise $_.fullname}

Weekend Scripter: Back Up Your PowerShell Profile
Jul 26, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Back Up Your PowerShell Profile

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about automatically backing up your Windows PowerShell profile. Microsoft Scripting Guy, Ed Wilson, is here. My rule for making backups is that when the loss of the item would cause me grief, it is backed up. Otherwise, there is not too much need for a backup. This includes things that are not related to computers in addition to computers, files, and Windows PowerShell profiles. For example, if I go on a trip and I only have a single battery for my camera, would I be upset if that battery dies, drains, or otherwise becomes useless? Maybe. But then again, maybe no...

PowerTip: Launch PowerShell Without a Profile
Jul 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Launch PowerShell Without a Profile

Doctor Scripto

Summary: Learn how to launch Windows PowerShell without using a profile.  I suspect my profile is causing issues with Windows PowerShell. How can I launch Windows PowerShell            without starting the profile?  Use the Run command to launch Windows PowerShell with the –noprofile switch: PowerShell -noprofile

Weekend Scripter: Replace One PowerShell Function with Another
Jul 25, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Replace One PowerShell Function with Another

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about replacing one Windows PowerShell function with a different one. Microsoft Scripting Guy, Ed Wilson, is here. One of the problems with writing Windows PowerShell code every day is that you eventually... No, it’s not what you think. I am often asked if I run out of ideas, and the answer is, "No, I don’t." There is so much I can do with Windows PowerShell that, in fact, a new version of Windows PowerShell will be out before I ever run out of ideas of what to do with the last version. No, the problem is not that I run out of ideas, but it is that I often fo...

PowerTip: Create New PowerShell Profile for All Hosts
Jul 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Create New PowerShell Profile for All Hosts

Doctor Scripto

Summary: Learn how to create a new Windows PowerShell current user profile for all hosts.  How can I easily create current user profile for all hosts that can be used in the Windows PowerShell console and            the Windows PowerShell ISE?  Use the New-Item cmdlet to create a new file. To find the correct path, use the $profile automatic variable and            choose the CurrentUserAllHosts property, for example: New-Item -ItemType file -Force -Path $PROFILE.CurrentUserAllHosts

Two Cool PowerShell Functions
Jul 24, 2015
Post comments count 0
Post likes count 0

Two Cool PowerShell Functions

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about a pair of cool Windows PowerShell functions to add to your profile. Microsoft Scripting Guy, Ed Wilson, is here. At times, it seems like a Windows PowerShell profile is like a filing cabinet. Whether you have good organizational skills or you organize in a more ad-hoc, random, fashion is a matter of choice—as long as your organization is effective. Today, I want to share a pair of Windows PowerShell functions that are in my Windows PowerShell profile. I believe that I copied them when June Blender and I team-taught a Windows PowerShell class for docum...

PowerTip: Open Windows Explorer to a Location
Jul 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Open Windows Explorer to a Location

Doctor Scripto

Summary: Easily open the Windows Explorer to a specific location in Windows PowerShell.  How can I use Windows PowerShell with the Windows Explorer graphical tool to browse through the files in            my home directory or documents location?  Use the Explorer program name and follow it with the location. For your home directory, use the            $Home automatic variable: explorer $HOME Note  To easily access your documents folder, you can use the variable that I created in            I Have a PowerShell Profile—Now What?: Explorer $doc

Sorting PowerShell Transcript Files
Jul 23, 2015
Post comments count 0
Post likes count 0

Sorting PowerShell Transcript Files

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about creating a sortable transcript name. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about Windows PowerShell is that if there is something that annoys you, you can generally fix it. Don’t get me wrong, Windows PowerShell is great, but like any program, there are things that annoy me. It is partly because I have different needs than a typical user—I have never been typical in my life. For example, I think that all of the defaults in Windows Explorer are wrong for me. For example, I want to see file extensions, I want to see ...

PowerTip: Determine if Running in PowerShell Console
Jul 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine if Running in PowerShell Console

Doctor Scripto

Summary: Determine if you are running inside the Windows PowerShell console.  How can I find if I am running inside the Windows PowerShell console for my Windows PowerShell profile?  Look at the $host.name property. If it returns ConsoleHost, you are running in the Windows PowerShell console.           The following code shows how to do this: if(($host.Name -match 'consolehost')) {$true}

PowerShell Profile? Which One?
Jul 22, 2015
Post comments count 0
Post likes count 0

PowerShell Profile? Which One?

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about determining which Windows PowerShell profile to use for which functions. Microsoft Scripting Guy, Ed Wilson, is here. Living in central Florida can be a bit warm and humid in late July. Of course, I knew that before we moved here. I told one of my friends recently, when he commented on the heat and humidity, that it was truth in advertising. I told him if the Scripting Wife survived July and August here, she would know that she could handle the worst of the summer weather. Interestingly enough, on many days recently, it has actually been warmer back in Char...

PowerTip: Find Name and Location of PowerShell Profiles
Jul 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Name and Location of PowerShell Profiles

Doctor Scripto

Summary: Learn how to find the name and location of various Windows PowerShell profiles.  How can I find the name and location of various Windows PowerShell profiles?  Use the $profile automatic variable to see what profiles are available for your particular Windows PowerShell           host (for example, the console host or the ISE). To find only the name and the location of the profiles,            you need to return only the properties from the object and then look for names that  begin with A or C,        ...

I Have a PowerShell Profile—Now What?
Jul 21, 2015
Post comments count 0
Post likes count 0

I Have a PowerShell Profile—Now What?

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the what to add into a Windows PowerShell profile. Microsoft Scripting Guy, Ed Wilson, is here. It was a beautiful sunny weekend in central Florida. The Scripting Wife and I headed to Tampa, where we met up with various Windows PowerShell peeps. It is good to get together and talk about cool stuff with cool people. The Microsoft office in Tampa is a really cool place to hang out, and it has awesome views of the harbor. There are also lots of really good restaurants in town. Anyway, when I am around Windows PowerShell people, one of the things I tend to ask ...

PowerTip: Determine If You Have PowerShell Profile
Jul 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine If You Have PowerShell Profile

Doctor Scripto

Summary: Learn how to determine if you have a local Windows PowerShell profile.     How can I find if I have a Windows PowerShell profile?           Use the Test-Path cmdlet, and check for the existence of $profile, for example: test-path $PROFILE

All About PowerShell Profiles
Jul 20, 2015
Post comments count 0
Post likes count 0

All About PowerShell Profiles

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about Windows PowerShell profiles.  Microsoft Scripting Guy, Ed Wilson, is here. Today I am heading back to the basics. Why? Because my hard disk drive died, and I had to order a new drive to replace it. It gave me a good chance to reinstall Windows 8.1. Now, my laptop is really fast. It is amazing how dramatically the stuff that you install slows down your laptop. Even when you uninstall stuff, most programs leave components behind, so my poor laptop bogs down like a tractor in a muddy field. I didn’t lose any data because I sync everything on a regul...

PowerTip: Find Tangent of 45-Degree Angle with PowerShell
Jul 19, 2015
Post comments count 1
Post likes count 0

PowerTip: Find Tangent of 45-Degree Angle with PowerShell

Doctor Scripto

Summary: Find the tangent of a 45-degree angle with Windows PowerShell.  How can I use Windows PowerShell to obtain the tangent of a 45-degree angle?  Use the Tan static method from the [math] class, for example: [math]::tan(45)

Weekend Scripter: Building Test Servers
Jul 19, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Building Test Servers

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about building test servers. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am listening to my favorite Swiss classical radio station on my computer, and I am sipping a cup of herb tea. I have a nice strawberry scone that I picked up in town at a local bakery. I am reminded of a conversation I had with a friend of mine who was a TAM in Zurich. We were talking about testing changes prior to implementation. In the old days, having a test network meant building racks of servers, restoring tapes, and trying to keep track configurations in sync with produ...

PowerTip: Set Breakpoint Based on Command
Jul 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Set Breakpoint Based on Command

Doctor Scripto

Summary: Learn to set a Windows PowerShell breakpoint based on a specific command.  How can I configure the Windows PowerShell debugger to start when a script hits a specific command?  Use the Set-PSBreakpoint cmdlet and specify a specific command name, for example: Set-PSBreakpoint -Command Foreach

Weekend Scripter: Break in to a Script via a Command
Jul 18, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Break in to a Script via a Command

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using the debugger to break in to a script via a specific command. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things, when troubleshooting a specific function in Windows PowerShell, is to set a breakpoint to occur each time the command is called. Remember, Windows PowerShell functions are also Windows PowerShell commands, just as language statements and cmdlets are. To set the breakpoint in a command, you use the -command parameter. You can break on a call to a Windows PowerShell cmdlet, function, or external script. You can use aliases wh...

PowerTip: Set PowerShell Breakpoint Based on Variable
Jul 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Set PowerShell Breakpoint Based on Variable

Doctor Scripto

Summary: Set a Windows PowerShell breakpoint based on a variable.  How can I enter the Windows PowerShell debugger when a particular variable is accessed in a specific            Windows PowerShell script?  Set a breakpoint and specify a particular variable and script, for example: Set-PSBreakpoint -Variable num -Mode write -Script C:\FSO\BadScript.ps1

Setting a Breakpoint on a Variable
Jul 17, 2015
Post comments count 0
Post likes count 0

Setting a Breakpoint on a Variable

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using variable breakpoints with the Windows PowerShell debugger. Hello Windows PowerShell scripting dudes and dudettes! Debugging Week continues, and today I am talking about using variable breakpoints with the Windows PowerShell debugger. Setting a breakpoint on line 1 of the script is useful for easily entering a debugging session. Setting a breakpoint on a variable can often make a problem with a script easy to detect. This is, of course, especially true when you have already determined that the problem is with a variable that is getting assigned a value...

PowerTip: Find All Disabled Breakpoints in PowerShell
Jul 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Find All Disabled Breakpoints in PowerShell

Doctor Scripto

Summary: Find all disabled breakpoints in a Windows PowerShell session.  How can I use Windows PowerShell to see what breakpoints are disabled in my current session?  Use the Get-PSBreakPoint cmdlet, and filter breakpoints that are not enabled, for example: Get-PSBreakpoint | where {-not ($_.enabled)}

Understanding PowerShell Script Debugging
Jul 16, 2015
Post comments count 0
Post likes count 0

Understanding PowerShell Script Debugging

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about understanding Windows PowerShell debugging. Microsoft Scripting Guy, Ed Wilson, is here. Today I am working a little bit on my presentation for the Atlanta TechStravagenza that will be held at the Georgia Tech Research Institute Conference Center in midtown Atlanta on Friday August 21, 2015. It is not going to be held at the Microsoft Office this year, because the event has simply grown too large for the facilities. It will be an absolutely awesome day, and I look forward to seeing Mark Minasi and others who will be there. As Debugging Week continues, I wan...

PowerTip: Find References to Uninitialized Variables in PowerShell
Jul 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Find References to Uninitialized Variables in PowerShell

Doctor Scripto

Summary: Easily find references to uninitialized variables in Windows PowerShell.  My extremely long script keeps failing and I suspect it may be because of variables that are not            initialized prior to being used. How can I find uninitialized variables?  Use the Set-StrictMode cmdlet and set it to –version 1 to ensure that all references to            initialized variables generate an error: Set-StrictMode –version 1

PowerShell Cruise announced
Jul 15, 2015
Post comments count 0
Post likes count 0

PowerShell Cruise announced

mredwilson

SUMMARY: The Windows PowerShell Cruise, PowerShell on the high seas, is announced What's better than a vacation? How's geeking out about PowerShell (and other technologies) with a bunch of MVPs and doing that, in the Bahamas? I'm Doug Finke, 7 time PowerShell MVP and author or "PowerShell for Developers". Earlier this year people in the PowerShell community asked about organizing an all PowerShell event or conference in the Northeast. In thinking about it, I hit on the idea of why not do a conference on a cruise. I told Jeff Langdon, he was one of the people I was in touch with about doing a large event around Po...

Use PowerShell Strict Mode for Debugging
Jul 15, 2015
Post comments count 0
Post likes count 0

Use PowerShell Strict Mode for Debugging

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using strict mode in Windows PowerShell for debugging purposes. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is that it can take being ignored or being used carelessly and sloppily, and it still seems to work fine. I mean, in the old days with VBScript, it was common to use Option Explicit to force you to declare all of the variables that you were going to use in the script. In Windows PowerShell, no one seems to do this…at all. The bad thing is that if I run a script (say in the Windows PowerShell ISE)...

PowerTip: Enable Script Tracing in PowerShell Functions
Jul 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Enable Script Tracing in PowerShell Functions

Doctor Scripto

Summary: Enable script tracing into and out of Windows PowerShell functions.  How can I trace my script execution into and out of Windows PowerShell functions?  Use the Set-PSDebug cmdlet and set a trace level of 2: Set-PSDebug  -Trace 2

More PowerShell Script Tracing and Strict Mode
Jul 14, 2015
Post comments count 0
Post likes count 0

More PowerShell Script Tracing and Strict Mode

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks more about Windows PowerShell script tracing and enabling strict mode. Microsoft Scripting Guy, Ed Wilson, is here. It can be somewhat painful to troubleshoot intermittent errors with Windows PowerShell. Two things that can lead to this are variables that do not get initialized properly (and therefore their values change over subsequent running of the script) and functions that do not get accessed properly. To solve both of these problems, we can use Windows PowerShell cmdlets. Yesterday in Tracing the Execution of a PowerShell Script, I introduced the tracing le...

PowerTip: Use Cmdlet to Trace Script Execution
Jul 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Cmdlet to Trace Script Execution

Doctor Scripto

Summary: Use a Windows PowerShell cmdlet to trace script execution.  How can I trace lines that execute in a Windows PowerShell script, without concern for variable assignments, functions, or external scripts?  Use the Set-PSDebug cmdlet and set a trace level of 1: Set-PSDebug -trace 1

Tracing the Execution of a PowerShell Script
Jul 13, 2015
Post comments count 0
Post likes count 0

Tracing the Execution of a PowerShell Script

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using a cmdlet to trace the execution of a Windows PowerShell script.  Hey, Scripting Guy! I am having a problem with a script. It does not generate any errors, but dude, it does not seem to work either. Can you help me debug it? —DR  Hello DR, Microsoft Scripting Guy, Ed Wilson, is here. When I see a script that doesn’t work, I think, "Cool…it is easy to troubleshoot." Often this is the case because the error message helps locate the source of the error. But if a script simply doesn’t work, it can be more diffic...

PowerTip: Find All Breakpoints in PowerShell Session
Jul 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Find All Breakpoints in PowerShell Session

Doctor Scripto

Summary: Find all breakpoints for a Windows PowerShell script.  How can I see the debugging breakpoints that are set in my current Windows PowerShell session?  Use the Get-PSBreakpoint cmdlet.

Weekend Scripter: Debug, Boss…Debug
Jul 12, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Debug, Boss…Debug

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about debugging Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about central Florida is there are lots of farmers markets… especially (I am told) this time of the year. This is great, because I prefer organically grown, locally sourced food. I mean, I like my food to be simply food—not food and a whole lot of additives and other things. My simple rule is this: If I cannot read and pronounce it, then I won’t eat it. Although I have taken many science classes at the university, I have not had a che...

PowerTip: Use PowerShell to Get Disk Drive Overview
Jul 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Disk Drive Overview

Doctor Scripto

Summary: Use Windows PowerShell to obtain a disk drive overview.  How can I use Windows PowerShell to get a quick overview of my disk drives?  Open Windows PowerShell with Admin rights, and use the Get-Disk function to retrieve            the disk number, operational status, health status, friendly name, and size, for example: Get-Disk | select number, operation*, health*, friendly*, size

Weekend Scripter: The Big Decision about Scripts
Jul 11, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: The Big Decision about Scripts

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about if you should write Windows PowerShell scripts or do something else. Microsoft Scripting Guy, Ed Wilson, is here. It is the weekend, and once again, it is a beautiful sunny morning in central Florida. I am sitting outside with my Windows Surface Pro 3, and taking the time to do a little writing. I picked up some fresh bagels, and I am sipping a nice cup of English Breakfast tea with a bit of lemon in it. As I reflect back over this week’s blog posts, I think I need to clarify one thing: the whole point of scripting is to make things easier. If it is e...

PowerTip: Use PowerShell to Obtain Unique List of Process Names
Jul 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Obtain Unique List of Process Names

Doctor Scripto

Summary: Use Windows PowerShell to get a list of unique process names.  How can I use Windows PowerShell to obtain a list of all the unique process names running on my system?  Use the Get-Process cmdlet, pipe the results to the Select-Object cmdlet, and specify the Name property and the –Unique switch: Get-Process | select name -Unique

Understanding PowerShell Modules
Jul 10, 2015
Post comments count 0
Post likes count 0

Understanding PowerShell Modules

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about Windows PowerShell modules.  Hey, Scripting Guy! I keep hearing about Windows PowerShell modules, but I do not know what they really mean. Is it something that comes with Windows PowerShell, or is it something I have to buy or download? I don’t get it. Can you shed some light? —ST  Hello ST, Microsoft Scripting Guy, Ed Wilson, is here. Things are really exciting around the Scripting Household. I have been talking to Microsoft evangelist ,Blain Barton, about doing a PowerShell Saturday in Florida. Without giving any details away, it is ...

PowerTip: Determine Name of PowerShell Host
Jul 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine Name of PowerShell Host

Doctor Scripto

Summary: Learn how to determine the name of the Windows PowerShell host.  How can I find the name of the Windows PowerShell host (such as the Windows PowerShell console or            the Windows PowerShell ISE)?  Use the Get-Host cmdlet and select the Name property: (get-host).name

Understanding Advanced Functions in PowerShell
Jul 9, 2015
Post comments count 0
Post likes count 0

Understanding Advanced Functions in PowerShell

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about Windows PowerShell advanced functions.  Hey, Scripting Guy! I keep hearing about advanced functions, but to be honest, I am not really sure what they are talking about. I mean, I can do a function, but when does it become advanced? Only when it is really long? Or when it does complicated stuff? I don’t know if I have ever written an advanced function, do you? —BB  Hello BB, Microsoft Scripting Guy, Ed Wilson, is here. Awesome day! I just received my copy of Blain Barton’s new book, Microsoft Public Cloud Services: Setting up your...

PowerTip: Find Status of Range of Services with PowerShell
Jul 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Status of Range of Services with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find the status of a range of services.  How can I use Windows PowerShell to find the status of a range of services that have an initial letter that            does not begin with V through Z?  Use Get-Service with the –Exclude parameter, and supply a wildcard character set that represents            the letters V through Z: Get-Service -Exclude [V-Z]*

Fun with PowerShell Functions
Jul 8, 2015
Post comments count 0
Post likes count 0

Fun with PowerShell Functions

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about basic design considerations for Windows PowerShell functions.  Hey, Scripting Guy! I keep hearing about functions, but I really do not know what they are, how to create one, or even how to use one. Can you help me with this? I am not a programmer, but it seems likely that you guys are trying to force me to become one. Help! —DS  Hello DS, Microsoft Scripting Guy, Ed Wilson, is here. It is another beautiful day here in Central Florida. I am sipping a nice cup of Djareerling tea, with a bit of orange blossom local honey, and munching on a hone...

PowerTip: Pick Up User Name with PowerShell
Jul 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Pick Up User Name with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to easily pick up the user name.  How can I easily pick up the user name from my Windows PowerShell script?  Use the USERNAME environmental variable, and pick it up from the $env Windows PowerShell drive: $env:USERNAME

PowerTip: Use PowerShell to Get Unique List of Process Names
Jul 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Unique List of Process Names

Doctor Scripto

Summary: Use Windows PowerShell to get a list of unique process names.  How can I use Windows PowerShell to obtain a list of all the unique process names running on my system?  Use the Get-Process cmdlet, pipe the results to the Select-Object cmdlet, and specify the Name property            and the –Unique switch: Get-Process | select name -Unique

A PowerShell Script Is…
Jul 7, 2015
Post comments count 0
Post likes count 0

A PowerShell Script Is…

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about creating and using a Windows PowerShell script. Microsoft Scripting Guy, Ed Wilson, is here. This afternoon, it is raining—actually more like a thunderstorm because there is lightning and thunder. In the afternoon in central Florida, there is a really good chance that for 10 or 15 minutes, one will see an awesome thunderstorm. I think the weather people always have a standard line: "Chance of afternoon thunderstorms"—and there is a good chance they will be right. Anyway, listening to Beethoven and watching a thunderstorm is awesome. I even decid...

PowerTip: Use PowerShell to Display Time in 24-Hour Format
Jul 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Time in 24-Hour Format

Doctor Scripto

Summary: Use Windows PowerShell to display the current time in 24-hour format.  How can I use Windows PowerShell to display the current time in 24-hour format?  Use the Get-Date cmdlet and the –UFormat parameter with %R: Get-Date -UFormat %R

PowerShell Scripting: The Terms
Jul 6, 2015
Post comments count 0
Post likes count 0

PowerShell Scripting: The Terms

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about Windows PowerShell scripting terminology.  Hey, Scripting Guy! So I am confused, and I am not afraid to admit that I am confused. In the old fashioned VBScript days, I wrote scripts. I could also write subroutines or functions. And that was about it. Pretty simple, and it made sense to me. But with Windows PowerShell, it seems that there is so much more, and I do not even know where to begin. Not to mention that I have not seen a single reference about how to create a subroutine in Windows PowerShell. What gives? Can you throw me a bone? —JT &nbs...

PowerTip: Get Time with PowerShell
Jul 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Time with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to get the current time.  How can I use Windows PowerShell to get the current time?  Use the Get-Date cmdlet and specify a –DisplayHint of Time: Get-Date -DisplayHint time

Weekend Scripter: When to Write a PowerShell Script
Jul 5, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: When to Write a PowerShell Script

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about when to write a Windows PowerShell script. Microsoft Scripting Guy, Ed Wilson, is here. I am enjoying a beautiful sunny morning in central Florida. The sun is shining, there is hardly a cloud in the sky, and a gentle ocean breeze tickles my skin. I am sitting outside under a beautiful, several-hundred year-old oak tree with Spanish moss that hangs to the ground from its bent branches. I mean, dude, if ZZ Top had a tree, it would look like this one. Anyway, I am sitting out here with an oversized cup of Darjeeling tea, a plate of freshly sliced locally grown...

PowerTip: Multiply Value in Variable and Store Results
Jul 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Multiply Value in Variable and Store Results

Doctor Scripto

Summary: Use Windows PowerShell to multiply the value stored in a variable and store the results. How can I use Windows PowerShell to multiply the value of a variable and store the results in the same variable? Use the *= operator, for example:PS C:> $a = 2PS C:> $a *= 3PS C:> $a6

PowerTip: Multiply Value in Variable and Store Results
Jul 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Multiply Value in Variable and Store Results

Doctor Scripto

Summary: Use Windows PowerShell to multiply the value stored in a variable and store the results.  How can I use Windows PowerShell to multiply the value of a variable and store the results in the same variable?  Use the *= operator, for example: PS C:\> $a = 2 PS C:\> $a *= 3 PS C:\> $a 6

Weekend Scripter: Welcome to the PowerShell Information Stream
Jul 4, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Welcome to the PowerShell Information Stream

Doctor Scripto

Summary: Learn about the Windows PowerShell information stream in this guest post by June Blender. Microsoft Scripting Guy, Ed Wilson, is here. Today we have another guest blog post by Honorary Scripting Guy and Sapien technical evangelist, June Blender. Take it away June... Note  This post is updated on August 3, 2015 for the Windows PowerShell 5.0.10240 preview. A previous version described the information stream features in Windows PowerShell 5.0.10018. This post introduces the new information stream in Windows PowerShell 5.0, and it explains the issue it tries to solve and its elegant solution. In M...

PowerTip: Use PowerShell to Create OU in Active Directory
Jul 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create OU in Active Directory

Doctor Scripto

Summary: Use Windows PowerShell to easily create an organizational unit in Active Directory.  How can I use Windows PowerShell to create a new organizational unit (OU) in Active Directory?  Use the New-ADOrganizationalUnit cmdlet, and specify the name and path. A description is optional.            If you want to easily delete the OU later, set the ProtectedFromAccidentalDeletion flag to false.            Note  The following command is a one-line command that accomplishes this: New-ADOrganizationalUnit -Name Charlotte -...

Use PowerShell to Find Changes to Active Directory
Jul 3, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Find Changes to Active Directory

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find changes to Active Directory.  Hey, Scripting Guy! I have this problem. It seems our company has undergone a lot of changes recently, and I need to find what changes have impacted Active Directory. Basically, I do not even know where to start. I would like to get an overview of what things have changed since a specific date. Is this even possible with Windows PowerShell? —GF  Hello GF, Microsoft Scripting Guy, Ed Wilson, is here. Hey, the weekend is nearly here—at least if you live on the eastern coast o...

PowerTip: Compare Two Objects with PowerShell
Jul 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Compare Two Objects with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to compare two objects to see differences.  How can I use Windows PowerShell to see if a particular property from two objects is the same?  Use the Compare-Object cmdlet, specify the reference object, the object to compare, and            the property you are interested in looking at, for example: Compare-Object -ReferenceObject $d -DifferenceObject $p -Property lockout

Using PowerShell to Check Lockout Threshold for Domains
Jul 2, 2015
Post comments count 0
Post likes count 0

Using PowerShell to Check Lockout Threshold for Domains

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to check the lockout threshold for several domains.  Hey, Scripting Guy! I have several domains in our forest, and it seems that some weasel got in and changed the lockout threshold in some of the child domains. I know we should have turned on auditing, but we did not. What I need right now is a way to find all of the domains that have been changed. —MB  Hello MB, Microsoft Scripting Guy, Ed Wilson, is here. This weekend, there is a battle-of-the-bands going on in downtown Charlotte. I am thinking that the Scripting ...

PowerTip: Use PowerShell to Get Domain Password Policy
Jul 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Domain Password Policy

Doctor Scripto

Summary: Use Windows PowerShell to get the domain password policy.  How can I use Windows PowerShell to retrieve the default password policy for my domain?  Use the Get-ADDefaultDomainPasswordPolicy cmdlet.

PowerTip: Use PowerShell to Get Domain Password Policy
Jul 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Domain Password Policy

Doctor Scripto

Summary: Use Windows PowerShell to get the domain password policy.  How can I use Windows PowerShell to retrieve the default password policy for my domain?  Use the Get-ADDefaultDomainPasswordPolicy cmdlet.

Use Windows PowerShell to Configure Domain Password Policy
Jul 1, 2015
Post comments count 0
Post likes count 0

Use Windows PowerShell to Configure Domain Password Policy

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to configure the default domain password policy.  Hey, Scripting Guy! I need some help. I need to get the default domain password policy, but I do not want to mess around with the Group Policy MMC. Instead, I would like to have objects I can use, and then make some decisions based on what I find. Can you help? —JB  Hello JB, Microsoft Scripting Guy, Ed Wilson, is here. The good news is that the temperature today is only 80 degrees Fahrenheit. The bad news is that dew point is about 78, so the resultant relative humid...

PowerTip: Determine What Character a String Starts With
Jun 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine What Character a String Starts With

Doctor Scripto

Summary: Use Windows PowerShell to determine what character a string starts with.  How can I use Windows PowerShell to show me if a string starts with a particular letter (this also needs to be           case sensitive)?  Use the StartsWith method from the String class, and supply the character to the method. It will return            a True or False Boolean value, for example: PS C:\> "string".StartsWith("s") True PS C:\> "string".StartsWith("S") False

Working with Users in Active Directory
Jun 30, 2015
Post comments count 0
Post likes count 0

Working with Users in Active Directory

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to work with users in Active Directory Domain Services.  Hey, Scripting Guy! We are a rather diversified IT shop, but we have a heavy investment in Microsoft, and particularly in Active Directory. We use it for everything. I need to be able to update user information, but I cannot install anything on my computer. I need something that is basically in the box. How can I do this? —OF  Microsoft Scripting Guy, Ed Wilson, is here. It is becoming rather warm here in central Florida. The other day, the Scripting Wife and I...

PowerTip: Convert All Uppercase String to Lowercase
Jun 29, 2015
Post comments count 1
Post likes count 0

PowerTip: Convert All Uppercase String to Lowercase

Doctor Scripto

Summary: Use Windows PowerShell to convert a string to all lowercase characters.  How can I use Windows PowerShell to convert a string that is in all uppercase to all lowercase characters?  Use the ToLower method from the String class: "STRING".ToLower()

Create Users in Active Directory Without Using Module
Jun 29, 2015
Post comments count 0
Post likes count 0

Create Users in Active Directory Without Using Module

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about creating users in Active Directory Domain Services without using a module. Hey, Scripting Guy! In my company, we do a lot of work with Active Directory, and my team is responsible for this. But not all of the administrators have the Active Directory module, so I cannot assume that it will be available when we need to run a script. I need to be able to create users from a script (like I did with VBScript) without having to do anything special. Can this still be done by using Windows PowerShell? —GF Hello GF, Microsoft Scripting Guy, Ed Wilson, is here....

PowerTip: Select Two Random Numbers from 20 Possibilities
Jun 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Select Two Random Numbers from 20 Possibilities

Doctor Scripto

Summary: Use Windows PowerShell to select two random numbers from twenty possible numbers.  How can I use Windows PowerShell to select two of twenty attendees at user group to receive prizes?  Create a range of input numbers with the Get-Random cmdlet, then use the –Count parameter to retrieve           two random numbers: Get-Random -InputObject (1..20) -Count 2

Weekend Scripter: Fun with Number Ranges and PowerShell
Jun 28, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Fun with Number Ranges and PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to split arrays of numbers into contiguous ranges. Microsoft Scripting Guy, Ed Wilson, is here. Today I have a cool post from guest blogger, Zachary Loeber. Here is a little bit about Zachary: Zachary Loeber is a solution architect with PSC Group. Zachary is a seasoned network and systems architect and an administrator with hands-on experience for a wide range of technologies including Cisco/Juniper/HP networking, Exchange 2003/2007/2010/2013, Lync 2010/2013, Skype for Business, Active Directory, VMware, Linux, SAN technologies, and Windows PowerShell scripting. Zachary holds seve...

PowerTip: Load All PowerShell Modules at Startup
Jun 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Load All PowerShell Modules at Startup

Doctor Scripto

Summary: Learn how to load all Windows PowerShell modules at startup.  How can I load all of my Windows PowerShell modules when I start the Windows PowerShell console?  In your Windows PowerShell profile, use the Get-Module cmdlet and pipe the results to the            Import-Module cmdlet, for example: Get-Module -ListAvailable | Import-Module

PowerShell Spotlight: Yeah! It’s the Scripting Games
Jun 27, 2015
Post comments count 0
Post likes count 0

PowerShell Spotlight: Yeah! It’s the Scripting Games

Doctor Scripto

Summary: Teresa Wilson, Microsoft PowerShell MVP, introduces the new Scripting Games for 2015. Hello everyone. Teresa Wilson (aka The Scripting Wife) here with this month's PowerShell Spotlight. I am going to spill the beans about the Scripting Games with a little help from Don Jones, Windows PowerShell MVP and president of PowerShell.org. Because I am the treasurer for PowerShell.org, I get to have input occasionally, and I am always ears to the ground when something is going on in the Windows PowerShell community so I can offer assistance as I am able. I am not into reinventing the wheel, so most of this post i...

PowerTip: Use PowerShell to Get Licensed Users in Office 365
Jun 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Licensed Users in Office 365

Doctor Scripto

Summary: Use Windows PowerShell to get a list of users who are licensed in Office 365.  How can I get a list of all users that are licensed in Office 365?  Use the Get-Msoluser cmdlet from the MSOnline module and filter on the IsLicensed property: Get-Msoluser | Where { $_.Islicensed }

Using Windows PowerShell with Staged Migrations: Part 5
Jun 26, 2015
Post comments count 0
Post likes count 0

Using Windows PowerShell with Staged Migrations: Part 5

Doctor Scripto

Summary: Use Windows PowerShell to license users and correct the login ID for Office 365.  Note  This is a five-part series that includes the following posts: Honorary Scripting Guy, Sean Kearney, is here, and we're finishing up our week with Windows PowerShell and staged migrations in Office 365. By this point you’ve done all the dirty work. The user email accounts are up in Office 365 and the on-premise staff is still able to communicate via email while the migration is ongoing. Ah, yes…excellent. A job well done. Well, almost. The Office 365 mailboxes still need t...

PowerTip: Provide Alternate Name to Nouns in Module
Jun 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Provide Alternate Name to Nouns in Module

Doctor Scripto

Summary: Use Windows PowerShell to provide alternate names to nouns in modules to avoid conflicts.  How can I use Windows PowerShell to avoid the problem of having conflicting cmdlet names in different modules?  Use the Prefix parameter with Import-Module. Prefix will take whatever letter segment you provide and            add that before the noun in all the cmdlets for a module you load. For example, if I want to make sure all the            cmdlets in the UEV module have HSG before the noun, I would type: Import-Modu...

Using Windows PowerShell with Staged Migrations: Part 4
Jun 25, 2015
Post comments count 0
Post likes count 0

Using Windows PowerShell with Staged Migrations: Part 4

Doctor Scripto

Summary: Use Windows PowerShell to convert mailboxes to mail-enabled users in Office 365. Note  This is a five-part series that includes the following posts: Honorary Scripting Guy, Sean Kearney is here. When last we left, you had been shown how to access the reports and statistics from your staged migration from Windows PowerShell. By that point, you would have some mailboxes completed with their data in the cloud. What next? Today we’re stepping into the bits and bytes in Windows PowerShell. For a moment, let’s think about what we really have: two separate and foreign Exchang...

PowerTip: Use Windows PowerShell to Get Migration Statistics
Jun 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Windows PowerShell to Get Migration Statistics

Doctor Scripto

Summary: Use Windows PowerShell to pull statistics about user migrations.  How can I use Windows PowerShell to easily display a report with the time and amount of data transferred with            my staged migrations?  Use the Get-MigrationUser and Get-MigrationUserStatistics cmdlets and access some key properties,            for example: Get-MigrationUser | Get-MigrationUserStatistics | Select-Object SyncedItemCount,TotalInprogressDuration,BytesTransferred,AverageBytesTransferredPerHour

Using Windows PowerShell with Staged Migrations: Part 3
Jun 24, 2015
Post comments count 0
Post likes count 0

Using Windows PowerShell with Staged Migrations: Part 3

Doctor Scripto

Summary: Use Windows PowerShell to obtain the status and statistics from staged migrations. Note  This is a five-part series that includes the following posts: Honorary Scripting Guy, Sean Kearney, is here. Today we’re going to look into using Windows PowerShell on a deeper level with our staged migrations. That is, we’re going to pull down not only the results of said migrations, but also statistics. When you examine your staged migrations you’ll see simple results such as Synched or Failed. In the following image, you can see the four batches we have done. All of these ...

PowerTip: Use PowerShell to Get List of Migration Batches in Office 365
Jun 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get List of Migration Batches in Office 365

Doctor Scripto

Summary: Use Windows PowerShell to identify all migration batches and their status in Office 365.  Rather than navigating the Office 365 console to check the status of a migration, is there an easy way            to do it with Windows PowerShell?  To get list of all migration batches in Office 365 and their status, simply run Get-MigrationBatch.

Using Windows PowerShell with Staged Migrations: Part 2
Jun 23, 2015
Post comments count 0
Post likes count 0

Using Windows PowerShell with Staged Migrations: Part 2

Doctor Scripto

Summary: Use Windows PowerShell to upload and start staged migrations. Note  This is a five-part series that includes the following posts: Honorary Scripting Guy, Sean Kearney, is here to get you up and running with staged migrations in Office 365. There are some prerequisites you’ll need, of course: With these in place, you can perform a staged migration. The staged migration builds content in Office 365 by synchronizing selected user mailboxes via Outlook Anywhere. When the synchronization process is complete, it establishes forwarding email from the on-premise Exchange server...

PowerTip: Use PowerShell to List All Domains in Office 365 Subscription
Jun 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List All Domains in Office 365 Subscription

Doctor Scripto

Summary: Use Windows Powershell and the MSOnline cmdlets to identify all Internet domains attached to an Office 365 subscription.  How can I use Windows PowerShell to easily audit an Office 365 subscription for domains that are attached to it?  Use the Get-MSolDomain cmdlet, and if you want a list in a CSV file for auditing purposes, add            the Export parameter, for example: Get-MsolDomain | Export-CSV o365domains.csv

Using Windows PowerShell with Staged Migrations: Part 1
Jun 22, 2015
Post comments count 0
Post likes count 0

Using Windows PowerShell with Staged Migrations: Part 1

Doctor Scripto

Summary: Use Windows PowerShell to add and verify email domains in Office 365. Note  This is a five-part series that includes the following posts: Honorary Scripting Guy, Sean Kearney, is here. This week we’re going to touch on something that should be useful to many IT professionals who are trying to get themselves on to Office 365—that is a staged migration. When you are moving to Office 365, a staged migration is the preferable option if you’re starting from an Exchange Server 2007 or 2003 environment. It allows you to build out mailboxes in Office 365 without really needin...

PowerTip: Use PowerShell to Generate Tenant Site Report
Jun 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Generate Tenant Site Report

Doctor Scripto

Summary: Use Windows PowerShell to generate a report about Office 365 tenant sites.  How can I use Windows PowerShell to generate a report about my Office 365 tenant sites?  Install the SharePoint Online Management Shell and install the cmdlet library for SharePoint Online            (provided by MVP, Gary LaPointe). This will give you 82 cmdlets.

Weekend Scripter: Start PowerShell Scripting for Office 365 Sites
Jun 21, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Start PowerShell Scripting for Office 365 Sites

Doctor Scripto

Summary: Guest blogger, Michael Blumenthal shows how to findWindows PowerShell cmdlets that are available for Office 365 sites. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger, Michael Blumenthal, who we met in Chicago in May at Microsoft Ignite. Here is a little bit about Michael: Michael Blumenthal is a technical solution evangelist with PSC Group and a Microsoft Office 365 MVP. As such, he is an experienced architect for SharePoint, and business technology advisor. Michael has deep SharePoint expertise, with two decades of development, infrastructure, and administratio...

PowerTip: Use PowerShell to Get Computer Name
Jun 20, 2015
Post comments count 6
Post likes count 0

PowerTip: Use PowerShell to Get Computer Name

Doctor Scripto

Summary: Use Windows PowerShell to get your computer name.  How can I use Windows PowerShell to easily retrieve my computer name?  Use the environmental variable ComputerName: $env:computername

Weekend Scripter: Understanding Quotation Marks in PowerShell
Jun 20, 2015
Post comments count 0
Post likes count 1

Weekend Scripter: Understanding Quotation Marks in PowerShell

Doctor Scripto

Summary: Guest blogger, Don Walker, explores using single and double quotation marks in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Welcome new guest blogger, Don Walker. Don is a coworker of guest blogger, Tim Bolton, and he worked with Tim on a project that Tim blogged about on June 18, 2015, Using PowerShell Grid View for User Info. Here's Don's contact information: Twitter: @EngineeringDon LinkedIn: www.linkedin.com/in/EngineeringDon A while back, I was asked to explain the difference between using single quotation marks ( ‘ ) and double quotation marks ( “ ) to...

PowerTip: Line Continuation in PowerShell
Jun 19, 2015
Post comments count 0
Post likes count 2

PowerTip: Line Continuation in PowerShell

Doctor Scripto

Summary: Ensure a line continuation in Windows PowerShell.  What the line continuation character should use to ensure my Windows PowerShell code            continues to the next line?  The line continuation character in Windows PowerShell is the backtick.            Type a <space>, the backtick, and then press ENTER, for example: Get-Process -Name ` "Powershell_ISE"

PowerShell Code Breaks: Break Line, Not Code
Jun 19, 2015
Post comments count 0
Post likes count 0

PowerShell Code Breaks: Break Line, Not Code

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about line continuation without breaking Windows PowerShell code.  Hey, Scripting Guy! I have a problem sometimes when I copy code from the Hey, Scripting Guy! Blog. It does not seem to work. I try to take out spaces, but it still doesn’t work. I am at my wits end because the code should do exactly what I want it to do, but I cannot get it to work. Can you help me? —BG  Hello BG, Microsoft Scripting Guy, Ed Wilson, is here. It is definitely summer here in Charlotte, North Carolina. When the sun comes up, it is already hot, and when the sun g...

PowerTip: Use PowerShell Grid View to Display Logon Info
Jun 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell Grid View to Display Logon Info

Doctor Scripto

Summary: Learn how to display user logon information.  How can I use Windows PowerShell to display user logon information in an easy graphical manner?  Create two hash tables using environmental variables, and pipe the input to the Out-Gridview cmdlet,            for example: @{"username" = $env:USERNAME}, @{"Computername"=$env:COMPUTERNAME} |Out-GridView -Title "user logon info" Note This is a single-line command broken at the pipeline character for display on the blog.

Using PowerShell Grid View for User Info
Jun 18, 2015
Post comments count 0
Post likes count 0

Using PowerShell Grid View for User Info

Doctor Scripto

Summary: Learn how to use the Windows PowerShell grid view to display user information in this guest post by Tim Bolton and Don Walker. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Tim Bolton... Hi all, This project was a joint effort with my coworker, Don Walker (@EngineeringDon). In my current work environment, the character set used for user IDs that are stored in Active Directory can be a mixed bag of uppercase letters, lowercase letters, or a mix of both. This is due in part to a large Active Directory merger project that is currently underway. Due to that condition and the numero...

PowerTip: Return Specific Number of PowerShell Cmdlets
Jun 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Return Specific Number of PowerShell Cmdlets

Doctor Scripto

Summary: Learn how to return only a specific number of Windows PowerShell cmdlets.  How can I find only four Windows PowerShell cmdlets that use the verb Get, without seeing a            long scrolling list of found cmdlets?  Use the TotalCount parameter of the Get-Command cmdlet, for example: Get-Command -Verb get -TotalCount 4

PowerShell and the Active Directory Schema: Part 2
Jun 17, 2015
Post comments count 3
Post likes count 0

PowerShell and the Active Directory Schema: Part 2

Doctor Scripto

Summary: Guest blogger, Andy Schneider, continues his discussion about extending the Active Directory schema. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Andy Schneider, for Part 2 of his series. If you missed yesterday's post, see PowerShell and the Active Directory Schema: Part 1. Yesterday, we looked at what the Active Directory schema is and how to access details of the schema by using Windows PowerShell. In this post, we are going to look at how we can look at the schema, and also update the schema. If you didn’t get a chance to read Extending the Active Directory Sche...

PowerTip: Find Specific PowerShell Cmdlet Help
Jun 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Specific PowerShell Cmdlet Help

Doctor Scripto

Summary: Learn how to find help for a specific Windows PowerShell cmdlet parameter.  How can I find more information about a specific Windows PowerShell parameter that I saw a presenter use?  Use the Get-Help cmdlet, and specify the Windows PowerShell cmdlet and parameter names.            This example returns help about the Raw parameter for the Get-Content cmdlet: get-help get-content -Parameter raw

PowerShell and the Active Directory Schema: Part 1
Jun 16, 2015
Post comments count 0
Post likes count 0

PowerShell and the Active Directory Schema: Part 1

Doctor Scripto

Summary: Guest blogger, Andy Schneider, discusses extending the Active Directory schema. Microsoft Scripting Guy, Ed Wilson, is here. We welcome back guest blogger, Andy Schneider. Andy has a two-part blog series that will conclude tomorrow. Andy Schneider is the Identity and Access Management Architect for IT Services at Avanade. His team’s job is to ensure that the right people can access the right things at the right time. Andy is very passionate about automation and the DevOps movement. He is a huge fan of Windows PowerShell, and he has been using it since it was first released as Monad. Andy’s pe...

PowerTip: Read Text File in Raw Mode with PowerShell
Jun 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Read Text File in Raw Mode with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to read a text file in raw mode.  How can I use Windows PowerShell to read a text file as a single line of text, not as an array of strings created by            end-of-line returns?  Use the –Raw parameter with Get-Content. This forces Windows PowerShell to ignore new line characters and            end-of-line returns, and instead, return the contents of the file as one string. Here is an example: Get-Content C:\fso\AnEmptyFile.txt -Raw

PowerShell Custom Type Module
Jun 15, 2015
Post comments count 0
Post likes count 0

PowerShell Custom Type Module

Doctor Scripto

Summary: Create custom types in Windows PowerShell with a free module by Jon Newman. Microsoft Scripting Guy, Ed Wilson, is here. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blogger who was with us in 2011, when he wrote Automate Facebook with a Free PowerShell Module.  My name is Jon Newman, and I’m an old hand at Windows PowerShell. I was on the Windows PowerShell 1.0 team, with Bruce, Jim, and all the rest. My primary responsibility was for pipeline execution and error handling. I started at Microsoft in September 1989 (25 years ago!). I wrote management UI and infrastruc...

PowerTip: Use PowerShell to Parse Delimiters in File
Jun 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Parse Delimiters in File

Doctor Scripto

Summary: Use Windows PowerShell to parse file delimiters in a file.  How can I use Windows PowerShell to break out lines in a text file that are delimited by “\”? Here is the file content: PS C:> Get-Content C:fsoAnEmptyFile.txt This is content \mydata\more stuff \addmydata\addmore stuff\evenmore  Use the –Delimiter parameter of the Get-Content cmdlet. Here is an example with the associated output: PS C:> Get-Content C:fsoAnEmptyFile.txt -Delimiter \ This is content \ mydata\ more stuff \ addmydata\ addmore stuff\ evenmore

Weekend Scripter: Deciphering Windows PowerShell Shorthand
Jun 14, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Deciphering Windows PowerShell Shorthand

Doctor Scripto

Summary: Learn how to decipher Windows PowerShell shorthand notation in this guest post written by Tim Warner. Microsoft Scripting Guy, Ed Wilson, is here. Welcome a new guest blogger today, Timothy Warner. Tim is an author and evangelist for Pluralsight, a premier online IT pro and development training company. Tim is the author of Sams Teach Yourself Windows PowerShell in 24 Hours, a contributor at PowerShell.org, and a member of the Nashville PowerShell User Group. Hi everyone. When I attended the Microsoft Ignite Conference in Chicago last week, I was somewhat surprised by the amount of Windows PowerShell sho...

PowerTip: Find All PowerShell Cmdlets Except…
Jun 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Find All PowerShell Cmdlets Except…

Doctor Scripto

Summary: Learn how to find all Windows PowerShell cmdlets except those from a specific module.  How can I find all Windows PowerShell cmdlets that begin with the verb "get" but are not contained in the            Windows PowerShell module named “PowerShellCookbook”?  Use the Get-Command cmdlet, and use the Where method to filter that the module name does not equal            “PowerShellCookbook”: (Get-Command -Verb get).where({$_.modulename -ne 'powershellcookbook'})

Weekend Scripter: Jacksonville IT Pro Camp Is Here
Jun 13, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Jacksonville IT Pro Camp Is Here

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the Jacksonville IT Pro Camp. Microsoft Scripting Guy, Ed Wilson, is here. This is a day I have been looking forward to for some time—and now it is here. It is time for the Jacksonville IT Pro Camp. Teresa (aka The Scripting Wife) and I are keynoting the event. That is right. You will get a chance to hear her speak for a change. We will be talking about the importance of community and getting involved in community. It will be awesome. I am also presenting two sessions. I will be doing the Data Grooming session that I presented at the Windows PowerShel...

PowerTip: Display Graphical PowerShell Help​
Jun 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Display Graphical PowerShell Help​

Doctor Scripto

Summary: Learn how to display graphical Windows PowerShell Help.  How can I see Windows PowerShell Help in a graphical way so I can float the Help?  Use the –ShowWindow parameter from the Get-Help cmdlet, for example: Get-Help Get-Process -ShowWindow

Five Best PowerShell Cmdlets
Jun 12, 2015
Post comments count 0
Post likes count 0

Five Best PowerShell Cmdlets

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the five best Windows PowerShell cmdlets. Microsoft Scripting Guy, Ed Wilson, is here. OK, I will admit that this post is completely arbitrary. What do I mean when I talk about the five best Windows PowerShell cmdlets (commands)? Well, I am thinking about the cmdlets I use on a daily basis and the cmdlets that make my life really easy. The best cmdlet: Get-Command For me, the best Windows PowerShell cmdlet is probably Get-Command. I use this cmdlet every single day. In fact, I often use it multiple times a day. Why? Because I simply cannot remember thousand...

PowerTip: Read NTFS File System Stream with PowerShell
Jun 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Read NTFS File System Stream with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to read a specific NTFS file system stream.  How can I use Windows PowerShell to read a specific NTFS file system stream?  Use the Get-Content cmdlet and specify the name of the file and the name of the stream.            This example reads a stream named Data: Get-Content C:\fso\AnEmptyFile.txt -Stream data

Table of Basic PowerShell Commands
Jun 11, 2015
Post comments count 2
Post likes count 10

Table of Basic PowerShell Commands

Doctor Scripto

PowerTip: Use PowerShell to Add Content to File Stream
Jun 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Add Content to File Stream

Doctor Scripto

Summary: Use Windows PowerShell to add content to the file system stream of a file.  How can I use Windows PowerShell to add data to an alternate NTFS file system stream of a file?  Use the Add-Content cmdlet and specify the name of the stream for the Stream parameter,            then specify the data in the –Value parameter, for example: Add-Content C:\fso\AnEmptyFile.txt -Stream Data -Value "datastream" Note  If the stream does not exist, Windows PowerShell creates it. 

Help: It Says Run a PowerShell Script
Jun 10, 2015
Post comments count 0
Post likes count 0

Help: It Says Run a PowerShell Script

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about running a Windows PowerShell script. Microsoft Scripting Guy, Ed Wilson, is here. Ninety two degrees Fahrenheit and sunny—that is what the weather is supposed to be this Saturday in Jacksonville when Teresa and I will be speaking at the Jacksonville IT Pro Camp. I can’t think of a better way to spend a sunny day in Jacksonville, Florida than in a building with the air conditioning on high, and talking about the way cool stuff in Windows PowerShell. Well, maybe I could think of one or two other things to do, but certainly, IT Pro Camp is at the t...

PowerTip: Convert to Decimals and Display Unicode Characters
Jun 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Convert to Decimals and Display Unicode Characters

Doctor Scripto

Summary: Use Windows PowerShell to convert hexadecimal values to decimal and display Unicode characters.  I found a cool Unicode table on the Internet, but all of the values are displayed as hexadecimal values.            How can I use Windows PowerShell to translate them to integers and display the Unicode characters?  Use the [Convert] class, call the ToInt32 method, specify the value and 16, and call the [char] class so you            can convert the character to its Unicode character, for example: PS C:\> [c...

Help! It Says PowerShell…Now What?
Jun 9, 2015
Post comments count 0
Post likes count 0

Help! It Says PowerShell…Now What?

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about how to run a Windows PowerShell command.  Hey, Scripting Guy! Help! I am reading through TechNet, and I found this command that seems like it will solve my problem, but I do not know how to do it. It says something about Windows PowerShell, but I do not know what that is, or how to run the command. I opened the command prompt, but all it did was give me errors. So where do I type the command? —WB  Hello WB, Microsoft Scripting Guy, Ed Wilson, is here. One of the bad things about working at Microsoft, is that time sort of becomes skewed. By t...

PowerTip: Use PowerShell to Add Content to File
Jun 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Add Content to File

Doctor Scripto

Summary: Learn how to use Windows PowerShell to add content to a file.  How can I use Windows PowerShell to add content to a file?  Use the Add-Content cmdlet, and specify the path to the file and the value of the content, for example: Add-Content C:\fso\AnEmptyFile.txt -Value "This is content"

Find PowerShell Reference Documentation
Jun 8, 2015
Post comments count 0
Post likes count 0

Find PowerShell Reference Documentation

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about where to find Windows PowerShell reference documentation. Microsoft Scripting Guy, Ed Wilson, is here. I am eagerly anticipating Saturday because Saturday is the Jacksonville IT Pro Camp, and the Scripting Wife and I will be speaking. I believe there are still tickets available, so if you are in the area, you should definitely check it out. It will be an awesome time. In addition to giving the Keynote, I think I am doing two additional sessions. It will be tremendous fun. The last time we were down there (a couple of years ago), we got to see some friends w...

PowerTip: Use PowerShell to Create New File
Jun 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create New File

Doctor Scripto

Summary: Create a new file with Windows PowerShell.  How can I use Windows PowerShell to create a new text file that will be empty until I add content?  Use the New-Item cmdlet and specify a path, name, and type, for example: New-Item c:\fso\AnEmptyFile.txt -ItemType file

Weekend Scripter: Best PowerShell Resources on the Web
Jun 7, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Best PowerShell Resources on the Web

Doctor Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about the best fundamental resources on the web for Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about the Microsoft Ignite conference in Chicago was getting to see and talk with so many people. Previously, there was a core group of people who went to TechEd and a core group of people who went to MEC, but there were not many people who went to both. As a result, groups were pigeon-holed. By combining the conferences into one giant conference, we were able to see, talk to, and meet people that otherwise would not be in o...

PowerTip: Find Which PowerShell Cmdlets Contain Specific Parameter
Jun 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Which PowerShell Cmdlets Contain Specific Parameter

Doctor Scripto

Summary: Find which Windows PowerShell cmdlets contain a specific parameter.  How can I find which cmdlets contain the –Force parameter?  Use the Get-Command cmdlet and specify the parameter name, for example: Get-Command -ParameterName force

Weekend Scripter: Find Coolest PowerShell Parameter Names
Jun 6, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Find Coolest PowerShell Parameter Names

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about finding the coolest Windows PowerShell parameter names. Microsoft Scripting Guy, Ed Wilson, is here. This morning, my friend and colleague, Dr. Thomas Shinder, posted on Facebook that his favorite Windows PowerShell parameter name is –NoClobber. Interestingly enough, when I was writing my Windows PowerShell Step by Step book, one of the editors suggested that I change –NoClobber to something else. I had to tell her that I could not change it because it was actually part of the code. So what are the parameters that are used by Windows PowerShell ...

PowerTip: Get List of Scheduled Job Results in Azure Automation
Jun 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Get List of Scheduled Job Results in Azure Automation

Doctor Scripto

Summary: Use Azure cmdlets to audit for scheduled job results in Azure Automation.  How can I use Windows PowerShell to view the results of my scheduled runbooks in Azure Automation?  Use the Get-AzureAutomationJob cmdlet from the Azure PowerShell module. For example, to see the results            of all jobs in the 'HSG-AzureAutomation' instance, type: Get-AzureAutomationJob –automationAccountname 'HSG-AzureAutomation'

Using Azure Automation: Part 5
Jun 5, 2015
Post comments count 0
Post likes count 0

Using Azure Automation: Part 5

Doctor Scripto

Summary: Schedule an Azure Automation runbook to get Azure to work for you. Honorary Scripting Guy, Sean Kearney, is here to show you the most importance piece of Azure Automation: the actual scheduling of runbooks to allow you to let Azure do all the automation for you! This is the final post in a five-part series. To catch up, read:  Yesterday, we finished our script to power down the virtual machines in Microsoft Azure, including sending some output to indicate the status of the shutdown. If we go back into our runbook, things look a little different now. Instead of defaulting to the draft editing w...

PowerTip: Start Azure Automation Job from PowerShell
Jun 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Start Azure Automation Job from PowerShell

Doctor Scripto

Summary: Use Azure PowerShell cmdlets to launch a remote Azure Automation job.  How can I trigger an Azure Automation job from a regular computer?  Use the Start-AzureAutomationRunbook cmdlet. For example, to trigger the runbook called            HSG-StopAzureVM that is attached to the HSG-AzureAutomation instance, run: Start-AzureAutomationRunbook -Name HSG-ShutdownAzureVM -AutomationAccountName HSG-AzureAutomation

Using Azure Automation: Part 4
Jun 4, 2015
Post comments count 0
Post likes count 0

Using Azure Automation: Part 4

Doctor Scripto

Summary: Learn how to report output from Azure Automation and publish to production. Honorary Scripting Guy, Sean Kearney, is here again to show you more about Azure Automation and to empower you in automating your assets in Azure. This is the fourth post in a five-part series. To catch up, read: Our current task is trying to see what is happening in the magic genie bottle that contains our Azure Automation runbook. I say "magic genie bottle" because up to this point, we really can't see what's going on, can we? There's no Windows Powershell console, no ISE. Nothing… Not a sau...

PowerTip: Show Runbooks in Azure Automation Instance
Jun 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Show Runbooks in Azure Automation Instance

Doctor Scripto

Summary: Use Windows PowerShell to show available runbooks in an Azure Automation instance.  How can I use Windows PowerShell to show which runbooks are available in an Azure Automation instance?  Use the Get-AzureAutomationRunbook cmdlet from the Azure module. For example,            to get the runbooks in the 'HSG-AzureAutomation' instance, type: Get-AzureAutomationRunbook –AutomationAccountName 'HSG-AzureAutomation'

Using Azure Automation: Part 3
Jun 3, 2015
Post comments count 0
Post likes count 0

Using Azure Automation: Part 3

Doctor Scripto

Summary: Learn how to access Azure Automation assets within a runbook. Honorary Scripting Guy, Sean Kearney, is here today to battle robots, aliens, and… …No, wait, sorry. My brain lapsed from watching an old rerun of Lost in Space. This is the third post in a five-part series. To catch up, read: Today I will continue showing you how to get up and running with Azure Automation with a simple project of having a runbook to shutdown virtual machines in Azure. Our previous runbook with the fully exposed credentials and a clear-text password looked like this (I sense far too many security specialists...

PowerTip: Show Available Credentials for Azure Automation
Jun 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Show Available Credentials for Azure Automation

Doctor Scripto

Summary: Use Windows PowerShell to get a list of available assets of the Credential type in Azure Automation.  How can I use Windows PowerShell to quickly audit an Azure Automation instance for any credentials that            might be there?  Use the Get-AzureAutomationCredential cmdlet and provide the name of the Azure Automation account,            for example: Get-AzureAutomationCredential –AutomationAccountName 'HSG-AzureAutomation'

Using Azure Automation: Part 2
Jun 2, 2015
Post comments count 0
Post likes count 0

Using Azure Automation: Part 2

Doctor Scripto

Summary: Honorary Scripting Guy, Sean Kearney discusses how to get started and test a basic runbook with Azure Automation. Honorary Scripting Guy, Sean Kearney, is here. Today I'm going to show you the basics you're going to need to make a useful runbook (or Windows PowerShell workflow, if that makes it easier to remember) in Microsoft Azure. This is the second post in a five-part series. Be sure to read Using Azure Automation: Part 1 first. I've started a very basic script block to get a list of virtual machines in Azure and stop them all. Nothing fancy. If I want to, I can click the Test bu...

PowerTip: Show Available Azure Automation Accounts
Jun 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Show Available Azure Automation Accounts

Doctor Scripto

Summary: Use Windows PowerShell to get a list of available Azure Automation accounts.  How can I use Windows PowerShell to see my Azure Automation accounts?  You can get this information with one simple cmdlet: Get-AzureAutomationAccount

Using Azure Automation: Part 1
Jun 1, 2015
Post comments count 0
Post likes count 0

Using Azure Automation: Part 1

Doctor Scripto

Summary: Honorary Scripting Guy, Sean Kearney discusses how to get started with Windows PowerShell and Azure Automation. Honorary Scripting Guy, Sean Kearney, is here, and for the next five days we're going to touch on Azure Automation, which is a great way to automate control of your Azure resources without Internet access. Azure Automation is, when you get right down to it, a way to schedule Windows PowerShell workflows in the cloud. "But wait!" you'll say. "If I want to do that, I can just as easily spin up a virtual machine in Azure and use the scheduled tasks in Windows Server 2...

Weekend Scripter: What to Include in a PowerShell Comment Block
May 31, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: What to Include in a PowerShell Comment Block

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about what to include in a Windows PowerShell comment block. Microsoft Scripting Guy, Ed Wilson, is here. Something that tends to confuse new scripters, regardless of the language, is what to include in a comment block at the beginning of a script. I have reviewed thousands of scripts for various scripters, and I have seen lots of variation. This variation ranges from nothing at all, no comments, not a thing to nearly complete books that describe everything a script should do, might do, and even ways to improve the script should it come time for revision. In real...

PowerTip: Maintain PowerShell Objects
May 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Maintain PowerShell Objects

Doctor Scripto

Summary: Maintain Windows PowerShell objects in the pipeline.  How can I send output to the Windows PowerShell pipeline without changing the formatting or objects, plus            insure that the output go to the Windows PowerShell console if there is nothing else in the pipeline?  The Write-Output cmdlet sends output to the pipeline or to the console if it is the last command in the pipeline: Get-Process | Write-Output

PowerShell Spotlight: Two PowerShell Events
May 30, 2015
Post comments count 0
Post likes count 0

PowerShell Spotlight: Two PowerShell Events

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about two upcoming Windows PowerShell community events. Microsoft Scripting Guy, Ed Wilson, is here. Today is the last Saturday of May, and therefore, it is PowerShell Spotlight day with MVP, Teresa Wilson... Happy scripting Saturday, everyone. Today our Windows PowerShell Spotlight is on two events coming up in the next two weeks. First is the Cincinnati PowerShell User Group meeting on June 3. Ed will be the guest speaker at this event. I will be in the audience. For signup, time, and place information (and lots more, see at CincyPowerShell. The main informa...

PowerTip:  Use PowerShell to Display Current Time
May 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Current Time

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display the current time.  How can I use Windows PowerShell to display the current time on my computer?  Use the Get-Date cmdlet and tell it to show only the time, for example: Get-Date -DisplayHint Time

PowerShell Time Sync: Orchestrate Monitoring of Remote Servers
May 29, 2015
Post comments count 0
Post likes count 0

PowerShell Time Sync: Orchestrate Monitoring of Remote Servers

Doctor Scripto

Summary: Guest blogger, Rudolf Vesely discusses how to monitor remote servers. Microsoft Scripting Guy, Ed Wilson, is here. Today is Part 3 of a 3-part series by guest blogger, Rudolf Vesely. To read the first 2 posts in this series, please see: In previous posts, I described my Time Sync module. I explained how to handle exceptions in parallel operations and how the Start-VSystemTimeSynchronization and Wait-VSystemTimeSynchronization workflows work. Those who have followed along may realize that there are two more workflows in the module. Get current time from the Internet      The f...

PowerTip: Force Time Resync with PowerShell
May 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Force Time Resync with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to force a time resynchronization.  How can I use Windows PowerShell to force a time resynchronization?  Use the W32tm /resync /force command.            Note This command requires elevated rights.

PowerShell Time Sync: Error Handling in Parallel in Workflows
May 28, 2015
Post comments count 0
Post likes count 0

PowerShell Time Sync: Error Handling in Parallel in Workflows

Doctor Scripto

Summary: Guest blogger, Rudolf Vesely talks about error handling in workflows and repair actions. Microsoft Scripting Guy, Ed Wilson, is here. Today is Part 2 of a 3-part series written by guest blogger Rudolf Vesely. Read yesterday’s post to catch up and to learn more about Rudolf: PowerShell Time Sync: Get and Evaluate Synchronization State. Take it away, Rudolf... Yesterday, I described the Time Sync module and I explained how the main inline script works. Those of you who checked my source code may realize that I used special error handling for the whole inline script (I do not mean error handling insid...

PowerTip: Use PowerShell to Find Time Service Status
May 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Time Service Status

Doctor Scripto

Summary: Use Windows PowerShell to find the status of the time service.  How can I use Windows PowerShell to find the status of the time service on my local computer?  If all you are looking for is the status, use the W32tm command with the /query and /status switches: w32tm /query /status

PowerShell Time Sync: Get and Evaluate Synchronization State
May 27, 2015
Post comments count 0
Post likes count 0

PowerShell Time Sync: Get and Evaluate Synchronization State

Doctor Scripto

Summary: Guest blogger, Rudolf Vesely, shows how to evaluate time synchronization. Microsoft Scripting Guy, Ed Wilson, is here. Today is day 1 of a 3-part series by Rudolf Vesely. Here, Rudolf tells us about himself: I work as a lead cloud architect in Tieto Productivity Cloud (TPC) at Tieto Corporation. I am a blogger on the Technology Stronghold blog, and I am the author of large series of articles called How to Build Microsoft Private Cloud. I started my career in IT as a developer (assembler, object-oriented programming, C++, C#, .NET, and ASP.NET). However, I moved to operations many years ago. Program...

PowerTip: Pad String to Left with PowerShell
May 26, 2015
Post comments count 0
Post likes count 1

PowerTip: Pad String to Left with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to pad a string to the left.  How can I use a specific Unicode character with Windows PowerShell to pad a string to the left so that the entire            string is a certain length?  Use the PadLeft method from the String class. Specify the length of the newly created string and the Unicode            character as the second parameter. Here is an example that uses a triangle as the pad character. The string is            6 characters long, and the newly created s...

PowerShell and BitLocker: Part 2
May 26, 2015
Post comments count 0
Post likes count 0

PowerShell and BitLocker: Part 2

Doctor Scripto

Summary: Guest blogger, Stephane van Gulick, continues his series about using Windows PowerShell and BitLocker together. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back Stephane van Gulick for the final part of his two-part series. Be sure you read PowerShell and BitLocker: Part 1 first. Encryption operations A lot of the following script examples come from a function I wrote called BitLockerSAK. It is a tool written in Windows PowerShell that makes BitLocker tasks easier to automate. Finally, we arrive at the interesting part: the encryption of the drive. Don’t get me wrong—the Trusted Plat...

PowerTip: Determine Letter a String Begins With
May 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine Letter a String Begins With

Doctor Scripto

Summary: Use Windows PowerShell to determine the letter that a string begins with.  How can I use Windows PowerShell to find if a particular string begins with the letter “s”?  Use the StartsWith method from the string, for example: PS C:\> "string".StartsWith("S") False PS C:\> "string".StartsWith("s") True Note The StartsWith method is case sensitive. Therefore “S” does not match the example, but “s” does.

PowerShell and BitLocker: Part 1
May 25, 2015
Post comments count 0
Post likes count 0

PowerShell and BitLocker: Part 1

Doctor Scripto

Summary: Guest blogger, Stephane van Gulick, presents a practical hands-on post that shows how to use Windows PowerShell and BitLocker together. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger, Stephane van Gulick. Stephane was introduced to me by The Scripting Wife, she was browsing the Internet and found his blog. She thought he would be an excellent guest for the Hey, Scripting Guy! Blog, and I totally agreed. This is be a two-part blog series and there is a lot of information to share. Here is where you can find Stephane: Website: PowerShell DistrictTwitter : @Stephane...

PowerTip: Find Formatting Information for List Views
May 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Formatting Information for List Views

Doctor Scripto

Summary: Find Windows PowerShell formatting information for list views.  How can I use Windows PowerShell to find information about format data for types for list views?  Use the Get-FormatData cmdlet and pipe the output to Where-Object., for example: Get-FormatData | ? FormatViewDefinition -Match 'list view'

Weekend Scripter: Use PowerShell for JIT Administration and PAM – Part 2
May 24, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell for JIT Administration and PAM – Part 2

Doctor Scripto

Summary: Guest blogger, and Microsoft PFE Ian Farr, continues his series about JIT administration with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today, welcome back Ian Farr for the conclusion of his two-part blog. Before you dig into today's post, please read Use PowerShell for JIT Administration and PAM – Part 1. To read more of Ian's previous guest posts, see these Hey, Scripting Guy! Blog posts. Yesterday, I discussed an advanced function that was written with my teammate, Phil Lane. The function grants membership of a high-privileged group for a defined period of time. ...

PowerTip: Identify Regions in Azure
May 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Identify Regions in Azure

Doctor Scripto

Summary: Use Windows PowerShell to get a current list of regions in Azure.  How can I use Windows PowerShell to show me a list of the regions in Microsoft Azure?  Use the Get-AzureLocation cmdlet to output the list to your screen, then you can filter with            the DisplayName parameter. This example lists all of the U.S. regions: Get-AzureLocation | Where { $_.Displayname –match 'US' } | Format-Table

Weekend Scripter: Use PowerShell for JIT Administration and PAM – Part 1
May 23, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell for JIT Administration and PAM – Part 1

Doctor Scripto

Summary: Guest blogger, Microsoft PFE, Ian Farr, talks about JIT administration with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger Ian Farr. To read more of Ian's previous guest posts, see these Hey, Scripting Guy! Blog posts. This weekend is a two-part blog, with today being Part 1. Here's Ian... You may be asking yourself, "What’s JIT administration, and who’s PAM?" Let me explain… The JIT stands for "just-in-time"—and not Just-in-Timberlake, as my colleague, Phil Lane, likes to insist! With Ed’s permissio...

PowerTip: See Data in Azure Storage
May 22, 2015
Post comments count 0
Post likes count 0

PowerTip: See Data in Azure Storage

Doctor Scripto

Summary: Use Windows PowerShell to show the files in an Azure Storage blob.  How can I use Windows PowerShell to see files that are in my subscription and stored in Azure blobs?  Use a combination of the Get-AzureStorageContainer and Get-AzureStorageBlob cmdlets.            For example, to see all of the data stored within the VHDs container in an Azure Storage blob, use: Get-AzureStorageContainer vhds | Get-AzureStorageBlob

Use PowerShell to Create Virtual Machine in Azure – Part 5
May 22, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Virtual Machine in Azure – Part 5

Doctor Scripto

Summary: Learn how to create a virtual machine in Azure by using your own VHD template. Honorary Scripting Guy, Sean Kearney is here with the last bit of coolness about creating virtual machines in Azure—using a customized template. This post is part of a series. To catch up, read: Your first challenge is to create a custom virtual machine, which really isn't a challenge. Let's imagine you've got a machine that's set up just the way you want it. Life is good and you're ready to rock. The first thing you'll want to do is make a backup copy of the operating system VHD. If the virtual machine name i...

PowerTip: Identify Extensions in Azure
May 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Identify Extensions in Azure

Doctor Scripto

Summary: Use Windows PowerShell to get a current list of virtual machine extensions in Azure.  How can I find all the extensions that are available for virtual machines in Azure?  To see all the extensions for a virtual machine in Azure, type: Get-AzureVMAvailableExtension | Format-Table

Use PowerShell to Create Virtual Machine in Azure – Part 4
May 21, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Virtual Machine in Azure – Part 4

Doctor Scripto

Summary: Learn how to leverage Desired State Configuration with a virtual machine in Microsoft Azure. Honorary Scripting Guy, Sean Kearney, here today filling in for my buddy Ed. Today I'll show you how to leverage Desired State Configuration (DSC) with a virtual machine in Microsoft Azure. This post is part of a series. To catch up, read: If you didn't already know, Windows PowerShell 4.0 introduced a great new feature called Desired State Configuration, which allows you to define and enforce the features that a server requires. Here is a simple example we will be using to define a very basic web s...

PowerTip: Identify Azure Subscriptions
May 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Identify Azure Subscriptions

Doctor Scripto

Summary: Use Windows PowerShell to get a current list of Azure subscriptions.  How can I use Windows PowerShell to show me a list of the subscriptions that are attached to my Azure account?  Use the Get-AzureSubscription cmdlet.

Use PowerShell to Create Virtual Machine in Azure – Part 3
May 20, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Virtual Machine in Azure – Part 3

Doctor Scripto

Summary: Learn how to spin up a virtual machine in Microsoft Azure. Honorary Scripting Guy, Sean Kearney is here. Ed is still resting nicely, so today, I'll show you how to spin up a virtual machine in Microsoft Azure! If you add Get-Help against the New-AzureVM cmdlet, you'll have an example like this one: New-AzureVMConfig -Name "MyNewVM" -InstanceSize ExtraSmall -ImageName (Get-AzureVMImage)[4].ImageName | Add-AzureProvisioningConfig -Windows -Password $adminPassword -AdminUsername PsTestAdmin | New-AzureVM -ServiceName "MySvc2" -AffinityGroup "Contoso" -WaitForBoot Let's break this down. The first part is the...

PowerTip: Identify Azure Services in Subscription
May 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Identify Azure Services in Subscription

Doctor Scripto

Summary: Use Windows PowerShell to get a current list of Azure services in a subscription.  How can I use Windows PowerShell to show me a list of the Azure services in a subscription?  Run the Get-AzureService cmdlet.

Use PowerShell to Create Virtual Machine in Azure – Part 2
May 19, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Virtual Machine in Azure – Part 2

Doctor Scripto

Summary: Learn how to work with sizing names in Microsoft Azure. Honorary Scripting Guy, Sean Kearney, is back again to show more really cool stuff in Microsoft Azure. Be sure to also read Use PowerShell to Create Virtual Machine in Azure – Part 1. When you're creating a virtual machine, you need to specify its size. In Hyper-V or other virtualization solutions, you would normally specify parameters such as: In Microsoft Azure, when you're creating a virtual machine, you actually have a series of prepackaged configurations. These are accessed with the Get-AzureRoleSize cmdlet. If you'd l...

PowerTip: Find the PowerShell Version
May 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Find the PowerShell Version

Doctor Scripto

Summary: Easily find your Windows PowerShell version.  How can I find information about my Windows PowerShell version?  Use the $psversionTable automatic variable with the PSVersion property, for example: $PSVersionTable.PSVersion.Major

Use PowerShell to Create Virtual Machine in Azure – Part 1
May 18, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Virtual Machine in Azure – Part 1

Doctor Scripto

Summary: Learn how to use the Azure PowerShell cmdlets to identify built-in virtual machine templates. Honorary Scripting Guy, Sean Kearney, is here today to help out and give Ed a break (enjoy some tea and rest your fingers, my friend). In November, I touched on how to use Windows PowerShell for some overall setup and management of the Azure infrastructure-as-a-service (IaaS). (If you'd like to read more, see this series of Hey, Scripting Guy! Blog posts: Manage Azure IaaS with Windows PowerShell.) Today, I'm going to specifically focus on creating those virtual machines and all you'll need to kno...

PowerTip: Find PowerShell Aliases by Module
May 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Aliases by Module

Doctor Scripto

Summary: Use Windows PowerShell to find aliases by module.  How can I easily find which modules expose aliases?  Use the Get-Alias cmdlet and pipe the results to the Sort-Object cmdlet (Sort is an alias), for example: Get-Alias | sort modulename -Descending

Weekend Scripter: Manage SQL Server Virtual Log File with PowerShell
May 17, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Manage SQL Server Virtual Log File with PowerShell

Doctor Scripto

Summary: Guest blogger, Microsoft PFE, Jonathan Yong, talks about using Windows PowerShell to manage the SQL Server virtual log file. Microsoft Scripting Guy, Ed Wilson, is here. This is the week of new guest bloggers it seems. Today, please welcome Microsoft PFE, Jonathan Yong... Some time back, I was discussing a SQL Server administration use case with another engineer. The customer’s DBA wanted to get a list of all virtual log files for each database in the instance to decide which database’s log file needed tuning. The easy part is that DBCC LOGINFO will provide this information. The tricky part i...

PowerTip: Find Aliases for PowerShell Cmdlets
May 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Aliases for PowerShell Cmdlets

Doctor Scripto

Summary: Learn how to find aliases for Windows PowerShell cmdlets.  How can I easily find all the aliases defined for a given Windows PowerShell cmdlet?  Use the –Definition parameter of the Get-Alias cmdlet, for example: Get-Alias -Definition Get-ChildItem

Weekend Scripter: Get Started with PowerShell for Amazon Web Services
May 16, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Get Started with PowerShell for Amazon Web Services

Doctor Scripto

Summary: Windows PowerShell MVP, Mike F Robbins, walks through a setup to manage an Amazon Web Services environment with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back Mike F Robbins to talk about Windows PowerShell for Amazon Web Services. Mike F Robbins is a Microsoft MVP for Windows PowerShell and for SAPIEN Technologies. He is a co-author of Windows PowerShell TFM 4th Edition, and he is the contributing author of a chapter in PowerShell Deep Dives. Mike has written guest posts for PowerShell Magazine, PowerShell.org, and the Hey, Scripting Guy! Blog (to read more of Mike...

PowerTip: Update Windows PowerShell Help Files
May 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Update Windows PowerShell Help Files

Doctor Scripto

Summary: Learn to easily update Windows PowerShell Help files.  I try to use Get-Help, but I am unable to retrieve any information. What do I need to do?  Open the Windows PowerShell console (or the Windows PowerShell ISE) with admin rights, and            type Update-Help.

Let Sleeping VBScript Scripts Lie
May 15, 2015
Post comments count 0
Post likes count 0

Let Sleeping VBScript Scripts Lie

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about when to replace a VBScript script and when not to. Microsoft Scripting Guy, Ed Wilson, is here. One of the really awesome things about the Microsoft Ignite conference in Chicago this year was the chance to talk to literally thousands of people who stopped by the Scripting Guys booth on the Expo floor. One of the things that surprised me was the number of people who apologized—actually apologized—for still running VBScript. They would say something like, “We still run lots of VBScript in our environment.” OK… Let me make this o...

PowerTip: Find Approved Verbs in PowerShell
May 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Approved Verbs in PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find approved verbs.  How can find a list of approved verbs for a function I am writing in Windows PowerShell?  Use the Get-Verb function.

Use PowerShell to Check In for Flight
May 14, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Check In for Flight

Doctor Scripto

Summary: Guest blogger, Microsoft PFE, Bill Grauer, talks about using Windows PowerShell to check in for a flight. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger—Bill Grauer, a Microsoft PFE... As a Windows PowerShell instructor, I try to drive home a simple point to my students, whether they are absolute beginners or more seasoned scripters. Becoming proficient in a language, whether it be Spanish or Windows PowerShell, requires practice. This means finding every opportunity you can to accomplish some task you're currently doing manually, and automating it.  These ...

PowerTip: Test URI with PowerShell
May 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Test URI with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to test a URI.  How can I use Windows PowerShell to easily test if I can reach a URI?  Use the Test-Uri function from the Windows PowerShell Cookbook module, for example: Test-Uri -Uri http://www.microsoft.com  

Use Windows PowerShell to Parse RSS Feeds
May 13, 2015
Post comments count 0
Post likes count 0

Use Windows PowerShell to Parse RSS Feeds

Doctor Scripto

Summary: Microsoft PowerShell MVP, Will Anderson, talks about using Windows PowerShell to parse RSS feeds. Microsoft Scripting Guy, Ed Wilson, is here. Today I welcome recent Windows PowerShell MVP and new guest blogger, Will Anderson... Hi there fellow scripters! Last week as I took my seat on a connecting flight in New York from beautiful Charlotte, North Carolina, my thoughts drifted to the wonderful experiences and memories that I took with me from the Windows PowerShell Summit. One thought in particular crossed my mind. It was a challenge posed to me by a member of the Windows PowerShell team. “Will,&r...

PowerTip: Convert PowerShell Path to Standard Path
May 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Convert PowerShell Path to Standard Path

Doctor Scripto

Summary: Convert a Windows PowerShell path to a standard path.  How can I convert a Windows PowerShell registry provider path to a standard registry path?  Use the Convert-Path cmdlet, for example: Convert-Path HKLM:\SOFTWARE\Microsoft

Write TargetResource Functions for PowerShell DSC
May 12, 2015
Post comments count 0
Post likes count 0

Write TargetResource Functions for PowerShell DSC

Doctor Scripto

Summary: Guest blogger and Microsoft PFE, Jason Walker, talks about writing Get, Set, and Test TargetResource functions for DSC. Microsoft Scripting Guy, Ed Wilson, is here. Microsoft PFE and Honorary Scripting Guy, Jason Walker, is back with us today for Part 2 of his two-part series. Yesterday in Anatomy of a PowerShell DSC Resource, I gave an overview of the anatomy of a DSC resource and explained how to use the xDscResourceDesigner module to lay down the foundation of a DSC resource. Today I will explain what is involved in writing your Get, Set, and Test TargetResource functions. I’m going to start wit...

PowerTip: Identify Location of PowerShell Providers
May 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Identify Location of PowerShell Providers

Doctor Scripto

Summary: Identify the location of Windows PowerShell providers.  How can I find where the Windows PowerShell providers on my system come from?  Use the Get-PSProvider Windows PowerShell cmdlet, and select the Name and the ModuleName properties: Get-PSProvider | select name, modulename

Anatomy of a PowerShell DSC Resource
May 11, 2015
Post comments count 0
Post likes count 0

Anatomy of a PowerShell DSC Resource

Doctor Scripto

Summary: Guest blogger and Microsoft PFE, Jason Walker, talks about the anatomy of a Windows PowerShell DSC resource. Microsoft Scripting Guy, Ed Wilson, is here. Today is Part 1 of a two-part series written by Microsoft PFE and Honorary Scripting Guy, Jason Walker. The majority of my "PowerShelling" lately has been around Desired State Configuration (DSC). However, the gotcha with DSC is if there isn’t a resource for the configuration area that you want to configure, you can’t use DSC for that task. Now let’s not jump to conclusions and eliminate DSC as a solution. If you can write a ...

Dude, PowerShell Changed My Life
May 7, 2015
Post comments count 0
Post likes count 0

Dude, PowerShell Changed My Life

mredwilson

Summary: Ed Wilson relates conversations from the Microsoft Ignite 2015 conference in Chicago. One of the great things about being at Ignite in Chicago is the opportunity to talk to so many people. I mean, with 23,000 attendees, most of whom it seems stopped by the Scripting Guys booth, the conversations are varied, and at times, downright inspirational. I had one person who was from Nigeria stop by to say “thank you.” Of, course, I should have, and I did, say thank you right back. Anyway, he said he began reading the Hey, Scripting Guy! Blog several years ago, and he taught himself Windows PowerShell...

Popcorn, Peanuts, and PowerShell
May 6, 2015
Post comments count 0
Post likes count 0

Popcorn, Peanuts, and PowerShell

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about day two of Microsoft Ignite 2015 in Chicago. When I was a kid, my brother and I could not wait for spring. In fact, during the winter, we carefully perused the schedule…THE schedule of the Cincinnati Reds games at Riverfront Stadium. Every year, our family would take two or three trips to Cincinnati to see the Reds play. It was a great time to be a fan, with Johnny Bench, Pete Rose, Tony Perez, and the rest of the “big red machine.” Of course, we would always pick double-headers, because if you make the trip, you want as much baseball act...

How Do You Use PowerShell?
May 5, 2015
Post comments count 0
Post likes count 0

How Do You Use PowerShell?

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about conversations with visitors to the Scripting Guys booth at Ignite 2015. It is Tuesday morning, and the expo is already at a dull roar of excitement. Microsoft PFEs Brian Wilhite, Jason Walker, and the Scripting Wife found a relatively quiet corner to check email, write blog posts, and generally play with our Surfaces. Jeffery Snover was here a few minutes ago asking how things are going at the Scripting Guys booth and confirming with Teresa that he will be at the Scripting Guys booth on Wednesday at 2:00 pm. One of the questions I asked people yesterday i...

Cool PowerShell Conversations at Ignite
May 4, 2015
Post comments count 0
Post likes count 0

Cool PowerShell Conversations at Ignite

mredwilson

Summary: Ed Wilson talks about some Windows PowerShell conversations at the Scripting Guys booth. One of the cool things about getting together with a bunch of people at the Scripting Guys booth is that I learn stuff. The conversations are great. Here is a case in point: Windows PowerShell MVP, Steve Murawski, stopped by the booth this morning. At the same time Microsoft PFEs, Gary Siepser, Brian Wilhite, and Jason Walker were here. Here is a picture: Ayway, while I was talking to Steve, I mentioned a conversation I had yesterday with a guy at lunch. I was talking about the importance of using –Whatif on a...

First Morning of Ignite in Chicago
May 4, 2015
Post comments count 0
Post likes count 0

First Morning of Ignite in Chicago

mredwilson

Summary: Ed Wilson talks about the first morning of Ignite conference in Chicago. It is 6:00 in the morning. I would say, "Oh dark thirty"—except it is earlier than that. The Scripting Wife and I headed downstairs from our conference hotel for the ride to the convention center. I expected it would take longer than the 15-minute ride yesterday due to the fact that it is, well, Chicago on a Monday morning. Actually, the ride, although longer, was not bad. Not bad at all. I also expected the first bus, which left at 6:30, would be rather empty. Again I was wrong. It was packed, so Teresa and I had to...

Ignite: T-1: Scripting Guys Booth Setup Day
May 3, 2015
Post comments count 0
Post likes count 0

Ignite: T-1: Scripting Guys Booth Setup Day

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about setting up the booth at Ignite 2015. The Scripting Wife and I arrived in Chicago last night for Microsoft Ignite 2015. As it turned out, it is an absolutely beautiful day. We herded onto the bus in front of our hotel, and headed to the conference center. It was a quick 15-minute trip. When we arrived at the conference center, we immediately met up with Rick Claus and Joey Snow. Teresa and I went into the Expo Hall, and found the Scripting Guys booth. It is right next to the Lumia area in the center of the Expo Hall. Our booth is part of the Microsoft are...

PowerTip: Keep Up with Hey, Scripting Guy! Blog
May 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Keep Up with Hey, Scripting Guy! Blog

Doctor Scripto

Summary: Easily keep up with Hey, Scripting Guy! Blog posts.  How can I easily keep up with Hey, Scripting Guy! Blog posts?  Install the Scripting Guys app on your Windows Smart Phone. It is in the store, and it works great.

Weekend Scripter: An Ideal PowerShell Schedule for Ignite
May 2, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: An Ideal PowerShell Schedule for Ignite

Doctor Scripto

Summary: Windows PowerShell MVP and Scripting Wife, Teresa Wilson, creates her ideal schedule for Ignite 2015 in Chicago. Microsoft Scripting Guy, Ed Wilson, is here. Today I decided to turn over the keyboard to the Scripting Wife, who is bouncing off of the walls in anticipation of Ignite starting… Greetings fellow PowerShellers! I am so excited! We just finished the Windows PowerShell Summit, and now we are on the road to Chicago for Microsoft Ignite. Tomorrow, we head to the conference center to check out our booth. Ed and I will be at the Scripting Guys booth in the Microsoft area during the hours the ...

PowerTip: Examine Default PowerShell Parameter Values
May 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Examine Default PowerShell Parameter Values

Doctor Scripto

Summary: Examine default Windows PowerShell parameter values.  How can I check to see if I have enabled any default Windows PowerShell parameter values?  Check the value of the $PSDefaultParameterValues variable.

PowerShell Tips and Tricks: Using Default Parameter Values
May 1, 2015
Post comments count 0
Post likes count 0

PowerShell Tips and Tricks: Using Default Parameter Values

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using default Windows PowerShell parameter values. Microsoft Scripting Guy, Ed Wilson, is here. The last thing I want to talk about from the tips and tricks session of the Charlotte Windows PowerShell User Group with Lee Holmes is using default Windows PowerShell parameter values. To effectively use Windows PowerShell default parameter values, I need to first evaluate how I work. For example, if I routinely add –Wrap when I am using the Format-Table cmdlet, it might make sense for me to set that as my default. To do this, I simply need to assign a val...

It’s Not Too Late to Learn PowerShell
Apr 30, 2015
Post comments count 0
Post likes count 0

It’s Not Too Late to Learn PowerShell

mredwilson

Summary: Ed Wilson talks about learning Windows PowerShell. It seems that there are always new technologies. It is hard to keep up with them, and it is hard to predict which ones are even worth the time and effort to learn. As with agile development, it seems there are also agile computing technologies. Over the years, I have been to many, many technology related conventions, conferences, and training classes. The world of IT is one of endless learning. One of the big reasons for going to conferences, is to see what is on the horizon, to see what is coming up next, and to see where I will need to focus my efforts...

PowerTip: Better Way to View PowerShell Help
Apr 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Better Way to View PowerShell Help

Doctor Scripto

Summary: Learn a better way to view Windows PowerShell Help.  I like the Windows PowerShell Help files, but I do not like trying to read them in the Windows PowerShell             console window. What is a better way to read the content?  Use the –ShowWindow parameter from Get-Help. This example displays the About_Automatic_Variables Help: Get-Help -Category helpfile automatic -ShowWindow

Select History Via PowerShell Out-Gridview
Apr 30, 2015
Post comments count 0
Post likes count 0

Select History Via PowerShell Out-Gridview

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, continues his tips and tricks series by talking about select Windows PowerShell commands via Out-GridView. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about getting a bunch of Windows PowerShell people together is that they begin to share tips and tricks they have figured out. One reason for this is that Windows PowerShell is highly discoverable. Another reason is that there is a whole lot of Windows PowerShell, and therefore, there is a whole bunch of stuff to discover. Many times (at least for me), the coolest tips and tricks are not somethin...

PowerTip: Find PowerShell Profiles
Apr 29, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Profiles

Doctor Scripto

Summary: Learn how to easily find Windows PowerShell profiles.  How can I Question: You want to find the path to Windows PowerShell profiles?  Use the $Profile automatic variable, but pipe the output to the Format-List cmdlet and use            the –Force parameter. Here is an example that uses the FL alias for Format-List): $profile | fl * -Force

PowerShell Tips and Tricks: Extended History
Apr 29, 2015
Post comments count 0
Post likes count 0

PowerShell Tips and Tricks: Extended History

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about a module that provides extended command history. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that came up during the Charlotte Windows PowerShell User Group meeting was the HistoryPx module that was written by Windows PowerShell MVP, Kirk Munro. This module adds additional history information to the Windows PowerShell console. For example, he adds information about the duration of a command, the output of the command, and errors generated by the command. Installing  HistoryPx Installing the HistoryPx module is really easy because it ...

PowerTip: Retrieve Last Token Received by PowerShell
Apr 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Retrieve Last Token Received by PowerShell

Doctor Scripto

Summary: Learn how to retrieve the last token that was received by Windows PowerShell.  How can I retrieve the last token received by Windows PowerShell?  Use the $$ automatic variable: PS C:\> notepad C:\fso\AMoreComplete.txt PS C:\> $$ C:\fso\AMoreComplete.txt

Use PSReadLine for More Efficient PowerShell Console
Apr 28, 2015
Post comments count 0
Post likes count 0

Use PSReadLine for More Efficient PowerShell Console

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, presents a tip from the Charlotte User Group meeting about using PSReadLine. Microsoft Scripting Guy, Ed Wilson, is here. One really big tip that came out during the Charlotte User Group meeting was to use the PSReadLine module. It provides is syntax highlighting, which makes it easier to understand commands and spot errors because I can see how Windows PowerShell is interpreting something. For example, in the following image, the cmdlet is colored yellow, parameters are gray, variables are green, and the output is white. If I am trying to run a command...

PowerTip: Find User's Home Directory in PowerShell
Apr 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Find User's Home Directory in PowerShell

Doctor Scripto

Summary: Find the path to the current user's home directory in Windows PowerShell.  How can I easily find the current user's home directory for a script I am writing?  Use the $home automatic variable: PS C:\> $HOME

Favorite PowerShell Tips and Tricks
Apr 27, 2015
Post comments count 0
Post likes count 0

Favorite PowerShell Tips and Tricks

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell tips and tricks from the Charlotte User Group meeting. Microsoft Scripting Guy, Ed Wilson, is here. Last week was a special meeting at the Charlotte Windows PowerShell User Group. It followed immediately after the Windows PowerShell Summit, and as a result, the user group included five members of the Windows PowerShell team, nearly a dozen MVPs, and at least that many Microsoft employees. All in all, there were nearly a hundred people in the room, and that, I believe, makes it the largest Windows PowerShell User Group meeting so far in Ch...

PowerTip: Find Current Directory in PowerShell
Apr 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Current Directory in PowerShell

Doctor Scripto

Summary: Easily find the current directory in Windows PowerShell.   How can I return a path object that contains information about the current working directory in Windows PowerShell?  Use the $pwd automatic variable: PS C:\> $pwd

Weekend Scripter: My First PowerShell Summit
Apr 26, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: My First PowerShell Summit

Doctor Scripto

Summary: Microsoft PowerShell MVP, Will Anderson, talks about his first Windows PowerShell Summit. Microsoft Scripting Guy, Ed Wilson, is here. Wow! What a week...or part of a week. Windows PowerShell Summit North America 2015 was here in Charlotte, NC this past week. The Scripting Wife and I met a lot of new people and made new friends. One of these friends is a brand new Windows PowerShell MVP, Will Anderson. Will wrote a blog post about his time here in Charlotte. First a little about Will... Will Anderson is a thirteen-year infrastructure veteran with a specialization in patch management, compliance, and Sys...

PowerTip: Determine if Property is Member of Object
Apr 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Determine if Property is Member of Object

Doctor Scripto

Summary: Determine if a property is a member of an object in Windows PowerShell.  How can I determine if a specific property is actually a member of an object in my Windows PowerShell script?  Use the Get-Member cmdlet, and cast the response into a Boolean data type by using the [bool] type             accelerator, for example: [bool](Get-member -Name time -InputObject (get-date) -MemberType Property) Note  I got this idea from Microsoft PFE, Clint Huffman. He uses it in his PAL data collector. He has a note in that script that says he got the ...

Weekend Scripter: Scripting Guys Ignite Booth Schedule
Apr 25, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Scripting Guys Ignite Booth Schedule

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about the Scripting Guys booth schedule. Microsoft Scripting Guy, Ed Wilson, is here. It is that time of year again. Conference time. TechEd North America is no more, but Microsoft Ignite is on the horizon. May 4-8, 2015 in Chicago! It is already sold out, but you can see the presentations as they are being recorded. Windows PowerShell MVP, Teresa Wilson (aka The Scripting Wife) is with us today to share the schedule of special guests you can meet at the Scripting Guys booth. Take it away, Teresa... I have a working schedule to share with you regarding who y...

PowerTip: Roll Back Active PowerShell Transaction
Apr 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Roll Back Active PowerShell Transaction

Doctor Scripto

Summary: Learn how to roll back an active Windows PowerShell transaction.  I started a transaction to modify the registry on my computer running Windows 8.1, but something failed,            and I want to roll back the transaction. How can I do this?  Use the Undo-Transaction cmdlet to roll back the active transaction.

Use PowerShell to Move User Files and Update Registry
Apr 24, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Move User Files and Update Registry

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to move user files and update the registry.  Hey, Scripting Guy! I need to move a bunch of user files from their local computer to a network share so we can back up the user's data prior to migrating their desktops. I know there are various tools I can use to do this, but our scenario is pretty simple because the user profile data is all located in specific folders. After I have moved their data, I need to update a registry key. That key will be read by another app, and the machines will be wiped before we drop a new image...

PowerTip: Set Default Location Stack with PowerShell
Apr 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Set Default Location Stack with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to set your default location stack.  How can I use Windows PowerShell to set the default for some named location stacks that I created?  Use the Set-Location cmdlet and specify the stack name, for example: Set-Location -StackName REG

Using Transactions with PowerShell Registry Provider
Apr 23, 2015
Post comments count 0
Post likes count 0

Using Transactions with PowerShell Registry Provider

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using transactions with the Windows PowerShell Registry provider.  Hey, Scripting Guy! I was looking at the various providers and their capabilities (see Find and Use Windows PowerShell Providers). I see that the Registry provider says it does transactions. What’s that all about? —JS  Hello JS, Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of tea from some tea that Windows PowerShell MVP, Sean Kearney, brought me from Ottawa. There just happens to be an awesome tea shop there, and Sean volunteered to brin...

PowerTip: Display Locations Stored on Stack
Apr 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Display Locations Stored on Stack

Doctor Scripto

Summary: Use Windows PowerShell to display locations stored on the default stack.  How can I use Windows PowerShell to see the locations that are stored on my default location stack?  Use the –Stack parameter of Get-Location: Get-Location -Stack

Using Named Location Stacks in PowerShell
Apr 22, 2015
Post comments count 0
Post likes count 0

Using Named Location Stacks in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using named location stacks in Windows PowerShell.  Hey, Scripting Guy! If I need to move around in two types of locations, how would I do it? Suppose I need to look in various places in my profile, and then I need to do some work in data locations elsewhere on my hard drive. How would I be able to keep track of the different locations? —AK  Hello AK, Microsoft Scripting Guy, Ed Wilson, is here. Today is the last day of the Windows PowerShell Summit in Charlotte. In fact, tonight the Charlotte Windows PowerShell User Group is having a specia...

PowerTip: Find PowerShell Cmdlets and Synopsis
Apr 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Cmdlets and Synopsis

Doctor Scripto

Summary: Use Windows PowerShell to find cmdlets and their associated synopsis.  How can I easily find a list of specific Windows PowerShell cmdlets and their associated meanings?  Use the Get-Command cmdlet, pipe the results to the Foreach-Object and Get-Help cmdlets,            then select the name and synopsis, for example: gcm -Noun item* | % {get-help $_} | ft name, synopsis

Location, Location, Location in PowerShell
Apr 21, 2015
Post comments count 0
Post likes count 0

Location, Location, Location in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about managing locations in Windows PowerShell.  Hey, Scripting Guy! I don’t understand what is the big deal with Get-Location. I mean, I can look and see where I am at, so why do I need Get-Location? For that matter, what are a PushD and a PopD? It says it has something to do with a stack, but I don’t know where that stack is, or even what a stack is. Can you help? —DW  Hello DW, Microsoft Scripting Guy, Ed Wilson, is here. The weather in Charlotte finally cleared up. It has been rather cold and wet the past couple days. This is kind ...

PowerTip: Find PowerShell Providers
Apr 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Providers

Doctor Scripto

Summary:  Learn how to find Windows PowerShell providers and their capabilities.  How can I find what Windows PowerShell providers I have on my system?  Use the Get-PSProvider cmdlet. Note  Beginning with Windows PowerShell 3.0, some providers load on-demand, and therefore, they do not appear unless they have been accessed at least once. The WSMAN provider is an example of such a provider.

Find and Use Windows PowerShell Providers
Apr 20, 2015
Post comments count 0
Post likes count 0

Find and Use Windows PowerShell Providers

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about finding and using Windows PowerShell providers.  Hey, Scripting Guy! I recently heard a Windows PowerShell MVP say that understanding the Windows PowerShell provider system is fundamental to understanding Windows PowerShell. I think I am in trouble because I have no idea what he is talking about. Can you throw a fella a bone? —DP  Hello DP, Microsoft Scripting Guy, Ed Wilson, is here. I am sipping a rather bland cup of tea, but I don’t care because it is a great day. In fact, the weather in Charlotte, North Carolina was rather cold and...

PowerTip: Return Specific Number of Letters from String
Apr 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Return Specific Number of Letters from String

Doctor Scripto

Summary: Use Windows PowerShell to return a specific number of letters from a string.  How can I use Windows PowerShell to easily to retrieve the first two letters from a string?  Use the SubString method from a string, and then specify the starting the position and the number            of letters to return, for example: PS C:\> ("string").Substring(0,2) st

Weekend Scripter: Use PowerShell to Create Users in Active Directory
Apr 19, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Create Users in Active Directory

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to read a CSV file and create users in Active Directory. Microsoft Scripting Guy, Ed Wilson, is here. Yesterday in Oh No! Oh Wait...PowerShell for the Win!, I created a CSV file from a Word document that I had been given. Today, I take the next logical step and create the users. When I have a working CSV file, I can begin the process of writing a script that will create the users in Active Directory. Note  The CSV file that I was given had more than 1,200 lines in it. Although I gave it a quick “once over glance,” I...

PowerTip: Save CSV Data and Maintain Unicode Encoding
Apr 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Save CSV Data and Maintain Unicode Encoding

Doctor Scripto

Summary: Use Windows PowerShell to save data as a CSV file and maintain the Unicode encoding.  How can I use Windows PowerShell to save my data as a CSV file but ensure that it is saved as Unicode?  Make sure you specify the –Encoding parameter when you call the Export-CSV cmdlet, for example: Export-Csv -Path C:\Data\Names.CSV -Encoding Unicode -NoTypeInformation

Weekend Scripter: Oh No! Oh Wait…PowerShell for the Win!
Apr 18, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Oh No! Oh Wait…PowerShell for the Win!

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to clean up an impossible document. Microsoft Scripting Guy, Ed Wilson, is here. Sometimes I just cringe. It is a reflex reaction born from many long (and at times, torturous) years in the IT field. I know, I should be able to get over it, and sometimes I actually think I am getting better. And then things like the following crop up in my email... I recently received a panic email from an IT admin. He was tasked with creating over 1,200 new user accounts. Hey, no problem. Give me a properly formatted CSV file or Excel spreadsheet, a...

PowerTip: Use PowerShell to Remove All CIM Sessions
Apr 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Remove All CIM Sessions

Doctor Scripto

Summary: Learn how to use Windows PowerShell to remove all CIM sessions.  How can I use Windows PowerShell to delete all the CIM sessions I have created?  Use the Get-CIMSession cmdlet to retrieve all CIM sessions, and pipe the results to the            Remove-CIMSession cmdlet: Get-CimSession | Remove-CimSession

Combine PowerShell Remoting and CIM
Apr 17, 2015
Post comments count 0
Post likes count 0

Combine PowerShell Remoting and CIM

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about combining Windows PowerShell remoting and CIM. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is remoting. It is not a new feature. In fact, it was introduced in Windows PowerShell 2.0—a time that seems like eons ago. Really. That was back in Windows Server 2008 R2, so that was in 2009. Anyway, it is turned on by default in Windows Server 2012 and later. Windows PowerShell remoting lets me connect to remote servers or workstations, over a single port, and in a secure manner. In addition, it ...

PowerTip: Find WMI Parent Class with PowerShell
Apr 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Find WMI Parent Class with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to easily find a WMI parent class.  How can I use Windows PowerShell to find what parent class a particular WMI class derives from?  Use the Get-CimClass cmdlet, and select the CimSuperClassName property, for example: (Get-Cimclass win32_bios).CimSuperClassName

Look at Schema of WMI Class with PowerShell
Apr 16, 2015
Post comments count 0
Post likes count 0

Look at Schema of WMI Class with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to look at the schema of a WMI class. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about WMI is that it is largely self-describing. This means that I can use WMI and look at WMI. With the CIM cmdlets, this goes even a step further. For example, if I want to look at the Win32_Desktop WMI class, I can use the Get-CimClass cmdlet, and examine it: PS C:> Get-CimClass win32_desktop    NameSpace: ROOT/cimv2 CimClassName         CimClassMethods      CimClassPr...

PowerTip: Remove Type Data with PowerShell
Apr 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Remove Type Data with PowerShell

Doctor Scripto

Summary: Learn how to remove type data by using Windows PowerShell.  How can I remove a custom type data that is producing an error message when I try to update it            in my Windows PowerShell session?  Use the Get-TypeData cmdlet to retrieve an instance of the type data, and pipe it to the            Remove-TypeData cmdlet, for example: "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Volume" |Get-TypeData | Remove-TypeData Note  This is a long single-line command that is broken a...

Create Custom Type Data in PowerShell to Format WMI Display
Apr 15, 2015
Post comments count 0
Post likes count 0

Create Custom Type Data in PowerShell to Format WMI Display

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating custom type data to control the way a WMI class displays.  Hey, Scripting Guy! Yesterday, you said you could create custom type data to control the way the Win32_Volume WMI class reports back. How would one go about doing that? I looked on the Internet, and to be honest, it looks like it is basically impossible. —AT  Hello AT, Microsoft Scripting Guy, Ed Wilson, is here. I love this time of the year. All the windows are open, the azaleas are in bloom, and I am upstairs with my Surface Pro 3, a cup of orange-cream green tea, and...

PowerTip: Use PowerShell to Find Cmdlets that Use CIM
Apr 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Cmdlets that Use CIM

Doctor Scripto

Summary: Use Windows PowerShell to find cmdlets that use CIM.  I want to see what Windows PowerShell cmdlets will use a CIM session, but when I use Get-Command,            only a couple things return. How can I fix this?  Windows PowerShell automatically loads modules, but when looking for parameters, it does not load modules.            Therefore, if you want to see all the commands that use a CIM session, first load the modules, then search for            commands that accept the CIMSession pa...

Comparing CIM and WMI in PowerShell
Apr 14, 2015
Post comments count 0
Post likes count 0

Comparing CIM and WMI in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about comparing CIM and Windows PowerShell.  Hey, Scripting Guy! When I query using a CIM function, I get back different stuff than when I query WMI. I don’t get it. Can you help? —BW  Hello BW, Microsoft Scripting Guy, Ed Wilson, is here. Yesterday in Working with Volumes in CIM, I began talking about WMI and CIM. Let’s continue by looking more in depth at what happens with Get-Volume and Win32_Volume. Anyone who has done a lot of work with WMI and with Windows PowerShell knows about types and type data. For example, when I query the ...

PowerTip: Use PowerShell to Find File or Folder
Apr 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find File or Folder

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find a file or a folder.  How can I use Windows PowerShell to determine if a variable contains a path that leads to a file or folder?  Use the Test-Path cmdlet to test the path stored in the variable, and then specify the PathType parameter,           for example: PS C:\> $fso = "c:\fso" PS C:\> $file = "C:\fso\backup.ps1" PS C:\> Test-Path $fso -PathType leaf False PS C:\> Test-Path $file -PathType leaf True

Working with Volumes in CIM
Apr 13, 2015
Post comments count 0
Post likes count 0

Working with Volumes in CIM

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about working with volumes with Windows PowerShell and CIM.  Hey, Scripting Guy! I don’t understand CIM at all. I mean, I thought it was basically WMI, but when I use WMI to look at volumes, I see different stuff. Can you help me? —AB  Hello AB, Microsoft Scripting Guy, Ed Wilson, is here. There are some questions that seem to be rather easy to answer, and then become confusing. So I am going to jump in and introduce CIM Week. The Windows Management Instrumentation (WMI) is Microsoft’s implementation of the Common Information Model (CI...

PowerTip: Use PowerShell to Find Files in Wrong Folder
Apr 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Files in Wrong Folder

Doctor Scripto

Summary: Use Windows PowerShell to easily find files that are in the wrong folder.  I have a folder for documents and another folder for images. But at times, I discover images in the            documents folder. How can I use Windows PowerShell to easily detect this situation?  Use the Test-Path cmdlet, and specify the file extension to exclude, for example: PS C:\> test-path c:\fso -Exclude *.bmp True PS C:\> dir c:\fso -Include *.bmp PS C:\> 

Weekend Scripter: Use PowerShell to Work with Embedded Objects
Apr 12, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Work with Embedded Objects

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to work with embedded objects. Microsoft Scripting Guy, Ed Wilson, is here. This morning I have my Zune 1.0 cranked up, and I am listening to some tunes. I have a nice cup of English Breakfast tea, and a warm croissant beside me. I also was able to score some homemade orange marmalade. Anyway, a few years ago, the Scripting Wife and I were in Maui, Hawaii, and we took an early morning drive up a winding road. We entered clouds, and it seemed like it was raining. I thought about turning back because of the rain, but there was no good...

PowerTip: Find Stats with PowerShell
Apr 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Stats with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find stats of objects.  How can I use Windows PowerShell to see the minimum, maximum, and average values of a            specific property in a series of objects?  Pipe the objects to the Measure-Object cmdlet, specify the property you seek, and use            the Average, Maximum, Sum, and Minimum switches, for example: $objects | Measure-Object -Property numberofwords -Sum -Average -Maximum -Minimum 

Weekend Scripter: Use PowerShell to Analyze Custom Objects
Apr 11, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Analyze Custom Objects

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to analyze custom objects. Microsoft Scripting Guy, Ed Wilson, is here. Last week, I talked about using a Windows PowerShell script to collect the number of words and documents for each of several years. To this, I wrote a Windows PowerShell script that trolled a number of folders, opened the Word documents, and gathered the word count. (See Use PowerShell to Count Words and Display Progress Bar.) The real power of the script comes not in simply emiting the objects to the Windows PowerShell console, but in collecting the objects, an...

PowerTip: Use PowerShell to Display Shared Folders
Apr 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Shared Folders

Doctor Scripto

Summary: Use Windows PowerShell to display shared folders.  How can I use Windows PowerShell to display shared folders that I set up on a local computer?  Use the Get-SMBShare cmdlet and no parameters.

Meet the PowerShell Summit 2015 Speakers #5
Apr 10, 2015
Post comments count 0
Post likes count 0

Meet the PowerShell Summit 2015 Speakers #5

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about the Windows PowerShell Summit 2015 speakers. Microsoft Scripting Guy, Ed Wilson, is here. Today is the final day for guest blogger, Teresa Wilson, to tell you about some of the speakers and sessions for the upcoming North America PowerShell Summit 2015 in Charlotte, NC. Thanks Ed. It has been my pleasure to write this week about some of the speakers and sessions coming up at the Summit. I made a deliberate effort to not include all the sessions and speakers—can’t spill all the beans. There will be sessions by members of the Windows PowerShe...

PowerTip: Use PowerShell to Verify Syntax of Path
Apr 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Verify Syntax of Path

Doctor Scripto

Summary: Learn how to use Windows PowerShell to verify the syntax of a path.  How can I use Windows PowerShell to verify that a path that accepts user input is using the correct syntax?  Use the –IsValid parameter of the Test-Path cmdlet, for example: PS C:\> $a = "c:\myfolder\nonexistentfile.txt" PS C:\> Test-Path $a -IsValid True PS C:\> $b = "c:\my()(*&^%\afile.txt" PS C:\> Test-Path $b -IsValid False Note  This command verifies if the syntax is correct for the provider, but it does not verify if the file exists.

Meet the PowerShell Summit 2015 Speakers #4
Apr 9, 2015
Post comments count 0
Post likes count 0

Meet the PowerShell Summit 2015 Speakers #4

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about the Windows PowerShell Summit 2015 speakers. Microsoft Scripting Guy, Ed Wilson, is here. We continue with guest blogger, Teresa Wilson, as she shares some of the speakers and their sessions for the North America PowerShell Summit 2015. Let’s kick off today with Jeffery Hicks. Jeff is a Windows PowerShell MVP, and he is on the Board of Directors for PowerShell.org. He has been a guest blogger on this site, and he is being an Honorary Scripting Guy. I can go on for pages about the other things he is involved in, but I won’t do that today. Jeff's s...

PowerTip: Use PowerShell to Find Files Newer than a Date
Apr 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Files Newer than a Date

Doctor Scripto

Summary: Use the Windows PowerShell to see if a file exists more recent than a certain date.  How can I use Windows PowerShell to see if a file more recent than a specific date exists in a folder?  Use the Test-Path cmdlet, specify the folder, and use the –NewerThan parameter.            The cmdlet expects a date in accordance with regional settings, for example: PS C:\> Test-Path c:\fso -NewerThan 3/30/15 True PS C:\> Test-Path c:\fso -NewerThan 4/3/15 False

Meet the PowerShell Summit 2015 Speakers #3
Apr 8, 2015
Post comments count 0
Post likes count 0

Meet the PowerShell Summit 2015 Speakers #3

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about the Windows PowerShell Summit speakers. Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife, Teresa Wilson, is my guest blogger all week. She is bringing you information about the speakers for the North America PowerShell Summit 2015 and their sessions. Don’t worry if you cannot attend the Summit. The sessions will be recorded and shared on You Tube. Happy Wednesday everyone! I am back to share with you again. Today, I am starting with Windows PowerShell MVP, Jason Helmick. Jason is the CFO for PowerShell.org and the person I work clo...

PowerTip: Use PowerShell to See Hidden and Non-Hidden Files
Apr 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to See Hidden and Non-Hidden Files

Doctor Scripto

Summary: Learn how to use Windows PowerShell to see hidden and non-hidden files.    How can I use Windows PowerShell to see all hidden and non-hidden files in a folder?  Use the Get-ChildItem cmdlet and specify the –File and the –Force switches.            Here is an example that uses the GCI alias: gci -Force -File

Meet the PowerShell Summit 2015 Speakers #2
Apr 7, 2015
Post comments count 0
Post likes count 0

Meet the PowerShell Summit 2015 Speakers #2

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about the Windows PowerShell Summit speakers. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Teresa Wilson, as she continues introducing you to the speakers for the PowerShell Summit and their sessions. Thanks Ed. I'm glad to have this opportunity to tell you a little bit about some of the speakers for the North America PowerShell Summit 2015 in Charlotte, NC. What would the PowerShell Summit be without PowerShell.org and our fearless leader, Don Jones? Don is a Windows PowerShell MVP and Honorary Scripting Guy. In his ses...

PowerTip: Use PowerShell to Display Only Hidden Files
Apr 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Only Hidden Files

Doctor Scripto

Summary: Use Windows PowerShell to display only hidden files.  How can I use Windows PowerShell to locate only hidden files?  Use the Get-ChildItem cmdlet and specify the Not Directory and the Hidden attributes (abbreviate as !d+h): gci -Att !d+h

Meet the PowerShell Summit 2015 Speakers #1
Apr 6, 2015
Post comments count 0
Post likes count 0

Meet the PowerShell Summit 2015 Speakers #1

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about the Windows PowerShell Summit 2015 speakers. Microsoft Scripting Guy, Ed Wilson, is here. This week we will be talking about the PowerShell Summit. So who better to write some guest blog posts but the treasurer for PowerShell.org—my very special Scripting Wife and Windows PowerShell MVP, Teresa Wilson. Take it away Teresa... Hello everyone! Thanks for stopping by and reading the blog today. I am all excited. It is April, which means I just returned from the US Open Days inaugural event in Malvern, PA for US MVPs, and I was renewed as a PowerShell...

PowerTip: Use PowerShell to Find Folders that Match Pattern
Apr 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Folders that Match Pattern

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find folders with names that match a specific pattern.  How can I use Windows PowerShell to find the path to folders that have names that match a specific pattern?  Use the Get-ChildItem cmdlet and the –Filter parameter with a pattern that matches the name, and then            specify the  –Directory parameter. Here is an example that matches folders that have a four-letter name: Get-ChildItem E:\Data\ScriptingGuys -filter "????" -Directory |  % { $_.fullname }

Weekend Scripter: Use PowerShell to Count Words and Display Progress Bar
Apr 5, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Count Words and Display Progress Bar

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to display a progress bar while counting the number of words in Word documents. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that a writer does is keep track of words. This is not so much because one gets paid by the word (although in the past that was actually true, and it is still true for some magazines). It is more because publishers need to know how many words will be in a book for planning purposes. It goes to the production budget, it goes to planning for shelf space in bookstores, and it influences the cost...

PowerTip: Use Filter Parameter with Get-ChildItem in PowerShell
Apr 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Filter Parameter with Get-ChildItem in PowerShell

Doctor Scripto

Summary: Use the –Filter parameter with the Get-ChildItem Windows PowerShell cmdlet.  Why can't I get the –Filter parameter to work with the Get-ChildItem cmdlet?  Try using the FileSystem provider. The –Filter parameter will accept two wildcard characters ( ? and * )            and a single string as a filter (not an array of strings like the –Include parameter uses). Here is an example           of using –Filter&nb...

Weekend Scripter: Using PowerShell to Look for Documents
Apr 4, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Using PowerShell to Look for Documents

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about different approaches to find documents with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. It is a lovely weekend down here in the deep south USA. I am sipping a nice cup of English Breakfast tea with lemon, lime, orange pith, and Hibiscus flower added. I decided to leave out the cinnamon stick this morning to see what would happen. What happened is that the resulting tea is mellow and tangy at the same time. I have the Rolling Stones cranked up on my Zune 2.0, and I am hanging out enjoying the beautiful weather. I also...

PowerTip: Look at Most Recent Error in PowerShell
Apr 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Look at Most Recent Error in PowerShell

Doctor Scripto

Summary: Learn how to see the most recent error in Windows PowerShell.  I ran a script that fails. How can I use Windows PowerShell to find the most recent error?  Use $error, and to see the most recent error, look at error 0: $error[0]

Catch PowerShell Errors Related to Reading the Registry
Apr 3, 2015
Post comments count 0
Post likes count 1

Catch PowerShell Errors Related to Reading the Registry

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Try, Catch, Finally blocks to catch Windows PowerShell errors related to reading the registry.  Hey, Scripting Guy! Yesterday you posted Update or Add Registry Key Value with PowerShell. Would it be easy to use Try, Catch, Finally blocks to know if I need to create the registry key or the registry key property? How can I do that? It doesn't seem very simple to me. —AP  Hello AP, Microsoft Scripting Guy, Ed Wilson, is here. The biggest challenge to using structured error handling in a Windows PowerShell script (beyond the most simp...

PowerTip: Use PowerShell to Read Registry Key Property Value
Apr 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Read Registry Key Property Value

Doctor Scripto

Summary: Use Windows PowerShell to read a registry key property value.  How can I use Windows PowerShell to read a registry key property value so I can find the version of a particular software package?  Use the Get-ItemProperty cmdlet, for example: Get-ItemProperty -Path HKCU:\Software\ScriptingGuys\Scripts -Name version

Update or Add Registry Key Value with PowerShell
Apr 2, 2015
Post comments count 2
Post likes count 3

Update or Add Registry Key Value with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to update or add a registry key value.  Hey, Scripting Guy! I am having a problem trying to update the registry. I am using the New-ItemProperty cmdlet, but it fails if the registry key does not exist. I added the –Force parameter, but it still will not create the registry key. The error message says that it cannot find the path because it does not exist. Is there something I am not doing? I am including my script so you can see what is going on. Help me please. —DC  Hello DC, Microsoft Scripting Guy, Ed Wilson...

PowerTip: Use PowerShell to Get File Hash
Apr 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get File Hash

Doctor Scripto

Summary: Learn how to use Windows PowerShell to get a file hash.  How can I use Windows PowerShell to get a hash of a file?  Use the Get-FileHash cmdlet, for example: (Get-FileHash C:\fso\myfile.txt).hash

Use PowerShell to Compare Two Files
Apr 1, 2015
Post comments count 0
Post likes count 1

Use PowerShell to Compare Two Files

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to compare two files.  Hey, Scripting Guy! I have a script that I wrote to compare two files, but it seems really slow. I am wondering what I can do to speed things up a bit. —JW  Hello JW, Microsoft Scripting Guy, Ed Wilson, is here. I looked at the script you supplied, where you use Compare-Object to compare two files. Here is your script: $fileA = "C:\fso\myfile.txt" $fileB = "C:\fso\CopyOfmyfile.txt" $fileC = "C:\fso\changedMyFile.txt" if(Compare-Object -ReferenceObject $(Get-Content...

PowerTip: Create Array in PowerShell
Mar 31, 2015
Post comments count 0
Post likes count 0

PowerTip: Create Array in PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to easily create an array.  Can I use Windows PowerShell to create an array of strings and avoid typing quotation marks            around all the strings?  Instead of creating an array, such as this: $array = “a”,”b”,”c”,”d”,”e”,”f”,”g”,”h”, use a single string,            and split it at the comma. It will be much less typing, and a whole lot faster. Here is an example: $array = 'a,b,c,d,e,f,g,h'.Split(&#039...

Help Comparing Objects in PowerShell
Mar 31, 2015
Post comments count 0
Post likes count 0

Help Comparing Objects in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, helps a reader compare two objects in Windows PowerShell.  Hey, Scripting Guy! I am having a problem with a script. I wrote a function to compare virtual machines with virtual drives that I have on my hard drive, and it works just fine. But when I try to put the thing into a larger script, and get the path from those drives, well, it just won’t work. In fact, all I get is gibberish. I am pasting my code into a different email. I hope you can help me. —RL  Hello RL, Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a wonderful ...

PowerTip: Use PowerShell to See if Media Center is Installed
Mar 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to See if Media Center is Installed

Doctor Scripto

Summary: Use Windows PowerShell to determine if a Windows 8.1 has Media Center installed.  How can I use Windows PowerShell to determine if a version of Windows 8.1 has Media Center installed?  Use WMI and look at the Caption property of the Win32_OperatingSystem WMI class, for example: (Get-CimInstance Win32_OperatingSystem).caption Note  You can also use the alias GCIM, or use Get-WmiObject (alias GWMI).

Use PowerShell to Detect if Hypervisor is Present
Mar 30, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Detect if Hypervisor is Present

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to determine if a hypervisor is present  Hey, Scripting Guy! I have been trying to use WMI to determine if a server has the hypervisor present. I found the WMI class, and even the properties I need. But alas, the WMI class seems to be broken, and it is causing my Windows PowerShell script to fail. For your information, I have been using the Win32_Processor WMI class because it seems to have the properties I need. I know there are various tools I can download that provide this information, but I prefer to use something native if...

PowerTip: How to Find PowerShell User Groups
Mar 29, 2015
Post comments count 0
Post likes count 0

PowerTip: How to Find PowerShell User Groups

Doctor Scripto

Summary: Learn how to find Windows PowerShell user groups.  Where do I begin a search to find if there is a Windows PowerShell user group in my area?  There are two primary places for finding Windows PowerShell user group information:

Weekend Scripter: Special Charlotte PowerShell User Group Meeting
Mar 29, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Special Charlotte PowerShell User Group Meeting

Doctor Scripto

Summary: On April 22, the Charlotte Windows PowerShell User Group will host Lee Holmes and Paul Higginbotham. Microsoft Scripting Guy, Ed Wilson, is here. Sometimes things just work out. The other day, I received an email from Lee Holmes. He is speaking at the Windows PowerShell Summit, which will be hosted in Charlotte, NC, on April 20 – 22. This event sold out in just a few days, and when additional tickets were added, it sold out again. It would probably be easier to get tickets to the NCAA basketball tournament, than it is to get tickets to this event. After all, after basketball teams lose, many people...

PowerTip: Find PowerShell Sessions at Ignite
Mar 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Sessions at Ignite

Doctor Scripto

Summary: See the scheduled Windows PowerShell sessions for Microsoft Ignite.  I am planning to attend the Microsoft Ignite conference in Chicago this year! How can I find what Windows PowerShell            sessions are on the schedule?  Go to the Microsoft Ignite page, and filter on Windows PowerShell: Windows PowerShell Sessions.            Also keep in mind that many other sessions may have a heavy Windows PowerShell content,            but they are not specifically keyed as Windows PowerShell sessions.

PowerShell Spotlight: Scripting Guys at Ignite
Mar 28, 2015
Post comments count 0
Post likes count 0

PowerShell Spotlight: Scripting Guys at Ignite

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson, talks about plans for the Scripting Guys booth at Ignite in Chicago. Microsoft Scripting Guy, Ed Wilson, is here. Today we have Windows PowerShell MVP, Teresa Wilson (aka The Scripting Wife) with another edition of PowerShell Spotlight... It is almost April which means conference season is about to begin. I am so excited. The first conference is the PowerShell Summit in Charlotte April 20-22. This event is sold out. It is going to be an awesome three days. If you are in the Charlotte area and did not get tickets to the Summit (or even if you did and are going to b...

PowerTip: Use PowerShell to Find Installed Optional Features
Mar 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Installed Optional Features

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find installed optional features in Windows.  How can I use Windows PowerShell to see what optional features are installed in a copy of Windows?  Use the Get-WindowsOptionalFeature cmdlet, and if you are looking at a version of Windows            that is running, use the –Online switch: Get-WindowsOptionalFeature -Online

Use PowerShell to Remove Optional Features from Windows VHD
Mar 27, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Remove Optional Features from Windows VHD

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to remove optional features from Windows virtual hard disks.  Hey, Scripting Guy! I have a number of virtual machines that have optional features that they do not need, such as Windows Media Player. In fact, the virtual machines are set up with no audio, so having Windows Media Player is sort of a waste. How can I easily remove this feature? —CG  Hello CG, Microsoft Scripting Guy, Ed Wilson, is here. This morning started off early. IIS MVP, Teri Donahue, stopped by to pick up Teresa’s Surface Pro 2. T...

PowerTip: Find DISM-Related PowerShell Cmdlets
Mar 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Find DISM-Related PowerShell Cmdlets

Doctor Scripto

Summary: Learn how to find all Windows PowerShell cmdlets that work with DISM.  How can I find all Windows PowerShell cmdlets that work with Deployment Image Servicing and Management (DISM)?  Use the Get-Command cmdlet and specify the DISM module: Get-Command -Module dism

Use PowerShell to Add Files to Offline Windows Image
Mar 26, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Add Files to Offline Windows Image

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to add files to an offline Windows image.  Hey, Scripting Guy! I have a number of VHDs that I need to add files to. I know that I can use File Manager to mount the VHD and then copy the files, but I am hoping that I can use Windows PowerShell to do this. The VHDs are for virtual machines that I run in my lab. Can you help? —AM  Hello AM, Microsoft Scripting Guy, Ed Wilson, is here. Today I am a bit sore. I finally made it back into the gym yesterday, and my trainer seemed to have it in for me. Anyway, I am listening ...

PowerTip: Use PowerShell to Find Virtual Hard Disks
Mar 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Virtual Hard Disks

Doctor Scripto

Summary: Use Windows PowerShell to find virtual hard disks on your system.  I notice that my disk space appears to be disappearing at a rapid rate, and I suspect someone is creating            virtual hard disks (VHDs) and forgetting about them. How can I use Windows PowerShell to find all the            VHDs on my system?  Use the Get-ChildItem (LS, Dir, gci are aliases), use a filter like *.vhd*, and specify the Recurse switched            parameter. To simply report on the...

Use PowerShell to Explore Old Windows VHDs
Mar 25, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Explore Old Windows VHDs

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to explore old Windows VHDs.  Hey, Scripting Guy! It is time for spring clean-up around our datacenter. I am not talking about chasing out dust bunnies, although that is part of it. What I am talking about is trying to determine what can be safely deleted without annoying the users too badly. We have a lot of virtual machines that could have data on them, but I do not know the passwords, and I do not want to go to the trouble of creating virtual machines, mounting the drives, and launching the things to see if there is any user...

PowerTip: Use PowerShell to See Who Can Access Folder
Mar 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to See Who Can Access Folder

Doctor Scripto

Summary: Use Windows PowerShell to see who has access to a folder.  How can I use Windows PowerShell to see who has access rights to a folder?  Use the Get-Acl cmdlet, specify the folder, and look at the access property, for example: (Get-Acl c:\fso).Access  

Use PowerShell to Disable Wi-Fi
Mar 24, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Disable Wi-Fi

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to disable Wi-Fi if Ethernet is connected.  Hey, Scripting Guy! When I have an Ethernet cable plugged in to my laptop and I am connected to a network, I want to ensure that everything else is disabled. How can I do that by using Windows PowerShell? —DH  Hello DH, Microsoft Scripting Guy, Ed Wilson, is here. This morning is a bit cool, and definitely moist outside. It is not raining, but it seems like it could easily do so. It sort of reminds me of winter mornings in Florida, when it was cool and damp. I have not seen...

PowerTip: Use PowerShell to Disable All Network Adapters
Mar 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Disable All Network Adapters

Doctor Scripto

Summary: Use Windows PowerShell to disable all network adapters on your system.  I often work in offline situations, and I would like to disable all network adapters on my laptop for security reasons            and to help to extend battery life. How can I use Windows PowerShell to do this easily?  Use the Get-NetAdapter cmdlet to retrieve all network adapters and pipe the results to the            Disable-NetAdapter cmdlet. To suppress confirmation messages use the –Confirm parameter       &nb...

Use PowerShell to Enable Wi-Fi
Mar 23, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Enable Wi-Fi

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to enable Wi-Fi if Ethernet is not connected.  Hey, Scripting Guy! Most of the time when I use my laptop running Windows 8.1, I am plugged in to the Ethernet network at work. Occasionally, I unplug the laptop and take it to meetings. I keep the Wi-Fi disabled when I am plugged in to the Ethernet because if I have it enabled, it seems that at random times, my laptop connects to Wi-Fi. I only notice this when Outlook becomes really slow or I am trying to download something that ends up taking forever. I also think this is a ...

PowerTip: Use PowerShell to Verify Hotfix
Mar 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Verify Hotfix

Doctor Scripto

Summary: Use Windows PowerShell to verify if a hotfix is installed.  How can I use Windows PowerShell to verify that my workstation running Windows 8.1 has            the November DSC rollup installed?  Use the Get-Hotfix cmdlet and search for ID KB3000850: Get-HotFix -Id kb3000850

Weekend Scripter: Use PowerShell to Find Longest Cmdlet Name
Mar 22, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Find Longest Cmdlet Name

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find the longest cmdlet name. Microsoft Scripting Guy, Ed Wilson, is here. This is an exciting time of the year, as we get ready for the PowerShell Summit in Charlotte and for the Microsoft Ignite conference in Chicago. I have been having numerous email conversations with various individuals the past week. One of the fun exchanges took place with Windows PowerShell MVP and Honorary Scripting Guy, Sean Kearney. We are planning something cool for Ignite, and we were bouncing ideas around, for example, "I wonder which Windows P...

PowerTip: Use PowerShell to Count Types of Images
Mar 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Count Types of Images

Doctor Scripto

Summary: Use Windows PowerShell to count different types of image files.  How can I use Windows PowerShell to see a count of the different types of image files on my computer?  Use the Get-ChildItem cmdlet to find the image files and then pipe the results to the Group-Object cmdlet,            for example: dir -Recurse -ea 0 -File -path e:\data -include "*.gif","*.jpg", "*.png", "*.bmp" | group extension -NoElement Note  Dir is an alias for Get-ChildItem and Group is an alias...

PSImaging Part 3: Group-ImageFile
Mar 21, 2015
Post comments count 0
Post likes count 1

PSImaging Part 3: Group-ImageFile

Doctor Scripto

Summary: Guest blogger, Ben Vierck, talks about grouping similar images with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have Ben Vierck back for Part 3 in his series about images. Before you begin, you might like to read: In first two blog posts of this series, we wrote the Windows PowerShell functions Test-Image and Export-Text into a new Windows PowerShell module named PSImaging. The purpose of this exercise is to give us a set of common atomic tools that we can use to automate some of day-to-day document management tasks that require manual human intervention. Today we'r...

PowerTip: Use PowerShell to Count Images
Mar 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Count Images

Doctor Scripto

Summary: Learn how to use Windows PowerShell to count images.  How can I use Windows PowerShell to count images on a drive?  Use the Get-ChildItem cmdlet, specify the path, and send the results to the Measure-Object cmdlet,            for example: dir -Recurse -ea 0 -File -path e:\data -include "*.gif","*.jpg", "*.png", "*.bmp" | measure Note  Dir is an alias for Get-ChildItem and Measure is an alias for Measure-Object.

PSImaging Part 2: Export-Text from Images
Mar 20, 2015
Post comments count 1
Post likes count 0

PSImaging Part 2: Export-Text from Images

Doctor Scripto

Summary: Guest blogger, Ben Vierck, talks about using Windows PowerShell to export text from an image. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger Ben Vierck, for Part 2 of PSImaging. Read Part 1 before diving into today’s post: PSImaging Part 1: Test-Image. Now, here’s Ben... In first blog post of this series, we wrote the Windows PowerShell function Test-Image to definitively detect whether a file is a known image type by analyzing the first 8 bits of its header. In this post, we're going to write a Windows PowerShell command with a cmdlet called Export-ImageText tha...

PowerTip: Read .exe Magic Number with PowerShell
Mar 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Read .exe Magic Number with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to see an .exe magic number.  How can I use Windows PowerShell to see the "magic number" associated with an executable file in Windows?  The term magic number refers to the bytes that occur at the beginning of every file and identify the format of file.            Use this command to read a Windows executable file header with Windows PowerShell:  [char[]](gc $env:windir\notepad.exe -Encoding Byte -ReadCount 1 -TotalCount 2)

PSImaging Part 1: Test-Image
Mar 19, 2015
Post comments count 0
Post likes count 0

PSImaging Part 1: Test-Image

Doctor Scripto

Summary: Guest blogger, Ben Vierck, talks about using Windows PowerShell to determine if a file is an image. Microsoft Scripting Guy, Ed Wilson, is here. I am happy to introduce a new guest blogger here at the Hey, Scripting Guy! Blog: Ben Vierck. Ben has been around for a while, using and supporting Windows PowerShell, and he certainly is not a noob by any stretch of the imagination. I had not previously talked to him about writing a guest blog, and then Teresa mentioned it to me. What would I do without the Scripting Wife? Let’s hope I don’t have to find out! Ben is presenting a three-part series ab...

PowerTip: Shut Down Virtual Machine with PowerShell
Mar 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Shut Down Virtual Machine with PowerShell

Doctor Scripto

Summary: Learn how to shut down a virtual machine by using Windows PowerShell.  How can I use Windows PowerShell to perform an orderly shutdown of a virtual machine?  When the Stop-VM cmdlet is used with no parameters, it conducts an orderly shutdown.            Here is an example: Stop-VM –name C1

Update Offline Virtual Machine with PowerShell and WSUS Offline Update: Part 2
Mar 18, 2015
Post comments count 0
Post likes count 0

Update Offline Virtual Machine with PowerShell and WSUS Offline Update: Part 2

Doctor Scripto

Summary: Microsoft PowerShell MVP, Sean Kearney, talks about updating an offline virtual machine with Windows PowerShell and WSUS Offline Update. Honorary Scripting Guy, Sean Kearney, here. Yesterday, I introduced you to a tool you can use to updating offline virtual machines: Update Offline Virtual Machine with PowerShell and WSUS Offline Update: Part 1. Today, we'll learn how to conclude our process. Within the folder structure is a folder called Client. This is the structure we need to expose to our offline virtual machines. The process we’re going to follow will be very simple: The followin...

PowerTip: Use PowerShell to Mount ISO
Mar 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Mount ISO

Doctor Scripto

Summary: Easily mount ISO files by using Windows PowerShell.  How can I use Windows PowerShell to mount ISO files in Windows 8?  Use the Mount-Disk cmdlet and specify the exact path of the ISO file, for example: Mount-DiskImage C:\Media\Filename.ISO

Update Offline Virtual Machine with PowerShell and WSUS Offline Update: Part 1
Mar 17, 2015
Post comments count 0
Post likes count 0

Update Offline Virtual Machine with PowerShell and WSUS Offline Update: Part 1

Doctor Scripto

Summary: Honorary Scripting Guy, Sean Kearney introduces a cool tool for updating virtual machines.  Hey, Scripting Guy! I have some virtual machines that are normally offline. They need to be updated on a regular basis, but these machines have no access to the Windows Server Update Services (WSUS) server. Is there an easy answer to this problem? —WT  Hello WT, Honorary Scripting Guy, Sean Kearney, is here to show a little magic with Windows PowerShell and the Windows update system. Updating an offline virtual machine really isn’t that difficult. Just power it up, wait for the updates to dow...

PowerTip: Use PowerShell to Find Network Adapters
Mar 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Network Adapters

Doctor Scripto

Summary: Use Windows PowerShell to find network adapters associated with running virtual machines.  How can I use Windows PowerShell to see the network adapters that are associated with all running            virtual machines on my Windows 8.1 laptop that runs Hyper-V?  Use the Get-VM cmdlet to look for running virtual machines. Then pipe the results to the            Get-VMNetworkAdapter cmdlet, for example: (Get-VM).where({$_.state -eq 'running'}) | Get-VMNetworkAdapter Note  This command must be run wi...

Updating Virtual Machines
Mar 16, 2015
Post comments count 0
Post likes count 0

Updating Virtual Machines

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the problem of updating virtual machines. Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping a nice cup of red berry tea. I also have a bowl of grapes and a bit of brie. The berry tea, grapes, and brie are a nice combination, and light enough that it makes a nice afternoon snack. One of the great things I love about Windows 8.1 is that it has real Hyper-V built-in to it, and it has Windows PowerShell cmdlet support for managing those virtual machines. The performance is really good, and it means that I can create a virtual machine...

PowerTip: Display the Value of Pi by Using PowerShell
Mar 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Display the Value of Pi by Using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to easily display the value of pi.  How can I use Windows PowerShell to obtain the value for pi?  Use the Pi static property from the System.Math class: [math]::pi

Weekend Scripter: Approximate the Value of Pi from a Polygon
Mar 14, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Approximate the Value of Pi from a Polygon

Doctor Scripto

Summary: Microsoft senior software engineer, Firaz Samet, shows how to use Windows PowerShell to approximate the value of pi from a polygon. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog post from Firaz Samet in honor of Pi (π) Day. I will turn the blog over… The Scripting Guy ran across my PowerShell Math Module on CodePlex, and he asked me if I would be interested in writing a blog post for Pi Day. I was also incidentally thinking about Pi Day, so this came at the right time. I hope you enjoy reading it. First a little bit about me... I am a senior software engineer at Micros...

PowerTip: Find Day of the Week with PowerShell
Mar 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Day of the Week with PowerShell

Doctor Scripto

Summary: Find the day of the week by using Windows PowerShell.  How can I use Windows PowerShell to find what day of the week a particular date falls on?  Access the DayOfWeek property from the DateTime object: (get-date).dayofweek

Optimize PowerShell Code?
Mar 13, 2015
Post comments count 0
Post likes count 0

Optimize PowerShell Code?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about optimizing Windows PowerShell code. Microsoft Scripting Guy, Ed Wilson, is here. I was looking at my Windows Phone this morning and I noticed that today is Friday the 13th. What seemed a bit strange to me is that I thought there was also a Friday the 13th last month. I then became curious. Exactly how often does the 13th of the month fall on a Friday? Or put another way, how many Friday the 13th’s are there in a year—or at least for this year? Perhaps I could have opened the Internet and used a Bing search to find out, But I was fairly certain t...

PowerTip: Use PowerShell to Check for Snapshots
Mar 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Check for Snapshots

Doctor Scripto

Summary: Learn how to use Windows PowerShell to check for virtual machine snapshots.  How can I use Windows PowerShell to see if a particular virtual machine has snapshots?  Use the Get-VMSnapshot cmdlet, for example: Get-VMSnapshot dc1_nwt Note  This cmdlet requires running an account that has admin rights.

Use PowerShell to Create Archive and Send Email
Mar 12, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Archive and Send Email

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to create a .zip archive and email it.  Hey, Scripting Guy! I have a number of files that I would like to archive on a regular basis to a .zip file. I need to email that .zip file as an attachment. I do this every week, and it takes me like nearly 15 minutes to create the .zip file, open Outlook, squirrel around and find the file, write the email, send the thing, and then delete the .zip archive from disk. If I could run a script, it would save me over an hour a month—that is nearly two days of free labor. Can you do it? &...

PowerTip: Use PowerShell to Copy Source to Multiple Destinations
Mar 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Copy Source to Multiple Destinations

Doctor Scripto

Summary: Use Windows PowerShell to copy a source directory to multiple destinations.  How can I use Windows PowerShell to make multiple backup copies of a source directory without wasting a            lot of time mousing around?  Copying a single source directory to multiple destinations can be a single line command, for example: "c:\fso1","c:\fso2","c:\fso3" | % {Copy-Item c:\fso -Recurse -Destination $_} Note  The % symbol is an alias for the Foreach-Object cmdlet.

Use PowerShell to Extract Zipped Files
Mar 11, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Extract Zipped Files

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to extract zipped files.  Hey, Scripting Guy! I need to be able to work with zipped files from time-to-time. Often I store files in a zip archive so they are portable. I know how to copy the .zip archive from one place to another with Windows PowerShell, but I cannot seem to figure out how to unzip the archive. Can you help me? I would be ever so grateful. —SK  Hello SK, Microsoft Scripting Guy, Ed Wilson, is here. This morning I got out my bag of espresso beans and set up my rotary bean grinder. I am thinking I will make some espre...

PowerTip: Use PowerShell to Map a Drive
Mar 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Map a Drive

Doctor Scripto

Summary: Learn how to use Windows PowerShell to map a drive.  How can I use Windows PowerShell  to map a drive to a server from a client running Windows 8.1?  Use the New-SmbMapping cmdlet and specify the local path and the remote path, for example: New-SmbMapping -LocalPath h: -RemotePath \\dc1\Share

Use PowerShell to Zip Multiple Folders
Mar 10, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Zip Multiple Folders

Doctor Scripto

Summary: Use Windows PowerShell to create a .zip archive of multiple folders.  Hey, Scripting Guy! I need to compress multiple folders before I attempt to archive them. I would like to do this without having to install additional software. Can you help? —DR  Hello DR, Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping a red berry tea and munching on a chocolate biscotti. Maybe it is not too exciting, but it is relaxing. I am looking over my email sent to scripter@microsoft.com on my Surface 3 Pro, and things are good. One of the cool things about the free update to Windows 8....

PowerTip: Use PowerShell to Find ODBC Drivers
Mar 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find ODBC Drivers

Doctor Scripto

Summary: Use Windows PowerShell to find installed ODBC drivers.  How can  I use Windows PowerShell to check installed ODBC drivers so that I can investigate if a missing            driver might be the cause of a database application that appears to be failing?  Use the Get-OdbcDriver function from the WDAC module, for example: Get-OdbcDriver | Format-Table name, platform -AutoSize

Use PowerShell to Create ZIP Archive of Folder
Mar 9, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create ZIP Archive of Folder

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create a .zip archive of a folder.  Hey, Scripting Guy! I need a way to create a .zip archive of a folder. I would like to do this on my laptop running Windows 8.1, and I do not want to install any other software. Can I do this? —TR  Hello TR, Microsoft Scripting Guy, Ed Wilson, is here. The weed eater dude is outside. The guy is really dedicated to his job. I mean, the snow has barely cleared, and he is out there chopping away with his weed eater. I really enjoy hearing him, because it fills me with hope tha...

PowerTip: Find if Folder Exists
Mar 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Find if Folder Exists

Doctor Scripto

Summary: Use Windows PowerShell to see if a folder exists.  How can I easily find if a folder exists for a Windows PowerShell script that I am writing?  Use the Test-Path cmdlet and the PathType parameter, for example: Test-Path c:\fso -PathType Container

Weekend Scripter: Use PowerShell to Create Folder
Mar 8, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Create Folder

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create folders. Microsoft Scripting Guy, Ed Wilson, is here. I am not a huge fan of using a mouse. In fact, the more things I can do from Windows PowerShell the better. It is a huge waste of time for me when I have to remove my hands from the keyboard, chase down a mouse, mouse around for a while, and then return my fingers to the home row on the keyboard. One cool thing is that Microsoft Word has a number of keyboard shortcuts—of course, it also has an API. I also do quite a bit of scripting for that. Another place where I...

PowerTip: Use PowerShell to Read the Content of a ZIP File
Mar 7, 2015
Post comments count 0
Post likes count 2

PowerTip: Use PowerShell to Read the Content of a ZIP File

Doctor Scripto

Summary: Learn how to use Windows PowerShell to read the content of a .zip file.  How can I read the content of a .zip file from within Windows PowerShell?   Use the OpenRead static method from the IO.Compression.ZipFile .NET Framework class.             First, you will need to load the assembly that contains the class. Here is an example: Add-Type -assembly "system.io.compression.filesystem" [io.compression.zipfile]::OpenRead("E:\Ch10.zip").Entries.Name

Weekend Scripter: Avoid PowerShell Scripting—Use GUI Tools
Mar 7, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Avoid PowerShell Scripting—Use GUI Tools

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about exporting queries from the event log tool. Microsoft Scripting Guy, Ed Wilson, is here. It has long been a truism (at least with things related to computers): powerful is opposite of simple. I can have a tool that is powerful, but with that power comes complexity. When that complexity is so complex as to render the tool ridiculously hard to use, the tool rapidly becomes useless. What is awesome is when a tool is extremely powerful and also very easy to use. Of course, this usually means that the tool makes lots of default choices for me. If those default ch...

PowerTip: Encrypt Files with PowerShell
Mar 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Encrypt Files with PowerShell

Doctor Scripto

Summary: Learn how to easily encrypt files by using Windows PowerShell.  How can I use Windows PowerShell to easily encrypt files?  Use the Encrypt static method from the System.IO.File .NET Framework class, for example: [io.file]::Encrypt("C:\fso\FileWithOutExtension")

Don’t Script: Create PowerShell Snippets
Mar 6, 2015
Post comments count 0
Post likes count 0

Don’t Script: Create PowerShell Snippets

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating custom Windows PowerShell snippets.  Hey, Scripting Guy! Thank you for yesterday's blog post, Don’t Write Scripts: Use Snippets. I like the idea of having access to Windows PowerShell script snippets. But I used to create my own snippets. It made it easier for me to work, and I could create a custom script based on my snippets in less than 30 seconds. I don’t see anything like that these days. Am I missing something? Please help me understand. —JT  Hello JT, Microsoft Scripting Guy, Ed Wilson, is here. This morning, it is raining. It looks like...

PowerTip: Use PowerShell to Identify Files Without an Extension
Mar 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Identify Files Without an Extension

Doctor Scripto

Summary: Use Windows PowerShell to identify files that do not have an extension.  How can I use Windows PowerShell to easily identify files that do not have an extension?  Use the HasExtension static method from the System.IO.Path .NET Framework class, for example: [System.IO.Path]::hasExtension("C:\fso\FileWithOutExtension")

Don’t Write Scripts: Use Snippets
Mar 5, 2015
Post comments count 0
Post likes count 0

Don’t Write Scripts: Use Snippets

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell snippets to avoid scripting demands.  Hey, Scripting Guy! One of the things that I find myself having to do from time-to-time is write scripts. I really don’t like to write scripts, but sometimes I cannot find what I need to, and I cannot avoid it. I really wish that when I do have to write a script, I could make it as painless as possible. Is painless possible? —RA  Hello RA, Microsoft Scripting Guy, Ed Wilson, is here. Well tonight is the Charlotte PowerShell Users Group meeting. We will be having a guest pre...

PowerTip: Use PowerShell to Find Temp User Directory
Mar 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Temp User Directory

Doctor Scripto

Summary: Use Windows PowerShell to find the temporary user directory.  How can I use Windows PowerShell to find location of my temporary user directory?   Use the GetTempPath static method from the System.IO.Path .NET Framework class: [System.IO.Path]::GetTempPath() 

Don’t Script: Edit PowerShell Command History
Mar 4, 2015
Post comments count 0
Post likes count 0

Don’t Script: Edit PowerShell Command History

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about editing the Windows PowerShell command history.  Hey, Scripting Guy! I liked your ideas in Avoid Scripting: Use PowerShell Command History. My problem is that I seldom (if ever) type commands perfectly the first time—often, not even the second time. This means that I end up with a lot of junk in my command history. I wish there was a way to clean up the command history so it would be more usable. Is there? —AP  Hello AP, Microsoft Scripting Guy, Ed Wilson, is here. This afternoon, I am listening to a Canadian rock group and sipping som...

PowerTip: Use PowerShell to Generate Random File Name
Mar 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Generate Random File Name

Doctor Scripto

Summary: Use Windows PowerShell to generate a random file name.  How can I use Windows PowerShell to generate a random file name so I can ensure that            a file I create does not have a naming conflict?  Use the GetRandomFileName static method from the System.IO.Path .NET Framework            class, for example: [System.IO.Path]::GetRandomFileName()

Avoid Scripting: Use PowerShell Command History
Mar 3, 2015
Post comments count 0
Post likes count 0

Avoid Scripting: Use PowerShell Command History

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about avoiding Windows PowerShell scripting by using command history.  Hey, Scripting Guy! I used to have a program that I could use to keep track of commands I typed at the command prompt. It permitted me to use macros to replay those commands or to select which commands I wanted to run. It was simple, elegant, and not complicated. It is a shame that “modern” programs are not that easy to use. I really don’t relish the thought of having to learning scripting to be able to run a few commands. I wish I could go back to my old command prompt....

PowerTip: Use PowerShell to Show Illegal File Name Characters
Mar 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show Illegal File Name Characters

Doctor Scripto

Summary: Use Windows PowerShell to display illegal characters for a file name.  How can I use Windows PowerShell to easily obtain a list of characters that are not permitted in file names?  Use the GetInvalidFileNameChars static method from the System.IO.Path .NET Framework class: [System.IO.Path]::GetInvalidFileNameChars()

Write and Run PowerShell Script Without Scripting
Mar 2, 2015
Post comments count 0
Post likes count 0

Write and Run PowerShell Script Without Scripting

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about writing and running a Windows PowerShell script without scripting.  Hey, Scripting Guy! I like using the Windows PowerShell ISE, but I do not have rights to run a script. I am stuck using a twenty year-old command prompt with Windows PowerShell inside. What’s up with that? —DM  Hello DM, Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping a cup of Gunpowder green tea, with a bit of fresh lemon juice in it. It is a nice refreshing treat for a midafternoon slump. Of course, the biscotti also helps. Anyway... DM, welc...

PowerTip: Use PowerShell to Return Directory Information
Mar 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Return Directory Information

Doctor Scripto

Summary: Use Windows PowerShell to return directory information.  How can I use Windows PowerShell to provide information about directories in a specific location?  Use the Get-ChildItem cmdlet, specific the path and use the –Directory switch, for example: Get-ChildItem e:\data -Directory

Weekend Scripter: Use PowerShell to Update SSL Bindings
Mar 1, 2015
Post comments count 1
Post likes count 0

Weekend Scripter: Use PowerShell to Update SSL Bindings

Doctor Scripto

Summary: Microsoft IIS MVP, Terri Donahue, talks about using Windows PowerShell to update SSL bindings. Microsoft Scripting Guy, Ed Wilson, is here. Today, please welcome back IIS MVP, Terri Donahue. Terri is an IIS MVP, but she also attends the Charlotte PowerShell User Group meetings and events. Take it away, Terri... I recently spoke about IIS at the Charlotte PowerShell User Group monthly meeting. One of the questions that I was asked related to updating SSL bindings after a certificate is renewed. As anyone that manages SSL certificates across multiple servers knows, this can be a time consuming task. I foun...

PowerTip: Use PowerShell to Decrypt Files
Feb 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Decrypt Files

Doctor Scripto

Summary: Use Windows PowerShell to decrypt files.  How can I use Windows PowerShell to decrypt a file that it previously encrypted?  Use the Decrypt static method from System.IO.File .NET Framework class, for example: [io.file]::Decrypt("C:\fso\FileWithOutExtension")

PowerShell Spotlight: Windows PowerShell User Groups
Feb 28, 2015
Post comments count 0
Post likes count 0

PowerShell Spotlight: Windows PowerShell User Groups

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about Windows PowerShell user groups in this edition of PowerShell Spotlight. Microsoft Scripting Guy, Ed Wilson, is here. Today is the last Saturday of the month, and that means it is PowerShell Spotlight time. Here is our guest blogger for the day, Teresa Wilson, with information about user groups... Greetings everyone, I hope you are off to a great start with your weekend, and thank-you for allowing me to be part of your day. I would like to shine the spotlight on user groups today. I realize that there are many places where attending a local user group mee...

PowerTip: Fix Network Connection Profile with PowerShell
Feb 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Fix Network Connection Profile with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to fix the network connection profile on your laptop running Windows 8.1.  How can I use Windows PowerShell to fix the connection profile for my home network on my laptop            running Windows 8.1?  Use the Get-NetAdapter cmdlet to verify the interface index, and then use the            Set-NetConnectionProfile cmdlet to specify the network category, for example: Set-NetConnectionProfile -InterfaceIndex 9 -NetworkCategory Private

Get Process Owner and Other Info with WMI and PowerShell
Feb 27, 2015
Post comments count 0
Post likes count 0

Get Process Owner and Other Info with WMI and PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell and WMI to retrieve process owner and other information. Microsoft Scripting Guy, Ed Wilson, is here. We were supposed to receive seven inches of snow the other day. They closed schools and businesses, and the roads were swamped with people rushing to various stores in preparation for the snowstorm of the century. Of course, the century is still not all that old, and the storm was not that big of a deal. In fact, as it turned out, it really was not a big deal at all. We received less than a half-inch of snow, and even that did not s...

PowerTip: Compare Processes with PowerShell
Feb 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Compare Processes with PowerShell

Doctor Scripto

Summary: Learn how to compare two processes with Windows PowerShell.  How can I use Windows PowerShell to find the differences between two instances of the same process            running on my system?  Use the Compare-Object cmdlet and specify specific properties to examine, such as cpu, id, vm, and ws.             Here is an example that uses two instances of Notepad: $a = Get-Process -Id 6208 $b = Get-Process -Id 10744 Compare-Object -ReferenceObject $a -DifferenceObject $b -Property cpu, ws, vm, id

Use WMI and PowerShell to Work with Services
Feb 26, 2015
Post comments count 0
Post likes count 0

Use WMI and PowerShell to Work with Services

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell and WMI to work with services. Microsoft Scripting Guy, Ed Wilson, is here. It is that time of the year. I just spent the last couple of hours uninstalling useless software from my laptop. This includes stuff that I intentionally installed and junk that becomes installed with other programs. I also spent a decent amount of time reviewing start-up programs and services. This is pretty much a stop gap measure – it is only a matter of time before I FDISK my machine and perform a complete reinstall. It still seems necessary to rei...

PowerTip: Find “Hidden” Property Values in PowerShell
Feb 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Find “Hidden” Property Values in PowerShell

Doctor Scripto

Summary: Learn how to find some missing property values in Windows PowerShell.  How can I find missing property values in the process information I am looking at in Windows PowerShell?  Launch Windows PowerShell with Admin rights (hold down the Shift key, right-click the Windows PowerShell icon,           select Run as Administrator or Run as different user, and then enter credentials for an account with            Admin rights). Note  Windows PowerShell runs in user mode; therefore, it only grants access to information to w...

Comparing WMI and Native PowerShell
Feb 25, 2015
Post comments count 0
Post likes count 0

Comparing WMI and Native PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about comparing WMI and using native Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. When Windows PowerShell was still in beta, there was a saying (song?) that said there must be 50 ways to stop a process. Actually, I am not certain it was ever turned into a Windows PowerShell song, but it probably could have been. Anyway, the conversation was a reflection of the many ways of doing things that are available in Windows PowerShell…and that was back in the Windows PowerShell 1.0 days. Today, there are even more ways of doing things. So w...

PowerTip: Find WMI Classes with a CIM Cmdlet
Feb 24, 2015
Post comments count 0
Post likes count 0

PowerTip: Find WMI Classes with a CIM Cmdlet

Doctor Scripto

Summary: Use a Windows PowerShell CIM cmdlet to find WMI classes.   How can I find Windows Management Instrumentation (WMI) classes that are related to a particular technology?  Use the Get-CimClass cmdlet and use a wildcard character for the name, then specify the Dynamic            parameter to help filter classes, for example: Get-CimClass -ClassName *bios* -QualifierName dynamic

When to Use WMI and PowerShell
Feb 24, 2015
Post comments count 0
Post likes count 0

When to Use WMI and PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about when to use WMI. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that Windows PowerShell has done is make WMI very easy to use. Beginning with Windows PowerShell 1.0 and the Get-WmiObject cmdlet, WMI information has become much easier to access. Whereas a simple VBScript script or Perl script would require a minimum of seven lines of rather complicated code to access WMI information, Windows PowerShell made the same information available as a one-liner. Truly a marvelous win for IT pros! But one problem remains. WMI (even in Windows Powe...

PowerTip: Troubleshoot a Word Automation Script
Feb 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Troubleshoot a Word Automation Script

Doctor Scripto

Summary: Learn to troubleshoot a Windows PowerShell script for Microsoft Word automation.   I have been struggling with a Windows PowerShell script that automates Word. Every time I run the script, I get an            error message that says the Word document is locked. What can I do?   When you test or develop your Windows PowerShell script for Word automation, make sure that you quit the             Word.Application object and close the Word document. Otherwise, the document will be locked. This is     &nbsp...

Use PowerShell to Count Comments in Word Docs
Feb 23, 2015
Post comments count 1
Post likes count 0

Use PowerShell to Count Comments in Word Docs

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to count comments in Microsoft Word documents. Microsoft Scripting Guy, Ed Wilson, is here. The process of writing often includes rewriting. In fact, I imagine that I spend more time rewriting stuff than I spent writing the original document—especially when I write a book. The book process goes something like this: I write a chapter, I send it to my editor. She looks it over for style and consistency within the series, and then she forwards it to the technical reviewer. The technical reviewer sends it back to the editor, who f...

PowerTip: Check Syntax Options for PowerShell Cmdlet
Feb 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Check Syntax Options for PowerShell Cmdlet

Doctor Scripto

Summary: Use the Get-Command cmdlet to check syntax options for a Windows PowerShell cmdlet.  How can I easily find syntax options (parameter sets) that exist for a particular Windows PowerShell cmdlet?  Use the Get-Command cmdlet and check the Definition property, for example: (Get-Command Stop-Process).Definition   

Weekend Scripter: Fun Things to Do with PowerShell
Feb 22, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Fun Things to Do with PowerShell

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about fun things to do with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog post from Microsoft Honorary Scripting Guy and Windows PowerShell MVP, Teresa Wilson, who shares some fun things to do with Windows PowerShell. Take it away, Teresa… Hello everyone, Sometimes when I am out and about, people will ask me what I do and where I work. It is easy to explain when you are talking to an IT professional, but to explain it to the general public is not so easy. I usually give a pretty simple explanation of ho...

PowerTip: Easy Way to Troubleshoot PowerShell Script
Feb 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Easy Way to Troubleshoot PowerShell Script

Doctor Scripto

Summary: Learn the easy way to troubleshoot a Windows PowerShell script.   I receive an error message every time I run my Windows PowerShell script. What is an easy way to troubleshoot the             script in the Windows PowerShell ISE?  Highlight the line of code in the script to select it (use the mouse or keyboard shortcuts), and then press F-8 to            run only the selected line of code. If no errors arise, select the next line of code and repeat the process until            an error arises.  

Weekend Scripter: Add Comment to Word Doc
Feb 21, 2015
Post comments count 1
Post likes count 0

Weekend Scripter: Add Comment to Word Doc

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to add a comment to a Microsoft Word document. Microsoft Scripting Guy, Ed Wilson, is here. I spend a lot of time using Microsoft Word. In fact, I spend more time using Word than Microsoft Outlook—and that is saying something. Actually, it is saying a lot. Word is open on my computer nearly every day of the year, and from time-to-time, at all hours of the day. Because I deal with editors, I also have to read comments that they add to Word documents. On the other hand, when I provide peer review for other writers, I also h...

PowerTip: Release COM Object in PowerShell
Feb 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Release COM Object in PowerShell

Doctor Scripto

Summary: Learn how to release a COM object in Windows PowerShell.   How can I make sure that a COM object in my Windows PowerShell automation script releases?  Use the ReleaseCOMObject static method from the Marshal class, and then pass it to the variable            that holds the COM object, for example: [System.Runtime.Interopservices.Marshal]::ReleaseComObject($doc) | Out-Null

Use PowerShell to Add Table to Word Doc and Email as Attachment
Feb 20, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Add Table to Word Doc and Email as Attachment

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create a document in Microsoft Word, add a table, and email the document as an attachment. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things I like to do with Windows PowerShell is to combine multiple tasks so that it makes life easier for me. I use what I call the “annoyance meter” quite often to determine whether to write a script or not. Today’s script is one of those things that rates pretty high on my annoyance meter. Here is the scenario: I need to supply my professor in my Shakespeare cl...

PowerTip: Get Row from CSV File Based On Value
Feb 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Get Row from CSV File Based On Value

Doctor Scripto

Summary: Use Windows PowerShell to get a row from a CSV file based on a specific value.  How can I use Windows PowerShell 4.0 to look up a specific row from a CSV file I imported into a variable?  Use the Where method, and use a match pattern to search on a specific column and value, for example: $topics = import-csv -Path C:\lit\Shakespeare.txt $topics.Where({$PSItem.play -eq 'hamlet'}).topic

Add Custom Headers to Folder Full of Word Documents
Feb 19, 2015
Post comments count 0
Post likes count 0

Add Custom Headers to Folder Full of Word Documents

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about reading a CSV file and adding custom headers to a folder full of Word documents. Microsoft Scripting Guy, Ed Wilson, is here. The snow continues to befuddle the drivers around here, and as a result, the Scripting Wife and I are staying home. This has given me a lot of time to sit, look at the giant slip-and-slide outside (also called a road), and write Windows PowerShell scripts. When I combine Word and Windows PowerShell, it is guaranteed to produce a lot of fun. Begin with my CSV file The other day, I created a CSV file with the titles of various plays th...

PowerTip: Use PowerShell ISE for Standard Enumerations
Feb 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell ISE for Standard Enumerations

Doctor Scripto

Summary: Use the Windows PowerShell ISE to use enumeration values.  How can I use the Windows PowerShell ISE to use the standard enumeration types to write a            Word automation script?  Cast the string as a type, and store the returned value in a variable. Each enumeration value            will be available as a static property. Here is an example: $HeaderFooterIndex = "microsoft.office.interop.word.WdHeaderFooterIndex" -as [type] $HeaderFooterIndex::wdHeaderFooterFirstPage

Use PowerShell to Add Headers to Word Documents
Feb 18, 2015
Post comments count 0
Post likes count 1

Use PowerShell to Add Headers to Word Documents

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to add headers to Microsoft Word documents. Microsoft Scripting Guy, Ed Wilson, is here. It snowed in Charlotte yesterday. It was not really a surprise because the weather service did a good job of warning that it would happen. Although the Scripting Wife and I were a bit worried that the power would go off, it turned out to be a huge non-event—at least for us. For the thousands of people who lost their power...well, that was a different story. It seems that these sorts of things always pile up—we lose the power, it is c...

PowerTip: Use PowerShell to List Word Autocorrect Entries
Feb 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List Word Autocorrect Entries

Doctor Scripto

Summary: Use Windows PowerShell to list autocorrect entries for Microsoft Word.  Microsoft Word keeps messing up what I type, and I suspect it could be an autocorrect issue. How can I use            Windows PowerShell to list all the entries in Microsoft Word autocorrect?  Use the New-Object cmdlet to create an instance of the Word.Application object. Look at autocorrect           and Entries, then pipe the results to the Format-Table cmdlet, and look at Name and Value properties: (New-Object -C...

Use PowerShell to Create Documents from Template
Feb 17, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Documents from Template

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create Word documents from a template.  Hey, Scripting Guy! I often need to create a bunch of Word documents. These documents have a number of standard features. Right now, I basically paste the last document I was working on into the folder, rename the file, open the file, delete all of the custom stuff, and leave the boilerplate stuff. I know there should be an easier way to do this, but to be honest I am doing the work of three people, and I simply do not have time to figure out an easier way to do this. Now the process t...

PowerTip: Find PowerShell Help for Specific Parameter
Feb 16, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Help for Specific Parameter

Doctor Scripto

Summary: Use Windows PowerShell Help to assist with a specific parameter.  I know I can use Get-Help –full to see the complete Help for a Windows PowerShell cmdlet, but how can I            see the Help for only  a specific parameter?  Use the Get-Help cmdlet, specify the cmdlet name, and then specify the specific parameter, for example: get-help Start-Process -Parameter wait

Use PowerShell to Back Up Word Docs
Feb 16, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Back Up Word Docs

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to make a backup of all Word documents.  Hey, Scripting Guy! I need some help. I routinely edit Microsoft Word documents, but because of the changes I make to the file, I like to keep the original file intact. So what I do is open a Word document, then I use the Save As feature in Word to save a copy of the file into a different folder. I am wondering if I can have Windows PowerShell use the Word automation feature to do a Save As for me. Can you help me? —GB  Hello GB, Microsoft Scripting Guy, Ed Wilson, is here. I ...

PowerTip: Open Fonts Dialog Box with PowerShell
Feb 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Open Fonts Dialog Box with PowerShell

Doctor Scripto

Summary: Use a Windows PowerShell cmdlet to open the Fonts dialog box.  How can I use Windows PowerShell to open the Fonts dialog box so I don't have to mouse around trying to find it?  Use the Show-ControlPanelItem cmdlet: Show-ControlPanelItem fonts

Weekend Scripter: German PowerShell Community Conference
Feb 15, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: German PowerShell Community Conference

Doctor Scripto

Summary: Windows PowerShell MVP, Tobias Weltner, talks about the Windows PowerShell Community Conference in Germany. Microsoft Scripting Guy, Ed Wilson, is here. I'm drooling today because of the information in this blog post. Teresa and I love to go to Germany. Our last two major vacations have started and ended there. Tobias Weltner is our guest blogger today, and I won’t share his news. I will give you a sneak peak though. This photo was taken in 2006 in Essen, Germany. If you have a chance to go, you will love Essen. It is a beautiful city, and it is easy to get to via the trains. Turning the keyb...

PowerTip: Use PowerShell to Start a Bunch of Processes
Feb 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Start a Bunch of Processes

Doctor Scripto

Summary: Learn how to start a bunch of processes by using Windows PowerShell.            How can I use Windows PowerShell to start a whole bunch of processes for testing purposes on one of my systems? Use a Windows PowerShell range operator, such as 1..10, to specify how many processes you want to create.            Then pipe the results to the Foreach-Object cmdlet, and in the script block, use Start-Process to create            the commands you need. Here is an example:1..10 | Foreach {St...

Weekend Scripter: Control Processes with PowerShell
Feb 14, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Control Processes with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to control processes. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am made a pot of Masala Chai. I found a pretty good recipe when I was doing a Bing search: Indian Masala Chai. One of my pet peeves is when people refer to it as Chai tea, which is rather silly because the word chai simply means tea, so they are literally saying "tea tea." Anyway, I spent a decent amount of time heating milk, finding spices, and making a nice pot of black Assam tea for the starter. It was a nice relaxing way to start a morning, an...

PowerTip: Find Assigned Virtual Machine Network Adapters
Feb 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Assigned Virtual Machine Network Adapters

Doctor Scripto

Summary: Learn how to find network adapters that are assigned to virtual machines.  How can I use Windows PowerShell to find what network adapters are assigned to my virtual machines?  Use the Get-VM cmdlet and pipe the results to the Get-VMNetworkAdapter cmdlet, for example: Get-VM | Get-VMNetworkAdapter           Note  You must run this command with elevated permissions.

Use PowerShell to View and Filter Information
Feb 13, 2015
Post comments count 0
Post likes count 0

Use PowerShell to View and Filter Information

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to view and filter information.  Hey, Scripting Guy! I am not a scripter—never have been, never will be. But over the years I have used lots of people's scripts to do different things. I actually got some of my favorite scripts from the Scripting Guys—scripts that create an HTA that allows me to filter and manipulate data. The cool thing about this is that all I need to do is to double-click, and boom! It pops up and does what it needs to do. I would love to be able to use Windows PowerShell to do something lik...

PowerTip: Run Part of PowerShell Command
Feb 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Run Part of PowerShell Command

Doctor Scripto

Summary: Learn how to run part of a command in the Windows PowerShell ISE.  I am having problems with a small part of a script that I am working on in the Windows PowerShell ISE—           how can I test only that code?  Highlight only the portion of the script you want to test, and press the F-8 key or the small green triangle on the            toolbar (or select Run Selection from the File menu). Only the section of code that you highlighted will run.

Don’t Learn PowerShell: Reaching Out
Feb 12, 2015
Post comments count 0
Post likes count 0

Don’t Learn PowerShell: Reaching Out

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about running commands on remote servers.  Hey, Scripting Guy! One of the things I really don’t understand is why Windows PowerShell is broken. I look at commands like you suggest, but they don’t work. Specifically, I wanted to see the status of services on my servers, but the commands just don’t work. What’s up with that? —BB  Hello BB, Microsoft Scripting Guy, Ed Wilson, is here. This morning it is cold and raining, which would not be unusual winter weather for Charlotte, North Carolina—except the weather app on Bin...

Dia's Test Post
Feb 11, 2015
Post comments count 0
Post likes count 0

Dia's Test Post

Doctor Scripto

Summary: Guest blogger, Tim Warner, talks about using Windows PowerShell conceptual Help. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back Timothy Warner as our guest blogger today. Let’s say you need to identify and extract all email addresses from a huge text file. To solve the issue, you decide to employ the Select-String cmdlet with regular expression (regex) syntax. Like the good PowerSheller you are, you update your local Help and examine the full Select-String documentation in a separate window: Get-Help –Name Select-String –ShowWindow   Now browse to the bottom of the file to the Related Links se...

PowerTip: Automatically Find Options in PowerShell
Feb 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Automatically Find Options in PowerShell

Doctor Scripto

Summary: Learn how to see available options in the Windows PowerShell ISE.  How can I easily see what options are available when I type in a cmdlet name in the Windows PowerShell ISE?  Use IntelliSense. There are two ways to display IntelliSense: 1. From the Edit menu, select Start Intellisense. 2. Use the Ctrl-Space keyboard shortcut as follows:

Don’t Learn PowerShell: Use Cmdlets
Feb 11, 2015
Post comments count 0
Post likes count 0

Don’t Learn PowerShell: Use Cmdlets

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell cmdlets to do IT ops work.  Hey, Scripting Guy! I have been an IT pro for many years, and to be honest, I am really good at my job. Now it seems you guys are abandoning me. I have been a loyal Microsoft supporter for many years, and I even got my MCSE back on Windows 2000. Now it seems like you want me to learn command-line stuff like AS400 or VAX. I learned Windows because I like graphical tools. I am good with a mouse, but I hate to type. What gives? —BV  Hello BV, Microsoft Scripting Guy, Ed Wilson, is here. One o...

PowerTip: Find What a PowerShell Command Does
Feb 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Find What a PowerShell Command Does

Doctor Scripto

Summary: Learn how to find out what a Windows PowerShell command does before it does it.  I found a Windows PowerShell command on the Internet that might be what I need, but how can I see what           it does before it messes something up?  You can add the –WhatIf parameter to all Windows PowerShell cmdlets that make changes automatically,            for example: Stop-Process –name MYPROCESS -WhatIf

Predict the Future with PowerShell
Feb 10, 2015
Post comments count 0
Post likes count 0

Predict the Future with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, discusses using Windows PowerShell to see what a command will do before it does it.  Hey, Scripting Guy! My football coach always said, “If you’re scared, admit you’re scared.” Well, Scripting Guy, in honor of my old coach, I am admitting I am scared. I do not know Windows PowerShell, but it seems that so many of the new products from Microsoft use it. It seems that there are some things that I have to use Windows PowerShell for—like I have no option. Maybe there is an option, but I can’t find it. So what do it do? I am afraid I...

PowerTip: Find PowerShell Commands
Feb 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Commands

Doctor Scripto

Summary: Learn how to easily find Windows PowerShell commands.  How can I use Windows PowerShell if I do not know the appropriate command to use or the available options?  In the Windows PowerShell console, type Show-Command. In the dialog box that appears, type what you need—           such as process or service name. The appropriate Windows PowerShell commands appear, and you can select            and run the command you need.

Don’t Learn PowerShell, Use PowerShell
Feb 9, 2015
Post comments count 0
Post likes count 0

Don’t Learn PowerShell, Use PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about getting started with Windows PowerShell.  Hey, Scripting Guy! I get it. I need to learn Windows PowerShell—I see it mentioned everywhere. The problem is that I don’t have five years to learn the stuff. And besides that, by the time that five years has passed, you guys will probably come out with at least two new versions of Windows PowerShell. So if I spend five years trying to learn Windows PowerShell 4.0, by the time I am done learning it, I will still be three or four versions behind. I feel like I can never catch up—like a ha...

PowerTip: Use PowerShell to Display Routing
Feb 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Routing

Doctor Scripto

Summary: Use Windows PowerShell to display networking routing information.  How can I use Windows PowerShell to display information about network connectivity issues related to            the routing table on my server and permit me to sort the output?  Use the Get-NetRoute Windows PowerShell function, and sort by interface index, nexthop, or other properties,            for example: Get-NetRoute | sort ifindex

Weekend Scripter: Use PowerShell to Synchronize Delegated Admin Passwords
Feb 8, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Synchronize Delegated Admin Passwords

Doctor Scripto

Summary: Microsoft PFE and Honorary Scripting Guy, Ian Farr, discusses using Windows PowerShell to synchronize delegated administrator passwords. Microsoft Scripting Guy, Ed Wilson, is here. Guest blogger and Honorary Scripting Guy, Ian Farr, is back with us today for the conclusion of his series about read-only domain controllers (RODCs)... Welcome to the final post in my semi-spontaneous series about managing and securing RODCs. The first post discussed a function that analyses RODC authentication. The function reports on accounts that are authenticated by an RODC that aren’t revealed (that is, the accoun...

PowerTip: Find Network Adapters Not Bound to TCP/IP
Feb 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Network Adapters Not Bound to TCP/IP

Doctor Scripto

Summary: Use Windows PowerShell to find network adapters that are not bound to TCP/IP.  I am troubleshooting a computer that will not connect to the network, and I suspect the protocol bindings.            How can I find network adapters that are not bound to TCP/IP? Use the Get-NetAdapterBinding Windows PowerShell function, filter on a display name of TCP,            and see if the protocol is enabled, for example: Get-NetAdapterBinding -DisplayName *tcp* | where {!($_.enabled)}

Weekend Scripter: Use PowerShell to Delegate Administrator of RODCs
Feb 7, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Delegate Administrator of RODCs

Doctor Scripto

Summary: Microsoft PFE, Ian Farr, discusses using Windows PowerShell to delegate administrator of RODC. Microsoft Scripting Guy, Ed Wilson, is here. Today we have Honorary Scripting Guy and Microsoft PFE, Ian Farr, back for more words of wisdom... Welcome to the third post in a four part series about securing and managing read-only domain controllers (RODCs). I like to think of this collection of posts as "organic"—they only became a series after the green shoots of the first two posts were already well established! The first post discussed a function that analyses RODC authentication. The function reports ...

PowerTip: Use PowerShell to Display Registry Keys
Feb 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Registry Keys

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display registry keys.  How can I use Windows PowerShell to provide a list of registry keys that I can filter, instead of using Regedit to search?  Use the Get-ItemProperty cmdlet and point it to a specific registry hive. The following command looks for            software and Microsoft on the HKLM drive. It uses the psChildName property to display the registry key names. Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\* | select pschildname

PowerTip: Use PowerShell to Install Modules on Your System
Feb 5, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Install Modules on Your System

Doctor Scripto

Summary: Learn how to use Windows PowerShell to install modules on your system.  How can I use Windows PowerShell to roll out a new set of modules that are used extensively in my organization?  When Windows PowerShell 5.0 is available, you can use PowerShellGet against an internal repository            to install your modules.   For systems running Windows PowerShell 4.0 or earlier, create a central repository of modules on a network share   and use a scheduled task to check for updated modules. Then copy any new or updated modules to your system.

Registry Cmdlets: Complete the Registry CDXML Module
Feb 5, 2015
Post comments count 0
Post likes count 0

Registry Cmdlets: Complete the Registry CDXML Module

Doctor Scripto

Summary: Richard Siddaway shows how to complete the registry CDXML module. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the final post in a series. To catch up, read: So far, you’ve seen how to create a CDXML module with a single cmdlet based on the GetStringValue method of the StdRegProv CIM class. In this post, I’ll show you how to add the other methods that are available in the class to create a complete module of easy-to-use cmdlets for working with the registry. I’ll also show you how to work with some of the more aw...

PowerTip: Override Modules in PowerShell Session
Feb 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Override Modules in PowerShell Session

Doctor Scripto

Summary: Learn how to override the modules you have imported into your Windows PowerShell session.  How can I re-load the Windows PowerShell module that I am developing so I can test the changes at each            stage of development?  By default, if you have a module loaded into to your Windows PowerShell session and you attempt to re-load it,            nothing happens because Import-Module discovers it is already loaded. Use the –Force parameter to ensure            that a fresh copy o...

Registry Cmdlets: Advanced CDXML
Feb 4, 2015
Post comments count 0
Post likes count 0

Registry Cmdlets: Advanced CDXML

Doctor Scripto

Summary: Richard Siddaway shows some advanced features in CDXML. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the third post in a series. To catch up, read: Yesterday, you saw that you can create a Windows PowerShell cmdlet from the StdRegProv CIM class by using CDXML, which enables you to read a string value from the registry. Today, I want to show you some of the advanced features of CDXML. These enable you to make your CDXML cmdlet act like any other Windows PowerShell cmdlet. For instance, you can make parameters mandatory and validate t...

PowerTip: Use PowerShell to Find Parameters for CIM Class Method
Feb 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Parameters for CIM Class Method

Doctor Scripto

Summary: Learn how to discover the parameters for a method in a CIM class. How can I find the parameters of a CIM class method, such as GetStringValue in the StdRegprov class? Use Get-CimClass to get the class:$class = Get-CimClass -ClassName StdRegProvTo view the methods:$class.CimClassMethodsTo view the parameters of a particular method:$class.CimClassMethods["GetStringValue"].ParametersYou will see the parameter name and data type. The qualifiers will tell you if it’s an input or output parameter.

Registry Cmdlets: First Steps with CDXML
Feb 3, 2015
Post comments count 0
Post likes count 0

Registry Cmdlets: First Steps with CDXML

Doctor Scripto

Summary: Richard Siddaway shows how to start creating CDXML cmdlets. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the second post in a series. Yesterday, in Registry Cmdlets: Working with the Registry, I explained that there aren’t any cmdlets for working directly with the registry. I showed some examples of using cmdlets that I’ve created to access the registry. The cmdlets are created from the WMI registry class, StdRegProv, by using CDXML. In this post, I’ll show you how to get started with CDXML. Before that, though, I’d...

PowerTip: Use PoweShell to Search for CIM Classes
Feb 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PoweShell to Search for CIM Classes

Doctor Scripto

Summary: Learn how to use Windows PowerShell to search for CIM classes.  How can I use Windows PowerShell to find a CIM class on my machine?  Use Get-WmiObject in List mode. For instance, to find the class for working with the registry, use: Get-WmiObject -Namespace root -Class StdRegProv -List –Recurse      Note If you don’t know where a class can be found, always start at the root. If you want to find the classes for working with disks: Get-WmiObject -Namespace root -Class *disk* -List -Recurse If you know the namespace, you can simplify the search: ...

Registry Cmdlets: Working with the Registry
Feb 2, 2015
Post comments count 1
Post likes count 1

Registry Cmdlets: Working with the Registry

Doctor Scripto

Summary: Richard Siddaway investigates how to use CIM to manage the registry. Honorary Scripting Guy, Richard Siddaway, here filling in for my good friend The Scripting Guy. Today, I'm starting a series about registry cmdlets by investigating how to work with the registry. The bad news is that there aren’t any cmdlets for working with the registry. There’s a Registry provider, which means you can use the Item and ItemProperty cmdlets to manage the local registry—but there aren’t any specific registry cmdlets associated with the provider. The good news is that we can adopt the approach that many teams at Microsoft...

PowerTip: Back up GPOs with PowerShell
Feb 1, 2015
Post comments count 0
Post likes count 0

PowerTip: Back up GPOs with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to back up all GPOs in a domain.  How can I use Windows PowerShell to generate a backup of all Group Policy Objects in a domain?  Use the Backup-GPO cmdlet from the Remote Server Administration Tools (RSAT).            Specify a name, path, domain, and server, for example: Backup-GPO -All -Path \\share\backups -Comment "weekly Backup" -Domain nwtraders.com -Server dc1

Weekend Scripter: Use PowerShell to Troubleshoot Group Policy Part 2
Feb 1, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Troubleshoot Group Policy Part 2

Doctor Scripto

Summary: Guest blogger, Alex Verboon, continues his series about using Windows PowerShell to troubleshoot Group Policy. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Alex Verboon. Today Alex adds to his previous blog about using Windows PowerShell to troubleshoot Group Policy. He provides a script that automates this process. You can read his blog at Anything about IT. Take it away Alex… In my previous post, Use PowerShell to Troubleshoot Group Policy, I shared a script that retrieves the Group Policy processing time. As shown here, when specifying the optional –ShowDetails...

PowerTip: Use PowerShell to Display Network Adapter Power Settings
Jan 31, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Network Adapter Power Settings

Doctor Scripto

Summary: Use Windows PowerShell to display network adapter power settings.  How can I use Windows PowerShell to see if my laptop is going to sleep—it keeps dropping off of the             wireless network.  Use the Get-NetAdapterPowerManagement Windows PowerShell command to display the power            management settings for your network adapter.

PowerShell Spotlight: Three Upcoming Spotlight Events
Jan 31, 2015
Post comments count 0
Post likes count 0

PowerShell Spotlight: Three Upcoming Spotlight Events

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, spotlights three Windows PowerShell events.  Microsoft Scripting Guy, Ed Wilson, is here. I was talking with Teresa (The Scripting Wife) about some ideas she had for sharing information with IT professionals. We came up with the idea for her to write a blog post once a month called PowerShell Spotlight. You can look for it the last Saturday of each month right here until she runs out of useful things to share. Without further ado, here is Microsoft MVP and Honorary Scripting Guy, Teresa Wilson.  Hello everyone, As Ed mentioned, we were talking about the av...

PowerTip: Use PowerShell to Round to Specific Decimal Place
Jan 30, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Round to Specific Decimal Place

Doctor Scripto

Summary: Use Windows PowerShell to round numbers to a specific decimal place.  How can I use Windows PowerShell to round a number to a specific number of decimal places, and            continue to have a number instead of converting it to a string.  Use the Round static method from the System.Math class. By default, it does not display decimal places,            but you can easily change that behavior. The following code illustrates this procedure: PS C:\> $a = 111.2226 PS C:\> [math]::Round($a) 111 PS C:\> [math]::Round($a,2) 111.22 P...

Rounding Numbers—PowerShell Style
Jan 30, 2015
Post comments count 0
Post likes count 0

Rounding Numbers—PowerShell Style

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to round numbers.  Hey, Scripting Guy! I think your series about formatting numbers has been pretty interesting. However, everything you have shown has a major problem—and that is that you convert numbers into strings. I would love to be able to display a Windows PowerShell number with a specific number of decimal places, but not have it be a string. Instead, I want it to be a number type. Can you do this? Or am I stuck with storing numbers and then converting them into strings before I display the results? —GS...

PowerTip: Express Percentage in PowerShell
Jan 29, 2015
Post comments count 0
Post likes count 1

PowerTip: Express Percentage in PowerShell

Doctor Scripto

Summary: Learn an easy method to express a percentage in Windows PowerShell.  How can I use Windows PowerShell to express a two-decimal place percentage? For example, I have multiple            calculations in a Windows PowerShell script, and I am tired of always dividing two numbers, multiplying            by a hundred, and trimming the results to two decimal places.  Use the special “P” format specifier as an overload to the ToString method, for example: PS C:\> (5/21).tostring("P") 23.81 %

Using PowerShell and Standard Number Formats
Jan 29, 2015
Post comments count 0
Post likes count 0

Using PowerShell and Standard Number Formats

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using standard number formats.  Hey, Scripting Guy! I love using Windows PowerShell. I use it for everything. My problem is that it does not do everything automatically. For example, I use the Get-Volume cmdlet a lot to check on disk space, but I need to do a manual calculation to see the percentage of free space. This involves basically writing a script and dividing the numbers, multiplying by a hundred, and then trimming all the excess decimal places. Is there anything you can do to help me? —AV  Hello AV, Microsoft Scripting Guy, Ed Wilso...

PowerTip: Round a Number with PowerShell
Jan 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Round a Number with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to round numbers to a specific decimal place.  How can I use Windows PowerShell to round a number to a specific number of decimal places, and continue to            have a number instead of converting it to a string.  Use the Round static method from the System.Math class. By default, it does not display decimal places, but            you can easily change that behavior. The following code illustrates this procedure: PS C:\> $a = 111.2226 PS C:\> [math]::Round($a) 111 PS C:\> [math]::Round($a,2...

PowerTip: Format Decimal Numbers in PowerShell
Jan 28, 2015
Post comments count 0
Post likes count 0

PowerTip: Format Decimal Numbers in PowerShell

Doctor Scripto

Summary: Learn how to display a specific number of decimal points in Windows PowerShell.  How can I use Windows PowerShell to display only one decimal place on a number that currently has two?  Use a custom number format string with the ToString method from the number, for example: PS C:\> (1.11).tostring("#.#") 1.1

Formatting PowerShell Decimal Places
Jan 28, 2015
Post comments count 2
Post likes count 0

Formatting PowerShell Decimal Places

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using strings to format the display of decimal places in Windows PowerShell.  Hey, Scripting Guy! One of the things I have a problem with is when I get numbers that have a lot of decimal places. I mean, how do I really get rid of them—at least properly? I have done things like convert them to integers, but that loses me all of the decimal places. I have also tried using Trim or other string techniques with mixed success. I would love to see how a real pro does it. Can you help me? —PA  Hello PA, Microsoft Scripting Guy, Ed Wilson, is h...

PowerTip: Use Parentheses to Override Operator Precedence
Jan 27, 2015
Post comments count 0
Post likes count 0

PowerTip: Use Parentheses to Override Operator Precedence

Doctor Scripto

Summary: Use parentheses to override operator precedence in Windows PowerShell.  How can I ensure that a math expression that keeps returning incorrect information will work properly in            Windows PowerShell?                                                 In Windows PowerShell (as in other languages), math operators have a precedence....

Working with Fixed Number Sizes in PowerShell
Jan 27, 2015
Post comments count 0
Post likes count 0

Working with Fixed Number Sizes in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about working with fixed number sizes in Windows PowerShell.  Hey, Scripting Guy! I have a script that returns a specific type of number, so I added a type constraint on the variable that holds the number. The problem is that sometimes when I run the script, I get errors. I cannot figure this out. Can you help me? —BG  Hello BG, Microsoft Scripting Guy, Ed Wilson, is here. We have not had any snow this year here in Charlotte, North Carolina. This is good news, and of course, bad news. The good news is that because the city is rarely prepared for s...

PowerTip: Round Number Up or Down with PowerShell
Jan 26, 2015
Post comments count 0
Post likes count 0

PowerTip: Round Number Up or Down with PowerShell

Doctor Scripto

Summary: Easily use Windows PowerShell to round a number up or down.    I want only a whole number returned, so I want the number rounded up or down as appropriate.            How can I do this with Windows PowerShell?  Cast the number as an integer, and Windows PowerShell will round the number up or down            as appropriate, for example: PS C:\> [int]22.4 22 PS C:\> [int]22.5 22 PS C:\> [int]22.6 23

Understanding Numbers in PowerShell
Jan 26, 2015
Post comments count 0
Post likes count 1

Understanding Numbers in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about numbers in Windows PowerShell.  Hey, Scripting Guy! One of the things that is frustrating to me with Windows PowerShell is the way that it handles numbers. For example, I want to know the percent of processor utilization for something, and it displays a number that is like fifty million numbers long. What is up with that? Why can’t Windows PowerShell just tell me something useful? —SP  Hello SP, Microsoft Scripting Guy, Ed Wilson, is here. Today it is cold and raining outside. I decided to make a cup of red berry tea. It does not have ...

PowerTip: Windows PowerShell Survival Guide
Jan 25, 2015
Post comments count 0
Post likes count 0

PowerTip: Windows PowerShell Survival Guide

Doctor Scripto

Summary: Find the Windows PowerShell Survival Guide.   Where can I find a community-based resource that links to all the essentials?  Check out the Windows PowerShell Survival Guide on the TechNet Wiki. It contains links to dozens of            Windows PowerShell resources.

2014 Honorary Scripting Guys Announced
Jan 25, 2015
Post comments count 0
Post likes count 0

2014 Honorary Scripting Guys Announced

Doctor Scripto

Summary: The Honorary Scripting Guys for 2014 are announced. Microsoft Scripting Guy, Ed Wilson, is here. I have been pretty busy, with missing work because of my ear surgery and the holidays and all, so I enlisted the help of the Scripting Wife, Teresa, to write the latest Honorary Scripting Guys post. I gave her the names and she did the rest. So here's Teresa... Hello everyone, You know that I do not try to hide things about myself nor do I try to embellish my qualities—I am what I am. I have strong points and weak points. Writing is not one of my strong points and repetition is one of the most usel...

PowerTip: View PowerShell Help Online
Jan 24, 2015
Post comments count 0
Post likes count 0

PowerTip: View PowerShell Help Online

Doctor Scripto

Summary: View Windows PowerShell cmdlet Help online.            How can I view Windows PowerShell Help in my web browser?  The –Online parameter with the Get-Help cmdlet opens the latest online Windows PowerShell Help             in your web browser, for example: Get-Help Get-Command -Online

Weekend Scripter: The Changing Nature of Documentation
Jan 24, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: The Changing Nature of Documentation

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the changing nature of documentation. Microsoft Scripting Guy, Ed Wilson, is here. This week, we announced Microsoft HoloLens during the Windows 10: The Next Chapter webcast. I mean, I want one—badly. This is going to be an incredible year. The excitement of holographic computing has me thinking about Star Trek. Of course last year, we introduced a holodeck—so the future is now, so to speak. But then I was thinking, "Does one ship a stack of books along with the HoloLens?" It doesn’t make sense, I suppose. Back when we shipped Wi...

PowerTip: Pipe String to Get-Date
Jan 23, 2015
Post comments count 0
Post likes count 0

PowerTip: Pipe String to Get-Date

Doctor Scripto

Summary: Pipe a string to the Windows PowerShell Get-Date cmdlet to convert it to a DateTime object.  How can I use Windows PowerShell to convert a date that is in a string format to a DateTime object?  Create a pipeline, for example: "11/14/2015" | get-date 

Create Custom Date Formats with PowerShell
Jan 23, 2015
Post comments count 0
Post likes count 0

Create Custom Date Formats with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating custom date formats with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about working with Windows PowerShell is that it is highly configurable. In short, if there is something that I do not like, I can change it. Most of the time, that change is relatively simple to make. So when working with dates and times, there are lots of standardized ways of displaying the information.             Note  Also see Formatting Date Strings with PowerShell. But i...

PowerTip: Use PowerShell to Display date Format for Specific Culture
Jan 22, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display date Format for Specific Culture

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display date formatting for a specific culture.  How can I use Windows PowerShell to see the short date pattern for a specific culture without            changing my UI culture settings?  Use the CultureInfo class from System.Globalization, call the GetCultureInfo static method            while passing a culture number, and choose the ShortDatePattern property from the DateTime            format object, for example: [S...

Formatting Date Strings with PowerShell
Jan 22, 2015
Post comments count 2
Post likes count 0

Formatting Date Strings with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about formatting date strings with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. It seems that different ways to display dates and times are in great supply. In fact, there are dozens of ways to do this. If I decide that I do not like the way a date or time displays, I can change it. In addition, the way a particular date style displays in one country is different than the way it displays in another country. These differences are part of the culture settings. For example, the output from the Get-Date cmdlet appears differently depending on the ...

PowerTip: Use PowerShell to Display Format for Short Date
Jan 21, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Format for Short Date

Doctor Scripto

Summary: Use Windows PowerShell to display the culture-specific format for a short date.  How can I use Windows PowerShell to display the format of a short date that is specific to the culture settings            of my system?  Use the Get-Culture cmdlet and select the DateTimeFormat and ShortDatePattern properties: (Get-Culture).DateTimeFormat.ShortDatePattern

Adding and Subtracting Dates with PowerShell
Jan 21, 2015
Post comments count 1
Post likes count 1

Adding and Subtracting Dates with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about adding and subtracting dates with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I really like about Windows PowerShell is the way it simplifies adding and subtracting from dates. For example, if I want to find users who haven’t logged in to the domain for 120 days, I need to be able to create a date that was 120 days ago. Then I need to get the date of their last log-in, and see if that date is more recent than 120 days ago. I may need to do the same thing with the last time that files were accessed or to examine t...

PowerTip: Use PowerShell to Find Day of Week
Jan 20, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Day of Week

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find the day of the week.  How can I use Windows PowerShell to find which day of the week a specific date will occur?  Use the Get-Date cmdlet, and specify day, month, and year parameters, for example: Get-Date -Month 2 -Day 14 -Year 2015

Use PowerShell to Work with Individual Dates
Jan 20, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Work with Individual Dates

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to work with dates. Microsoft Scripting Guy, Ed Wilson, is here. I don’t know about you, but one thing about my life as the Scripting Guy is that it keeps me busy. "Keeping busy" is a slang expression that means, "Dude, you are swamped." The Scripting Wife and I just spent most of last week planning events for the remainder of 2015. Yep, my year is pretty well planned out. Not because I love being super organized. In fact, my default behavior is rather the opposite—I prefer a more natural, organic schedule. But the only ...

PowerTip: Use PowerShell to Show Time
Jan 19, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show Time

Doctor Scripto

Summary: Use Windows PowerShell to show the current time.  How can I use Windows PowerShell to easily display only the current time?  Use the Get-Date cmdlet and choose the Time display hint: Get-Date -DisplayHint Time

Working with Dates in PowerShell
Jan 19, 2015
Post comments count 0
Post likes count 0

Working with Dates in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the fundamentals of working with dates in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. For as long as I can remember, I have pretty much always hated working with dates and times. Back on my Osborne One, it was no fun. The Atari did not make it any better; neither did my first IBM-compatible PCs. But you know, I am probably not the only one who dislikes working with dates and times—that must be one reasons there are so many ways of formatting the silly things. I mean, there must be nearly a hundred different ways (I am not exaggera...

PowerTip: Test Connection to Remote Server
Jan 18, 2015
Post comments count 0
Post likes count 0

PowerTip: Test Connection to Remote Server

Doctor Scripto

Summary: Use Windows PowerShell to test the connection to a remote server.  How can I test the connection in my server to see if I can run a remote Windows PowerShell command?  Use the Test-WsMan cmdlet, for example: Test-WsMan –computername s1

Weekend Scripter: Use PowerShell to Remotely Create Scheduled Task and Folder
Jan 18, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Remotely Create Scheduled Task and Folder

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to remotely create a scheduled task and folder. Microsoft Scripting Guy, Ed Wilson, is here. On Friday in Use PowerShell to Create Scheduled Task in New Folder, I created a pretty long Windows PowerShell script that creates a folder for scheduled tasks, and creates, enables, and configures a scheduled task. Over the weekend, I received several emails to scripter@microsoft.com that said basically, “That is all good, but I need to create the same scheduled task on a hundred servers. I cannot run around to run this script on all ...

PowerTip: Create XML Representation of Scheduled Task
Jan 17, 2015
Post comments count 0
Post likes count 0

PowerTip: Create XML Representation of Scheduled Task

Doctor Scripto

Summary: Learn how to export a scheduled task to XML by using Windows PowerShell.  How can I use Windows PowerShell to create an XML representation of a scheduled task?  Use the Get-ScheduledTask function and pipe the results to the Export-ScheduledTask function,            for example: Get-ScheduledTask applog | Export-ScheduledTask

Weekend Scripter: Use PowerShell to Document Scheduled Tasks
Jan 17, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Document Scheduled Tasks

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to document scheduled tasks. Microsoft Scripting Guy, Ed Wilson, is here. One of the really cool things about Windows PowerShell is the way that it builds on itself. When I learn a little bit about Windows PowerShell, I can apply those principles to accomplish other things. It does not matter what I am working with, Windows PowerShell works the same. Today, I have a great example. I have seen several comments, and even received a few emails to scripter@microsoft.com asking about documenting scheduled tasks. People generally want to ...

PowerTip: Use PowerShell to Delete Scheduled Task
Jan 16, 2015
Post comments count 3
Post likes count 0

PowerTip: Use PowerShell to Delete Scheduled Task

Doctor Scripto

Summary: Use Windows PowerShell to delete a scheduled task.  How can I use Windows PowerShell to delete a scheduled task?  Use the Unregister-ScheduledTask function. By default, this command will prompt for confirmation. Therefore,            if you want to use a Windows PowerShell script to remotely delete the scheduled task, you will need to supply            confirmation in the command. Here is an example: Unregister-ScheduledTask -TaskName applog -Confirm:$false Note  This command was introduced in Windows 8 and Windows ...

Use PowerShell to Create Scheduled Task in New Folder
Jan 16, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Scheduled Task in New Folder

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create a new scheduled task in a specific folder. Microsoft Scripting Guy, Ed Wilson, is here. Today I want to combine several of the scripts I have discussed this week based on scheduled tasks. Specifically, I am going to do the following: To do this, I am going to combine the various pieces of script I have used this week. To make the script a bit easier to read, I am putting the script into functions. These are not advanced functions, and they do not have good function names. The value of today’s exercise is to sho...

PowerTip: Use PowerShell to Enable Scheduled Task
Jan 15, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Enable Scheduled Task

Doctor Scripto

Summary: Use Windows PowerShell to enable a scheduled task.  How can I use Windows PowerShell to enable a scheduled task?  Use the Enable-ScheduledTask function from the Scheduled Task module, for example: Enable-ScheduledTask -TaskName applog Note  This command uses the Scheduled Task module (which was introduced in Windows 8 and Windows Server 2012), and it requires admin rights.

Use PowerShell to Create Scheduled Tasks Folders
Jan 15, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Scheduled Tasks Folders

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create a folder for scheduled tasks. Microsoft Scripting Guy, Ed Wilson, is here. Today I have several meetings, and I am really looking forward to them. One of my meetings is with the Windows PowerShell team. I have a meeting with them every other week, and it is always a lot of fun. They are great people! My other meeting is with the team working with the Microsoft Ignite Conference in Chicago. That is probably all I can say right now. But suffice it to say, that I get to attend fun and exciting meetings. That is why I, as oppo...

PowerTip: Use PowerShell to Disable Scheduled Task
Jan 14, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Disable Scheduled Task

Doctor Scripto

Summary: Learn how to use Windows PowerShell to disable a scheduled task.  How can I use Windows PowerShell to disable a scheduled task?  Use the Disable-ScheduledTask cmdlet from the Scheduled Task module, for example: Disable-ScheduledTask -TaskName applog Note  This cmdlet was introduced in Windows 8 and Windows Server 2012, and it requires admin rights.

Use PowerShell to Configure Scheduled Task
Jan 14, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Configure Scheduled Task

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to configure a scheduled task. Microsoft Scripting Guy, Ed Wilson, is here. This morning is a coffee morning. I don’t have a lot of coffee mornings, but occasionally I break down and desire a raw coffee jolt. When I do, I use my French press, some spring water, my rotary bean grinder, and usually some sort of special beans. Usually, that translates into a nice Kona bean. It seems to take me nearly a half hour to make a decent cup of coffee. Luckily, I can almost do it in my sleep—which is a good thing. Because I do not m...

PowerTip: Find Scheduled Tasks with PowerShell
Jan 13, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Scheduled Tasks with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find the location of scheduled tasks.  How can I use Windows PowerShell to easily look for scheduled tasks in the graphical tool?  Use the Get-ScheduledTask cmdlet and search on the TaskPath property. Related scheduled tasks are            grouped together and TaskPath provides that location. Here is an example: Get-ScheduledTask | where taskpath -match 'powershell'

Use PowerShell to Create Scheduled Tasks
Jan 13, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Create Scheduled Tasks

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create a scheduled task. Microsoft Scripting Guy, Ed Wilson, is here. Today, it is cold, wet, and rainy—not exactly my favorite combination. In fact, I would rather have snow. At least then there would be an excuse for the dreariness. Oh well. Snow in the deep south is about as rare as—well...as rare as people who enjoy manually creating scheduled tasks. Dude, creating scheduled tasks is boring. Not only that, it is easy to make a mistake. And when I am done creating a scheduled task, I am not really sure what it is g...

PowerTip: Use PowerShell to Show "Ready" Scheduled Tasks
Jan 12, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show "Ready" Scheduled Tasks

Doctor Scripto

Summary: Use Windows PowerShell to show all scheduled tasks that are ready to run.  How can I use Windows PowerShell to find what scheduled tasks are ready to run on my system?  Use the Get-ScheduledTask cmdlet, pipe the results to the Where-Object cmdlet, and            filter on the state being ready, for example: Get-ScheduledTask | where state -EQ 'ready'

Use PowerShell to Show Results of Scheduled Tasks
Jan 12, 2015
Post comments count 0
Post likes count 0

Use PowerShell to Show Results of Scheduled Tasks

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to see the results of scheduled tasks. Microsoft Scripting Guy, Ed Wilson, is here. It is snack time. For me, a perfect snack is a piece of biscotti and a cup of tea. Today, I am having such a snack—the tea is a nice green tea with a bit of jasmine flower in it. Lovely. Something else that is lovely is using the cmdlets from Scheduled Tasks module. This module contains a number of very helpful cmdlets. Note  For a great overview of the Scheduled Tasks module, see Windows 8.1 and the Land of Forgotten Modules: Part 5....

PowerTip: Use PowerShell to Find Status of Scheduled Tasks
Jan 11, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Status of Scheduled Tasks

Doctor Scripto

Summary: Use Windows PowerShell to find the status of scheduled tasks.  My laptop is acting strangely. Task Manager shows lots of processes running, but I have disabled everything I can see.            How can I use Windows PowerShell to determine what scheduled tasks are running in the background?  Use the Get-ScheduledTask cmdlet and sort by the state: Get-ScheduledTask | sort state

PowerTip: Use PowerShell to Unblock Files in Folder
Jan 10, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Unblock Files in Folder

Doctor Scripto

Summary: Learn how to use Windows PowerShell to unblock files downloaded from the Internet.  I downloaded a module from the Script Center Repository, and when I expanded and copied the files to            my modules folder, I forgot to unblock them. Now every time I start Windows PowerShell, I get error            messages and the modules don’t work. How can I easily fix this situation?  Use the Get-ChildItem cmdlet to return a list of all files in your modules directory, and pipe them to            the Unblo...

PowerTip: Find Restore Points with PowerShell
Jan 9, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Restore Points with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find restore points.  How can I use Windows PowerShell to find a list of restore points on my computers running            Windows 8.1 or Windows 8?  Use the Get-ComputerRestorePoint cmdlet. Notes 

PowerTip: Find Related PowerShell Commands
Jan 8, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Related PowerShell Commands

Doctor Scripto

Summary: Learn how to find related Windows PowerShell commands.  How can I find related commands in Windows PowerShell?  Use the Get-Command cmdlet and sort by the ModuleName property.            For example, to find commands that use the Get verb, use the following command: Get-Command –Verb get | Sort modulename

PowerTip: Find Time Zone Names with PowerShell
Jan 7, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Time Zone Names with PowerShell

Doctor Scripto

Summary: Find time zone enumeration names with Windows PowerShell.  How can I use Windows PowerShell to enumerate the names of time zones that are configured on my computer?  Use the System.TimeZoneInfo .NET Framework class, and use the GetSystemTimeZones static method            to obtain the list. You want the ID property for enumeration values and the DisplayName property to see            the standard display name values. Here is an example: [timezoneinfo]::GetSystemTimeZones() | select displayname, id

PowerTip: Use PowerShell to Get All Computer Names
Jan 6, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get All Computer Names

Doctor Scripto

Summary: Use Windows PowerShell to easily retrieve a list of all computer names on the network.  How can I use Windows PowerShell to obtain a list of all the servers on the network so I can run a            script against them without typing a bunch of names?  Use the Get-ADComputer cmdlet from the Active Directory module            (available via the Remote Server Administration Tools), for example: (Get-ADComputer -Filter *).name

PowerTip: List Folders Containing PowerShell Modules
Jan 5, 2015
Post comments count 0
Post likes count 0

PowerTip: List Folders Containing PowerShell Modules

Doctor Scripto

Summary: Learn how to list all folders that contain Windows PowerShell modules.  How can I see a list of all folders that contain Windows PowerShell modules?  Use the PSModulePath environmental variable, and split it to form paths to the modules. Then use the            Get-ChildItem cmdlet (dir is an alias) and specify only directories while using a wildcard character for a filter.            Here is an example: Dir ($env:PSModulePath -split ";") -Filter * -directory

PowerTip: Find Tickets to PowerShell Summit
Jan 4, 2015
Post comments count 0
Post likes count 0

PowerTip: Find Tickets to PowerShell Summit

Doctor Scripto

Summary: Learn how to get tickets to PowerShell Summit 2015.  I tried to get a ticket to the Windows PowerShell Summit 2015 in in Charlotte, North Carolina,             but it was sold out. How can I find a ticket?  Additional tickets will be made available on a first come, first served basis via PowerShell.org on January 11.             Be ready, though, because these seats will go fast. Here is the link: PowerShell Summit N.A. 2015 – Additional Capacity

Weekend Scripter: The Best Ways to Learn PowerShell
Jan 4, 2015
Post comments count 0
Post likes count 1

Weekend Scripter: The Best Ways to Learn PowerShell

Doctor Scripto

Summary:  PowerShell MVP, Teresa Wilson, talks about the best ways to learn Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post by Windows PowerShell MVP, Teresa Wilson, aka The Scripting Wife. I asked her to talk a little bit about how one goes about learning Windows PowerShell. Take it away, Scripting Wife… Hello everyone, Teresa Wilson here. From time-to-time, whether at TechEd, at a user group meeting, or even online, people ask me how to go about learning Windows PowerShell. In general, my answer it the same. So here goes… Everyone learns in a differ...

PowerTip: Use PowerShell to Get DVD Drive Attached to Virtual Machine
Jan 3, 2015
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get DVD Drive Attached to Virtual Machine

Doctor Scripto

Summary: Use Windows PowerShell to get information about the DVD drive attached to a virtual machine.  How can I use Windows PowerShell to find information about a DVD drive that is attached to             a running virtual machine?  Use the Get-VMDVDDrive cmdlet, for example: Get-VMDvdDrive –VMName VM1

Weekend Scripter: Why Should I Learn PowerShell?
Jan 2, 2015
Post comments count 0
Post likes count 0

Weekend Scripter: Why Should I Learn PowerShell?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about why you should learn Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. The other day, I ran into an IT pro at the mall. He recognized me and started talking to me. It was like, dude, I was trapped. It turned out that he was cool, and yapping with him was much more fun than walking around a boring mall. Although, this particular mall happens to have a Microsoft Store in it (which incidentally is why the Scripting Wife and I made the trek downtown). Hmm, come to think of it, that might also be why there happened to be an IT pro hanging around. ...

PowerTip: Open PowerShell ISE and a Script
Jan 2, 2015
Post comments count 0
Post likes count 0

PowerTip: Open PowerShell ISE and a Script

Doctor Scripto

Summary: Learn how to open the Windows PowerShell ISE and a script at the same time.  How can I open a specific script and the Windows PowerShell ISE at the same time?  Use the Windows PowerShell_ISE command from the Windows PowerShell console,             a command prompt or the Start/Run command. Specify the –File option and supply             one or more scripts to the command. The following command opens two scripts, Bios.ps1             and Bogus.ps1 from the current directory: PowerShell_ISE &...

What Is PowerShell?
Jan 2, 2015
Post comments count 0
Post likes count 0

What Is PowerShell?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, explains Windows PowerShell.  Hey, Scripting Guy! I keep hearing this term...all over...everywhere. But I do not know what it is. Can you tell me, "What is Windows PowerShell?" —DB  Hello DB, Microsoft Scripting Guy, Ed Wilson, is here. This morning it is cold. At least, it is Charlotte, North Carolina—it is nearly freezing. That is enough to keep me inside with a nice cup of English Breakfast tea, and a freshly made Blueberry Scone. I decided to check the email sent to scripter@microsoft.com on my Surface Pro 3. Today is one of tho...

PowerShell Predictions for 2015
Jan 1, 2015
Post comments count 0
Post likes count 0

PowerShell Predictions for 2015

Doctor Scripto

Summary: Windows PowerShell MVP, Don Jones, provides predictions for 2015. Don Jones here. from PowerShell.org and Pluralsight. The Scripting Guy asked me to have another stab at predicting what’s in store for Windows PowerShell in 2015, so without further ado… Folks will realize how fast Windows is moving We’re going to see a lot of people asking, “I installed Windows PowerShell 5.0, but I don’t have (insert name of feature). What’s wrong?” Their problem will be that they’re running on an older version of Windows that doesn’t include that feature—...

PowerTip: What Should You Learn in 2015?
Dec 31, 2014
Post comments count 0
Post likes count 0

PowerTip: What Should You Learn in 2015?

Doctor Scripto

Summary: Windows PowerShell MVP, Richard Siddaway, makes a recommendation for 2015.  What Windows PowerShell topic should I learn in 2015?  Desired State Configuration (DSC). Note  Today's PowerTip was supplied by Windows PowerShell MVP, Richard Siddaway.

2014: A PowerShell Year in Perspective
Dec 31, 2014
Post comments count 0
Post likes count 0

2014: A PowerShell Year in Perspective

Doctor Scripto

Summary: Richard Siddaway discusses the growth of Windows PowerShell in 2014. Microsoft Scripting Guy, Ed Wilson, is here. Today, Honorary Scripting Guy and Windows PowerShell MVP, Richard Siddaway looks at the world of Windows PowerShell in 2014... The Scripting Guy asked me if I’d like to review 2014 from a Windows PowerShell perspective. This is a look at the changes in Windows PowerShell and the Windows PowerShell community over the last 12 months. If I don’t mention a particular activity that you were involved with, I apologize—but in reality, the Windows PowerShell community is so huge and...

PowerTip: Resources for Learning PowerShell
Dec 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Resources for Learning PowerShell

Doctor Scripto

Summary: Learn about resources to help you learn about Windows PowerShell.  What do you recommend for online resources to learn about Windows PowerShell and find answers and help for script issues.  The Script Center is the landing page to start. From there, you can go to the Script Center Repository,            the Hey, Scripting Guy! Blog, and the Official Scripting Guys Forum. There is also a tab on that page            for Learn. This will take you to some webcasts that the Scripting Guy (Ed Wilson) made to hel...

Top Hey, Scripting Guy! Blog Posts for 2014
Dec 30, 2014
Post comments count 0
Post likes count 0

Top Hey, Scripting Guy! Blog Posts for 2014

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about the top Hey, Scripting Guy! Blog posts for 2014. Microsoft Scripting Guy, Ed Wilson, is here. Today we feature Honorary Scripting Guy and Windows PowerShell MVP, Teresa Wilson, aka The Scripting Wife. Hello everyone, I did a little research and came up with the top five Hey, Scripting Guy! Blog posts for 2014 (based on number of views). The results are sort of interesting. The top post is a basic article dealing with files and folders. The second most popular post talks about network adapters. The third is another basic article about looping, and the las...

PowerTip: Find PowerShell User Groups
Dec 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell User Groups

Doctor Scripto

Summary: Learn how to easily find Windows PowerShell user groups.  Where can I find information about which cities have Windows PowerShell user groups?  There are two locations: Also feel free to contact me directly at ScriptingWife@hotmail.com. Sometimes I know of cities with people who would like to meet-up for an informal chat about Windows PowerShell. Note  This tip was supplied by Windows PowerShell MVP, Teresa Wilson.

Top PowerShell Scripts of 2014
Dec 29, 2014
Post comments count 0
Post likes count 0

Top PowerShell Scripts of 2014

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about the top Windows PowerShell scripts of 2014 in the Script Center Script Repository. Microsoft Scripting Guy, Ed Wilson, is here. Windows PowerShell MVP, Teresa Wilson, also known as "The Scripting Wife" is here today to tell us the five most popular scripts that were downloaded from the Script Center Repository in 2014. Take it away Teresa... Hello all. I have gathered some stats for you. Here are the top five most popular scripts that were downloaded from the Script Center Repository in 2014: 1. File System Security PowerShell Module 3.2.2 by Raimun...

Weekend Scripter: Playing with PowerShell Prompt
Dec 28, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Playing with PowerShell Prompt

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about playing with the Windows PowerShell prompt. Microsoft Scripting Guy, Ed Wilson, is here. It is time to round up all of those end-of-the-year kinds of things. This is, in fact, the last weekend Hey, Scripting Guy! Blog post of 2014. Not sure what that means; but it is true, this is the last weekend post of the year. Not that I am going to do anything special, or make a big deal of it, but I just was thinking about it. One thing I like to do from time-to-time, is override my Windows PowerShell prompt. The cool thing is that I can do it on the fly. This is bec...

PowerTip: Explore PowerShell Help
Dec 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Explore PowerShell Help

Doctor Scripto

Summary: Use Out-GridView to easily explore Windows PowerShell Help.  How can I easily explore Windows PowerShell cmdlets and then see the cmdlet Help from them?  Use the Get-Command cmdlet, pipe the output to Out-GridView with the -Wait parameter,            and then pipe the results to Get-Help with the –Full parameter.            This example finds all cmdlets that begin with the verb Set: Get-Command -Verb set | Out-GridView -PassThru | get-help -Full Note  For...

PowerTip: Round Numbers with PowerShell
Dec 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Round Numbers with PowerShell

Doctor Scripto

Summary: Easily use Windows PowerShell to round numbers.  How can I use Windows PowerShell to easily round numbers?  Use the Round static method from the System.Math class, for example: PS C:\> 22/7 3.14285714285714 PS C:\> [math]::Round(22/7) 3 PS C:\> 

Weekend Scripter: Exploring IP Address Functions
Dec 27, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Exploring IP Address Functions

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell with TCP/IP. Microsoft Scripting Guy, Ed Wilson, is here. This morning, I decided to make a cup of orange spice tea. I did not even do it manually. I used a tea bag. I know, I know, I know. But hey, sometimes I like the convenience of opening a tea bag and filling the cup with hot water. Boom! I am done. This is especially true when I have a good bag of tea—not some of the cheaper tea that one might purchase at a big-box discount store that sells everything from car batteries to peanut butter. Indeed, over the years, I have fo...

PowerTrivia: Scripting Guys Holiday Special Trivia #7
Dec 26, 2014
Post comments count 0
Post likes count 0

PowerTrivia: Scripting Guys Holiday Special Trivia #7

Doctor Scripto

Summary: Remember the name of the first holiday tune on the Hey, Scripting Guy! Blog?  What was the very first holiday tune done on the Hey, Scripting Guy! Blog?            You'll find the answer at the bottom of this post...     And here is the answer for the PowerTrivia #6 question:  What is the title of the fourth Scripting Guys holiday special, which seemed to last an incredibly long night? ‘Twas the Night of Before Scripting The answer to today's question is:  Theme from A PowerShell Carol – Mr. Script  Remember to listen to th...

Oliver Script: A Holiday Tale–Part 7
Dec 26, 2014
Post comments count 0
Post likes count 0

Oliver Script: A Holiday Tale–Part 7

Doctor Scripto

Summary: The future shapes up for Oliver, and he plays with a new string feature in Windows PowerShell.    Note This is the final post in a series. To catch up, read: When we left Oliver, he was experiencing some health issues, but after several weeks of rest, he was ready to get back to work. It turned out that his illness would always be with him, but it was controllable. No more triple sugar-triple caffeine coffees for him! He was happy to be back working with technology again. He was working on a few new projects when a co-worker came up to him with a problem. Charley had been tasked with sp...

PowerTrivia: Scripting Guys Holiday Special Trivia #6
Dec 25, 2014
Post comments count 0
Post likes count 0

PowerTrivia: Scripting Guys Holiday Special Trivia #6

Doctor Scripto

Summary: Simmer your minds with thoughts of past Scripting Guys holiday specials.  What is the title of the fourth Scripting Guys holiday special, which seemed to last an incredibly long night?  Think you know the answer? Verify by looking at this surprise post...or stay tuned.            The answer will be posted in tomorrow's PowerTrivia! And here is the answer for the PowerTrivia #5 question:  What was the name of the song written for the second Scripting Guys holiday special that           suspiciously sounded like gerbils singing...

Oliver Script: A Holiday Tale–Part 6
Dec 25, 2014
Post comments count 0
Post likes count 0

Oliver Script: A Holiday Tale–Part 6

Doctor Scripto

Summary: Oliver manages Azure and Office 365 with Windows PowerShell and discovers how to store credentials securely.    Note This is the sixth post in a series. To catch up, read: When we last left Oliver, he was heading out to begin his new job for a Microsoft Gold Partner in a wintery hell. All he could remember after arriving in his new home was that he had never seen so much snow in his entire life. A simple four hour drive turned into a twenty hour crawl through a blizzard. He could see trucks flipped over everywhere along the side of the road. He also neglected to take care of some small, ...

PowerTrivia: Scripting Guys Holiday Special Trivia #5
Dec 24, 2014
Post comments count 0
Post likes count 0

PowerTrivia: Scripting Guys Holiday Special Trivia #5

Doctor Scripto

Summary: Remember this silly song from the second Scripting Guys holiday special?  What was the name of the song written for the second Scripting Guys holiday special that suspiciously            sounded like gerbils singing?  Think you know the answer? Verify by listening to this little parody...or stay tuned.            The answer will be posted in tomorrow's PowerTrivia! And here is the answer for the PowerTrivia #4 question:  Who were the two main characters in the third Scripting Guys holiday special, It’s a Wonde...

Oliver Script: A Holiday Tale–Part 5
Dec 24, 2014
Post comments count 0
Post likes count 0

Oliver Script: A Holiday Tale–Part 5

Doctor Scripto

Summary: Oliver joins an enterprise environment and introduces Windows PowerShell to DevOps.    Note This is the fifth post in a series. To catch up, read: It is Oliver's first day in an enterprise-class environment…a day full of excitement, and…co-op students? Only moments after walking in, he found himself surround by a batch a young interns asking which machine they should reimage next. “Who sent you to me? This is my first day.” “Fagin.” One of the youngest ones (probably not even in grade 10) piped up. “We’re Fagin’s interns. We spe...

PowerTrivia: Scripting Guys Holiday Special Trivia #4
Dec 23, 2014
Post comments count 0
Post likes count 0

PowerTrivia: Scripting Guys Holiday Special Trivia #4

Doctor Scripto

Summary: Remember those wonderful people from the third Scripting Guys holiday special?  Who were the two main characters in the third Scripting Guys holiday special, It’s a Wonderful Shell?  Think you know the answer? Verify by reading It’s a Wonderful Shell—Chapter 1           ...or stay tuned. The answer will be posted in tomorrow's PowerTrivia! And here is the answer for the PowerTrivia #3 question:  Who were the characters who handled the IT infrastructure in the second Hey, Scripting          Guys holiday ...

Oliver Script: A Holiday Tale–Part 4
Dec 23, 2014
Post comments count 0
Post likes count 0

Oliver Script: A Holiday Tale–Part 4

Doctor Scripto

Summary: Oliver’s true challenges begin and he discovers built-in Windows PowerShell scripts. Note This is the fourth post in a series. To catch up, read: If you will remember, our friend had taken on a new and terrifyingly amazing challenge. He was about to take on the venture of starting a new company from the ground up with a good friend. For everyone else, this could be considered “flying over a canyon full of crocodiles without a safety net, and armed with only a propeller.” On your worst days, you think you may be eaten alive—on your best days, you're inches from being eate...

PowerTrivia: Scripting Guys Holiday Special Trivia #3
Dec 22, 2014
Post comments count 0
Post likes count 0

PowerTrivia: Scripting Guys Holiday Special Trivia #3

Doctor Scripto

Summary: Remember the characters from previous Hey, Scripting Guys! holiday specials?  Who were the characters who handled the IT infrastructure in the second Scripting Guys holiday            special, How Mr. Finch Learned Scripting?  Think you know the answer? Verify by reading Use PowerShell to Find and Unlock Users in Active Directory           ...or stay tuned. The answer will be posted in tomorrow's PowerTrivia! And here is the answer for the PowerTrivia #2 question: From the third Scripting Guys! holiday special, can you n...

Oliver Script: A Holiday Tale–Part 3
Dec 22, 2014
Post comments count 0
Post likes count 0

Oliver Script: A Holiday Tale–Part 3

Doctor Scripto

Summary: Oliver finishes computer school, gets his first real job, and uses Windows PowerShell remoting. Note This is the third post in a series. To catch up, read: It is the beginning of a new day for Oliver: computer school! Learning actual higher-end technology. Oliver was about to fall over as he walked into the institute. He could actually smell the ozone of the technology burning in the air. As it turns out, it was actually a power cord burning behind a terminal. Oliver quickly reported the incident to his instructor, Mr. Beadle, who quickly dispatched Oliver with a roll of electrical tape to repair the...

PowerTrivia: Scripting Guys Holiday Special Trivia #2
Dec 21, 2014
Post comments count 0
Post likes count 0

PowerTrivia: Scripting Guys Holiday Special Trivia #2

Doctor Scripto

Summary: Remember a holiday tune that entertained us?  From the third Scripting Guys! holiday special, can you name the theme song            that was sung most horribly off-key by a certain unnamed Windows PowerShell MVP?  Think you know the answer? Verify by watching this surprise video...or stay tuned.            The answer will be posted in tomorrow's PowerTrivia!   And here is the answer for the PowerTrivia #1 question:     In the very first Scripting Guys holiday special, A PowerShell Carol, who was the ...

Oliver Script: A Holiday Tale–Part 2
Dec 21, 2014
Post comments count 0
Post likes count 0

Oliver Script: A Holiday Tale–Part 2

Doctor Scripto

Summary: Oliver discovers how to easily find data with Windows PowerShell. Note  This is the second post in a series. To get started, read Oliver Script: A Holiday Tale–Part 1. “Would you like fries with that?” How Oliver hated uttering those words daily. He hated going home, smelling of rancid grease and old soda pop. But he found contentment because it did pay the bills and he was grateful to have work when so many others didn’t. He also got an occasional free lunch—even though it was food expired from the heat chute at the restaurant. But food is food, and the small bles...

PowerTrivia: Scripting Guys Holiday Special Trivia #1
Dec 20, 2014
Post comments count 0
Post likes count 0

PowerTrivia: Scripting Guys Holiday Special Trivia #1

Doctor Scripto

Summary: Have some fun remembering holiday specials from the past five years.  In the very first Scripting Guys holiday special, A PowerShell Carol, who was the poor unhappy            fellow who lost his way and would only use VBScript?  Think you know the answer? Verify by reading Holiday PowerShell Carol, Part One...or stay tuned.            The answer will be posted in tomorrow's PowerTrivia!

Oliver Script: A Holiday Tale–Part 1
Dec 20, 2014
Post comments count 0
Post likes count 0

Oliver Script: A Holiday Tale–Part 1

Doctor Scripto

Summary: We are introduced to our friend, Oliver Script, who discovers the magic of Get-Help in Windows PowerShell. There are times when dreams wander away...    when the magic fades because we forget to believe in the possible...    when we let the whispers of the possibilities of tomorrow silently wander off and disappear into the night. Often we call this “adulthood.” Then there are more commonly the times where the dreams are simply those magical adventures we embark upon during the midnight hours. However, there are the rare and wonderful exceptions where the dreamer and the d...

PowerTip: Convert String into DateTime Object
Dec 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Convert String into DateTime Object

Doctor Scripto

Summary: Use Windows PowerShell to convert a string into a DateTime object.  How can I use Windows PowerShell to easily create a System.DateTime object from a string?  Use the [DateTime] type accelerator to convert the string, for example: [datetime]"1/2/14"

Access Objects Inside Other Objects in PowerShell Pipeline
Dec 19, 2014
Post comments count 0
Post likes count 0

Access Objects Inside Other Objects in PowerShell Pipeline

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about accessing objects inside other objects in the Windows PowerShell pipeline.  Hey, Scripting Guy! Yesterday in Create Custom PowerShell Objects, you talked about writing a script to access embedded objects. That seems like a lot of trouble. Is there a better or easier way to do that, for example, when working in the Windows PowerShell console? —BZ  Hello BZ, Microsoft Scripting Guy, Ed Wilson, is here. It is nearly here! The fifth annual Scripting Guys holiday special! Windows PowerShell MVP, Sean Kearney, has been hard at work on this series ...

PowerTip: Create Custom PowerShell Objects
Dec 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Create Custom PowerShell Objects

Doctor Scripto

Summary: Learn about the easiest way to create a custom Windows PowerShell object.  How can I easily create a custom object that contains only a few of the existing properties of a            Windows PowerShell cmdlet?  Use the Select-Object cmdlet in the pipeline and choose the properties you want to add to the object: Get-Process | Select-Object name, id

Create Custom PowerShell Objects
Dec 18, 2014
Post comments count 0
Post likes count 0

Create Custom PowerShell Objects

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating custom objects via Windows PowerShell.  Hey, Scripting Guy! Yesterday in Understand Embedded Objects in PowerShell, you said the easy way to expand a Windows PowerShell object was to use the –ExpandProperty parameter from the Select-Object cmdlet. That works OK, but I cannot also select other properties. So I end up with a bunch of extra stuff, and I have no idea what it is related to. Is there something you can do to help with this? —SB  Hello SB, Microsoft Scripting Guy, Ed Wilson, is here. The other day, I received an email...

PowerTip: Expand Objects in PowerShell
Dec 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Expand Objects in PowerShell

Doctor Scripto

Summary: Learn how to easily expand objects in Windows PowerShell.  How can I expand an object that was returned by my Windows PowerShell expression?  Use the –ExpandProperty parameter from Select-Object to expand objects in Windows PowerShell.            This example expands the System.Diagnostics.ProcessStartInfo object returned by the Get-Process cmdlet: Get-Process | Select-Object -ExpandProperty startinfo

Understand Embedded Objects in PowerShell
Dec 17, 2014
Post comments count 0
Post likes count 0

Understand Embedded Objects in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about understanding embedded objects in Windows PowerShell.  Hey, Scripting Guy! I don’t get it. Some things in Windows PowerShell are so easy, and others are so complicated. It seems to go from ridiculously easy to ridiculously hard all at once. Take for instance, the Get-Process cmdlet. I mean, a moron can use that cmdlet. It is not too hard to type Get-Process—in fact, the hardest part is remembering to use a hypen in the middle. But after I do that, now what? There are things that just do not make sense, and things that are impossible to find...

PowerTip: Programmatically Open Script in PowerShell ISE
Dec 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Programmatically Open Script in PowerShell ISE

Doctor Scripto

Summary: Use Windows PowerShell to open a script in the Windows PowerShell ISE.  How can I use Windows PowerShell to run a script that will open another script in a new tab            in the Windows PowerShell ISE?  Use the CurrentPowerShellTab Files Add method from the $psISE object, for example: $psISE.CurrentPowerShellTab.Files.Add("C:\fso\Get-Battery.ps1")

Use PowerShell to Find Hotfixes Installed in Time Range
Dec 16, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Find Hotfixes Installed in Time Range

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find hotfixes that were installed during a certain time range.  Hey, Scripting Guy! I have a problem at work. It seems there was a hotfix that was installed in the last couple of months that is causing problems with the video driver on a certain model of computer. Unfortunately, the problem has been somewhat erratic, and due to holidays, the users have been slow to report the issue. So I do not have exact information as to when the hotfix was installed. I only have a time frame, so to speak. I know that the update occurred s...

PowerTip: Require Specific Module in PowerShell Script
Dec 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Require Specific Module in PowerShell Script

Doctor Scripto

Summary: Learn how to require a specific module in a Windows PowerShell script.  How can I prevent a Windows PowerShell script from running if it requires the Active Directory module            and the module is not available?  At first line of the script, use the #Requires statement to require the Active Directory module: #Requires –Modules ActiveDirectory

Start Virtual Machines in Order and Wait for Stabilization
Dec 15, 2014
Post comments count 0
Post likes count 0

Start Virtual Machines in Order and Wait for Stabilization

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using a Windows PowerShell workflow to ensure that virtual machines start in order and stabilize. Microsoft Scripting Guy, Ed Wilson, is here. Last month, I wrote the following blog post: Use PowerShell to Start or Stop Virtual Machines in Order. The workflow worked great. The problem is that some of the virtual machines take a while to stabilize after they are running. This means that when I start virtual machines in a specific order, there needs to be a bit of a delay from the time the virtual machine is running to the time that I can sign in or connect t...

PowerTip: Cause Out-GridView Cmdlet to Pause
Dec 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Cause Out-GridView Cmdlet to Pause

Doctor Scripto

Summary: Use Windows PowerShell to pause the script while the Out-GridView displays.  How can I pause the execution of my Windows PowerShell script while the Out-GridView cmdlet displays a grid view?            (I do not need to pass information from the grid to the script.)  The –Wait parameter from the Out-GridView cmdlet will pause script execution while the grid displays.            Here is an example: Get-Process | select name, id | Out-GridView -Wait

Weekend Scripter: Create PowerShell Graphical Help Function
Dec 14, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Create PowerShell Graphical Help Function

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating a graphical Help function in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Well, I should have known. In yesterday’s post, A Graphical Tool to Explore PowerShell Help, I said it would not take too long to convert my Windows PowerShell script (that I used to display Help) into a function. All of a sudden, I get a dozen emails to scripter@microsoft.com asking how to do that—not to mention a few tweets. As it turned out, I spent more than a few seconds converting the script into a function. Of course, I decided if I am g...

PowerTip: Use PowerShell Out-GridView to Explore Cmdlets
Dec 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell Out-GridView to Explore Cmdlets

Doctor Scripto

Summary: Use the Windows PowerShell Out-GridView cmdlet to aid in exploring cmdlets.  How can I use Windows PowerShell to graphically explore cmdlets provided by the Hyper-V module and filter by verb?  Use the Get-Command cmdlet and specify the Hyper-V module. Select the name, verb, noun, and definition            properties and pipe the results to the Out-GridView cmdlet: Get-Command -Module Hyper-V | Select name, verb, noun, definition | Out-GridView

Weekend Scripter: A Graphical Tool to Explore PowerShell Help
Dec 13, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: A Graphical Tool to Explore PowerShell Help

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to explore Help topics. Microsoft Scripting Guy, Ed Wilson, is here. With the drops of the Windows Management Framework 5.0 (also known as Windows PowerShell 5.0), now is a good time to begin exploring modules, new cmdlets, and so on. It is way cool that Windows PowerShell is largely self-documenting and that it has tools that make it easy to discover features and use them. Note  The script today works in Windows PowerShell 4.0 and Windows PowerShell 3.0. It does not take advantage of any new features of Win...

PowerTip: Find PowerShell Cmdlets Supplied by Module
Dec 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Cmdlets Supplied by Module

Doctor Scripto

Summary: Find Windows PowerShell cmdlets that are supplied by a specific module.  How can I easily see all the cmdlets that ship with the Hyper-V module.?  Use the Get-Command cmdlet, and specify the Hyper-V module. (Tab expansion works for module names, which is great because who can remember if Hyper-V has a hyphen?) Get-Command -Module Hyper-V

Use PowerShell for an Easy Shutdown
Dec 12, 2014
Post comments count 0
Post likes count 0

Use PowerShell for an Easy Shutdown

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to perform an easy shutdown. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I do with Windows PowerShell is to automate repetitive tasks. It may sound rather obvious, but I can assure you it is not. The reason? I become a creature of habit. I finally wrote this script, which I use on a regular basis: Use PowerShell to Start or Stop Virtual Machines in Order. I could have written that script a long time ago, but I didn’t. I blindly went on...clicking every day to start the same four or five virtual machines over...

PowerTip: Replace Multiple Words in String with PowerShell
Dec 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Replace Multiple Words in String with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to replace multiple words in a string.    How can I use Windows PowerShell to replace misspelled words in a string?  Use the –Replace operator, for example: $s = "The calander says there are five calendar days left in the callander" $s -replace "calander|callander","Calendar"

Use a PowerShell Function to Determine Miles to Go
Dec 11, 2014
Post comments count 0
Post likes count 0

Use a PowerShell Function to Determine Miles to Go

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about a Windows PowerShell function to determine miles remaining to meet challenge. Microsoft Scripting Guy, Ed Wilson, is here. If you are friends with me on Facebook, you know that in October I accepted a challenge to run a hundred miles before January 31, 2015. I was doing really well until I was knocked out of the action by surgery. The other day the doctor gave me a clearance to begin exercising again. Now, I need to know how many miles I need to do, per day, to complete the 100-mile challenge. When I was on the treadmill this morning, I decided that this wa...

PowerTip: Use CIM and PowerShell to Find WMI Classes
Dec 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Use CIM and PowerShell to Find WMI Classes

Doctor Scripto

Summary: Use CIM and Windows PowerShell to find WMI classes related to threads.  How can I use Windows PowerShell to easily find WMI classes that are related to threads?  Use the Get-CimClass cmdlet, and specify a wildcard character for threads: Get-CimClass *thread*

Use PowerShell and WMI to Explore Threads
Dec 10, 2014
Post comments count 0
Post likes count 0

Use PowerShell and WMI to Explore Threads

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell and WMI to explore processes and threads.  Hey, Scripting Guy! I need to find information about threads that are related to a specific process. I am wondering how I can do this by using Windows PowerShell. Can you help me? —CP  Hello CP, Microsoft Scripting Guy, Ed Wilson, is here. This morning I have a couple of meetings. I like meetings because it is a great chance to interact with other people from Microsoft—and that is always a good thing when one works from home. It is one of the things I miss most about w...

PowerTip: Use PowerShell to Determine Weeks Between Dates
Dec 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Determine Weeks Between Dates

Doctor Scripto

Summary: Use Windows PowerShell to determine the number of weeks between two dates.  I have a project that is broken into several major components of work. I know the start date of the project and            the end date of the project. How can I use Windows PowerShell to determine the number of weeks between            these dates so I can determine how many weeks to allocate for each milestone?  Use the New-TimeSpan cmdlet to create a timespan object that represents the amount of time between           &nbsp...

Use PowerShell to Get BIOS Information on Remote Servers
Dec 9, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Get BIOS Information on Remote Servers

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to retrieve BIOS information from remote servers.  Hey, Scripting Guy! I really hope you can help me. I need to get a list of basic BIOS information from our servers. All of the servers that I need are listed in a single organizational unit (OU) in Active Directory. I am wondering if I can query that OU to get my servers, and then use Windows PowerShell to connect to those servers and query for BIOS information. I tried using the Get-WmiObject cmdlet to query for the Win32_BIOS class in a few test scripts, but that did not work...

PowerTip: Zoom the PowerShell ISE
Dec 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Zoom the PowerShell ISE

Doctor Scripto

Summary: Use a Windows PowerShell command to increase zoom in the Windows PowerShell ISE.  How can I increase the zoom level in a script that I use to set up the Windows PowerShell ISE before presentations?  Use the $host object and the PrivateData object, and set the zoom size to greater than 100.            Here is an example that sets the zoom to 150 percent: $Host.PrivateData.Zoom = 150

Pre- and Post-Incrementing Do…While Loop in PowerShell
Dec 8, 2014
Post comments count 0
Post likes count 0

Pre- and Post-Incrementing Do…While Loop in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about pre- and post-incrementing the Do...While loop in Windows PowerShell.  Hey, Scripting Guy! I think that I found a bug in Windows PowerShell. In fact, I am pretty sure that I have. It involves using the ++ increment operator. For example, I know that $a = $a + 1 is the same as using $a++ because the ++ operator adds one to the value stored in the $a variable. With this understanding, here is the command to reproduce the bug I found. First, my command that uses $a = $a + 1: #Loop #1 $a=0 Do {     $a } While (($a = $a + 1) -le 5) The output...

PowerTip: Use PowerShell to See if String Has Wildcard Character
Dec 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to See if String Has Wildcard Character

Doctor Scripto

Summary: Use Windows PowerShell to determine if a string contains a wildcard character.  How can I use Windows PowerShell to determine if a string contains a wildcard character?  Use the static ContainsWildcardCharacters method from the System.Management.Automation.WildcardPattern            .NET Framework class, for example: PS C:\> $wc = '*' PS C:\> $wc * PS C:\> [System.Management.Automation.WildcardPattern]::ContainsWildcardCharacters($wc) True

Weekend Scripter: Count Images with PowerShell
Dec 7, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Count Images with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, counts the images he used in Hey, Scripting Guy! Blog posts through the years. Microsoft Scripting Guy, Ed Wilson, is here. I have been writing the Hey, Scripting Guy! Blog for a while…actually, quite a while. It is the best job I have ever had—and at Microsoft, I have had some really cool jobs. I have previously mentioned the file structure that I use on my laptop, but here is a synopsis: I have all of my data in a folder called, surprisingly enough, Data. Inside my Data folder, I have a folder called ScriptingGuys. It contains all of my Hey, Scripting Gu...

PowerTip: Use PowerShell to Replace Characters in String
Dec 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Replace Characters in String

Doctor Scripto

Summary: Use Windows PowerShell to replace non-alphabetic and non-number characters in a string.  How can I use Windows PowerShell to replace every non-alphabetic and non-number character in a string            with a hyphen?  Use the Windows PowerShell –Replace operator and the \w regular expression character class.            The \w character class includes the letters a-z, A-Z, and numbers. Here is an example: PS C:\> $s = 'abc.123,DEF&ghi' PS C:\> $s -replace "\w", &#039...

Weekend Scripter: Remove Non-Alphabetic Characters from String
Dec 6, 2014
Post comments count 1
Post likes count 0

Weekend Scripter: Remove Non-Alphabetic Characters from String

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to remove all non-alphabetic characters from a string. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am drinking a nice up of English Breakfast tea and munching on a Biscotti. I know...Biscotti is not a very good breakfast. Oh well. I went to my favorite bakery yesterday looking for some nice scones (which do make a good breakfast). For some reason, all of the scones they had were covered with a half-inch thick gunky sugar icing. I mean, DUDE! There was not enough time to talk the Scripting Wife into making some nice s...

PowerTip: Create Self-Updating Variable
Dec 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Create Self-Updating Variable

Doctor Scripto

Summary: Learn how to create a self-updating variable.  How can I create a variable that will automatically update when I call it?  Use Set-PSBreakPoint to set a variable that will always have the current date and time (or only time): Set-PSBreakpoint -Variable Time -Mode Read -Action {$Global:Time=(Get-Date).ToShortTimeString();$Global:Time} $Time Set-PSBreakpoint -Variable Date -Mode Read -Action {$Global:Date=Get-Date;$Global:Date} $Date Note  You need to call the variable to kick off the PSBreakPoint action script block the first time.          ...

Use the PowerShell Debugger
Dec 5, 2014
Post comments count 0
Post likes count 0

Use the PowerShell Debugger

Doctor Scripto

Summary: Boe Prox shows how to debug scripts in Windows PowerShell. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the final part in a series of five posts about troubleshooting Windows PowerShell scripts and functions. The series includes: Over the course of the week, I have been showing you various approaches to troubleshoot your code (or someone else’s code). Today I wrap things up by talking about the Windows PowerShell debugger. I'll look at the console and the ISE to help troubleshoot different parts of the code. D...

PowerTip: Use PowerShell to View Trace Sources
Dec 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to View Trace Sources

Doctor Scripto

Summary: Use Windows PowerShell to view all trace sources.  How can I use Windows PowerShell to see all available trace sources?  Use Get-TraceSource cmdlet: Get-TraceSource | Select Name, Description PS C:> get-tracesource | Select Name, Description  Name                                                        Description----...

Trace Your Commands by Using Trace-Command
Dec 4, 2014
Post comments count 0
Post likes count 0

Trace Your Commands by Using Trace-Command

Doctor Scripto

Summary: Boe Prox uses Trace-Command to understand commands. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the fourth part in a series of five posts about troubleshooting PowerShell scripts/functions. The series includes: Today I am talking about using Trace-Command to look at your commands and to help better understand how they are working behind the scenes. Have you ever noticed that you can type Get without the actual verb and get cmdlets? And what is really happening when you pipe objects into a cmdlet and the cmdle...

PowerTip: Use PowerShell to Hide Parameter From IntelliSense
Dec 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Hide Parameter From IntelliSense

Doctor Scripto

Summary: Learn how to use Windows PowerShell to hide a parameter from IntelliSense.  How can I use Windows PowerShell to hide a parameter from IntelliSense?  Introduced in Windows PowerShell 4.0, you can specify the DontShow attribute            for the [parameter()] type to hide that parameter from IntelliSense: Function Test-Something {     [cmdletbinding()]     Param (         [parameter(DontShow)]         $HiddenParameter,     ...

Enforce Better Script Practices by Using Set-StrictMode
Dec 3, 2014
Post comments count 0
Post likes count 1

Enforce Better Script Practices by Using Set-StrictMode

Doctor Scripto

Summary: Boe Prox shows how to use Set-StrictMode to write better scripts. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the third part in a series of five posts about troubleshooting Windows PowerShell scripts and functions. The series includes: If you remember back in the VBScript days, if you wanted to enforce better practices with the handling of undeclared variables in your code, you would use Option Explicit. If you tried to throw in a variable that wasn’t defined at the top of the script, it would throw a...

PowerTip: Use PowerShell to Remove an Item from an Array
Dec 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Remove an Item from an Array

Doctor Scripto

Summary: Use Windows PowerShell remove an item from an array. How can I remove an item from an array?Use the ArrayList class, which has the Remove() method (instead of using System.Array,            which does not have this method):PS > $ArrayList = New-Object System.Collections.ArrayListPS > [void]$ArrayList.AddRange((1..10))PS > $ArrayList12345678910PS > 1..10 | % {If ($_%2){[void]$ArrayList.Remove($_)}}PS > $ArrayList246810

Troubleshoot by Using Set-PSDebug
Dec 2, 2014
Post comments count 0
Post likes count 0

Troubleshoot by Using Set-PSDebug

Doctor Scripto

Summary: Boe Prox uses the Set-PSDebug cmdlet to assist in troubleshooting. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the second part in a series of five posts about troubleshooting Windows PowerShell scripts and functions. The series includes: Today I am going to talk about using the Set-PSDebug cmdlet to assist in troubleshooting a script or function. This cmdlet provides some basic debugging capabilities and allows you to set up trace levels, depending on how you want to view the execution of a script or function....

PowerTip: Avoid Prompt When Using –Debug
Dec 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Avoid Prompt When Using –Debug

Doctor Scripto

Summary: Boe Prox shows how to avoid being prompted when using –Debug.  I love using –Debug in functions to figure out what is going on, but how can I avoid being prompted            each time I run into Write-Debug in my code?  After you declare your parameters, check for –Debug, and set the $DebugPreference            value to ‘Continue’ instead of ‘Inquire’: If ($PSBoundParameters[‘Debug’]) {     $DebugPreference='...

Provide Support by Using Verbose and Debug Streams
Dec 1, 2014
Post comments count 0
Post likes count 0

Provide Support by Using Verbose and Debug Streams

Doctor Scripto

Summary: Provide code support by using Verbose and Debug streams. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the first part in a series of five posts about troubleshooting Windows PowerShell scripts and functions. The series includes: When you write a script or function, you want to make sure that things work correctly and that you have provided enough information for the individuals who will be using the code in their day-to-day activities. Although you have Get-Help and inline comments in the code, sometimes they ...

Networking Ideas for PowerShell Scripters
Nov 30, 2014
Post comments count 0
Post likes count 0

Networking Ideas for PowerShell Scripters

Doctor Scripto

Summary: The Scripting Wife presents networking ideas for Windows PowerShell scripters. Microsoft Scripting Guy, Ed Wilson, is here. Today the Scripting Wife is going to write the blog post... Hello fellow scripters! The Scripting Guy, Ed Wilson, is not feeling so great, so I thought I would be nice to him on this Sunday morning and write this blog post. If you are new to this blog, I am Ed’s real-life wife and a Microsoft MVP. To read more of my posts, see these Hey, Scripting Guy! Blog posts.  November has been an exciting and busy month for me personally. It started with the MVP Summit and ended wit...

PowerTip: Find Module Information from Cmdlet
Nov 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Module Information from Cmdlet

Doctor Scripto

Summary: Find Windows PowerShell module information from a cmdlet.  How can I find more information about the module that provides a Windows PowerShell cmdlet?  Use the Get-Command cmdlet, pipe the results to the Foreach-Object cmdlet, then inside the script block,            use Get-Module. Here is an example using the Get-Process cmdlet: Get-Command get-process | foreach {Get-Module -name $_.modulename}

Weekend Scripter: Latitude, Longitude, and PowerShell
Nov 29, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Latitude, Longitude, and PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to retrieve latitude and longitude information. Microsoft Scripting Guy, Ed Wilson, is here. Today it is cold and dreary, so I thought it would be a nice time to play around with Windows PowerShell. One of the things I have always wanted to do is use Windows PowerShell to find the latitude and longitude for a specific address. I know there are webpages where I can look up this information—but if I ever want to do anything with latitude and longitude in a Windows PowerShell script, I had better know how to do the lookup. So, I ...

PowerTip: Use PowerShell to Get List of FSMO Role Holders
Nov 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get List of FSMO Role Holders

Doctor Scripto

Summary: Use Windows PowerShell to get a list of FSMO role holders in Active Directory.  I use NETDOM QUERY FSMO to list my domain controllers that hold the FSMO roles, but can I do it with Windows PowerShell?  As usual, there is more than one way to do most things in Windows PowerShell, but here are some syntax examples to meet your needs: Get-ADDomain | Select-Object InfrastructureMaster, RIDMaster, PDCEmulator Get-ADForest | Select-Object DomainNamingMaster, SchemaMaster Get-ADDomainController -Filter * |      Select-Object Name, Domain, Forest, OperationMasterRoles |   ...

Active Directory Week: Essential Steps for PowerShell when Upgrading
Nov 28, 2014
Post comments count 0
Post likes count 0

Active Directory Week: Essential Steps for PowerShell when Upgrading

Doctor Scripto

Summary: Learn three essential steps for Windows PowerShell when upgrading from Windows Server 2003. Microsoft Scripting Guy, Ed Wilson, is here. Today we have the final post in the series about Active Directory PowerShell by Ashley McGlone. Before you begin, you might enjoy reading these posts from the series: Over the years Microsoft has released a number of new features to enhance Active Directory functionality. (For more information, see Active Directory Features in Different Versions of Windows Server.) If you are just now upgrading from Windows Server 2003, you have much to be thankful for. You wil...

PowerTip: Use PowerShell to Work with Active Directory Date Fields
Nov 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Work with Active Directory Date Fields

Doctor Scripto

Summary: Use Windows PowerShell to work with Active Directory date fields.  How can I Use Windows PowerShell to work with date fields in Active Directory?  Try the following techniques: # Password last set within the last 30 days? $pwdLastSet = Get-ADUser Administrator -Properties pwdLastSet |      Select-Object -ExpandProperty pwdLastSet # Option A $pwdLastSet -gt (Get-Date).AddDays(-30).ToFileTimeUTC() # Option B [datetime]::fromFileTimeUTC($pwdLastSet) -gt (Get-Date).AddDays(-30)  

Active Directory Week: Stale Object Cleanup Guidance—Part 2
Nov 27, 2014
Post comments count 0
Post likes count 0

Active Directory Week: Stale Object Cleanup Guidance—Part 2

Doctor Scripto

Summary: Scripting tips for cleaning up stale Active Directory accounts. Microsoft Scripting Guy, Ed Wilson, is here. Today we continue our series about Active Directory PowerShell by Ashley McGlone. Before you begin, you might enjoy reading these posts from the series: See yesterday’s post for a discussion and guidance about stale-object cleanup. You really need to read it for context. Continuing from yesterday… I have been doing Active Directory scripting for well over a decade. You need to know that there is no fail-safe way to identify stale users and groups with 100% accuracy. We can have a high...

PowerTip: Use PowerShell to Get Inactive Active Directory Accounts
Nov 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Inactive Active Directory Accounts

Doctor Scripto

Summary: Use Windows PowerShell to get a report of inactive Active Directory accounts.How can I use Windows PowerShell to get a report of inactive Active Directory accounts?The Search-ADAccount cmdlet has a number of parameters and switches to help identify stale accounts: You can also use the -UsersOnly or -ComputersOnly switch to narrow the results:  

Active Directory Week: Stale Object Cleanup Guidance—Part 1
Nov 26, 2014
Post comments count 1
Post likes count 0

Active Directory Week: Stale Object Cleanup Guidance—Part 1

Doctor Scripto

Summary: Learn about how to clean up stale Active Directory accounts. Microsoft Scripting Guy, Ed Wilson, is here. Today we continue our series about Active Directory PowerShell by Ashley McGlone. Before you begin, you might enjoy reading his first two posts: Here's Ashley... In the United States, this week we celebrate Thanksgiving. I’ve made the joke before that you can give thanks for Windows PowerShell, but your family really will not understand the significance. Nevertheless, I am thankful for family, friends, and Windows PowerShell. Clean your room much? In my work with Microsoft, I have foun...

PowerTip: Use PowerShell to Find if User Is Nested Group Member
Nov 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find if User Is Nested Group Member

Doctor Scripto

Summary: Use Windows PowerShell to find if a user is a nested member of a particular group.  How can I use Windows PowerShell to quickly find if a user is a nested member of a particular group,            for example, Domain Admins?  Use the -RecursiveMatch LDAP filter operator: Get-ADUser -Filter 'memberOf ‑RecursiveMatch "CN=Administrators,CN=Builtin,DC=Fabrikam,DC=com"' ‑SearchBase "CN=Administrator,CN=Users,DC=Fabrikam,DC=com" If the user is a member of the group, the query returns an AD object representing the user. If not a member of the group, t...

Active Directory Week: Explore Group Membership with PowerShell
Nov 25, 2014
Post comments count 0
Post likes count 0

Active Directory Week: Explore Group Membership with PowerShell

Doctor Scripto

Summary: Learn about the nuances involved in reporting group memberships with Active Directory PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we continue our series about Active Directory PowerShell by Ashley McGlone. If you missed it, you may enjoy reading Get Started with Active Directory PowerShell first. Now, here's Ashley... Security priority In our world today, security is getting more focus with every headline about data breaches. One key strategy to keep your environment secure is regular audits of group memberships. Hopefully, you or your company’s information security team are...

PowerTip: Find PowerShell Help Topics for Active Directory
Nov 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Help Topics for Active Directory

Doctor Scripto

Summary: Find the Windows PowerShell help_about topics for Active Directory.  Where are the Windows PowerShell help_about topics for Active Directory? If you have Windows 7 or Windows Server 2008 R2 with the Active Directory Remote Server Administration Tools            (RSAT) installed, you also have the Active Directory Help topics.  If you have Windows PowerShell 4.0 or Windows PowerShell 3.0 installed, you can run the following command  from an elevated Windows PowerShell console to install them:Update-Help -Module ActiveDirectory -VerboseTo view th...

Active Directory Week: Get Started with Active Directory PowerShell
Nov 24, 2014
Post comments count 0
Post likes count 0

Active Directory Week: Get Started with Active Directory PowerShell

Doctor Scripto

Summary: Microsoft premier field engineer (PFE), Ashley McGlone, discusses the Active Directory PowerShell cmdlets. Microsoft Scripting Guy, Ed Wilson, is here. Today we start a series about Active Directory PowerShell, written by Ashley McGlone... Ashley is a Microsoft premier field engineer (PFE) and a frequent speaker at events like PowerShell Saturday, Windows PowerShell Summit, and TechMentor. He has been working with Active Directory since the release candidate of Windows 2000. Today he specializes in Active Directory and Windows PowerShell, and he helps Microsoft premier customers reach their full pot...

PowerTip: Use PowerShell to Find If Folder Inherits from Parent
Nov 23, 2014
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to Find If Folder Inherits from Parent

Doctor Scripto

Summary: Use Windows PowerShell to determine if an NTFS folder inherits from its parent folder.  How can I use Windows PowerShell to determine if an NTFS folder inherits from its parent folder?  Use the Get-NTFSAccessInheritance cmdlet provided by the NTFSSecurity module, for example: Get-NTFSAccessInheritance -Path C:\Windows Or if you want to query multiple folders: dir -Recurse | Get-NTFSAccessInheritance | Where-Object { -not $_.InheritanceEnabled }

Weekend Scripter: Manage NTFS Inheritance and Use Privileges
Nov 23, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Manage NTFS Inheritance and Use Privileges

Doctor Scripto

Summary: Microsoft PFE, Raimund Andree, talks about using Windows PowerShell to disable inheritance on folders. Microsoft Scripting Guy, Ed Wilson, is here. Today Raimund Andree, talks about using Windows PowerShell to disable inheritance on folders. Take it away, Raimund... In my previous post, Use PowerShell to Get, Add, and Remove NTFS Permissions, I talked about NTFS inheritance. Inheritance is a fundamental feature of NTFS to keep permissions consistent and easy to manage. However, there are some scenarios where you want to disable inheritance on folders or find out where it has been disabled. This post expl...

PowerTip: Use PowerShell to Show Hidden Files
Nov 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show Hidden Files

Doctor Scripto

Summary: Use Windows PowerShell to display only hidden files.  How can I see hidden files by using Windows PowerShell 4.0?  Use the Get-ChildItem cmdlet, and add the –Hidden and the –File switches: Get-ChildItem -Hidden -File

Weekend Scripter: Use PowerShell to Get, Add, and Remove NTFS Permissions
Nov 22, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Get, Add, and Remove NTFS Permissions

Doctor Scripto

Summary: Microsoft PFE, Raimund Andree, talks about using Windows PowerShell to get, add, and remove permissions. Microsoft Scripting Guy, Ed Wilson, is here. Today we have Microsoft Premier Field Engineer, Raimund Andree, back to talk about using Windows PowerShell to work with permissions... Managing file and folder permissions in Windows PowerShell is not that easy, and there are numerous articles and blog posts describing how it works by using the .NET classes. This is far from being comfortable, and there is one major and one minor restriction: This post introduces the NTFSSecurity module, which prov...

PowerTip: Identify All Stopped Azure Virtual Machines with PowerShell
Nov 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Identify All Stopped Azure Virtual Machines with PowerShell

Doctor Scripto

Summary: Identify virtual machines that are shut down, but are consuming billing time.  How can I use Windows PowerShell to track virtual machines that are not shut down from            the management portal in Azure?  Use the Get-AzureVM cmdlet, and filter on 'StoppedVM' status: Get-AzureVM | Where { $_.Status –eq 'StoppedVM' } You can then properly shut down all of them with the Stop-AzureVM cmdlet: Get-AzureVM | Where { $_.Status –eq 'StoppedVM' } | Stop-AzureVM

Managing Azure IaaS with Windows PowerShell: Part 5
Nov 21, 2014
Post comments count 0
Post likes count 0

Managing Azure IaaS with Windows PowerShell: Part 5

Doctor Scripto

Summary: Use Windows PowerShell to manage virtual machines in Azure. Honorary Scripting Guy, Sean Kearney, is here flying through the digital stratosphere on our final day with Windows PowerShell and Azure! We started by creating a virtual network for our Azure workstations and escalated to spinning up some virtual machines. To read more, see the previous topics in this series: Pretty cool! But we're dealing with the fun stuff today... Normally in Azure, if you were to initiate a shutdown in Windows or Linux, the operating system shuts down, but the Azure resources remain live in the service. The answe...

PowerTip: Set Default Storage Account for PowerShell Cmdlets in Azure
Nov 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Set Default Storage Account for PowerShell Cmdlets in Azure

Doctor Scripto

Summary: Learn how to define the default storage account to be used with the Azure PowerShell cmdlets.  How do I tell Azure which media or storage account I'd like to use when I create a virtual machine?  Use Get-AzureStorageAccount to access the names of your storage accounts, and            then use Set-AzureSubscription to define your current default for the cmdlets. The following example sets the first account as the default in the subscription called 'HSG Azure Subscription': $StorageAccount=(Get-AzureStorageAccount)[0].label Set...

Managing Azure IaaS with Windows PowerShell: Part 4
Nov 20, 2014
Post comments count 0
Post likes count 0

Managing Azure IaaS with Windows PowerShell: Part 4

Doctor Scripto

Summary: Create a simple virtual machine from a predefined template in Azure. Honorary Scripting Guy, Sean Kearney, is here with my head still stuck in the clouds! Yesterday we created a network in Microsoft Azure for our resources to leverage—much like Hyper-V leverages a virtual network switch for its resources. Today we'll create a simple virtual machine from a predefined template in Azure. Creating a virtual machine from a template in Azure is pretty simple. We select Virtual Machines in the left pane of the management portal, and then click the +NEW button at the bottom. From here, we choose Quic...

PowerTip: Use PowerShell to Identify Services in Azure by Location
Nov 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Identify Services in Azure by Location

Doctor Scripto

Summary: Use Azure PowerShell cmdlets to identify which services a datacenter will contain.  How can I use Windows PowerShell to identify which services a particular datacenter in Azure contains?  Access the AvailableServices property from the Get-AzureLocation cmdlet, for example: (Get-AzureLocation | where { $_.DisplayName -eq 'Brazil South' }).AvailableServices

Manage Azure IaaS with Windows PowerShell: Part 3
Nov 19, 2014
Post comments count 0
Post likes count 0

Manage Azure IaaS with Windows PowerShell: Part 3

Doctor Scripto

Summary: Access some information you need to easily automate virtual machine creation in Azure. Honorary Scripting Guy, Sean Kearney, is here to rain the Power of PowerShell and Azure down onto you!    Note This is the third post in a series. You might also enjoy reading: Yesterday we saw how to create storage in Azure. Today we're going to examine how to access some of the information you'll need to easily automate virtual machine creation in Azure. Normally when I create a virtual machine (or any other resource in Azure), I will be asked for locations where the service is to be hosted. W...

PowerTip: Get Azure Subscription Names with PowerShell
Nov 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Get Azure Subscription Names with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to get the name of cmdlets referring to your Azure subscription.  Is there an easy way to obtain the Azure cmdlets referring to my subscription name?  Use the Get-AzureSubscription cmdlet and access the SubscriptionName property: (Get-AzureSubscription).subscriptionname If you have multiple subscriptions, you can access them individually: (Get-AzureSubscription)[0].subscriptionname (Get-AzureSubscription)[1].subscriptionname

Manage Azure IaaS with Windows PowerShell: Part 2
Nov 18, 2014
Post comments count 0
Post likes count 0

Manage Azure IaaS with Windows PowerShell: Part 2

Doctor Scripto

Summary: Attend to prep work to get  virtual machine cmdlets working. Honorary Scripting Guy, Sean Kearney is here with some scribbly notes to help you out with Azure scripts for your virtual machines. Note  This is the second post in a series. You might also enjoy reading Manage Azure IaaS with Windows PowerShell: Part 1. Before you can create virtual machines in Azure, you need to do some prep work to get those virtual machine cmdlets working. The first thing you need is storage; that is, a place to put your little pile of stuff, because everybody needs a place for their stuff. Just imagine ...

PowerTip: Connect to Azure to Leverage PowerShell Cmdlets
Nov 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Connect to Azure to Leverage PowerShell Cmdlets

Doctor Scripto

Summary: Learn how to use the Microsoft Azure cmdlets to connect to an Azure subscription. I downloaded the Azure PowerShell cmdlets, and I when I run them, they produce an            error. How do I authenticate to Microsoft Azure from the cmdlets? Use a combination of two cmdlets (Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile)            your first time:Get-AzurePublishSettingsFileThis prompts for authentication to Azure and prompts you to save a file on your local drive. The file extension is .publishsettings.Then run...

Manage Azure IaaS with Windows PowerShell: Part 1
Nov 17, 2014
Post comments count 0
Post likes count 0

Manage Azure IaaS with Windows PowerShell: Part 1

Doctor Scripto

Summary: Establish a connection to Azure through Windows PowerShell. Honorary Scripting Guy, Sean Kearney, is here. I'm back from the MVP Summit with my head in the clouds! More specifically, the Azure sky! Yes, my head is truly in the clouds. About a month ago, I got some training in Microsoft Azure and I got to meet the fellow who created the Windows PowerShell cmdlets for Azure, Michael Washam. I looked up at him and began blubbering, "…I'm not worthy….I'm not worthy… I'm not worthy…" Of course, Michael looked at me and was thinking, "Uh…OK&...

PowerTip: Continue a Windows PowerShell Script After Restart
Nov 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Continue a Windows PowerShell Script After Restart

Doctor Scripto

Summary: Learn how to continue a script after a remote system restart by using Windows PowerShell. I am configuring MPIO to automatically claim the iSCSI Bus Type, which requires a restart. However, I want to continue           automating afterward, so how do I continue my script from that point? Introduced in Windows PowerShell 4.0, you can use Restart-Computer with the Wait and For parameters.            By default the Restart-Computer cmdlet uses DCOM as the protocol to perform the restart, so if ...

Weekend Scripter: Scriptify—A New PowerShell Learning Tool
Nov 16, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Scriptify—A New PowerShell Learning Tool

Doctor Scripto

Summary: Microsoft PFE, Steve Jeffery, talks about a new Windows PowerShell learning tool: Scriptify. Microsoft Scripting Guy, Ed Wilson, is here. Today I have a guest blog post by premier field engineer, Steve Jeffery. He talks about a new tool he created to help you learn Windows PowerShell. Now, here's Steve... I started using Windows PowerShell several years ago as a SharePoint administrator. I quickly realized what a powerful language it is when I started automating my daily tasks with it. Eventually, I was automating complete builds. Since then, I’ve become a Windows PowerShell fanatic, and I try...

PowerTip: Using PowerShell to Search Text Files for Letter Pattern
Nov 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Using PowerShell to Search Text Files for Letter Pattern

Doctor Scripto

Summary: Use Windows PowerShell to search the contents of all text files in a folder for a specific letter pattern.  How can I use Windows PowerShell to search the contents of a lot of files in a folder for            the occurrence of a specific letter pattern?  Use the Select-String cmdlet, and specify the pattern and the path to the files.            Windows PowerShell automatically reads the contents of the text files, and it will show the path            and the line number of the file that contains ...

Use PowerShell to Search Active Directory for High-Privileged Accounts
Nov 15, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Search Active Directory for High-Privileged Accounts

Doctor Scripto

Summary: Microsoft PFE, Ian Farr, provides a Windows PowerShell function that searches for Active Directory users with high-privileged memberships. Microsoft Scripting Guy, Ed Wilson, is here. Today, we have another guest blog post from Microsoft premier field engineer (PFE), Ian Farr. Take it away, Ian… As a youngster, I loved watching Columbo, the bumbling, disheveled, and tenacious LAPD detective. At the end of each episode, almost as an afterthought, he’d outwit the murderer with an investigative coup de grace. Televisual gold! A few months ago, I discussed a function that analyzes the authentica...

PowerTip: Find WSMAN Settings by Using PowerShell
Nov 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Find WSMAN Settings by Using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find the WSMAN service settings on a local computer.  How can I use Windows PowerShell to easily verify the WSMAN settings on my local computer?  Open the Windows PowerShell ISE or console with admin rights, and then use the            WSMAN provider to display the LocalHost\Service folder as shown here: dir WSMan:\localhost\Service

Final Comments about PowerShell Comments
Nov 14, 2014
Post comments count 0
Post likes count 0

Final Comments about PowerShell Comments

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, concludes the series of posts about adding comments to Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. This morning, I am sipping a cup of Assam tea. It is rich, robust, and has a very nice flavor. I add a bit of lemon juice and a cinnamon stick to balance out the flavor. I also have a piece of dark chocolate that seems to go exceptionally well with the tea. With tea, it is all about balance. In a way, it is the same with adding comments to a Windows PowerShell script. Five Ws and an H Comments help make the script easy to understand. I like to...

PowerTip: Use PowerShell to Display Event Viewer
Nov 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Event Viewer

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display the Event Viewer tool.  I often use the Event Viewer, but I have a hard time finding it or remembering its name.            How can I use Windows PowerShell to see the Event Viewer?  Use the Show-EventLog cmdlet—Tab expansion works so you do not have to type much,           and it is easier to remember and type than EventVwr: Show-EventLog

More Comments about PowerShell Commenting
Nov 13, 2014
Post comments count 0
Post likes count 0

More Comments about PowerShell Commenting

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, continues the discussion about Windows PowerShell comments. Microsoft Scripting Guy, Ed Wilson, is here. This morning, I was up early because I had to take the Scripting Wife to the airport. Luckily, it was really early, so Charlotte’s world class traffic had not yet had a chance to accumulate. She is heading to Long Beach, California to help with registration for Bouchercon 2014. Bouchercon is a huge conference (sort of like TechEd) devoted to mystery writers and mystery readers. More than likely, she will come back home with a suitcase full of mystery books fro...

PowerTip: Check UI Culture and Current Culture
Nov 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Check UI Culture and Current Culture

Doctor Scripto

Summary: Learn how to use Windows PowerShell to compare the UI culture and the current culture.  How can I use Windows PowerShell to easily check if the UI culture and the current culture on my            computer are the same.?  Use the Compare-Object, Get-Culture, and Get-UiCulture cmdlets: Compare-Object (Get-Culture) (Get-UICulture)

Use Regions for PowerShell Comments
Nov 12, 2014
Post comments count 0
Post likes count 0

Use Regions for PowerShell Comments

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about combining regions and Windows PowerShell comments in the ISE. Microsoft Scripting Guy, Ed Wilson, is here. This morning I want to talk about an idea I had the other day when I was on the treadmill. First of all, I will say that walking on a treadmill for an hour is a great way to get some time to think. I often have great ideas when I am walking on the treadmill. At other times, I have some pretty whacky ideas. I think that today’s idea probably falls somewhere in-between. I have been talking about adding comments to scripts, and yesterday I talked ab...

PowerTip: Examine PowerShell Cmdlet Coverage
Nov 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Examine PowerShell Cmdlet Coverage

Doctor Scripto

Summary: Learn how to examine where Windows PowerShell cmdlets come from.  How can I use Windows PowerShell to find which modules supply the most cmdlets of a particular type?  Use the Get-Command cmdlet and specify a particular verb (such as Get), pipe the resulting objects           to the Group-Object cmdlet to group by the ModuleName property, then sort the results in a           descending fashion, for example: get-command -verb get | group ModuleName | sort count -Descending

Top Four Suggestions for Effective PowerShell Comments
Nov 11, 2014
Post comments count 0
Post likes count 0

Top Four Suggestions for Effective PowerShell Comments

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, lists his top four ideas to include in comments in Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. It is a new week. This one is filled with potential for unlimited new explorations, beginnings of wonderful friendships, and delving into the mysteries of long forgotten books. Well OK, I actually began the new week yesterday—but still, there is lots to discover about Windows PowerShell. The weather continues to be absolutely fabulous here in Charlotte, North Carolina. The days are almost perfect. In fact, the weather is so glorious that I h...

PowerTip: Add Multiple-line Comments in PowerShell
Nov 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Add Multiple-line Comments in PowerShell

Doctor Scripto

Summary: Learn how to add multiple-line comments in Windows PowerShell.  How can I  use Windows PowerShell to add a comment that will wrap over several lines           if I do not want to use a hash tag for each line?  Begin the comment with <# and end the comment with #>, for example: <#    this is a    multiple line comment #>

Six Comments about PowerShell Commenting
Nov 10, 2014
Post comments count 0
Post likes count 0

Six Comments about PowerShell Commenting

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about adding comments to Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. This morning brings another cool fall day in Charlotte, North Carolina. I am sipping a cup of English Breakfast tea with a cinnamon stick and a bit of orange peel in it. I am also munching on a Biscotti. It goes really well with the tea. One of the most common questions I get from people who are learning Windows PowerShell, is in regards to adding comments to their scripts. I have found lots of people who add lots of comments and even more people who add no comments ...

PowerTip: Use PowerShell to Find Windows Version
Nov 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Windows Version

Doctor Scripto

Summary: Use Windows PowerShell to find what version of Windows you are running.  How can I use Windows PowerShell to find the version of Windows that is installed on a group of computers?            To be safe, I need the command to be compatible with Windows PowerShell  2.0.  Use the Get-WmiObject cmdlet and query the Win32_OperatingSystem WMI class: (Get-WmiObject win32_operatingsystem).version

Weekend Scripter: Install PowerShell 4.0 in Windows 7
Nov 9, 2014
Post comments count 1
Post likes count 0

Weekend Scripter: Install PowerShell 4.0 in Windows 7

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about upgrading Windows PowerShell 2.0 to Windows PowerShell 4.0 in Windows 7. Hello everyone. The Scripting Wife, here. The Scripting Guy is off reading a book—I think it may be Rob Roy by Walter Scott, but I am not sure. He seems to be on a Walter Scott kick lately. I have little interest in a book that has to come in two or more volumes, so I was looking over the recent Hey, Scripting Guy! Blog posts about upgrading to Windows PowerShell 4.0. I realized that the Scripting Guy had forgotten to say exactly how to upgrade. I mean, really. Like every...

PowerTip: Save Offline Version of PowerShell Help
Nov 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Save Offline Version of PowerShell Help

Doctor Scripto

Summary: Learn how to save Windows PowerShell Help into offline files.  How can I get the files to update Windows PowerShell Help on my servers that are inside a            screened subnet and do not have direct access to the Internet?  Use the Save-Help Windows PowerShell cmdlet, and specify a shared location for the            downloaded files on a computer that does have access to the Internet, for example: Save-Help -Module * -DestinationPath C:\Shared\UpdateHelp

Weekend Scripter: Use PowerShell to Update Help on Remote Servers
Nov 8, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Update Help on Remote Servers

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to update Windows PowerShell Help on remote servers. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about any version of Windows PowerShell is the Help that comes with the product. Having access to Get-Help is great whether I am working on a server or a workstation. I will admit that even having worked with Windows PowerShell as long as I have, I do not remember every cmdlet, every nuance, every switch and parameter available. I don’t think anyone does. This greatness is actually a double-edged sword. Beg...

PowerTip: Use PowerShell to Find MAC Address
Nov 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find MAC Address

ScriptingGuy1

Summary: Easily find your MAC address with Windows PowerShell.  How can I use Windows PowerShell to find the MAC address on my computer?  Use the Getmac command-line reference. -or- Use WMI, for example: Get-WmiObject win32_networkadapterconfiguration | select description, macaddress Get-CimInstance win32_networkadapterconfiguration | select description, macaddress 

What It Means to Be a PowerShell MVP
Nov 7, 2014
Post comments count 0
Post likes count 0

What It Means to Be a PowerShell MVP

ScriptingGuy1

Summary: Four Windows PowerShell MVPs share what the title means to them. Microsoft Scripting Guy, Ed Wilson, is here. The MVP Summit is over. Many MVPs began their long trek home last night. Others decided to remain overnight or even over the weekend before heading home. From the feedback I have received, one thing is for sure, this year's MVP Summit was one of the best ever. The big question is, "Why?" Why do the MVPs do what they do? I mean, they have to pay for their own travel to come to the Summit. They have to share a room (or pay for their half of a room). And to be honest, it is a long, brutal schedule o...

PowerTip: Find All PowerShell MVPs
Nov 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Find All PowerShell MVPs

Doctor Scripto

Summary: Learn how to find all of the Windows PowerShell MVPs.  How can I find a list of all of the Windows PowerShell MVPs?  Use the search engine on the MVP site with the PowerShell Technical expertise filter: Find an MVP.

A Day in the Life of MVPs at the Summit
Nov 6, 2014
Post comments count 0
Post likes count 0

A Day in the Life of MVPs at the Summit

Doctor Scripto

Summary: Windows PowerShell MVPs, Sean Kearney, Steve Murawski, and Shane Hoey, talk more about the MVP Summit. An update from Sean... The last day of the MVP Summit is upon us. Aside from of all of the NDA goodie events, many really cool things happen outside of the MVP Summit sessions. Evening events and exploring downtown Bellevue—sure, there’s fun there. But I truly look forward to this Summit every year. First I get to spend a whole week at Microsoft’s head office (which, if you’re a complete nerd like me, is way too cool—it is truly “Disneyland for Nerds”). I notic...

PowerTip: Wait for PowerShell Job to Complete
Nov 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Wait for PowerShell Job to Complete

Doctor Scripto

Summary: Learn how to wait for a Windows PowerShell job to complete.  How can I use Windows PowerShell to wait for a job that I have run to complete?  Use the Wait-Job cmdlet, and specify the job ID, for example: Wait-Job –ID 5

Remotely Run a PowerShell Workflow
Nov 5, 2014
Post comments count 0
Post likes count 0

Remotely Run a PowerShell Workflow

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about running a Windows PowerShell workflow on a remote computer. Microsoft Scripting Guy, Ed Wilson, is here. This morning it is beautiful outside. I am sitting on the porch sipping a cup of English Breakfast tea. I made a pot this morning, and I added some orange peel, Meyer lemon, and a bit of hibiscus flower to give it a nice tangy flavor. The Scripting Wife is still at the MVP Summit in Seattle, so I had to head to a local bakery to score some scones for breakfast. I found some really nice cinnamon scones, but they also had cinnamon sugar drizzled over the t...

PowerTip: Find Help about Specific PowerShell Parameter
Nov 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Help about Specific PowerShell Parameter

Doctor Scripto

Summary: Learn how to find Help about a specific Windows PowerShell parameter.  How can I easily find what values a specific Windows PowerShell cmdlet accepts?  Use the Get-Help cmdlet and specify the cmdlet name and parameter, for example: get-help Restart-Computer -Parameter for

MVP Summit–First Day Reports
Nov 4, 2014
Post comments count 0
Post likes count 0

MVP Summit–First Day Reports

mredwilson

Summary: Windows PowerShell MVPs share their Summit experiences. Here is a report Windows PowerShell MVP, Steve Murawski The MVP Summit is one of my favorite times of the year despite the fact that [MVP.Summit] -notcontains 'Sleep'. Why is the Summit one of my favorite times? Well, I'll tell you. First, you have a thousand or two zealous community members (more on that in a second) descend on Bellevue, Washington. It is almost guaranteed that you'll spend time talking to MVPs in other product areas and start learning bits and pieces about what is happening in their area of focus. The differen...

Uninstalling the PowerShell ISE by Using a Workflow
Nov 4, 2014
Post comments count 0
Post likes count 0

Uninstalling the PowerShell ISE by Using a Workflow

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about removing a Windows feature by using a Windows PowerShell workflow. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of Sencha green tea. I happened to have some lying around and I decided I would go ahead and drink it this morning. I added a bit of fresh lemon and half a stick of cinnamon to the cup. It is quite good, if a bit understated. Normally, I would have green tea in the afternoon, but like I said, this morning I happened to have some lying around, so I thought, "Why not?" There are, in fact, several times when I say, "W...

PowerTip: Find Information about Started Virtual Machine
Nov 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Information about Started Virtual Machine

Doctor Scripto

Summary: Use Windows PowerShell to find detailed information about a started virtual machine.  I use the Start-VM cmdlet on my computer running Hyper-V, but how can I use Windows PowerShell            to find more information about the virtual machine that actually starts?  Use the –PassThru parameter to return a virtual machine information object. Store the returned            object in a variable, and then use Windows PowerShell to parse that variable. Here is an example: $vm = Start-VM –name c1 –passthru...

The MVP Summit–Posting 1
Nov 3, 2014
Post comments count 0
Post likes count 0

The MVP Summit–Posting 1

mredwilson

Summary: Windows PowerShell MVPs, Teresa Wilson and Richard Siddaway, provide initial impressions fromthe MVP Summit. Hello everyone. This is Teresa. My flight was uneventful. Actually, it was better than uneventful because I was able to get upgraded. At least, my flight was only about five hours—and not like the 28 hours reported by some MVPs on Facebook. Well, I have been here in Seattle for a couple of days. I came a bit early so I could spend some time with friends. My flight in was largely uneventful, except that Dr. Scripto, who is traveling with me, got stopped at the airport. It happens to him a lot...

Use PowerShell to Start or Stop Virtual Machines in Order
Nov 3, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Start or Stop Virtual Machines in Order

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using a Windows PowerShell workflow to start or stop virtual machines in a specific order. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sitting outside enjoying a beautiful fall day. I found a little coffee and tea shop nearby, so I am sitting outside sipping a nice cup of English Breakfast tea and munching an apple cinnamon scone. It is not too bad actually. Of course, the little coffee and tea shop has WiFi, so I have my Surface 3 Pro with me, and I am checking email sent to scripter@microsoft.com. I ran across an email from a perso...

PowerTip: Use PowerShell to Query Cluster Shared Volumes' Free Space
Nov 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Query Cluster Shared Volumes' Free Space

Doctor Scripto

Summary: Learn how to use Windows PowerShell to query for free space in Cluster Shared Volumes. How can I use Windows PowerShell to find the free space in all my Cluster Shared Volumes for Hyper-V in            Windows Server 2012 R2 or Windows Server 2012? Use the Get-ClusterSharedVolume cmdlet with the –Cluster parameter and your Hyper-V cluster name.            Loop through each cluster shared volume and output a Windows PowerShell custom object to the pipeline.            The foll...

Weekend Scripter: Simplify to Troubleshoot PowerShell Script
Nov 2, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Simplify to Troubleshoot PowerShell Script

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, helps an old friend fix his script. Microsoft Scripting Guy, Ed Wilson, is here. I am a big believer in simplicity. I enjoy simple things: a nice cup of hot tea, reading a good book, watching a sunset on the beach, taking a train ride through the Alps, or spending an evening conversing with friends. Simplicity is one of the things I like about Windows PowerShell. It can take a complex operation and make it simple. Desire State Configuration (DSC) is one such tool. When I see a Windows PowerShell script that is complex, I naturally begin to look at it to see if there ar...

PowerTip: Use PowerShell to Find Module to Import
Nov 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Module to Import

Doctor Scripto

Summary: Use Tab expansion in Windows PowerShell to find a module to import.  I know I need the full name of a specific Windows PowerShell module to import it, but I am not sure of the            complete name, and I do not want to do a lot of typing. The module exists in a known Windows            PowerShell module location. How can I quickly find the module name?  Use Tab expansion with the Import-Module cmdlet. You only need to know the first letter            of the module, then you can tab through th...

Weekend Scripter: Announcing WMI Explorer 2.0
Nov 1, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Announcing WMI Explorer 2.0

Doctor Scripto

Summary: Microsoft senior support escalation engineer, Vinay Pamnani, talks about WMI Explorer 2.0. Microsoft Scripting Guy, Ed Wilson, is here. Today I am pleased to invite back Microsoft senior support escalation engineer, Vinay Pamnani, who supports Configuration Manager. He's here to talk about the latest edition of his WMI Explorer tool. Take it away Vinay... I’m excited to announce that WMI Explorer 2.0 is now available for download from CodePlex: WMI Explorer. Special thanks to Tim Helton for his guidance and support. Requirements: New features include:  ...

PowerTip: Export Certificate by Using PowerShell
Oct 31, 2014
Post comments count 0
Post likes count 0

PowerTip: Export Certificate by Using PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to export a certificate.  How can I use Windows PowerShell to export a certificate?  Use the Export-Certificate cmdlet and specify the file output destination. By default it will export a file            of the type Cert. Here is an example: Export-Certificate -Cert (Get-Item Cert:\CurrentUser\My\3EF2) -FilePath c:\fso\mycert.cert

AutomatedLab Tutorial Series Part 6:  Install Software and Run Custom Activities
Oct 31, 2014
Post comments count 0
Post likes count 0

AutomatedLab Tutorial Series Part 6: Install Software and Run Custom Activities

Doctor Scripto

Summary: Microsoft PFEs, Raimund Andree and Per Pedersen, explain how to customize your existing environment and install software to some or all machines in your lab. Microsoft Scripting Guy, Ed Wilson, is here. Today is Part 6 of a series written by Microsoft PFEs Raimund Andree and Per Pedersen. Read their previous posts here: In the previous blog posts, you learned how easy it is to create complex lab environments by using AutomatedLab. This post explains how to customize your existing environment and install software to some or all machines in the lab. Installation If you have a version of A...

PowerTip: Use PowerShell to Import Certificate
Oct 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Import Certificate

Doctor Scripto

Summary: Use Windows PowerShell to import a certificate.  How can I use Windows PowerShell to automate the installation of a certificate?  Use the Import-Certificate cmdlet, and specify the certificate store location and the path to            the certificate file, for example: Import-Certificate –filepath c:\fso\mycert.cert –certStorelocation cert:\currentuser\my

AutomatedLab Tutorial Series Part 5: Install CA Two-Tier Hierarchy for PKI
Oct 30, 2014
Post comments count 0
Post likes count 0

AutomatedLab Tutorial Series Part 5: Install CA Two-Tier Hierarchy for PKI

Doctor Scripto

Summary: Microsoft PFEs, Raimund Andree and Per Pedersen, talk about using Windows PowerShell to automate the deployment of a PKI environment as it would typically be deployed in a production environment. Microsoft Scripting Guy, Ed Wilson, is here. Today is Part 5 of a series by Microsoft PFEs, Raimund Andree and Per Pedersen. Read their previous posts here: Following up on Part 4, this post explains how to deploy a public key infrastructure (PKI) environment as it would typically be deployed in a production environment. The PKI environment will be deployed using two servers. One server will be a root...

PowerTip: Troubleshoot Get-VM Cmdlet
Oct 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Troubleshoot Get-VM Cmdlet

Doctor Scripto

Summary: Learn about a quick troubleshooting tip for the Get-VM cmdlet.  I am using the Get-VM cmdlet to find information about virtual machines on my local laptop, but it does not            appear to do anything. What could be the matter?  The Get-VM cmdlet must be run with Admin permissions. But unfortunately, it does not tell you that when            run in a non-elevated Windows PowerShell console. To launch the Windows PowerShell console with            Admin permissions, right-c...

AutomatedLab Tutorial Series Part 4: Install a Simple PKI Environment
Oct 29, 2014
Post comments count 0
Post likes count 0

AutomatedLab Tutorial Series Part 4: Install a Simple PKI Environment

Doctor Scripto

Summary: Learn how to easily deploy a PKI environment by using AutomatedLab. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back Microsoft PFEs, Raimund Andree and Per Pedersen, and their series about AutomatedLab. Read their previous posts here: This blog post shows how to use AutomatedLab to easily deploy a public key infrastructure (PKI) environment. The PKI environment will be a single server, which is installed with the certification authority (CA) role. Subsequently, you will be able to request and issue certificates to all computers and users in your lab. Also, if you want to sign Windows Pow...

PowerTip: Use PowerShell to Take Snapshot of Virtual Machine
Oct 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Take Snapshot of Virtual Machine

Doctor Scripto

Summary: Use Windows PowerShell to take a snapshot of a virtual machine prior to making changes.  How can I use Windows PowerShell to take a snapshot of a virtual machine prior to making changes to it?  Use the CheckPoint-VM cmdlet, for example: Checkpoint-VM -Name DC1 -SnapshotName BeforeUpdate

AutomatedLab Tutorial Part 3: Working with Predefined Server Roles
Oct 28, 2014
Post comments count 0
Post likes count 0

AutomatedLab Tutorial Part 3: Working with Predefined Server Roles

Doctor Scripto

Summary: Learn how to predefine server roles and switch the operating system to Windows 10 Technical Preview in your AutomatedLab environment. Microsoft Scripting Guy, Ed Wilson, is here. Today brings us Part 3 in a series by Microsoft PFEs, Raimund Andree and Per Pedersen. The last blog post explained how to create a small lab environment using AutomatedLab. This post explains how to extend the lab you created by predefining server roles and switching the operating system to Windows 10 Technical Preview. To catch up, read: Installation If you have a version of AutomatedLab that is earlier than Automated...

PowerTip: Create System Restore Point by using PowerShell
Oct 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Create System Restore Point by using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to quickly create a system restore point.  How can I use Windows PowerShell to roll back the settings if the changes I make mess up my computer?  Open the Windows PowerShell console with Admin rights, and use the Checkpoint-Computer cmdlet.            Specify a good description of the checkpoint and the restore point type, for example: Checkpoint-Computer -Description 'everything fine' -RestorePointType modify_settings

AutomatedLab Tutorial Part 2: Create a Simple Lab
Oct 27, 2014
Post comments count 0
Post likes count 1

AutomatedLab Tutorial Part 2: Create a Simple Lab

Doctor Scripto

Summary: Learn how to create a small lab environment by using AutomatedLab. Microsoft Scripting Guy, Ed Wilson, is here. Today we have Part 2 of the series by Microsoft PFEs, Raimund Andree and Per Pedersen. Today they talk about installing the Windows PowerShell modules to use with AutomatedLab, and the steps required to create a simple lab. If you follow along, you will have AutomatedLab installed on your Hyper-V host and a lab set up with two machines. Note  Before you read this post, you might benefit from reading AutomatedLab Tutorial Part 1: Introduction to AutomatedLab. Installation The install...

PowerTip: Find Syntax of PowerShell Cmdlet
Oct 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Syntax of PowerShell Cmdlet

Doctor Scripto

Summary: Easily find the syntax of a Windows PowerShell cmdlet.  How can I use Windows PowerShell to see the syntax of a cmdlet I want to use?  Use the Get-Command cmdlet (gcm is an alias) with the –Syntax switch, for example: gcm Checkpoint-Computer -Syntax

AutomatedLab Tutorial Part 1: Introduction to AutomatedLab
Oct 26, 2014
Post comments count 0
Post likes count 0

AutomatedLab Tutorial Part 1: Introduction to AutomatedLab

Doctor Scripto

Summary: Microsoft PFEs, Raimund Andree and Per Pedersen, present a multipart series about using Windows PowerShell to deploy a solution called AutomatedLab. Microsoft Scripting Guy, Ed Wilson, is here. Today we kick off a multiple part series about automated lab deployment by using Windows PowerShell. Written by two Microsoft premier field engineers, Raimund Andree and Per Pedersen, this series focuses on lots of good stuff, and it culminates with a way cool Windows PowerShell script. This is a series you do not want to miss. Raimund Andree I am a premier field engineer working for Microsoft Customer Services a...

PowerTip: Test Connectivity to Remote Servers without Ping
Oct 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Test Connectivity to Remote Servers without Ping

Doctor Scripto

Summary: Use Windows PowerShell to test connectivity to remote servers without using Ping.  How can I test connectivity to remote servers to ensure my Windows PowerShell scripts will work if I            have the Packet Internet Grouper (PING) blocked at the firewall?  Use Test-WsMan, for example: 's1','s2' | % {Test-Wsman $_}

Weekend Scripter: Team Talk About Why to Upgrade to PowerShell 4.0
Oct 25, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Team Talk About Why to Upgrade to PowerShell 4.0

Doctor Scripto

Summary: Windows PowerShell program manager, John Slack, talks about upgrading to Windows PowerShell 4.0. Microsoft Scripting Guy, Ed Wilson, is here. Today we have John Slack, a program manager in the Windows PowerShell team as our guest blogger... Do you use the version of Windows PowerShell that ships with your operating system? Do you wonder if you should make the jump and install Windows PowerShell 4.0 or try out Windows PowerShell 5.0 Preview? Here’s the short answer: I think you should. Want more of an explanation? At a high level, I see the following benefits to updating: New feat...

PowerTip: Use PowerShell to Keep Servers Correctly Configured
Oct 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Keep Servers Correctly Configured

Doctor Scripto

Summary: How do I keep my servers configured correctly?  I can write Windows PowerShell scripts to configure my machines, but how do I enforce these configurations            after the script has finished?  This situation is called "configuration drift." You’ve set up your server properly, and then over time,            little changes are made that lead to an unknown production state. To manage configuration drift,            use Desired State Configuration (DSC).           ...

Number 1 Reason to Upgrade to PowerShell 4.0: Desired State Configuration
Oct 24, 2014
Post comments count 0
Post likes count 0

Number 1 Reason to Upgrade to PowerShell 4.0: Desired State Configuration

Doctor Scripto

Summary: Windows PowerShell MVP, Dave Wyatt, says the number 1 reason to upgrade to Windows PowerShell 4.0 is Desired State Configuration. Microsoft Scripting Guy, Ed Wilson, is here. Today, Dave Wyatt, is back to share his ideas about upgrading to Windows PowerShell 4.0. Dave is a Microsoft MVP (Windows PowerShell) and a member of the board of directors at PowerShell.org. He works in IT, mainly focusing on automation, configuration management, and production support of Windows Server and point-of-sale systems for a large retail company. Blog: Dave Wyatt's BlogTwitter: @MSH_Dave When I got an email...

My Path to a PowerShell 4.0 Upgrade
Oct 23, 2014
Post comments count 0
Post likes count 0

My Path to a PowerShell 4.0 Upgrade

Doctor Scripto

Summary: Microsoft IIS MVP, Terri Donahue, talks about her path to upgrading to Windows PowerShell 4.0. Microsoft Scripting Guy, Ed Wilson, is here. Welcome new guest blogger, Terri Donahue. Microsoft IIS MVP, Terri Donahue is a systems administrator who has been supporting Internet Information Services (IIS) since version 4.0. Through the years, she has had extensive hands-on experience with many web servers including Lotus Domino, Apache, and of course, IIS. She has a passion for helping people solve technology-related problems. She is focusing on improving her Windows PowerShell skills. She regularly...

PowerTip: Use PowerShell 4.0 Where Operator to Filter
Oct 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell 4.0 Where Operator to Filter

Doctor Scripto

Summary: Use Windows PowerShell 4.0 Where operator to filter results.  How can I use a Where operator in Windows PowerShell (without using the pipeline or Where-Object)            to filter through processes?  Use Get-Process  to group the processes into a collection, then use the Where operator            and filter on the process name, for example: (Get-process).Where({$_.ProcessName -eq 'winlogon'})

Practical Reasons for Upgrading to PowerShell 4.0
Oct 22, 2014
Post comments count 0
Post likes count 0

Practical Reasons for Upgrading to PowerShell 4.0

Doctor Scripto

Summary: Guest blogger and Windows PowerShell MVP, Jeff Wouters, provides several practical reasons for upgrading to Windows PowerShell 4.0. Microsoft Scripting Guy, Ed Wilson, is here. Today we continue our “Why Upgrade to Windows PowerShell 4.0” series with a guest blog post written by Jeff Wouters. Jeff is a Windows PowerShell MVP in the Netherlands, and he is a cofounder of the Dutch PowerShell User Group. Not only that, he is a great guy and a good friend to the Scripting Wife and me. Take it away Jeff... When you are considering upgrading to a new version of Windows PowerShell and remaining on t...

PowerTip: Replace Characters in String that Is Not Part of Group
Oct 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Replace Characters in String that Is Not Part of Group

Doctor Scripto

Summary: Use Windows PowerShell to replace all characters in a string that is not part of a group. How can I use Windows PowerShell to remove all the non-alphabetic characters in the following string?           (The single quotation marks are not part of the string.)'({Abcde})' Create a regular expression pattern (character group) that includes the alphabetic characters a – z and A – Z,            and use the "not in character group" operator (^) at the beginning of the pattern. Use the Windows PowerShell       &...

Upgrade to PowerShell 4.0 Because It Is Easier to Use
Oct 21, 2014
Post comments count 0
Post likes count 0

Upgrade to PowerShell 4.0 Because It Is Easier to Use

Doctor Scripto

Summary: Microsoft PowerShell MVP, Teresa Wilson (aka Scripting Wife), talks about upgrading to Windows PowerShell 4.0 because it is easier to use. Microsoft Scripting Guy, Ed Wilson, is here. Today I continue my series of posts about upgrading to Windows PowerShell 4.0 by turning over the keyboard to Windows PowerShell MVP, Teresa Wilson. Teresa is also known as the Scripting Wife, and she is active in the Windows PowerShell community with events such as PowerShell Saturday, PowerShell User Groups, and PowerShell.org. Take it away Teresa... Hi everyone. Teresa, aka Scripting Wife, is here. I know that ...

PowerTip: Determine PowerShell Version on Your System
Oct 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Determine PowerShell Version on Your System

Doctor Scripto

Summary: Learn how to determine the version of Windows PowerShell installed on your system. How can I discover the version of Windows PowerShell that is installed on a particular system?   Use the $psversiontable built-in variable to get a display such as this:Name                           Value----                           -----PS...

Should I Upgrade to Latest Windows PowerShell Version?
Oct 20, 2014
Post comments count 0
Post likes count 0

Should I Upgrade to Latest Windows PowerShell Version?

Doctor Scripto

Summary: Richard Siddaway discusses the issues around upgrading your version of Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today's post is provided by Richard Siddaway... Richard is based out of the UK and spends his time automating anything, and everything, for Kelway, Ltd. A 7-year Windows PowerShell MVP, Richard is a prolific blogger, mainly about Windows PowerShell, (Richard Siddaway's Blog: A PowerShell MVPs site) and a frequent speaker at user groups and Windows PowerShell conferences. He has written a number of Windows PowerShell books: Windows PowerShell in Practice, Windows PowerShe...

PowerTip: Get PowerShell Module by Using –FullyQualifiedName Parameter
Oct 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Get PowerShell Module by Using –FullyQualifiedName Parameter

Doctor Scripto

Summary: Learn how to get a specific Windows PowerShell module by using the –FullyQualifiedName parameter.  How can I look at the specific version of a Windows PowerShell module?  In Windows PowerShell 4.0, you can do this by using the –FullyQualifiedName parameter of the            Get-Module cmdlet. You specify a hash table that contains the name and version of the module            (you can also use the GUID). Here is an example using my Windows PowerShell ISE module: Get-Module –FullyQualifiedName ...

Weekend Scripter: Why Upgrade to PowerShell 4.0?
Oct 19, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Why Upgrade to PowerShell 4.0?

Doctor Scripto

Summary: Microsoft Scripting Guy Ed Wilson talks about why to upgrade to Windows PowerShell 4.0 Microsoft Scripting Guy, Ed Wilson, is here. I am kicking off a week of posts that are written by Windows PowerShell MVPs, a member of the product group, and myself, in which we are going to talk about upgrading to Windows PowerShell 4.0. For each of us, the reasons vary a bit. Why is this important? The short answer is that Windows PowerShell is a crucial technology from Microsoft, and it is central to our management strategy. With the shift to the cloud, Windows PowerShell takes on an even greater role in manage...

PowerTip: Find Errors Related to Update-Help
Oct 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Errors Related to Update-Help

Doctor Scripto

Summary: Use Windows PowerShell to find errors related to Update-Help.  How can I use Windows PowerShell to find if Update-Help is completing successfully on my computer?  Use the Get-WinEvent cmdlet and search Windows PowerShell logs for event 4103 and a status level of 2 (error).            You can narrow the results by adding a start time. When you find the events, use Select-Object and the            –ExpandProperty parameter to expand the message field. Here is a command that looks for err...

Weekend Scripter: Why Learn PowerShell?
Oct 18, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Why Learn PowerShell?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about why to learn Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Every once in a while, I am asked, “Why should I learn Windows PowerShell?” To be honest, that is always a bit of a troublesome question. Not because I cannot answer it, but because to me the question is nearly irrelevant. I will confess that I love using Windows PowerShell. I use it every day, and when I am not using it, I am actually thinking about it. Recently, I was getting dressed to head out to the gym, and a Windows PowerShell command popped into my head. I call...

PowerTip: Change the PowerShell Prompt
Oct 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Change the PowerShell Prompt

Doctor Scripto

Summary: Learn how to shorten the Windows PowerShell prompt. I am concerned that the Windows PowerShell prompt is becoming too long when working with the registry or the            file system, and I would like to shorten it. Change the prompt with the following one-liner (remember to add a space at the end of the prompt            for reading ease):Function prompt {“My Prompt “}When you close Windows PowerShell, the prompt returns to the original configuration.Note  Today's PowerTip is supplied by Windows PowerShell MVP, ...

PowerTip: Use PowerShell to Remove Characters in a String
Oct 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Remove Characters in a String

Doctor Scripto

Summary: Learn how to use Windows PowerShell to remove specific characters in a string. I have a string that includes braces:$a = '{Abcde}'   I want to remove the braces, but keep the text string inside the braces.    How can I do this by using Windows PowerShell? Use the –Replace operator, create a regular expression pattern that includes only the braces you want to remove,            and then write the results back to the variable, for example:PS C:> $a = '{Abcde}'PS C:> $a -replace '[{}]',''abcdePS C:> $a = $a -replace '[{}]',...

PowerTip: Check Status of PowerShell Help Files on Remote Computers
Oct 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Check Status of PowerShell Help Files on Remote Computers

Doctor Scripto

Summary: Use Windows PowerShell to check the status of Help file updates on remote computers.  How can I easily see if the Windows PowerShell Help files are up-to-date on my remote computers?  Use the Invoke-Command cmdlet, target the remote computers, use Get-Help to look for help,            and then use the Select-String cmdlet to search for “Cannot find the Help files” in the output.            Here is an example (this is a single-line command broken at the pipeline character for readability): Invok...

PowerTip: Use PowerShell to See If WinRM Is Running on Remote Computer
Oct 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to See If WinRM Is Running on Remote Computer

Doctor Scripto

Summary: Learn how to easily use Windows PowerShell to check if WinRM is running on a remote computer.  How can I use Windows PowerShell to ensure that WinRM is running and configured on my three remote computers?  Create an array of computer names, and pipe them to the Test-WsMan cmdlet, for example: "s1","s2","dc1" | % { Test-WSMan $_ } Note  % is an alias for the Foreach-Object cmdlet.

PowerTip: Check Version of PowerShell
Oct 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Check Version of PowerShell

Doctor Scripto

Summary: Learn how to check your version of Windows PowerShell.  How can I find what version of Windows PowerShell my computer is running?  Use the automatic $PSVersionTable variable, and check the PSVersion property, for example: $PSVersionTable.PSVersion

PowerTip: Find Name of PowerShell Host
Oct 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Name of PowerShell Host

Doctor Scripto

Summary: Learn to find the name of the Windows PowerShell host.  How can I determine if I am running a Windows PowerShell script in the Windows PowerShell console?  Use the Get-Host cmdlet. Here is how to check:   if((Get-Host).name -ne "consolehost") {"Take appropriate action here"}

Weekend Scripter: Glimpse into the PowerShell Future
Oct 12, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Glimpse into the PowerShell Future

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the future of Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. I don’t know about you, but I “got into IT” because I am easily bored. I don’t mean that I have a short attention span, because I don’t. I can be laser focused when I am working on a problem—and that focus can remain for days, even weeks or months, if need be. But when I have solved a problem, well, then I am no longer interested. That is one reason I loved being a consultant. I was always faced with more problems to solve—larger challeng...

PowerTip: Use PowerShell to Display Number Grouping and Control Decimal Places
Oct 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Number Grouping and Control Decimal Places

Doctor Scripto

Summary: Use Windows PowerShell to display number grouping and control the number of displayed decimal places.  How can I use Windows PowerShell to group digits and control the number of decimal places in a large number?  Use the Numeric Format Specifier, and specify the number of required decimal places. Here are a few examples: PS C:\> (1000*1000).tostring("N") 1,000,000.00 PS C:\> (1000*1000).tostring("N1") 1,000,000.0 PS C:\> (1000*1000).tostring("N3") 1,000,000.000

Weekend Scripter: Use PowerShell to Calculate and Display Percentages
Oct 11, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Calculate and Display Percentages

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to calculate and display percentages. Microsoft Scripting Guy, Ed Wilson, is here. This morning, I am sipping a cup of red berry tea. It is tangy and refreshing. I will admit that I cheated. I used our machine. Boom! 90 seconds later it was done. I guess I could actually do that in my sleep. Of course, I do not make tea in my sleep, but I do sometimes write Windows PowerShell script while I am dozing. When this happens, I need to get to work quickly—before I forget what I was thinking about. In Windows 8.1, Windows 8, Win...

PowerTip: Use PowerShell to Get SSL Certificate
Oct 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get SSL Certificate

Doctor Scripto

Summary: Learn how to use Windows PowerShell to get an SSL certificate from an internal certification authority.  How can I use Windows PowerShell to get an SSL certificate from an internal certification authority (CA)            and import it to my web server's local certificate store?  Use the Get-Certificate cmdlet, specify the template, the DNS name, subject, and store location, for example           (this is a one-line command broken to fit on the webpage): Get-Certificate -Template WebServer -DnsName "webserver.contoso...

Use PowerShell to Identify When Hotfixes Are Installed
Oct 10, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Identify When Hotfixes Are Installed

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to list when hotfixes are installed.  Hey, Scripting Guy! Our corporate security person has tasked my manager with finding out about the number of hotfixes released by Microsoft each month. My manager, of course, passed the buck to me. I think I could probably find the information on the Internet—but dude, I really do not believe everything I read on the Web. Instead, I was wondering if I could find this information from my local system by using Windows PowerShell. By the way, I am running Windows 8.1 with all of the...

PowerTip: Empty Hash Table with PowerShell
Oct 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Empty Hash Table with PowerShell

Doctor Scripto

Summary: Learn how to easily empty a hash table by using Windows PowerShell.  I want to write new values to a hash table, and I want to ensure that it contains none of the original keys or values.            How can I accomplish this task without deleting and re-creating the hash table?  Use the Clear method from the hash table object, for example: PS C:\> $a = @{a=1;b=2;c=3}  PS C:\> $a.Clear()

Convert a Script to a PowerShell Function
Oct 9, 2014
Post comments count 0
Post likes count 0

Convert a Script to a PowerShell Function

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about converting a script to a Windows PowerShell function. Microsoft Scripting Guy, Ed Wilson, is here. When I have a script that I think I will use more than once or twice, it often makes sense for me to convert it to a function. If it is something I will use on a regular basis, I might add that function to my Windows PowerShell profile, or I might put it into a module so that it is easily accessible. In fact, one of my major challenges (having written nearly 1,500 Windows PowerShell scripts) is finding and reusing scripts I wrote several years ago. Funct...

PowerTip: Use PowerShell to Find Information about Object Properties
Oct 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Information about Object Properties

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find information about object properties.  How can I use Windows PowerShell to look at information about the properties of an object stored in a variable?  Use the PSObject property, and look at the Properties collection, for example: $a = @{} $a.psobject.properties

Extend the Encode/Decode PowerShell Script
Oct 8, 2014
Post comments count 0
Post likes count 0

Extend the Encode/Decode PowerShell Script

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about extending his ASCII encode/decode Windows PowerShell script. Microsoft Scripting Guy, Ed Wilson, is here. I am a huge advocate of learning by playing around. Maybe that is why I did such a good job back when I was in kindergarten—and why I had such a tough time in high school. Who knows... Anyway, what have I learned from playing around with hash tables and doing a simple ASCII lookup and replace? Note  This is an extension of my previous posts on the subject. Before you read today's post, you should read Automatically Create Hash Table...

PowerTip: Put Array of Letters Back into a Word with PowerShell
Oct 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Put Array of Letters Back into a Word with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to put an array of letters back together to form a word.  I split a word by converting it to a chararray, and now I want to put it back together.            How can I use Windows PowerShell to do this?  Use the –Join operator to put the characters back together. To convert it back to a string,            add the ToString method, for example: $a = "dog".ToCharArray()  ($a -join '').tostring() 

Converting Words to ASCII Numbers and Back with PowerShell
Oct 7, 2014
Post comments count 0
Post likes count 0

Converting Words to ASCII Numbers and Back with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to convert words to ASCII numbers and back again. Microsoft Scripting Guy, Ed Wilson, is here. Today, I am sipping a nice cup of Earl Grey tea with just a little jasmine in it. Along with a cinnamon stick, it is a nice mellow cup. I am checking my email sent to scripter@microsoft.com on my Surface Pro 3, and playing around with Windows PowerShell. I thought it would be fun to open the project I started yesterday when I created a couple of hash tables. Note  Today’s post continues yesterday's post: Automatically Create Hash Tables and Reverse Value with PowerShe...

PowerTip: Break a Word into Letters with PowerShell
Oct 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Break a Word into Letters with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to break a word into letters.  How can I use Windows PowerShell to break a word into letters?  Use the tochararray method, for example: “dog”.tochararray()

Automatically Create Hash Tables and Reverse Values
Oct 6, 2014
Post comments count 0
Post likes count 0

Automatically Create Hash Tables and Reverse Values

Doctor Scripto

Summary: Learn how to automatically create hash tables and reverse keys and values. Microsoft Scripting Guy, Ed Wilson, is here. The other day, I was playing around with Windows PowerShell, and thought I would create a couple of hash tables automatically. One hash table would contain all of the lowercase ASCII letters in the order of ASCII value, then lowercase letter. The other would reverse the order, and contain the lowercase letters first, and then the ASCII value. I could then use the hash tables as look-up tables for making automatic conversions. As I said, I was playing around with these things, and I real...

PowerTip: View All Values of an Enum
Oct 5, 2014
Post comments count 0
Post likes count 0

PowerTip: View All Values of an Enum

Doctor Scripto

Summary: Boe Prox shows how to view all values of an enum. How can I view all of the available values of an enum? Use the [Enum]::GetNames() method, for example:PS C: > [Enum]::GetNames([System.ConsoleColor])BlackDarkBlueDarkGreenDarkCyanDarkRedDarkMagentaDarkYellowGrayDarkGrayBlueGreenCyanRedMagentaYellowWhite

Weekend Scripter: Give Your PowerShell Console a Glassy Theme
Oct 5, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Give Your PowerShell Console a Glassy Theme

Doctor Scripto

Summary: Boe Prox shows how to give the Windows PowerShell console a glass-like look. Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. Have you ever sat at your desk while working in the Windows PowerShell console and thought, “Wouldn’t it be great if this console had a more unique look? Perhaps something like a glassy look?” Well, if that is the case, then you are in luck! I am going to take you through the process of turning your Windows PowerShell console into a glassy console. It may not improve your scripting, but at least it will make others ta...

PowerTip: Find How Many Scripts Use Write-Host
Oct 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Find How Many Scripts Use Write-Host

Doctor Scripto

Summary: Use Windows PowerShell to find how many scripts use the Write-Host cmdlet.  I am trying to improve how I write Windows PowerShell scripts, and I want to reduce the number of times I use            Write-Host. How can I find how many times I used this cmdlet in my scripts?  Use the Get-ChildItem cmdlet to retrieve all .ps1 files from your script directory. Then pipe the FileInfo objects            to the Select-String cmdlet and look for the pattern Write-Host. Use the Quiet sw...

Weekend Scripter: Change PowerShell Get-Help to Display Examples
Oct 4, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Change PowerShell Get-Help to Display Examples

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about changing the Get-Help cmdlet so it always displays examples. Microsoft Scripting Guy, Ed Wilson, is here. For the last several weeks, I have been working on a project at work. The documentation team talked to customers to see how they were using Windows PowerShell, and to see how and when they used Help. The project has been a lot of fun, and it has been very interesting. The other day, we were discussing the results of the survey we conducted, and one of the managers mentioned that one customer said that he wished when he typed Get-Help, it would always di...

PowerTip: Change Color of PowerShell Errors
Oct 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Change Color of PowerShell Errors

Doctor Scripto

Summary: Learn how to change the color of Windows PowerShell errors.  How can I change the color of Windows PowerShell errors in the Windows PowerShell console?  Use $host.PrivateData and supply a new value for ErrorForegroundColor, for example: $Host.PrivateData.ErrorForegroundColor = 'white'

Adding Local Users to Local Groups
Oct 3, 2014
Post comments count 0
Post likes count 0

Adding Local Users to Local Groups

Doctor Scripto

Summary: Learn how to use Windows PowerShell to add local users to local groups. Microsoft Scripting Guy, Ed Wilson, is here. Creating local user objects and local group objects is fine, but to be useful, I need to be able to add users to groups. When working with local accounts, I need to use the ADSI type accelerator to facilitate the way things work.    Note  This is the third in a series of three posts. If you haven't read them already, you might benefit from reading the first two posts before you read this: Today I add the users to the group. Connect to the actual group Adding a user to a group is ...

PowerTip: Use PowerShell to Reverse Array
Oct 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Reverse Array

Doctor Scripto

Summary: Easily use Windows PowerShell to reverse an array.  How can I use Windows PowerShell to reverse an array?  Pipe the array to the Sort-Object cmdlet and use the –Descending switch, for example: $a = 1,2,3,4,5 $b = $a | sort -Descending

Use PowerShell to Create Local Groups
Oct 2, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Create Local Groups

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating local groups. Microsoft Scripting Guy, Ed Wilson, is here. Creating a local group works exactly the same way as creating a local user account (see Use PowerShell to Create Local User Accounts). The process involves the following steps:   Notes  At this point, there are no Windows PowerShell cmdlets from Microsoft that make it easy to create a local user account or a local group. Although it is possible to use the Desired State Configuration (DSC ) provider and the local account provider, this requires Windows Powe...

PowerTip: Use PowerShell to Create Hash Table to Hold Lowercase Letters
Oct 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Hash Table to Hold Lowercase Letters

Doctor Scripto

Summary: Use Windows PowerShell to create a hash table that holds all ASCII lowercase letters.  How can I use Windows PowerShell to create a hash table that holds all lowercase ASCII letters?  Create an empty ordered dictionary, and then use the add method to add the numbers 97-122            as keys and the [char] associated with the number as the value, for example: $a = [ordered]@{} 97..122 | foreach-object {$a.Add($_,[char]$_)}

PowerTip: Retrieving Specific Items from Hash Table
Sep 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Retrieving Specific Items from Hash Table

Doctor Scripto

Summary: Retrieve specific items from a Windows PowerShell hash table.  How can I use Windows PowerShell t retrieve specific values associated with specific keys in a hash table?  Suppose you have a hash table such as this: $d = @{a=28;b=29;c=30} The keys and values associated with the hash table are: PS C:> $d   Name                           Value                    &...

Use PowerShell to Create Ordered Dictionary
Sep 30, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Create Ordered Dictionary

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create an ordered dictionary. Microsoft Scripting Guy, Ed Wilson, is here. One of the really cool things that was introduced in Windows PowerShell 3.0, is that I can create an ordered dictionary. Basically, an ordered dictionary works like a Windows PowerShell hash table. The difference is that it maintains its order. Note  For a good overview of the ordered dictionary in Windows PowerShell, refer to this Hey, Scripting Guy! Blog post by June Blender: ConvertTo-OrderedDictionary. Dude, it is frustrating… One of ...

PowerTip: Find Syntax for Related PowerShell Cmdlets
Sep 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Syntax for Related PowerShell Cmdlets

Doctor Scripto

Summary: Easily find the syntax for related Windows PowerShell cmdlets.  How can I easily find the syntax for related Windows PowerShell cmdlets with the least effort?  Use the Get-Command cmdlet, select the noun, and use the –syntax switch, for example: Get-Command -Noun csv -Syntax

PowerShell and Active Directory Recycle Bin
Sep 29, 2014
Post comments count 0
Post likes count 0

PowerShell and Active Directory Recycle Bin

Doctor Scripto

Summary: Guest blogger, Alan Kaplan, talks about using Windows PowerShell with the Active Directory Recycle Bin. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog post written by Alan Kaplan. I met Alan several years ago when the Scripting Wife and Jim Christopher started the Windows PowerShell User Group in Charlotte, North Carolina. Since then, our path continue to cross when I see him at various regional IT group meetings (and at PowerShell Saturday). He is a real Windows PowerShell enthusiast, and he has grown his skills significantly since I first met him. Now he is a guest blogger. Tak...

PowerTip: Display Keys from Hash Table
Sep 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Display Keys from Hash Table

Doctor Scripto

Summary: Learn how to display keys from a hash table.  How can I display only the keys in a Windows PowerShell hash table?  Store the hash table in a variable, and then use the Keys property, for example: $a = @{a=1;b=2;c=3;d=4} $a.Keys

Weekend Scripter: Sorting PowerShell Hash Tables
Sep 28, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Sorting PowerShell Hash Tables

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about sorting hash tables. Microsoft Scripting Guy, Ed Wilson, is here. Today is part of the Scripting Wife’s birthday weekend, and so we are heading out to see the Friesian horse keuring. She has watched the event via live streaming on the Internet, but never attended one in person…so off we go. This means I am up a bit early, sipping extra strong English Breakfast tea, and munching on a kiwi. I do not have enough time to make my usual bowl of Irish steel-cut oats this morning. While I wait for my tea to steep, I thought I would answer a question th...

PowerTip: Find all Format*xml Files Referencing WMI Class
Sep 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Find all Format*xml Files Referencing WMI Class

Doctor Scripto

Summary: Find all Format*xml files that contain references to specific WMI class.  I am trying to find why a particular WMI class returns a subset of properties. I suspect output is controlled by an            entry in one of the Format*xml files, so how can I use Windows PowerShell to easily find which file contains            the formatting information?  Use the Get-ChildItem cmdlet to list the files in $pshome. Then use Select-String to search for the            WMI class name. To clean ...

Weekend Scripter: Why Does PowerShell Hide Stuff?
Sep 27, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Why Does PowerShell Hide Stuff?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about how Windows PowerShell decides what to display. Microsoft Scripting Guy, Ed Wilson, is here. This morning I received an email from a friend with whom I used to work a long time ago. (He was one of the reviewers on the WMI book I wrote in the VBScript days.) Here is his email:  Hey, Mr. Ed! How are you and the Scripting Wife? Hope you are well! I enjoy seeing your Facebook posts about your antics with your personal trainer. I have a quick Windows PowerShell question for you that has been nagging me for a while. I have a simple script that runs via ...

PowerTip: Find Current Working Directory in PowerShell
Sep 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Current Working Directory in PowerShell

Doctor Scripto

Summary: Easily find your current working directory in Windows PowerShell.  I saved a file to my current working directory while I was working in the Windows PowerShell console,            but I am not sure how to find where the file is.  Use the Convert-Path cmdlet and specify a period ( . ). It displays a file system path to your            current working directory: Convert-Path.

What's Up with the Crazy PowerShell Formatting?
Sep 26, 2014
Post comments count 0
Post likes count 0

What's Up with the Crazy PowerShell Formatting?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about calculating properties in output.  Hey, Scripting Guy! Dude, I’ve got a question. I read your Hey, Scripting Guy! Blog every day. In fact, most times, I read it twice a day. One thing you do all the time, and I don’t understand, is that you send something to, like, Format-Table. I get it when you put in a property name—hey, that’s easy. What I don’t understand is when you add the curly braces, the ampersands, and all that, and then the output is magically changed into what you want. How does that work? I can’t seem t...

PowerTip: Use PowerShell to Assess Memory Requirements
Sep 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Assess Memory Requirements

Doctor Scripto

Summary: Use Windows PowerShell to assess memory requirements.  How can I use Windows PowerShell to figure out the minimum, maximum, and average working set            requirements for processes on my workstation?  Use the Get-Process cmdlet to return the working set information. Select the working set and pipe the results            to Measure-Object. Here is an example: Get-Process | measure ws -Maximum -Minimum -Average

Analyzing PowerShell Script Files
Sep 25, 2014
Post comments count 0
Post likes count 0

Analyzing PowerShell Script Files

Doctor Scripto

Summary: Learn how to analyze Windows PowerShell script files. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sitting around sipping a cup of English Breakfast tea. I added some peppermint, spearmint, lemon grass, licorice root, and a cinnamon stick to the pot. The result is a very refreshing cup of tea. I am sitting on the back porch with my Surface 3 Pro and playing around with Windows PowerShell. I have a folder that I use to store miscellaneous Windows PowerShell scripts. I call the folder PSExtras and it contains scripts that I wrote for no apparent reason—I was just playing around...

PowerTip: Use PowerShell and Graphical Tool to View Files
Sep 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell and Graphical Tool to View Files

Doctor Scripto

Summary: Use Windows PowerShell and a graphical tool to view large files.  How can I use Windows PowerShell to easily see what files in a folder are the largest so I can clean up my file system?   Use the Get-ChildItem cmdlet to return the contents of a folder, select the name and length of the files, then             pipe the results to the Out-GridView cmdlet for easy viewing. This example uses a folder named C:\fso: Get-ChildItem c:\fso | Select name, length | Out-GridView 

Use Select-String Cmdlet in PowerShell to View Contents of Log File
Sep 24, 2014
Post comments count 0
Post likes count 0

Use Select-String Cmdlet in PowerShell to View Contents of Log File

Doctor Scripto

Summary: Use the Windows PowerShell cmdlet, Select-String, to view the contents of a log file.  Hey, Scripting Guy! I have a log file that I created by dumping process information from Get-Process. It is quite long, and I am trying to use Select-String to find the number of instances of a certain process. The problem is that when I find the instance, I do not know what the columns mean. I am wondering what I can do to get the column headers in addition to the process information to show up in my output. I know I can do this with a script, but I don’t want to write a script to accomplish this task. Can ...

PowerTip: Read First Line of File with PowerShell
Sep 23, 2014
Post comments count 0
Post likes count 1

PowerTip: Read First Line of File with PowerShell

Doctor Scripto

Summary: Learn how to read only the first line of a file by using Windows PowerShell.  How can I use Windows PowerShell to read only the first line of a file?  Introduced in Windows PowerShell 3.0, you can use the -First parameter, for example: Get-Content C:\fso\batteryReport.txt -First 1

Fun Formatting Ones—Part 2: The Method
Sep 23, 2014
Post comments count 0
Post likes count 0

Fun Formatting Ones—Part 2: The Method

Doctor Scripto

Summary: June Blender explains Doug Finke's multiplication and formatting trick. Today...the method. Microsoft Scripting Guy, Ed Wilson, is here. This is the second part of a two-part series written by June Blender, Honorary Scripting Guy. In the first part, Fun Formatting Ones—Part 1: The Task, we discussed the task of printing Doug's multiplication table. In this part, we'll talk about the techniques that he used, including formatting the table. Note If you already understand an element of the method, such as Ranges, you can skip that section. The sections are independent. Here's June... Today, I'll ...

PowerTip: Display Hidden Properties from Object
Sep 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Display Hidden Properties from Object

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display hidden properties from an object.  How can I see if there are any hidden properties on an object I have returned from Windows PowerShell?  Use the -Force parameter with either Format-List or Format-Table, for example: Get-ChildItem C: | Format-List * -Force  

Fun Formatting Ones—Part 1: The Task
Sep 22, 2014
Post comments count 0
Post likes count 0

Fun Formatting Ones—Part 1: The Task

Doctor Scripto

Summary: June Blender explains Doug Finke's multiplication and formatting trick. Today...the task. Microsoft Scripting Guy, Ed Wilson, is here. Today, Honorary Scripting Guy, June Blender, examines a multiplication and formatting trick that Doug Finke posted on the PowerShell Facebook page. I've broken this article into two parts: Part 1: The Task   Explains what Doug was trying to do and how to do it in Windows PowerShell. Part 2: The Method   Explains the techniques that Doug used. If you already understand The Task, you can wait for Part 2: The Method. Now, here's June... Win...

PowerTip: Remove Leading and Trailing Spaces with PowerShell
Sep 21, 2014
Post comments count 0
Post likes count 1

PowerTip: Remove Leading and Trailing Spaces with PowerShell

Doctor Scripto

Summary: Use the Trim() method to remove extraneous space from a String object.  Is there an easy way to drop all spaces that are before or after a string in Windows PowerShell?  Use the Trim() method to remove all spaces before and after a string from the output, for example: $Something='                 I love PowerShell                     ' $Something.trim()

Weekend Scripter: Use PowerShell to Connect to GoToMeeting
Sep 21, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Connect to GoToMeeting

Doctor Scripto

Summary: Use Windows PowerShell to provide a GUI input and build a custom URL for Internet Explorer. Honorary Scripting Guy, Sean Kearney, here to share a little fun that I have enjoyed on the client site. I say it was fun because, to be quite honest, the problem really wasn't that challenging, but to make the solution seamless to an end user was. Our challenge is to try to get a computer to connect to GoToMeeting without installing the client software. The problem was that the application would try to force a user through a complete download of the client application, then attempt an installation. Only afte...

PowerTip: Use PowerShell to Find Object Events
Sep 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Object Events

Doctor Scripto

Summary: Find events from objects by using Windows PowerShell.  How can I use Windows PowerShell to find what events are offered by a process?  Use Get-Process to retrieve an instance of the process, pipe the results to Get-Member,            and specify a MemberType Event: notepad Get-Process notepad | Get-Member -MemberType Event

Weekend Scripter: Playing with PowerShell Processes and Events
Sep 20, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Playing with PowerShell Processes and Events

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about playing with processes and events in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. This morning I woke up and I had an idea. This happens to me sometimes. Not often. But occasionally. And here it was. I could not get it out of my mind... Can I use an event from a specific process? I wonder. I should be able to do this, but hmmmm. I know a process that I retrieve by using the Get-Process cmdlet is really an instance of System.Diagnostics.Process. I also know that in addition to having methods and properties, it has events. Here are the eve...

PowerTip: Display Message in 16 Colors
Sep 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Display Message in 16 Colors

Doctor Scripto

Summary: Use Windows PowerShell to display a message in 16 colors.  How can I use Windows PowerShell to easily display a message in 16 different colors to start my presentation            with something a little different?  Use the range operator to create 16 numbers. Pipe the numbers to the Foreach-Object cmdlet. In the            script block, use Write-Host, and specify the foreground color as the number.           Here is the command (using aliases for conciseness): 0..15 | %{write-host -f $_ &#0...

Use PowerShell to Repeatedly Terminate Specific Processes
Sep 19, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Repeatedly Terminate Specific Processes

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to terminate processes that start at random times.  Hey, Scripting Guy! I have a question that I hope you can answer. It seems that there are several processes that keep starting on my computer running Windows 8.1. That eat up lots of resources, and I cannot seem to find where they are coming from. I have used the Sysinternals autoruns command, and yet they keep coming and consuming. What I would really love is to have a script that detects when these bogus processes start, and then terminate them. Can you help with that? ...

PowerTip: Cause PowerShell to Wait for Specific Event
Sep 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Cause PowerShell to Wait for Specific Event

Doctor Scripto

Summary: Cause Windows PowerShell to wait for a specific event to be generated.  How can I make my Windows PowerShell console halt until an event that I registered by using the            Register-CimIndicationEvent cmdlet occurs?  Use the Wait-Event cmdlet and specifiy the source identifier. For example, if you registered            for an event named nq, use the following command: Wait-Event -SourceIdentifier nq

Use PowerShell to Monitor Specific Process Creation
Sep 18, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Monitor Specific Process Creation

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to monitor for the creation of specific processes. Microsoft Scripting Guy, Ed Wilson, is here. This morning it is beginning to look like autumn. Who knows, it may become really hot and humid over the weekend, but today I can delude myself into hearing the rustling of leaves, imagine cool breezes blowing across the yard, and think of squirrels as they quickly gather supplies for a long winter. All of these things are really quite simple, routine, and ordinary. And yet they demand a certain amount of preparation. If I don’t clean t...

PowerTip: Find Extended Type Data in PowerShell Session
Sep 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Extended Type Data in PowerShell Session

Doctor Scripto

Summary: Find extended type data in your current Windows PowerShell session.  How can I find out what extended type data exists in my current Windows PowerShell session?  Use the Get-TypeData cmdlet.

Use PowerShell to Monitor for Process Startup
Sep 17, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Monitor for Process Startup

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to monitor for process startup. Microsoft Scripting Guy, Ed Wilson, is here. This morning, I spent a decent amount of time answering an email from a former colleague. I will actually share his email and my reply this coming weekend. In the meantime, I was playing around Register-CimIndicationEvent. This is not really a new Windows PowerShell cmdlet—I mean, it has been around for a while (since Windows PowerShell 3.0), but not much has been written about it. There is little useful documentation for the cmdlet either. In to...

PowerTip: Change Value of Element in Array with PowerShell
Sep 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Change Value of Element in Array with PowerShell

ScriptingGuy1

Summary: Learn how to use Windows PowerShell to change the value of an element in an array.  How can I use Windows PowerShell to update one of the values in one of the elements of an array?  Use the Item method to retrieve the element and assign a new value. Here is an example of            updating the value of the first element in an array: $a = 1,2,3,4,5 $a.Item(0) = 12 $a Note  Remember that in Windows PowerShell, all arrays are zero-based. This means that the first element is actually element 0.

Use PowerShell to Start Random Processes at Random Times
Sep 16, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Start Random Processes at Random Times

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create random processes at random times.  Hey, Scripting Guy! I need to start a process that I pick randomly from a list. I would like these processes to start at random times so I can test my monitoring application. Is this something Windows PowerShell can do? —JD  Hello JD, Microsoft Scripting Guy, Ed Wilson, is here. This morning, I am sipping a cup of Darjeeling tea that I made with spearmint, licorice root, and a cinnamon stick. The taste is understated, and quite nice. It goes well with the Irish steel-cut o...

PowerTip: Use PowerShell to Find Path for Processes
Sep 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Path for Processes

Doctor Scripto

Summary: Use Windows PowerShell to find the path of the executable for running processes.  I noticed a process and I am unsure of what it does. How can I use Windows PowerShell to find more information?  Look at the path to the executable to find information about a process. If it is legitimate, often the folder            provides decent information. Here is an example: (Get-Process -Name snagit32).path

Use PowerShell to Start a Process at Random Times
Sep 15, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Start a Process at Random Times

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to start a process at random intervals.  Hey, Scripting Guy! I have a rather unusual request. I am testing a new monitoring application, and I need a script that will start processes at random intervals so I can check the effectiveness of the solution. Is this something you can help me with? —BB  Hello BB, Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sitting on the porch, sipping a nice cup of green tea with orange flavorings in it. The tea is called Orange Cream, and it tastes exactly like the old ...

PowerTip: Use Windows PowerShell to Open Word Document
Sep 14, 2014
Post comments count 1
Post likes count 0

PowerTip: Use Windows PowerShell to Open Word Document

Doctor Scripto

Summary: Learn how to use Windows PowerShell to open a Microsoft Word document.  How can I open a Word document with Windows PowerShell?  Use the New-Object cmdlet: $Filename='C:\HappyBirthdayEd.docx' $Word=NEW-Object –comobject Word.Application $Document=$Word.documents.open($Filename) You can now programmatically access methods and properties to edit the Word document.

Weekend Scripter: Manipulating Word and Excel with PowerShell
Sep 14, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Manipulating Word and Excel with PowerShell

Doctor Scripto

Summary: Leverage the Office API to manipulate data in Word and Excel with Windows PowerShell. Honorary Scripting Guy, Sean Kearney, is here today to give Ed the day off. Why? Well, it's his birthday, of course! People worldwide have been sending Ed Happy Birthday wishes. His inbox almost went offline with so many "Happy Birthdays" coming his way! Today Ed is relaxing, but he has one task. The Scripting Wife is standing over him, "Ed, you should send thank-you notes to all of your friends." The Scripting Guy looked at his inbox, "I'd love to, dear, but there are almost 87,561 p...

PowerTip: Find Array Members with Get-Member in PowerShell
Sep 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Array Members with Get-Member in PowerShell

Doctor Scripto

Summary: Learn to find members of an array with the Get-Member cmdlet in Windows PowerShell.  I have an array of numbers: 1,2,3,4,5 that I assigned to variable $a. When I pipe it to Get-Member: $a | gm,            all I see are members for int32. How can I find the members of an array by using Get-Member?  There are two ways to do this: 1. Use the uniary operator ( , ) in front of the array prior to piping it to Get-Member: PS C:\> $a = 1,2,3,4,5 PS C:\> ,$a | get-member 2. Use the –InputObject parameter with Get...

Weekend Scripter: The WMI Explorer Tool
Sep 13, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: The WMI Explorer Tool

Doctor Scripto

Summary: Guest blogger, Vinay Pamnani, talks about a cool new WMI tool. Microsoft Scripting Guy, Ed Wilson, is here. One of the absolutely greatest things about working for Microsoft is the chance to meet (even virtually) and interact with really smart people who absolutely love technology. I recently ran across a post by Vinay (todays guest blogger) in an internal mailing where he was describing his new WMI Explorer tool. I downloaded the tool, played around with it a bit, and thought about writing a post about it—the tool is that good. But then, I decided it would be better if I could persuade the person ...

PowerTip: Find WMI Classes Related to Services
Sep 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Find WMI Classes Related to Services

Doctor Scripto

Summary: Use Windows PowerShell to find WMI classes related to services that reveal start mode.  How can I use Windows PowerShell to find a WMI class that will help me identify how services are starting?  Use the Get-CimClass cmdlet, use a wildcard character for the name, and specify StartMode            as the property, for example: Get-CimClass *service* -PropertyName startmode

Why Are All These Services Starting?
Sep 12, 2014
Post comments count 0
Post likes count 0

Why Are All These Services Starting?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using WMI to find out how services start.  Hey, Scripting Guy! I was looking at the processes on my workstation, and I see lots of things running. I suspect many of these are actually services. But I am wondering how I can use Windows PowerShell to find services that start automatically. For example, the great cmdlet Get-Service does not display this information. Any thoughts? —TL  Hello TL, Microsoft Scripting Guy, Ed Wilson, is here. Yes, I have some thoughts. My main thought is that tomorrow begins the weekend in Charlotte, North Carolina...

PowerTip: Use PowerShell to Cast to WMI UInt Value Type
Sep 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Cast to WMI UInt Value Type

Doctor Scripto

Summary: Use Windows PowerShell to cast to the WMI UInt value type.  I am comparing data from WMI, and it seems strange. I found the value type is a UInt32, and when I looked it up, I found that it is an unsigned 32-bit integer. How can I use Windows PowerShell to create one of these?  Use [uint32] and cast your normal integer to this type, for example: PS C:\> [uint32]$a = 3 PS C:\> $a.GetType() IsPublic IsSerial Name                           ...

Use PowerShell and WMI to Glean Basic Operating System Information
Sep 11, 2014
Post comments count 0
Post likes count 0

Use PowerShell and WMI to Glean Basic Operating System Information

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell and WMI to obtain basic operating system information.  Hey, Scripting Guy! I need to check on computers on my network to find out the operating system, service pack level, and whether the computer has been rebooted in the last 30 days. Can you help with this? —DD  Hello DD, Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife is starting to get excited about the MVP Summit in Redmond. She was out there a few years ago with me, and she loved the chance to meet so many MVPs from all over the world. This is h...

PowerTip: Find Value from PowerShell Hash Table
Sep 10, 2014
Post comments count 0
Post likes count 1

PowerTip: Find Value from PowerShell Hash Table

Doctor Scripto

Summary: Look up values from a Windows PowerShell hash table.  How can I look up a specific value that is associated with a specific key in a Windows PowerShell hash table?  Use the Item method and supply the key, for example: $hash = @{    2 = "Removable disk"    3="Fixed local disk"    4="Network disk"    5 = "Compact disk"}   $hash.Item(3)

Inventory Drive Types by Using PowerShell
Sep 10, 2014
Post comments count 0
Post likes count 0

Inventory Drive Types by Using PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to detect drive types.  Hey, Scripting Guy! We have a number of workstations in our network. Many of the users bring USB keys from home to transfer their files. Others have large external USB drives attached to their machines, and others have portable CD/DVD devices attached. I need to come up with some kind of inventory so I see how prevalent this situation really is. Can Windows PowerShell help? —OG  Hello OG, Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sitting on the porch sipping a nice cup of ...

PowerTip: Find WMI Classes by Using PowerShell
Sep 9, 2014
Post comments count 0
Post likes count 1

PowerTip: Find WMI Classes by Using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find WMI classes.  I am searching for a WMI class to help me find information about Windows startup configuration.            I am unsure of the class name. How can I use Windows PowerShell to help me find the class (assuming it exists)?  Use the Get-CimClass CIM cmdlet that was introduced in Windows PowerShell 3.0.            Here is an example of using the Get-CimClass cmdlet to find Windows startup information. Get-Cimclass win32_st*

Use PowerShell to Provide Startup Information
Sep 9, 2014
Post comments count 0
Post likes count 2

Use PowerShell to Provide Startup Information

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find startup information.  Hey, Scripting Guy! It seems that my laptop running Windows 8.1 takes forever to start lately. I don’t really even know where to begin with this. I haven’t added anything that I know of, but still it is dog slow. I don’t want to reinstall Windows because…well, for one thing, if I don’t solve the issue, it might come back again. Can Windows PowerShell help me with this? —OB  Hello OB, Microsoft Scripting Guy, Ed Wilson, is here. The weather is still a b...

PowerTip: Use Tab to Complete WMI Class Names
Sep 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Use Tab to Complete WMI Class Names

Doctor Scripto

Summary: Use Tab completion to type WMI class names in Windows PowerShell.  I am using WMI in the Windows PowerShell console and in the Windows PowerShell ISE, and I am having a hard time            correctly typing the long convoluted class names. How can I simplify the process and be more accurate? Use the Get-CimInstance cmdlet instead of the Get-WmiObject cmdlet. One advantage (among many) of the            Get-CimInstance cmdlet is that it will do Tab completion on WMI class names.         &nbsp...

Use PowerShell to Detect Activation Status
Sep 8, 2014
Post comments count 1
Post likes count 0

Use PowerShell to Detect Activation Status

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell and WMI to display Windows activation status.  Hey, Scripting Guy! The previous network administrator at my company was not attentive to his work. I am not sure what he actually did for a living, but it certainly was not network administration. I think he was a professional Internet surfer. I suspect that many of our desktop operating systems are not activated properly. I want to produce a list of desktop systems, get the names and versions of the operating systems, and find out if the system is activated properly. Can I do thi...

PowerTip: New Lines with PowerShell
Sep 7, 2014
Post comments count 3
Post likes count 2

PowerTip: New Lines with PowerShell

Doctor Scripto

Summary: Create new lines with Windows PowerShell.  How can I use Windows PowerShell to add a new line between lines for my text output?  Use the `n character, for example: PS C:\> "string with new line `n in it" string with new line  in it Note  If you need a carriage return, use `r. For a carriage return and a new line, use `r`n.

Weekend Scripter: Don’t Break PowerShell Script with Line Breaks
Sep 7, 2014
Post comments count 1
Post likes count 0

Weekend Scripter: Don’t Break PowerShell Script with Line Breaks

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about line breaks in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. This morning, the weather is cool for a change. It was a great morning to get up and take a walk through a peach grove. There is actually a sidewalk through the peach grove here. Peach season is nearly over, so the peach trees still have leaves, but no peaches on them now. One of the problems with writing books, blogs, and papers about Windows PowerShell is that the line length is pretty much limited to 80 characters. With modern monitors and the Windows PowerShell ISE, I can ha...

PowerTip: PowerShell Tabs
Sep 6, 2014
Post comments count 0
Post likes count 0

PowerTip: PowerShell Tabs

Doctor Scripto

Summary: Understand Windows PowerShell tabs.  How can I use Windows PowerShell to efficiently add 1, 2, or 3 tabs to a string?  Use the `t character for a single tab. Use `t`t for two tabs, and multiply them for three or more (such as “`t”*3).            Here are examples: PS C:\> "this has a `t in it" this has a       in it PS C:\> "this has 2 `t`t in it" this has 2               in it PS C:\> "this has 3...

Weekend Scripter: Space: Not the Final Frontier in PowerShell
Sep 6, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Space: Not the Final Frontier in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about spacing in Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of English Breakfast tea. I added some orange peel and fresh squeezed Meyer lemon juice to it. I also added a cinnamon stick. The result is nice and tangy—great to help one to wake up in the morning. I was at an international market the other day, and I picked up a bag of instant scone mix. I thought I would give it a try. They are not bad is the final mark...not too bad at all. Certainly not on par with a freshly made scone from scratch...

PowerTip: Find How Many Days until PowerShell Summit Europe 2014
Sep 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Find How Many Days until PowerShell Summit Europe 2014

Doctor Scripto

Summary: Use Windows PowerShell to find how many days until Windows PowerShell Summit Europe in Amsterdam.  How can I use Windows PowerShell to help me find how many days until the Windows PowerShell Summit            Europe 2014 in Amsterdam?  Use the New-TimeSpan cmdlet, and use Get-Date to specify the start time and Sept. 29, 2014 as the end time: New-TimeSpan -Start (get-date) -End 9/29/14

PowerShell Summit Europe 2014 in Amsterdam
Sep 5, 2014
Post comments count 0
Post likes count 0

PowerShell Summit Europe 2014 in Amsterdam

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the Windows PowerShell Summit Europe in Amsterdam. Microsoft Scripting Guy, Ed Wilson, is here. It is nearly here...just a few weeks actually. And unbelievably, there are still a few tickets left.  I am talking about the Windows PowerShell Summit Europe 2014 in Amsterdam. This is an awesome event, and it is being held in an awesome city. The Scripting Wife and I have been to the Netherlands twice in the past couple years. Each time was to talk to the Dutch PowerShell User Group (which is one of the world’s best Windows PowerShell user groups...

PowerTip: Use Complete Name for PowerShell Cmdlet
Sep 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Use Complete Name for PowerShell Cmdlet

Doctor Scripto

Summary: Use the complete name for a Windows PowerShell cmdlet.  How can I ensure that I use the correct cmdlet in my Windows PowerShell session if I think             there might be more than one with the same name?  Use the complete name of the cmdlet—this includes the module name and the cmdlet name.            Here is an example of using the standard Get-Process cmdlet: Microsoft.PowerShell.Management\get-process

PowerShell Naming Conflicts
Sep 4, 2014
Post comments count 1
Post likes count 0

PowerShell Naming Conflicts

Doctor Scripto

Summary: Learn how to handle naming conflicts for Windows PowerShell cmdlets.  Hey, Scripting Guy! My Windows PowerShell installation is completely hosted on my laptop. In fact, I tried to uninstall and reinstall Windows PowerShell, but that did not work. I really do not want to have to pave my laptop. I download this module from the Internet. It works really well, but the issue is that one of the cmdlets replaced one of the standard cmdlets on my computer. I really need to be able to use the standard cmdlet, and I do not know what to do. Help! —DV  Hello DV, Microsoft Scripting Guy, Ed Wilson, is...

PowerTip: Use PowerShell to Copy Array
Sep 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Copy Array

Doctor Scripto

Summary: Use Windows PowerShell to copy an array.  How can I use Windows PowerShell to copy the contents of one array over another array?  One way to do this is to use the Copy static method from the System.Array .NET Framework class, for example: PS C:> $a = 1,2,3,4,5 PS C:> $b = 6,7,8,9,10 PS C:> [array]::copy($a,$b,5) PS C:> $b 1 2 3 4 5

Using and Understanding Tuples in PowerShell
Sep 3, 2014
Post comments count 0
Post likes count 0

Using and Understanding Tuples in PowerShell

Doctor Scripto

Summary: Guest blogger, Windows PowerShell MVP, Joel Bennett talks about using tuples in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today, we have a guest blog post by Windows PowerShell MVP, Joel Bennett. Joel has been a MVP for a while, and he created the infrastructure that is used by the Scripting Games before they were turned over to PowerShell.org. In addition, he was instrumental in creating PoshCode, which was the first Windows PowerShell repository on the Internet. So, without further ado, here is Joel… When Ed asked me to write a post explaining tuples and comparing them to ...

PowerTip: Reverse Array with PowerShell
Sep 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Reverse Array with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to reverse an array.  How can I use Windows PowerShell to sort an array that is going in the wrong direction?  Call the Reverse static method from the [array] class, for example: PS C:\> $a = 1,2,3,4,5 PS C:\> [array]::Reverse($a)

Using a Tuple in PowerShell
Sep 2, 2014
Post comments count 0
Post likes count 0

Using a Tuple in PowerShell

Doctor Scripto

Summary: Learn how to use a Tuple in Windows PowerShell Hey, Scripting Guy! I read your article from yesterday, so I know about Tuples. How do I actually use one? —HD Hello HD, Microsoft Scripting Guy, Ed Wilson, is here. I just got back from working out with my trainer. I am not nearly as sore today, but then there is always tomorrow. Anyway, I decided to drink a protein shake and a glass of water now. I will have tea later with my mid-morning snack. I grabbed my Surface Pro 3, and I am quickly checking my email to scripter@microsof&#x...

PowerTip: Use PowerShell to Sort Array
Sep 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Sort Array

Doctor Scripto

Summary: Use Windows PowerShell to sort an array.  How can I use Windows PowerShell to sort an array?  Use the static Sort method from the [array] class, for example: $a = 1,2,4,5,3,6   [array]::sort($a)

What’s a Tuple, and Why Would I Want to Use It?
Sep 1, 2014
Post comments count 0
Post likes count 0

What’s a Tuple, and Why Would I Want to Use It?

Doctor Scripto

Summary: Learn about using tuples with Windows PowerShell.  Hey, Scripting Guy! What is a tuple, and why would I want to use one? —RT  Hello RT, Microsoft Scripting Guy, Ed Wilson, is here. I just got back from the gymnasium, and I am sitting on the back porch sipping a glass of water, trying to cool down. I decided last week to begin an exercise regime. I know exercise is supposed to make one feel better and all that, but so far, I feel worse—much worse. I am so sore that even my eyelids hurt. Oh well, I am sure it gets easier. Hmmm, I wonder if my trainer will take it easy on me if I bring...

PowerTip: Using PowerShell to Determine if Path Is to File or Folder
Aug 31, 2014
Post comments count 1
Post likes count 0

PowerTip: Using PowerShell to Determine if Path Is to File or Folder

Doctor Scripto

Summary: Learn how to use Windows PowerShell to determine if a path is to a file or a folder.  How can I use Windows PowerShell to determine if a path is to a file or a folder?  Use the Get-Item cmdlet to get the object represented by the path. Then use the –Is operator to see if the            object is a [system.io.directoryinfo] object or a [system.io.fileinfo] object. Here is an example: PS C:\> (Get-Item c:\fso) -is [System.IO.DirectoryInfo] True PS C:\> (Get-Item C:\fso\csidl.txt) -is [System.IO.DirectoryInfo] False

Weekend Scripter: Parse Folder of Data with PowerShell
Aug 31, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Parse Folder of Data with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to parse a folder that contains data dumps. Microsoft Scripting Guy, Ed Wilson, is here. This morning I got up, and headed to the Farmers Market in town. I picked up a fresh melon for breakfast and some locally made cheese. Melon and cheese with a nice up of English Breakfast tea…not a bad meal. I am sitting on the back porch, munching melon, sipping tea, and checking my email on my Surface Pro 3. (The cheese was pretty much gone as soon as I sliced it—not saying what happened to it, just that it did not make it to the porch.) I decided that I need to do one more ...

PowerTip: Use PowerShell to Set Primary and Secondary DNS Server Addresses
Aug 30, 2014
Post comments count 3
Post likes count 0

PowerTip: Use PowerShell to Set Primary and Secondary DNS Server Addresses

Doctor Scripto

Summary: Use Windows PowerShell to set the primary and secondary DNS server addresses for a client.  I recently changed the IP address scheme for an entire subnet. How can I use Windows PowerShell to set the            primary and secondary DNS server addresses for the client workstations?  Use the Set-DNSClientServerAddress cmdlet, and specify the primary and the secondary DNS servers as            an array, for example: Set-DNSClientServerAddress –interfaceIndex 12 –ServerAddresses (“10.0.0.1”,”10.0.0.2...

Weekend Scripter: A Function to Clean Up Data Import
Aug 30, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: A Function to Clean Up Data Import

Doctor Scripto

Summary: Learn about a Windows PowerShell function you can use to clean up data prior to import. Microsoft Scripting Guy, Ed Wilson, is here. We are entering the Labor Day weekend in the United States today. Labor Day is a sad holiday, but it is also a happy time. It is sad because it traditionally marks the end of summer. It is happy because if you live in Charlotte, North Carolina, it means that the time of high temperatures and high humidity are nearing an end. Autumn (September through November) is definitely the best time of the year to visit Charlotte. The temperatures during the day are warm enough to perm...

PowerTip: Hide Common Code in PowerShell ISE
Aug 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Hide Common Code in PowerShell ISE

Doctor Scripto

Summary: Learn how to hide common code in the Windows PowerShell ISE. How can I hide related code in the Windows PowerShell ISE to make it easier to troubleshoot and to read? Open the ISE, and in the script pane, begin a section with the #Region tag and a name.            Then end the section with the #EndRegion tag. Now everything between the two tags can be collapsed            and hidden when desired. Here is an example:#region Name If($d.name -match  ',')        {  &...

Creating Custom PowerShell Objects
Aug 29, 2014
Post comments count 0
Post likes count 0

Creating Custom PowerShell Objects

Doctor Scripto

Summary: Use Windows PowerShell to create custom objects prior to data export. Microsoft Scripting Guy, Ed Wilson, is here. It is nice and cool this morning so I decided to walk over to the neighborhood coffee and tea shop to have a cup of tea. I can sit outside and enjoy the day. There is free wireless Internet, so I brought my Surface Pro 3 to check my email sent to scripter@microsoft.com, hang out on Facebook and Twitter, and generally do all the things I do in my day-to-day life as the Scripting Guy. Today, I want to look at creating custom objects from Windows PowerShell as a way of outputting the data ...

PowerTip: Use Graphical Tool to Create PowerShell Commands
Aug 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Use Graphical Tool to Create PowerShell Commands

Doctor Scripto

Summary: Learn how to use a graphical tool to create Windows PowerShell commands.    How can I use Windows PowerShell so that I can point-and-click at options that are available for a using a particular cmdlet?  Use the Show-Command cmdlet and select the parameters you need, for example: Show-Command -Name Get-Process

Use PowerShell to Fix Address Issues Prior to Export
Aug 28, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Fix Address Issues Prior to Export

Doctor Scripto

Summary: Use Windows PowerShell to fix address issues prior to exporting the data to another database. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am listening to The Doors on my Zune HD, and sipping a very nice cup of tea. I used three spoons of Darjeeling tea, one spoon of lemon grass, one spoon of marshmallow root, one spoon of licorice root, and one cinnamon stick. I steeped it in my pot for four minutes. The water is 208 degrees (and of course, I preheated the pot by filling the pot half full of hot water and letting it sit for a minute). The tea is naturally sweet, with the cinnamon, licoric...

PowerTip: Use PowerShell to Change System Time
Aug 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Change System Time

Doctor Scripto

Summary: Learn how to use Windows PowerShell to change the system time. The clock on my computer (running Windows 8.1) is 30 minutes slow. How can I use Windows PowerShell             to move the system time up 30 minutes? Use the Set-Date cmdlet, create a TimeSpan object equal to 30 minutes, and supply it to             the –adjust parameter:Set-Date -Adjust (New-TimeSpan -Minutes 30)To alter the clock back 30 minutes, create a negative TimeSpan, for example:Set-Date -Adjust (New-TimeSpan -Min...

Use PowerShell to Normalize Names Before Data Import
Aug 27, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Normalize Names Before Data Import

Doctor Scripto

Summary: Use Windows PowerShell to normalize names before importing data. Microsoft Scripting Guy, Ed Wilson, is here. I have been reading Jane Austen Northanger Abbey this week in the evenings. I really love the way Jane Austen develops her characters. I also like some of the ways the characters express themselves. For example, “Give me but a little cheerful company…” Indeed. I like to hang out with people who are cheerful, and who have a good attitude. It rubs off.  This is also how Windows PowerShell is. For example, rather than complaining about the person who designed a poor database&...

PowerTip: Create Custom Names for CSV File
Aug 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Create Custom Names for CSV File

Doctor Scripto

Summary: Use Windows PowerShell to create custom column headings.  How can I use Windows PowerShell to generate custom heading for a CSV file when I import it?  Specify the –Header parameter as an array of names in the order of the fields, for example: Import-CSV c:\fso\myfile.csv –delimiter “:” –header ‘FName’, ‘LName’, ‘Street’, ‘City’, ‘State’, ‘Zip’

Use PowerShell to Fix Date from CSV File
Aug 26, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Fix Date from CSV File

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to fix the date in a CSV file prior to data export. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of English Breakfast tea. I added a cinnamon stick and a bit of lemon grass to the pot. Of course before I did anything, I primed my pot—that is, I filled the pot half full with hot water and let the pot sit for a couple of minutes. This has two benefits: it warms the pot and it helps ensure that there is no leftover tastes or smells in the pot to ruin the pot of tea. I am sitting at the bar in our k...

PowerTip: Use PowerShell to Read Tab Delimited File
Aug 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Read Tab Delimited File

Doctor Scripto

Summary: Use Windows PowerShell to read a Tab delimited file.  How can I use Windows PowerShell to read a Tab delimited file?  Use the Import-CSV cmdlet and specify a delimiter of `t, for example: $a = Import-Csv -Delimiter "`t" -Path c:\fso\mytabfile.tsv

Use PowerShell to Read Munged Data
Aug 25, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Read Munged Data

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell with munged data. Microsoft Scripting Guy, Ed Wilson, is here. Last week, the Scripting Wife and I had the opportunity to attend the Charlotte SQL Users Group. This is always a highlight, because that user group is one of the largest SQL User Groups around. I was speaking, and I decided to come up with something a little different. In the past when I have spoken, I have talked about using Windows PowerShell to manage SQL Server, or about best practices for SQL Server admins, and those sorts of things. This time, I wanted to do somet...

PowerTip: Find Cmdlets that Need TimeSpan Object
Aug 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Cmdlets that Need TimeSpan Object

Doctor Scripto

Summary: Use Get-Command to find cmdlets that need a TimeSpan object for input.  How can I use Windows PowerShell to find which cmdlets will accept a TimeSpan object for input?  Use the ParameterType parameter from the Get-Command cmdlet, for example: Get-Command -ParameterType timespan

Weekend Scripter: Use PowerShell to Troubleshoot Group Policy
Aug 24, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Troubleshoot Group Policy

Doctor Scripto

Summary: Guest blogger, Alex Verboon, talks about using Windows PowerShell to troubleshoot delays in Group Policy performance. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger, Alex Verboon. I was reading Alex’s blog page. I liked what he had to say and I invited him to contribute a guest blog post here. You can read his blog at Anything about IT. Now, here is Alex... For years, I have been reading and consuming content from the Hey, Scripting Guy! Blog, so it's a big pleasure to give something back. Today I want to share with you a Windows PowerShell script I put together...

PowerTip: Use PowerShell to Install Sysinternals
Aug 23, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Install Sysinternals

Doctor Scripto

Summary: Learn to use Windows PowerShell to easily install Sysinternals utilities.  How do I find a Chocolatey package that installs Sysinternals?  Use the Find-Package cmdlet: Find-Package –Name Sysinternals Note   This command requires the OneGet module in Windows PowerShell 5.0.

Weekend Scripter: PowerShell and Chocolatey
Aug 23, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell and Chocolatey

Doctor Scripto

Summary: Guest blogger and Honorary Scripting Guy, June Blender, talks about using Windows PowerShell and Chocolatey. Microsoft Scripting Guy, Ed Wilson, is here. Today, I welcome back guest blogger, June Blender. I’m probably one of five people on earth who really do not like chocolate, so I wasn’t too keen to learn about something called “Chocolatey.” But I kept hearing about Chocolatey and other “package installers,” such as NuGet, and I wanted to know what all of the fuss was about. Then along comes Windows PowerShell 5.0 Preview with a module called OneGet that works ...

PowerTip: Mini-Scripting Games 2014 Answer 5
Aug 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Answer 5

Doctor Scripto

Summary: Here is the answer to the final question in Mini-Scripting Games 2014.  You created a constant variable in your Windows PowerShell console. Now, when you attempt to delete the variable,            you get an error message. How can you remove a constant variable?  A constant variable is created by using the New-Variable cmdlet, for example: New-Variable c "c" -Option Constant    After a variable is created as a constant, it cannot be removed until the console (or ISE) is closed and reopened.

PowerShell Mini-Scripting Games 2014: Answer 5
Aug 22, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Answer 5

Doctor Scripto

Summary: Here is the answer to Problem 5 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. It is time for the answer to Problem 5 in Mini-Scripting Games 2014. Last week, I posted the complete Problem 5 description and task outline. Problem 5 synopsis Your manager has tasked you to help a junior admin with a script. It appears that the junior admin wants to solicit input from the user when the script is running. Then based on the input from the user, the script will do something else. Answer There are many ways of obtaining input from the user. One way to do it is to cr...

PowerTip: Mini-Scripting Games 2014 Answer 4
Aug 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Answer 4

Doctor Scripto

Summary: Here is the answer to the fourth question in Mini-Scripting Games 2014.  You are attempting to use Try/Catch/Finally in your script. No matter what you try,             the script never seems to catch it. What is the most likely cause of the problem?  The most likely cause of the problem is that your Try statement does not generate a terminating error,             and therefore, there is nothing for Catch to catch.  One easy way to fix this is to change your $ErrorActionPreference variable from&n...

PowerShell Mini-Scripting Games 2014: Answer 4
Aug 21, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Answer 4

Doctor Scripto

Summary: Here is the answer to Problem 4 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. It is time for the answer to Problem 4 in Mini-Scripting Games 2014. Last week, I posted the complete Problem 4 description and task outline. Problem 4 synopsis Your manager tasked you with what he considers to be a really important issue. The people at the Help Desk want a tool that will permit them to easily stop processes. Your manager doesn’t want to give them permission to use Task Manager because it carries too much power. He decided that he wants you to write a script...

PowerTip: Mini-Scripting Games 2014 Answer 3
Aug 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Answer 3

Doctor Scripto

Summary: Here is the answer to the third question in Mini-Scripting Games 2014.  You are writing a script, and when it runs, you receive an error message that states:                “You cannot call a method on a null-valued expression."            What is the first thing you should check?  Check the code that creates the object that you stored in the variable. It is probable that there is a             problem with that code. For example, let's say I read from a database and store th...

PowerShell Mini-Scripting Games 2014: Answer 3
Aug 20, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Answer 3

Doctor Scripto

Summary: Here is the answer to Problem 3 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. Today it is time to look at Problem 3. Last week, I posted the complete Problem 3 description and task outline. Problem 3 synopsis One of your teammates wrote a script that runs against a select subgroup of users once a week. This script takes a rather long time to complete (upwards of five minutes in some cases). Therefore, the sign-in appears to hang when it is their turn for processing. Users have done everything (called the Help Desk, rebooted the computers, booted up with the...

PowerTip: Mini-Scripting Games 2014 Answer 2
Aug 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Answer 2

Doctor Scripto

Summary: Here is the answer to the second question in Mini-Scripting Games 2014.  On your laptop running Windows 8.1, you are running Hyper-V.            You have heard that there are cmdlets that let you manage this.            You open Windows PowerShell and type the following command: Get-VM Absolutely nothing comes back. But you know you have several virtual machines on your computer. Why does nothing return?  The Hyper-V cmdlets require Admin rights. Therefore, you need to open the Windows PowerShell console       &nbsp...

PowerShell Mini-Scripting Games 2014: Answer 2
Aug 19, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Answer 2

Doctor Scripto

Summary: Here is the answer to Problem 2 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. Problem 2 could be a bear to solve. After all, it involves text manipulation. Last week, I posted the complete Problem 2 description and task outline. Problem 2 synopsis You have a CSV file that contains five columns. It comes from the HR department and it contains information that you do not need. You only need to work with three of the columns. Moving forward As I said, it could be a bear to solve this problem, unless you remember that when imported, a CSV file produces objects....

PowerTip: Mini-Scripting Games 2014 Answer 1
Aug 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Answer 1

Doctor Scripto

Summary: Here is the answer to the first question in Mini-Scripting Games 2014.  On your laptop running Windows 8.1, you opened the Windows PowerShell console and typed Get-Disk.            You were greeted with an error message that says:                 “Get-Disk: Access to a CIM resource was not available to the client."             What is the issue?  You need to open the Windows PowerShell console with Admin rights. Right-click the icon for the     &...

PowerShell Mini-Scripting Games 2014: Answer 1
Aug 18, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Answer 1

Doctor Scripto

Summary: Here is the answer to Problem 1 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. Here is an answer to Problem 1 in Windows PowerShell Mini-Scripting Games 2014. Last week, I posted the complete Problem 1 description and task outline. Problem one synopsis You are reading a CSV file that was created from another source. The CSV file has four fields that are to be read and then used to update four attributes in Active Directory. The problem is that the CSV file does not have all four fields filled out. In some cases, there is a space in the field, in others a tab...

PowerTip: Find PowerShell Canonical Aliases
Aug 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Canonical Aliases

Doctor Scripto

Summary: Find Windows PowerShell aliases that are read-only and available in all scopes.  How can I produce a list of Windows PowerShell aliases that are read-only and are available in            all Windows PowerShell scopes?  Use the Get-Alias cmdlet to produce a list of aliases, filter on aliases that have an option of read-only,            and select the name, definition, and options: Get-Alias | Where options -match 'readonly' | select name, definition, options

Weekend Scripter: Many Paths to a PowerShell Command
Aug 17, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Many Paths to a PowerShell Command

Doctor Scripto

Summary: Microsoft Scripting Guy Ed Wilson talks about using different types of commands in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. A while ago, someone said there must be 50 ways to stop a process in Windows PowerShell. Although I am not certain that number is entirely accurate, it probably comes close. The great thing about all the different ways of doing things in Windows PowerShell is that it permits us to meet Windows PowerShell from our current backgrounds. This enables us to leverage as much previous knowledge as possible. For example, suppose you spent years as a .NET developer, a...

PowerTip: Change Value of Element in PowerShell Array
Aug 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Change Value of Element in PowerShell Array

Doctor Scripto

Summary: Learn how to change the value of an element in a Windows PowerShell array.  How can I use Windows PowerShell to change the value of the first element in an array?  Use the Set method and specify the element number and the new value, for example: PS C:\> $a = 1,2,3,4,5 PS C:\> $a.Set(0,50)

The Scripting Editor Tells All
Aug 16, 2014
Post comments count 0
Post likes count 0

The Scripting Editor Tells All

Doctor Scripto

Summary: Dia Reeves, aka the Scripting Editor, has some fun talking about working on the Hey, Scripting Guy! Blog. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog post from my editor, Dia Reeves... Hello to all you Windows PowerShell scripters and fans of the Hey, Scripting Guy! Blog! I have been editing and publishing this blog since 2011, and I thought it would be fun to write a post that helps you understand my part in our process and share some stats about our blog. Maybe I will let Ed edit and publish my post! Well, maybe not... Although I have been a technical editor for 14 years, I...

PowerTip: Mini-Scripting Games 2014 Question 5
Aug 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Question 5

Doctor Scripto

Summary: Here is the fifth short-answer question for Mini-Scripting Games 2014.  You created a constant variable in your Windows PowerShell console.            Now when you attempt to delete the variable, you get an error message.            How can you remove a constant variable?  Answer to be posted next week!

PowerShell Mini-Scripting Games 2014: Problem 5
Aug 15, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Problem 5

Doctor Scripto

Summary: Here is the final problem in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. This is it. It is day five of the Mini-Scripting Games. Next week, I will share solutions to the questions (PowerTips) and problems from this week. Problem 5 description Your manager has tasked you to help a junior admin with a script. It appears that the junior admin wants to solicit input from the user when the script is running. Then based on the input from the user, the script will  do something else. Task You only have to write a piece of sample code that will solicit input fr...

PowerTip: Mini-Scripting Games 2014 Question 4
Aug 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Question 4

Doctor Scripto

Summary: Here is the fourth short-answer question for Mini-Scripting Games 2014.  You are attempting to use Try/Catch/Finally in your script. No matter what you try, the script never seems to catch it.            What is the most likely cause of the problem?  Answer to be posted next week!

PowerShell Mini-Scripting Games 2014: Problem 4
Aug 14, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Problem 4

Doctor Scripto

Summary: Here is Problem 4 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. Today we have problem four in the Windows PowerShell Mini-Scripting Games. Remember: Please do not post any answers to these problems until next week. Please do not spoil the fun for your fellow scripters! Problem 4 description Your manager tasked you with what he considers to be a really important issue. The people at the Help Desk want a tool that will permit them to easily stop processes. Your manager doesn’t want to give them permission to use Task Manager because it carries too much ...

PowerTip: Mini-Scripting Games 2014 Question 3
Aug 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Question 3

Doctor Scripto

Summary: Here is the third short-answer question for Mini-Scripting Games 2014.  You are writing a script, and when it runs, you receive an error message that states:                 “You cannot call a method on a null-valued expression."            What is the first thing you should check?  Answer to be posted next week!

PowerShell Mini-Scripting Games 2014: Problem 3
Aug 13, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Problem 3

Doctor Scripto

Summary: Here is Problem 3 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. Today is the middle of the Windows PowerShell Mini-Scripting Games, so we are ready for Problem 3. Remember: Please do not post any answers to these problems until next week. Please do not spoil the fun for your fellow scripters! Problem 3 description One of your teammates wrote a script that runs against a select subgroup of users once a week. This script takes a rather long time to complete (upwards of five minutes in some cases). Therefore, the sign-in appears to hang when it is their turn f...

PowerTip: Mini-Scripting Games 2014 Question 2
Aug 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Question 2

Doctor Scripto

Summary: Here is the second short-answer question for Mini-Scripting Games 2014.  On your laptop running Windows 8.1, you are running Hyper-V.            You have heard that there are cmdlets that let you manage this.            You open Windows PowerShell and type the following command: Get-VM            Absolutely nothing comes back. But you know you have several virtual machines on your computer.            Why does nothing return?  Answer to be posted next week!

PowerShell Mini-Scripting Games 2014: Problem 2
Aug 12, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Problem 2

Doctor Scripto

Summary: Here is Problem 2 in Windows PowerShell Mini-Scripting Games 2014. Microsoft Scripting Guy, Ed Wilson, is here. It is time for the second problem of the Windows PowerShell Mini-Scripting Games. Remember: Please do not post any answers to these problems until next week. Please do not spoil the fun for your fellow scripters! Problem 2 description You have a CSV file that contains five columns. It comes from the HR department and it contains information that you do not need. You only need to work with three of the columns. Tasks Hint: Create a very simple CSV file by using Notepad (or another feature...

PowerTip: Mini-Scripting Games 2014 Question 1
Aug 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Mini-Scripting Games 2014 Question 1

Doctor Scripto

Summary: Here is the Mini-Scripting Games 2014 first short-answer question.  On your laptop running Windows 8.1, you opened the Windows PowerShell console and typed Get-Disk.            You were greeted with an error message that says:                 “Get-Disk: Access to a CIM resource was not available to the client."            What is the issue?  Answer to be posted next week!

PowerShell Mini-Scripting Games 2014: Problem 1
Aug 11, 2014
Post comments count 0
Post likes count 0

PowerShell Mini-Scripting Games 2014: Problem 1

Doctor Scripto

Summary: Introducing Problem 1 in the Windows PowerShell Mini-Scripting Games 2014.  Hey, Scripting Guy! You know, the Scripting Games are tons of fun, and I always learn a lot. I wish you would post problems from time-to-time, instead of me having to wait for the official Scripting Games. You don’t have to have prizes, judging, or even guest commentators. I would just like the practice. Is it even possible to do something like that? —EB  Hello EB, Microsoft Scripting Guy, Ed Wilson, is here. Sure it is possible. In fact, I like that idea. So here goes…a Mini-Scripting Games Week! I w...

PowerTip: Use PowerShell to Find Printer Configuration
Aug 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Printer Configuration

Doctor Scripto

Summary: Use Windows PowerShell in Windows 8.1 to easily find the configuration of printers.  How can I use Windows PowerShell to see the configuration of all printers defined on my Windows 8.1 system?  Use the Get-Printer cmdlet and pipe the results to the Get-PrintConfiguration cmdlet: get-printer | Get-PrintConfiguration

Mini-PowerShell Scripting Games 2014: Questions, Problems, and Answers
Aug 10, 2014
Post comments count 0
Post likes count 0

Mini-PowerShell Scripting Games 2014: Questions, Problems, and Answers

mredwilson

Summary: Use these Mini-PowerShell Scripting Games questions, problems, and answers for practice or in User Group meetings. Microsoft Scripting Guy Ed Wilson is here. On August 11, 2014, we kicked off a five day Mini-PowerShell Scripting Games. This was in response to a number of requests I have received in person, via email, via Twitter, and even from the Scripting Wife herself. All these queries have one thing in common—they all start like this, "I really enjoy the Scripting Games, but I wish we could do it more often." To which I thought, "Dude, that is impossible. There is too much work involved." ...

Weekend Scripter: Add Security Groups to Print Servers by Using PowerShell
Aug 10, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Add Security Groups to Print Servers by Using PowerShell

Doctor Scripto

Summary: Guest blogger, Alan Morris, talks about using Windows PowerShell to add security groups to print servers. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog from Alan Morris. Here is a little about Alan: Alan Morris has been involved with testing the Windows print system since Windows 2000. Active on Microsoft forums, he has been helping people worldwide with print-related issues for over 10 years. Working with Microsoft IT, he has been instrumental in rolling out prerelease versions of Windows Server for use as production print servers. Getting started Suppose I have a print server ...

PowerTip: Use PowerShell to Identify Users Without a Photo
Aug 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Identify Users Without a Photo

Doctor Scripto

Summary: List all users who do not have a photo assigned in Active Directory.  Is there a simple way that I can use Windows PowerShell to identify users who do not have a photo assigned in Active Directory?  Target the ThumbnailPhoto property, and filter the users for Null: GET-ADUSER –filter * -properties ThumbnailPhoto | Where { $_.ThumbnailPhoto –eq $NULL }

Weekend Scripter: Exporting and Importing Photos in Active Directory
Aug 9, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Exporting and Importing Photos in Active Directory

Doctor Scripto

Summary: Use Windows PowerShell to import and export photos in Active Directory. Honorary Scripting Guy, Sean Kearney, is here. I was playing about with Active Directory this week. I wanted to be able to get photos to automatically populate on my workstations running Windows 7. By doing some online reading, I found that you can store this in the ThumbnailPhoto attribute within Active Directory. In truth this that is not a hidden feature. If you're running Exchange Server 2013, Exchange Server 2010, or Lync, there are already cmdlets to do this. But I wanted to play. I actually wanted two optio...

PowerTip: Find How Many Days Are in a Month
Aug 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Find How Many Days Are in a Month

Doctor Scripto

Summary: Figure out how many days are in a month by using Windows PowerShell.  How can I use Windows PowerShell to find how many days are in a particular month?  Use the DaysInMonth static method from the System.DateTime object.             It expects the year and then the month as arguments. Here are a couple examples: Days in October 2014: [datetime]::DaysInMonth(14,10) Days in February 2015: [datetime]::DaysInMonth(2015,2)

Use PowerShell to Report on Exchange Online
Aug 8, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Report on Exchange Online

Doctor Scripto

Summary: Use the Windows PowerShell cmdlets to generate Exchange Online information. Microsoft Scripting Guy, Ed Wilson, is here. This morning, I have a meeting with my manager, and this afternoon, I am meeting with a couple of teammates. The meetings will bookend another wonderful day of Windows PowerShell coolness. In honor of the meeting this morning, I made a nice pot of Darjeeling tea, and I put in a bit of peppermint and spearmint and cinnamon stick. A little bit of orange peel rounds out the flavor. It almost feels extravagant to use a very nice Darjeeling tea and add in the spices, but hey, some people ad...

PowerTip:  Find Syntax for PowerShell Method
Aug 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Syntax for PowerShell Method

Doctor Scripto

Summary: Use Windows PowerShell to find the syntax for a method.  I am trying to figure out how to use a .NET Framework method, but it is not working.            How can I get a better idea of what to do?  Call the method with no parenthesis or parameters, for example: [DateTime]::DaysInMonth

Use PowerShell to Produce Mailbox Activity Report
Aug 7, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Produce Mailbox Activity Report

Doctor Scripto

Summary: Use Windows PowerShell to produce a mailbox activity report for Office 365. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of pomegranate black tea, and nibbling on a fresh blueberry scone. I am using my Windows Surface Pro 2 to check my email, and to make sure the Hey, Scripting Guy! Blog posted properly overnight. Everything is groovy. I am looking for the Scripting Wife’s phone. No, she hasn’t lost it. She ordered a new one. To be fair, it will be her birthday present, although she may not know that yet. She is turning out to be a huge gadget geek, and sh...

PowerTip: Determine if PowerShell is a 64-Bit Version
Aug 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Determine if PowerShell is a 64-Bit Version

Doctor Scripto

Summary: Use Windows PowerShell to easily find out if the shell is a 64-bit version.  How can I use Windows PowerShell to determine if I am currently running a 64-bit version?  Use the Is64BitProcess static method from the System.Environment class: [System.Environment]::Is64BitProcess

Use PowerShell for Office 365 Reporting
Aug 6, 2014
Post comments count 0
Post likes count 0

Use PowerShell for Office 365 Reporting

Doctor Scripto

Summary: Use Windows PowerShell to query the Office 365 Reporting web service.  Hey, Scripting Guy! There are a lot of reports available via various buttons on the Office 365 Admin page, but only a few seem to have a cmdlet to back them up. Is there a way that I can use Windows PowerShell to automate creation, and maybe even to customize the results from those reports? —GB  Hello GB, Microsoft Scripting Guy, Ed Wilson, is here. This morning I thought I would play some Alice Cooper on my Zune. I decided to have a bagel and a cup of coffee for breakfast. Teresa scored some organic Peruvian bean...

PowerTip: Expand Environmental Variables with PowerShell
Aug 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Expand Environmental Variables with PowerShell

Doctor Scripto

Summary: Learn to expand the value of environmental variables by using Windows PowerShell.  How can I use Windows PowerShell to find the value of a common environmental variable            such as %username% or %computername%?  Use the ExpandEnvornmentalVariables static method from the           System.Environment .NET Framework class, for example: [System.Environment]::ExpandEnvironmentVariables("%username%") [System.Environment]::ExpandEnvironmentVariables("%computername%")

Use PowerShell to Force Office 365 Online Users to Change Passwords
Aug 5, 2014
Post comments count 0
Post likes count 1

Use PowerShell to Force Office 365 Online Users to Change Passwords

Doctor Scripto

Summary: Use Windows PowerShell to force Office 365 online users to change their passwords.  Hey, Scripting Guy! I used your technique from yesterday to create a bunch of Office 365 users online, and now I want to force them to change their passwords. If I could also make them use a complex password, that would be great. Can you help me out Oh, Scripting One? —SW  Hello SW, Microsoft Scripting Guy, Ed Wilson, is here. Things are becoming interesting around the Scripting House this week. This is because yours truly, the Scripting Guy, has a birthday coming up in a few weeks. It is always fun trying...

PowerTip: Use PowerShell to List Time Zones Defined on System
Aug 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List Time Zones Defined on System

Doctor Scripto

Summary: Use Windows PowerShell to list time zones that are defined on a system.  How can I use Windows PowerShell to produce a list of all the time zones that are defined on my system?  Use the System.TimeZone .NET Framework class, and call the GetTimeZones static method: [System.TimeZoneInfo]::GetSystemTimeZones()

Use PowerShell to Create Bulk Users for Office 365
Aug 4, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Create Bulk Users for Office 365

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating bulk users in Office 365. Microsoft Scripting Guy, Ed Wilson, is here. This morning I spent a bit of time talking to my mentee. It is really cool, because yesterday I spent some time talking to my mentor. So it is sort of like the circle completing itself. I have been getting quite a few questions about Office 365 and Windows PowerShell here lately, so I thought I would spend a bit of time talking about that. Note  I have written many Hey, Scripting Guy! Blog posts about this topic, including Getting Started with the Office 365 PowerShell, Us...

PowerTip: Use PowerShell to Display Square Root of Number
Aug 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Square Root of Number

Doctor Scripto

Summary: Use Windows PowerShell to display the square root of a number.  How can I figure out the square root of a number when I am writing a Windows PowerShell script?  Use the Sqrt static method from the System.Math class. This example obtains the square root of the number 9: [math]::Sqrt(9)

Weekend Scripter: A Hidden Gem in the PowerShell Ocean: Get-PSCallStack
Aug 3, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: A Hidden Gem in the PowerShell Ocean: Get-PSCallStack

Doctor Scripto

Summary: Microsoft PowerShell MVP, Jeff Wouters, talks about using the Get-PSCallStack Windows PowerShell cmdlet. Microsoft Scripting Guy, Ed Wilson, is here. Today Windows PowerShell MVP, Jeff Wouters, is back with another guest blog post. To read more of Jeff's previous guest posts, see these Hey, Scripting Guy! Blog posts. And now, Jeff... I once tweeted the following: This blog post is all about that quote. Some time ago, I found myself in a situation where I needed to create a generic function that knew what other function or script called it. Let me explain... I wanted to write a function to log infor...

PowerTip: Wire Up PowerShell GUI Buttons
Aug 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Wire Up PowerShell GUI Buttons

Doctor Scripto

Summary: Learn to use the OK and Cancel buttons in a Windows PowerShell GUI.  How can I use Windows PowerShell to get my GUI’s OK and Cancel buttons to trigger when            the user presses ENTER or Escape?  Assign the OK and Cancel button objects to your form’s AcceptButton and CancelButton properties: $form.AcceptButton = $OKButton$form.CancelButton = $CancelButton

Weekend Scripter: Fixing PowerShell GUI Examples
Aug 2, 2014
Post comments count 1
Post likes count 0

Weekend Scripter: Fixing PowerShell GUI Examples

Doctor Scripto

Summary: Microsoft PowerShell MVP, Dave Wyatt, talks about using Windows PowerShell GUI example code. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Dave Wyatt. To read more of Dave’s previous guest posts, see these Hey, Scripting Guy! Blog posts. Dave is a Windows PowerShell MVP and a member of the board of directors at PowerShell.org. He works in IT, and he mainly focuses on automation, configuration management, and production support of computers running the Windows Server operating system and point-of-sale systems for a large retail company. Blog: http://davewyatt.wordpress.com...

PowerTip: Use PowerShell to Create Temporary File Name
Aug 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Temporary File Name

Doctor Scripto

Summary: Use Windows PowerShell to create a temporary file name.  I need to output data to a file, but I do not need a permanent file name and location because            the file will be later deleted. How can I easily use Windows PowerShell to create a temporary file name?  Use the GetTempFileName static method from the System.IO.Path .NET Framework class: [System.IO.Path]::GetTempFileName()

I've Got a PowerShell Secret: Adding a GUI to Scripts
Aug 1, 2014
Post comments count 0
Post likes count 1

I've Got a PowerShell Secret: Adding a GUI to Scripts

Doctor Scripto

Summary: Microsoft PFE, Chris Conte, talks about adding a GUI for Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. Today Chris Conte is our guest blogger. Chris Conte is a premier field engineer at Microsoft who grew up with a passion for computers and the creative arts. At age 12, he started programming by copying assembly game code on his dad's Commodore 64. Eventually, he parlayed that experience into learning about Visual Basic for Applications (VBA), ASP.NET, C#, and a variety of client scripting languages and frameworks. You can learn more about Chris via LinkedIn or Twitter @Cr...

PowerTip: Use PowerShell to Display Invalid File Names
Jul 31, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Invalid File Names

Doctor Scripto

Summary: Use Windows PowerShell to display invalid file name characters.  How can I use Windows PowerShell to display information about invalid file name characters?  Use the System.IO.Path class and call the GetInvalidFileNameChars static method: [System.IO.Path]::GetInvalidFileNameChars()

Exclude Delayed Start Services when Checking Status with PowerShell
Jul 31, 2014
Post comments count 0
Post likes count 0

Exclude Delayed Start Services when Checking Status with PowerShell

Doctor Scripto

Summary: Windows PowerShell MVP, Mike Robbins, shows us how to use Windows PowerShell to check the status of Windows services and improve the accuracy of results. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Mike Robbins. Mike F Robbins is a senior systems engineer with 20 years of professional experience as an IT pro. Mike has provided enterprise computing solutions for educational, financial, health care, and manufacturing customers. He’s a Windows PowerShell MVP and self-proclaimed evangelist who uses Windows PowerShell on a daily basis to administer and manage Windows Server...

PowerTip: Check Status of PowerShell Preference Variables
Jul 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Check Status of PowerShell Preference Variables

Doctor Scripto

Summary: Learn to easily check the value assignments of Windows PowerShell preference variables.  How can I use Windows PowerShell to quickly check the value of Windows PowerShell preference variables?  You can use the Windows PowerShell variable drive and look for variables that end with            the word preference. In this example, dir is an alias for Get-Content: dir variable:*preference 

Use PowerShell to Write Verbose Output
Jul 30, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Write Verbose Output

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to write verbose output.    Hey, Scripting Guy! The other day, you said that I should not use Write-Host. I even read that such usage is dangerous to the health of small canines in 2012 Scripting Games Commentary: STOP USING WRITE-HOST!. —BP  Hello BP, Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of English Breakfast tea with a cinnamon stick and a squeeze of lemon. I am using my Surface Pro 2 to check my scripter@microsoft.com email, and I saw another email from you. I decid...

PowerTip: Use PowerShell to Create Two Column Output
Jul 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Two Column Output

Doctor Scripto

Summary: Create a two column output of data by using Windows PowerShell.  How can I use Windows PowerShell to create output that has two columns?  Use the Format-Wide cmdlet, and then use the –Column parameter to specify            a number of columns, for example: Get-Process | Format-Wide name -Column 2

Troubleshoot PowerShell Script Output
Jul 29, 2014
Post comments count 0
Post likes count 0

Troubleshoot PowerShell Script Output

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about troubleshooting output from a Windows PowerShell script.  Hey, Scripting Guy! First, I want to say that you guys absolutely rock! I mean, I never miss a single day reading your posts. They are always right on, and it is like somehow you read my mind. I cannot tell you how many times I have read your post in the morning, and then needed to do that very thing in the afternoon. I also know that you probably get hundreds of emails every day, so I don’t really expect an answer, but I thought that maybe...what the heck. So here goes: I wrote a script t...

PowerTip: Start PowerShell with No Profile
Jul 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Start PowerShell with No Profile

Doctor Scripto

Summary: Start Windows PowerShell with no profile to troubleshoot scripts.  How can I use Windows PowerShell to troubleshoot a script that sometimes works and sometimes does not?  Look for any external dependencies by starting Windows PowerShell with no profile.            Use Start/Run, and in the dialog box, type: PowerShell –noprofile

Troubleshooting a PowerShell SQL Server Script
Jul 28, 2014
Post comments count 0
Post likes count 0

Troubleshooting a PowerShell SQL Server Script

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, helps a reader with a Windows PowerShell and SQL Server scripting issue. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a nice cup of Darjeeling tea. I added a bit of peppermint leaves, spearmint leaves, orange peel, licorice root, and a cinnamon stick. The result is very refreshing, with just a little bit of a kick to help jump start one's scripting. I was reviewing my scripter@microsoft.com email this morning, and I ran across the following question:  Hey, Scripting Guy! Is there good training content available for Windows PowerShell...

PowerTip: Use PowerShell to Find WMI Classes for Creating
Jul 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find WMI Classes for Creating

Doctor Scripto

Summary: Learn to find WMI classes that permit creating stuff.  How can I use Windows PowerShell to help me find WMI classes that will permit me to create stuff?  Use the Get-CimClass cmdlet, and specify the MethodName of create: Get-CimClass -MethodName create

Weekend Scripter: Authentication Silos Part 2
Jul 27, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Authentication Silos Part 2

Doctor Scripto

Summary: Microsoft PFE, Ian Farr, continues his series about using Windows PowerShell to work with Authentication Policy Silos. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back today, guest blogger, Ian Farr. If you missed yesterday's post I suggest that you read it before reading todays post: Authentication Silos: Part 1. Yesterday, I left you by saying that we would explore a bit in my lab today. From my lab: Notice that both the msDS-AuthNPolicySiloMembersBL and msDS-AssignedAuthNPolicySilo attributes are populated with the distinguished name of the new Authentication Policy Silo for e...

PowerTip: Use PowerShell to Find WMI Classes
Jul 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find WMI Classes

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find WMI classes.  How can I use Windows PowerShell to find WMI classes related to the BIOS on my computer.  Use the Get-CimClass cmdlet and search for the wildcard term *bios*: Get-CimClass *bios*

Weekend Scripter: Authentication Silos Part 1
Jul 26, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Authentication Silos Part 1

Doctor Scripto

Summary: Microsoft PFE, Ian Farr, talks about using Windows PowerShell to handle Authentication Policy Silos. Microsoft Scripting Guy, Ed Wilson, is here. This weekend we have a two-part series from Ian Farr. To read more of Ian's previous guest posts, see these Hey, Scripting Guy! Blog posts. Legend has it that there exists a great, gilded tome of Active Directory wisdom, maintained by learned elders with long, white beards and silver sandals… Rumour has it that I might have just made that up! If such a book were to exist, it should contain the following advice: And it’s the last point tha...

PowerTip: List All Parameters for a Cmdlet
Jul 25, 2014
Post comments count 0
Post likes count 0

PowerTip: List All Parameters for a Cmdlet

Doctor Scripto

Summary: Learn to provide a parameter list for a cmdlet in a viewable table.  I am trying to work with cmdlets with so many parameters that I am having a hard time reading them in Get-Help.            Is there a way to list them in a single table?  Access the Parameters property by using Get-Command and the cmdlet name, for example: (GET-Command GET-Childitem).parameters

Transforming the Active Directory Cmdlets: Part 5
Jul 25, 2014
Post comments count 0
Post likes count 0

Transforming the Active Directory Cmdlets: Part 5

Doctor Scripto

Summary: Learn how to translate between ADSI, Quest, and Windows PowerShell cmdlets for creating users.  Hey, Scripting Guy! Today I'm translating a script for modifying user properties and I could really use some help. There are so many parameters to work with. Where do I start? —LC  Hello LC, Honorary Scripting Guy, Sean Kearney, here. I'm finishing up this week where I have been discussing switching between the various forms of Active Directory cmdlets.** ** Note This is the final post in a series. For more, see: Funny enough, LC, Kevin had the same issue. He actually had an older ADSI script tha...

PowerTip: Identify All Properties for Active Directory User
Jul 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Identify All Properties for Active Directory User

Doctor Scripto

Summary: Use the –Properties parameter to find all properties attached to an Active Directory user.  How can I use Windows PowerShell rather than digging through the ADSI editor to find            the available properties for a user in our Active Directory?  Leverage the –Properties parameter on a single user to see all available property names: GET-Aduser Jubal.Harshaw –properties * | Get-Member

Transforming the Active Directory Cmdlets: Part 4
Jul 24, 2014
Post comments count 0
Post likes count 0

Transforming the Active Directory Cmdlets: Part 4

Doctor Scripto

Summary: Learn how to translate between ADSI, Quest, and Windows PowerShell cmdlets to read additional user properties.  Hey, Scripting Guy! I'm trying figure something out. I can get some properties with the Quest cmdlets without even asking, but when I go to use the Windows PowerShell cmdlets, they aren't there. How can I get these properties from the system? —RM  Hello RM, Honorary Scripting Guy, Sean Kearney, here. Today you can peek in as I guide my old buddy, Kevin, through converting some of his newer Windows PowerShell goodies for Active Directory to some older things. Note This is the fourth post i...

PowerTip: Use PowerShell to Determine ASCII Value
Jul 23, 2014
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to Determine ASCII Value

Doctor Scripto

Summary: Learn to use Windows PowerShell to determine the ASCII numeric value of a character.  How can I use Windows PowerShell to tell the ASCII value of a character?  You can get the numeric value of an ASCII character quite easily, for example,            to get the value of the lowercase letter a, type: [byte][char]'a'

Transforming the Active Directory Cmdlets: Part 3
Jul 23, 2014
Post comments count 0
Post likes count 0

Transforming the Active Directory Cmdlets: Part 3

Doctor Scripto

Summary: Learn how to translate between ADSI, Quest, and Windows PowerShell cmdlets for creating users.  Hey, Scripting Guy! I downloaded a script from the Internet to remove users, but it's designed to use the newer Windows PowerShell cmdlets. My server environment doesn't have them available yet. Can you help me convert to them? —RD  Hello RD, Honorary Scripting Guy, Sean Kearney, here. I'm working with my old friend, Kevin. This is the third post in a series. For more, see: Kevin discovered the power of Bing, and he found a really cool script for purging users. He found a snag though. "I...

PowerTip: Convert Plain Text to Secure String
Jul 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Convert Plain Text to Secure String

Doctor Scripto

Summary: Learn to convert a plain text password to a secure string for cmdlet parameters.   I'm trying to convert some scripts to work with the Active Directory modules,            but they need a secure string for the password. How do I create one of these?  Use the ConvertTo-SecureString cmdlet, capture the output, then            supply the new variable as SecureString for the password: $SecurePassword=ConvertTo-SecureString 'MySuperSecretP@ssw0rd!' –asplaintext –force 

Transforming the Active Directory Cmdlets: Part 2
Jul 22, 2014
Post comments count 0
Post likes count 0

Transforming the Active Directory Cmdlets: Part 2

Doctor Scripto

Summary: Learn how to transcribe between ADSI, Quest, and Windows PowerShell cmdlets for creating users.  Hey, Scripting Guy! I used to use the Quest cmdlets to create new users, but I need to rewrite some of my scripts to work with a legacy environment that can't use the .NET Framework. Can you help me? —SH  Hello SH, Honorary Scripting Guy, Sean Kearney, is here again. We're going to go into a bit more about translating between the various ways of working with Active Directory and Windows PowerShell. This is the second post in a series. You might also enjoy reading Transforming to Acti...

PowerTip: Find List of Users in Active Directory
Jul 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Find List of Users in Active Directory

Doctor Scripto

Summary: Use the Filter parameter in the Active Directory module.  I was playing with the Active Directory cmdlets and noticed that they seem to need the Distinguished Name.            Is there any way to find users instead of supplying this very explicit object each time?  Use the –Filter parameter to pull the information. For example, to find all users with the last name Smith,            specify the Surname attribute with the –Filter parameter: GET-ADUser –filter 'Surname &n...

Transforming the Active Directory Cmdlets: Part 1
Jul 21, 2014
Post comments count 0
Post likes count 0

Transforming the Active Directory Cmdlets: Part 1

Doctor Scripto

Summary: Learn how to translate between ADSI, Quest, and Windows PowerShell cmdlets for creating users in Active Directory.  Hey, Scripting Guy! I've got some older scripts that create users by using the [ADSI] accelerator. Can you show me how they might be rewritten to work with the more modern cmdlets in Windows Server 2012 R2? —DM  Hello DM, Honorary Scripting Guy, Sean Kearney, is here, and I'm just "primed" to show you how to "transform" from one style of scripting to another! Windows PowerShell is truly a technology that is more than meets the eye. It can be a simple management con...

PowerTip: Use PowerShell to Display Last Boot Time
Jul 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Last Boot Time

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display last boot up time.  How can I use Windows PowerShell to find the last time a workstation booted up?  Use the WMI Class Win32_OperatingSystem and select the LastBootupTime property.           Using the Get-CimInstance cmdlet returns a properly formatted DateTime object, for example: (Get-CimInstance Win32_operatingSystem).lastbootuptime

Weekend Scripter: Use PowerShell to Fix Broken Printer
Jul 20, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Fix Broken Printer

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to fix a printer that keeps losing its duplexer. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is that if I want to, I can generally use it to solve all of my issues. Sometimes the issue is not sufficient that I want to invest the time. However, if it is a persistent issue, and if it occurs often enough, at some point, it might very well tip the scale. The issue I have today is just such a case. Why can't I use my duplexer? I believe in printing on both sides of the paper when I ha...

PowerTip: Find All PowerShell Profile Locations
Jul 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Find All PowerShell Profile Locations

Doctor Scripto

Summary: Use the hidden properties of $profile to find Windows PowerShell profile locations.  How can I find the path to Windows PowerShell profile locations on my computer?  Use the –Force parameter from Format-List to display the hidden properties and values: $PROFILE | Format-List -Force

Weekend Scripter: Exploring Powershell Profiles
Jul 19, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Exploring Powershell Profiles

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, explores Windows PowerShell profiles and locations. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about the weekend is that it provides two entire days with no meetings, no specific obligations, and it gives me time to think and reflect. This is also a time to play with Windows PowerShell. Since Windows PowerShell 1.0 came out, the $profile automatic variable points to the CurrerentUserCurrentHost Windows PowerShell profile. This is extremely helpful because otherwise it would be a heck of a lot of typing, even when using tab expansion. Here ...

PowerTip: Remove Spaces from Both Ends of String
Jul 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Remove Spaces from Both Ends of String

Doctor Scripto

Summary: Learn to use Windows PowerShell to remove spaces from both ends of a string.  How can I use Windows PowerShell to remove spaces at both ends of a string?  Use the Trim method from the System.String .NET Framework class.           In this example, I create a string with a space at each end of the word, then          I call the Trim method to remove both spaces: $string = " a String " $string.Trim() Note  The Trim method exists on strings, so to use it, simply call it directly from t...

Trim Your Strings with PowerShell
Jul 18, 2014
Post comments count 0
Post likes count 2

Trim Your Strings with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to trim strings and clean up data. Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife heads out today to spend time with her other passion at the Blue Ridge Classic Horse Show. Unfortunately, I will not get to attend much of that event due to a week of training that my group is doing. But I will have the chance to see at least one day of the events. PowerShell Summit Europe Speaking of the Scripting Wife’s passions, registration is open now for the Windows PowerShell Summit in Europe. The event will be held Sept 2...

PowerTip: Use PowerShell Split Operator to Break Strings
Jul 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell Split Operator to Break Strings

Doctor Scripto

Summary: Learn how to use the Windows PowerShell Split operator to break up strings.  How can I use Windows PowerShell to break a string at a specific character?  Use the Split operator and specify the character to split on, for example: PS C:\> "this,is,a,string" -split ","

Using the Split Method in PowerShell
Jul 17, 2014
Post comments count 0
Post likes count 0

Using the Split Method in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using the Split method in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Dude, dude, dude, (or dudette, as the case may be) I still cannot find my teapot after our move. At least I found my kettle to heat water so I can make tea, but unfortunately, without a teapot, I am stuck drinking “bagged” tea leaves. It is not a major crisis yet, but I do miss blending my own teas with my own herbs. And of course, my various tins of teas and herbs are sitting here, just waiting for me to locate the teapot. On the bright side, I did pick u...

PowerTip: Create Empty String with PowerShell
Jul 16, 2014
Post comments count 0
Post likes count 1

PowerTip: Create Empty String with PowerShell

Doctor Scripto

Summary: Learn how to create an empty string by using Windows PowerShell.  How can I use Windows PowerShell to create an empty string?  Use the static Empty field from the System.String class: [string]::Empty

Join Me in a Few String Methods Using PowerShell
Jul 16, 2014
Post comments count 0
Post likes count 0

Join Me in a Few String Methods Using PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using the String class of the Join method in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. This morning while I was eating breakfast and reviewing my email on my Surface 2 Pro, I noticed that I have meetings all afternoon. Luckily, I was up early, and so I can get my writing done before the meetings start. The good thing is that I love meetings. Or, perhaps, I should say, that I love good meetings. Useless meetings are, well, useless. But a good meeting is great because it lets me collaborate with brilliant people, and I always leave...

PowerTip: Use PowerShell to Get Hash Code of Tuple
Jul 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Hash Code of Tuple

Doctor Scripto

Summary: Learn how to get the hash code of a tuple by using Windows PowerShell.  How can I use Windows PowerShell to get the hash code for a tuple?  Call the GetHashCode method from your Tuple object—for example,             this command creates a tuple and obtains the hash code of it: $t = [tuple]::Create(1,2) $t.GetHashCode()     This can also be accomplished in a single line: [tuple]::Create(1,2).gethashcode()

Keep Your Hands Clean: Use PowerShell to Glue Strings Together
Jul 15, 2014
Post comments count 0
Post likes count 0

Keep Your Hands Clean: Use PowerShell to Glue Strings Together

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about several approaches for concatenating strings by using Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. This weekend, I was speaking about blogging and technical writing at the South Carolina Writers Workshop in Rock Hill, South Carolina. One of the cool things is a couple of people drove from Atlanta and from Raleigh, North Carolina to attend my sessions. It was great to see them. If you hang out with The Scripting Wife on Facebook, you know that we also moved over the weekend. It is just across town, but still it is a major disruption. This...

PowerTip: Remove First Two Letters of String
Jul 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Remove First Two Letters of String

Doctor Scripto

Summary: Learn how to use Windows PowerShell remove the first two letters from a string.  How can I use Windows PowerShell to remove the first two letters from a string?  Use the SubString method, for example: $a = “String” $a.substring(2) 

PowerShell String Theory
Jul 14, 2014
Post comments count 0
Post likes count 0

PowerShell String Theory

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to work with strings. Microsoft Scripting Guy, Ed Wilson, is here. This has been an exciting week around the Scripting Household. From our lanai, we can see several little rabbits hopping around—they seem to like the clover. We have seen some butterflies (which in past years, we have not seen), and the hummingbirds are back. It is a great time to be out and about. Sitting in a swing, observing nature is a fundamental that helps me keep a positive mental outlook. Another fundamental is working with strings in Windows PowerShell...

PowerTip: Generate Random Beeps with PowerShell
Jul 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Generate Random Beeps with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to generate random beeps.  How can I generate random beeps by using Windows PowerShell?  Create a range of numbers between 190 and 8500 that will determine the tone.           Use the Get-Random cmdlet to choose a random number of tones. Pipe the results to the           ForEach-Object cmdlet, and call the Beep static method from the system.console class.           The first number determines the tone, and the second number determines the length of the tone. ...

Weekend Scripter: Hurrah for Curah
Jul 13, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Hurrah for Curah

Doctor Scripto

Summary: Teresa Wilson (aka Scripting Wife) talks about how Microsoft Curah solved her search issue. Microsoft Scripting Guy, Ed Wilson, is here. Windows PowerShell MVP, Teresa Wilson is back with us today to share information about Curah. One of the problems with trying to find technical information is...well...trying to find it in the first place. It seems that I can spend hours trying to find just the right article to solve an issue. Search engines are helpful at times, but if I do not know the right thing to search for, I am doomed. Going to a specific page, or set of pages, such as TechNet or MSDN, is OK&mda...

PowerTip: PowerShell Summit Europe 2014
Jul 12, 2014
Post comments count 0
Post likes count 0

PowerTip: PowerShell Summit Europe 2014

Doctor Scripto

Summary: The Scripting Wife shares information about Windows PowerShell Summit Europe 2014.  Do you have any information about the Windows PowerShell Summit Europe 2014?  Windows PowerShell Summit 2014 is Sept 29–October 1, 2014 in Amsterdam. One nice thing about this smaller event is that there is only one track, so you don’t have to choose between sessions that you want to attend and what you will miss.

Weekend Scripter: Top Ten PowerScripting PodCasts
Jul 12, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Top Ten PowerScripting PodCasts

Doctor Scripto

Summary: Windows PowerShell MVP, Teresa Wilson, talks about the top ten PowerScripting podcasts. Microsoft Scripting Guy, Ed Wilson, is here. This weekend we have a very special guest blogger. You guessed it. Teresa Wilson, aka The Scripting Wife, will share her thoughts with you. Take it away Teresa... Happy Saturday everyone. Things have been pretty busy here in the Scripting house. I feel like I have not been in touch with you for a while. My apologies. Today's topic is my career as the scheduler for the PowerScripting podcasts, and I want to share my top ten most memorable guests, subjects, or episodes. As so...

PowerTip: How Long Has My Computer Been Running?
Jul 11, 2014
Post comments count 0
Post likes count 0

PowerTip: How Long Has My Computer Been Running?

Doctor Scripto

Summary: Learn a one-liner Windows PowerShell command to see how long a computer has run.  How can I use Windows PowerShell to find out how long my computer has been running           since last boot up without writing a script?  Use the Win32_OperatingSystem WMI class and the LastBootupTime property,           and then subtract the value of the current date/time that comes from Get-Date: (Get-Date) - (Get-CimInstance Win32_operatingSystem).lastbootuptime

An End of Week Treat: Mini-Scripting Games
Jul 11, 2014
Post comments count 0
Post likes count 0

An End of Week Treat: Mini-Scripting Games

Doctor Scripto

Summary: Windows PowerShell MVP, Jim Christopher, shares a mini-Scripting Games event from the Charlotte Windows PowerShell User Group. Microsoft Scripting Guy, Ed Wilson, is here. Welcome today, guest blogger, Jim Christopher. Jim is a Windows PowerShell MVP and the leader of the Charlotte Windows PowerShell User Group. He was instrumental in creating and hosting two Windows PowerShell Saturdays in Charlotte, and he is also an all-around nice guy. Let’s see what Jim has to say about himself… I am a four-time Windows PowerShell MVP, and I help run the Charlotte PowerShell Users Group. I currently own...

PowerTip: Count a Range of Seconds with PowerShell
Jul 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Count a Range of Seconds with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to count a range of seconds.  How can I use Windows PowerShell to count a range of seconds of increasing duration?  Use the range operator to create a range of numbers, then pipe the results to the ForEach-Object cmdlet           inside a script block call Start-Sleep: 1..5 | ForEach {Start-Sleep -Seconds $_ ; "$_ seconds"}

Use Windows PowerShell to Prepare for Migration from SharePoint 2007
Jul 10, 2014
Post comments count 0
Post likes count 0

Use Windows PowerShell to Prepare for Migration from SharePoint 2007

Doctor Scripto

Summary: Marc Adam Carter talks about using Windows PowerShell to smooth the way for a large SharePoint 2007 migration. Microsoft Scripting Guy, Ed Wilson, is here. Today our guest blogger is Marc Adam Carter... If you’re responsible for administering a SharePoint 2013 or SharePoint 2010 farm, I’d have to say that things are looking pretty good right now with the availability of management tools. The SharePoint administration lawn is seriously greener on these farms. Let’s face it, even if you haven’t yet migrated from an older platform, such as Microsoft Office SharePoint Server...

PowerTip: Find Information About ErrorActionPreference
Jul 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Information About ErrorActionPreference

Doctor Scripto

Summary: Find information, beyond the basics, for the Windows PowerShell variable ErrorActionPreference.  How can I use Windows PowerShell to see information, beyond only the value, for the variable ErrorActionPreference?  Use the Get-Variable cmdlet and pipe the results to the Format-List cmdlet: Get-Variable ErrorActionPreference | Format-List * Note  When you use the *variable cmdlets, you do not specify the initial dollar sign. So it is represented as ErrorActionPreference not $ErrorActionPreference.

Handling Errors the PowerShell Way
Jul 9, 2014
Post comments count 0
Post likes count 0

Handling Errors the PowerShell Way

Doctor Scripto

Summary: Trevor Sullivan talks about handling errors in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have guest blogger and Windows PowerShell MVP, Trevor Sullivan... also find Trevor on Twitter (https://twitter.com/pcgeek86) and his blog (http://trevorsullivan.net) Microsoft Scripting Guy, Ed Wilson, just wrote a post about how to use the Try-Catch-Finally blocks in Windows PowerShell. But have you ever wondered if that was the only way to handle errors? It turns out that although it’s a great way to handle errors, there are still other options! If you’re coming to Windo...

PowerTip: Use PowerShell to Locate the Help File You Need
Jul 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Locate the Help File You Need

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find the Help file you need.  How can I figure out the exact name of the Help file that I am looking for about sessions?  Use a wildcard character with Get-Help to narrow down the scope of the Help files: Get-Help about_*session*   Name                              Category  Module                    ...

Getting to Know ForEach and ForEach-Object
Jul 8, 2014
Post comments count 0
Post likes count 4

Getting to Know ForEach and ForEach-Object

Doctor Scripto

Summary: Learn the differences between ForEach and ForEach-Object in Windows PowerShell. Honorary Scripting Guy and Windows PowerShell MVP, Boe Prox, here today filling in for my good friend, The Scripting Guy. Today I am going to talk about some differences between using ForEach and using ForEach-Object in day-to-day scripting activities. There are times when you are unable to make use of a cmdlet that has built-in pipeline support, such as something like this: Get-ChildItem –File –Filter “*.TMP” | Remove-Item –Verbose To get around this, we can make use of some other capabilities o...

PowerTip: Find Information About PowerShell Cmdlet Parameter Sets
Jul 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Information About PowerShell Cmdlet Parameter Sets

Doctor Scripto

Summary: Learn how to find information about Windows PowerShell cmdlet parameter sets.  How can I find information about the various parameter sets for a specific Windows PowerShell cmdlet?  Use Get-Command to return cmdlet information, pipe the results to the Select-Object cmdlet,           and expand the ParameterSets property: Get-Command Stop-Process | select -expand parametersets

Piping Results from One PowerShell Cmdlet to Another
Jul 7, 2014
Post comments count 0
Post likes count 0

Piping Results from One PowerShell Cmdlet to Another

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about piping the results from one cmdlet to another.  Hey, Scripting Guy! I have a problem. When I pipe information from one Windows PowerShell cmdlet to anther (for example, when I use Get-Process and pipe it to Stop-Process ), sometimes it works, and sometimes it does not. This is not great. What is the deal? Can you help? —LR  Hello LR, Microsoft Scripting Guy, Ed Wilson, is here. The nice thing about a hurricane is when it is gone. In Charlotte, we got some pretty heavy rain as a result of Hurricane Arthur, but nothing serious. Now we are enjo...

PowerTip: Find PowerShell Variables in Various Scopes
Jul 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Variables in Various Scopes

Doctor Scripto

Summary: Learn how to find Windows PowerShell variables in various scopes.  How can I see what Windows PowerShell variables exist in various scopes?  Use the Get-Variable cmdlet and use the –Scope modifier (this can be global, local, or script), for example: Get-Variable -Scope global

Weekend Scripter: From Zero to PowerShell Hero
Jul 6, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: From Zero to PowerShell Hero

Doctor Scripto

Summary: Microsoft MVP and winner of the Scripting Games, Taylor Gibb, talks about his experience with Windows PowerShell and IT in general. Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about TechEd is getting to talk to the various people that I meet virtually. One person who was both fun and inspirational to talk to was Taylor Gibb, who is the winner of this year's Scripting Games. I asked Taylor if he would be willing to share his story. So today we have a new guest blogger, Taylor Gibb. I will let Taylor tell you about himself... I was born and raised in Durban, South Africa. I am a so...

PowerTip: Examine the Most Recent PowerShell Error
Jul 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Examine the Most Recent PowerShell Error

Doctor Scripto

Summary: Learn how to examine the most recent error in Windows PowerShell.  My Windows PowerShell command failed with an error. How can I look at the error record?  Use the $error automatic variable to it displays the last error.           You can see more details by piping it to the Format-List cmdlet and using –Force: $error | Format-List * -Force

Weekend Scripter: Using Try, Catch, Finally Blocks for PowerShell Error Handling
Jul 5, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Using Try, Catch, Finally Blocks for PowerShell Error Handling

Doctor Scripto

Summary: Microsoft PFE, Ashley McGlone, talks about using Try, Catch, Finally blocks for error handling in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today’s guest blogger is Ashley McGlone, a Microsoft premier field engineer. Ashley is a popular speaker at our Windows PowerShell Saturday events. He regularly blogs about Active Directory and Windows PowerShell at Goatee PFE. You can follow him on Twitter as @GoateePFE. Take it away, Ashley... Why do scripts have errors? That is a long philosophical debate, and there is more than one correct answer. The generally accepted answer is that...

PowerTip: Difference Between XML PowerShell Cmdlets
Jul 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Difference Between XML PowerShell Cmdlets

Doctor Scripto

Summary: Understand the difference between XML cmdlets in Windows PowerShell. What is the difference between the Windows PowerShell cmdlets, Export-CliXML and ConvertTo-XML? The Help file for ConvertTo-XML says:"This cmdlet is similar to Export-CliXML, except that Export-CliXML stores the resulting XML in a file. ConvertTo-XML returns the XML, so you can continue to process it in Windows PowerShell."The Export verb encapsulates your objects in a persistent data store (such as a file) or into an interchange format. The ConvertTo verb simply changes the objects...

Back to Basics Part 5: Outputting Data
Jul 4, 2014
Post comments count 0
Post likes count 0

Back to Basics Part 5: Outputting Data

Doctor Scripto

Summary: Microsoft PFE, Gary Siepser, talks about outputting data via the pipeline in this exciting conclusion to a five part series. Microsoft Scripting Guy, Ed Wilson, is here. Today brings an end to a week of guest blog posts by Gary Siepser. You can read the following posts to catch up with the previous days: In Parts 3 and 4 of this series, we talked about a number of different things you can do with data coming down the pipeline. In Part 5, we are going to talk about what you do at the end of a pipeline. This can often be to output or present your data in some way. We’ll focus on formatting your ob...

PowerTip: Looking for Folders and Files in PowerShell
Jul 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Looking for Folders and Files in PowerShell

Doctor Scripto

Summary: Learn about looking for folders and files in Windows PowerShell. Why does this command show me folders instead of files?Dir | Where PSIsContainer -eq False In Windows PowerShell, use the automatic variables $True and $False to refer to Boolean values          instead of the string True and False. To perform the comparison, Windows PowerShell converts          the object on the right into the same type as on the left, so the string False is evaluated as a Boolean True.In this case, you are converting a string in...

Back to Basics Part 4: More Ways to Manipulate Data
Jul 3, 2014
Post comments count 0
Post likes count 0

Back to Basics Part 4: More Ways to Manipulate Data

Doctor Scripto

Summary: Microsoft PFE, Gary Siepser, talks more about the basics of the Windows PowerShell pipeline. Microsoft Scripting Guy, Ed Wilson, is here. Today Gary Siepser delivers his Part 4 of his five part series. To follow along, you can read: In Part 3, we introduced several cool things you can do with your data. In this post, we will continue that investigation by looking at even cooler techniques. We’ll focus on: Grouping data Sometimes when you are working with typical IT admin-type information, it’s useful to get counts of various things. Often there are common values on objects. For example, ...

PowerTip: Sorting More than One Column
Jul 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Sorting More than One Column

Doctor Scripto

Summary: Learn to sort by more than one column in Windows PowerShell.  Can I use Windows PowerShell to sort by more than one column, and have the primary column be ascending           and secondary column be descending?  In the Help examples, you'll see that the Property parameter accepts a hash table in place of a           real property name. In this hash table, you can specify the property to sort by and the order per property.           Copy Example 5 from the Help file and edit to suit your needs.

Back to the Basics Part 3: Do Something with Your Data
Jul 2, 2014
Post comments count 0
Post likes count 0

Back to the Basics Part 3: Do Something with Your Data

Doctor Scripto

Summary: Microsoft PFE, Gary Siepser, further investigates the basics of the Windows PowerShell pipeline. Microsoft Scripting Guy, Ed Wilson, is here. It's midweek already! Time sure flies, especially when you have a guest blogger for the week. Welcome back Gary Siepser for the third part in a series. To catch up, read: In Part 2 of this series, we looked at how you start a pipeline. In this part, we’ll see some basic and easy-to-use commands that let us manipulate that data to suit our needs.  First, let’s do a quick review of cmdlets. They are single-purpose commands that can be used together in a pipel...

PowerTip: Use Custom Delimiter with CSV File
Jul 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Use Custom Delimiter with CSV File

Doctor Scripto

Summary: Use a custom delimiter with Windows PowerShell when reading a CSV file.  Can I use a delimiter other than the comma ( , ) when reading from a CSV file?  Import-CSV has a parameter dedicated for this purpose called -Delimiter: Get-Help Import-Csv -ShowWindow You can easily use this during the import:

Back to the Basics Part 2: Learn about the Pipeline and “Getters”
Jul 1, 2014
Post comments count 0
Post likes count 0

Back to the Basics Part 2: Learn about the Pipeline and “Getters”

Doctor Scripto

Summary: Microsoft PFE, Gary Siepser, talks about the basics of using the Windows PowerShell pipeline and "getters." Microsoft Scripting Guy, Ed Wilson, is here. This week, Gary Siepser, a Microsoft PFE is our guest blogger. Yesterday, we posted the first part of his series: Back to the Basics Part 1: Learn About the PowerShell Pipeline. In in first post of this series, we looked at what the pipeline is and why you want to use it. We also outlined the common parts of the pipeline by introducing the “getters, doing something with your data, and outputting your data somewhere. In this post, we’ll focus on the fir...

PowerTip: Learn to Start the PowerShell Pipeline
Jun 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Learn to Start the PowerShell Pipeline

Doctor Scripto

Summary: Find cmdlets that permit starting the pipeline in Windows PowerShell.   How do I find all the Get commands that allow me to start a pipeline?  Although there are a number of ways, the Get-Command cmdlet has a parameter           called -Verb for this purpose: PS > Get-Command -Verb Get CommandType Name          ModuleName       ----------- ----          ----------       Alias  Get-ProvisionedAppxPack...

Back to the Basics Part 1: Learn About the PowerShell Pipeline
Jun 30, 2014
Post comments count 0
Post likes count 0

Back to the Basics Part 1: Learn About the PowerShell Pipeline

Doctor Scripto

Summary: Guest blogger and Microsoft PFE, Gary Siepser, talks about the basics of the Windows PowerShell pipeline. Microsoft Scripting Guy, Ed Wilson, is here. This week we have a series of five posts that are written by PFE Gary Siepser as we head back to the basics with the Windows PowerShell pipeline. Gary Siepser here (@PowerShellPFE). For Microsoft, I am a senior premier field engineer specializing in everything PowerShell. These days I find myself mostly teaching several Windows PowerShell classes to Microsoft customers. Check out Support: Premier Support Services to learn more. Windows PowerShell has been ...

PowerTip: Document Server's IP Addresses by Using PowerShell
Jun 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Document Server's IP Addresses by Using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to document the IP addresses on a server.  How can I use Windows PowerShell to easily go through my server environment and           document the IP addresses in use on each machine?  We can do this with a wee bit o' magic from the new Get-NetIPConfiguration cmdlet           in Windows Server 2012 R2: Get-NetIPConfiguration | Select-object InterfaceDescription -ExpandProperty AllIPAddresses If you'd like to save it in a file, use the Export-CSV cmdlet: Get-NetIPConfiguration | Select...

Weekend Scripter: Basic Lync Server 2013 Backup and Restore—Part 2
Jun 29, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Basic Lync Server 2013 Backup and Restore—Part 2

Doctor Scripto

Summary: Use native automation and Windows PowerShell cmdlets to back up Lync Server 2013. Honorary Scripting Guy, Sean Kearney, is here to finish up my crazy weekend fun automating Lync backup. So we've already gone through probably the trickiest part, which is getting the bulk of the Lync server infrastructure backed up. To read about that, see Basic Lync Server 2013 Backup and Restore—Part 1. Now what else could be backed up? How about the firewall settings? Obtaining the firewall configuration of your servers is incredibly easy within Windows Server 2012 R2. One single cmdlet gets us everythin...

PowerTip: Export Lync Topology with PowerShell
Jun 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Export Lync Topology with PowerShell

Doctor Scripto

Summary: Use the Lync cmdlets to obtain a copy of the Lync topology.  Instead of going through the GUI wizard, can I use Windows PowerShell to schedule a fresh copy           of my Lync topology as a regular nightly task so I can compare deltas?  Run the following Windows PowerShell cmdlet to create a file called Topology.zip with all of your topology: Export-CsConfiguration -FileName C:\Backup\Config.zip

Weekend Scripter: Basic Lync Server 2013 Backup and Restore—Part 1
Jun 28, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Basic Lync Server 2013 Backup and Restore—Part 1

Doctor Scripto

Summary: Learn how to make a rudimentary backup for a simple Lync Server environment. Honorary Scripting Guy, Sean Kearney, is here. Today we're going to play a game of "Let's Pretend." Let's pretend you got hired in a new company or are taking over from someone who had to deploy a simple Lync infrastructure. This will be a bit more complex than last week when we talked about simple management techniques for Lync Server 2013. Be sure to read this series of Hey, Scripting Guy! Blog posts: Managing Lync Server 2013 with Windows PowerShell. This time, our configuration will be: So the question is, "How do...

PowerTip: List All Lync Enterprise Voice Users with PowerShell
Jun 27, 2014
Post comments count 0
Post likes count 0

PowerTip: List All Lync Enterprise Voice Users with PowerShell

Doctor Scripto

Summary: Get a list of users and phone numbers from your Lync infrastructure.  How can I use Windows PowerShell to pull a weekly list of all our Lync Telephone numbers?  Use the Get-CSUser cmdlet, and in your Lync Server management shell, type: GET-CSUser | Where { $_.EnterpriseVoiceEnabled } If you'd like a list of only the names and phone numbers, use: GET-CSUser | Where { $_.EnterpriseVoiceEnabled } | Select-Object DisplayName,LineURI

Managing Lync Server 2013 with Windows PowerShell—Part 5
Jun 27, 2014
Post comments count 0
Post likes count 0

Managing Lync Server 2013 with Windows PowerShell—Part 5

Doctor Scripto

Summary: Learn about basic Lync auditing.  Hey, Scripting Guy! I go sites and need to work on various Lync servers. Often my first challenge is getting their configuration. Where do I start? —RD  Hello RD, Honorary Scripting Guy, Sean Kearney, is here to help you out with a little basic Lync auditing.      Note This is the fifth part in a series. You might also enjoy reading: Now my good friend, Lync MVP, Pat Richard, is probably nodding on this one. The first place you go to get your Lync configuration is (do not stop, do pass Go…. MOVE IT, MOVE IT, MOVE IT!) the Lync...

PowerTip: Get List of Blocked Domains on Lync with PowerShell
Jun 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Get List of Blocked Domains on Lync with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to get a list of all domains that are blocked from federating with Lync.  I am auditing a client's Lync server and need to pull up a list of all the Domains that are presently blocked or not blocked with Lync. How can I easily do that with PowerShell?  Run the Get-CSBlockedDomain cmdlet: GET-CSBlockedDomain If you'd like to export that information, pipe it to Export-CSV: GET-CSBlockedDomain | EXPORT-CSV BlockedList.csv

Managing Lync Server 2013 with Windows PowerShell—Part 4
Jun 26, 2014
Post comments count 0
Post likes count 0

Managing Lync Server 2013 with Windows PowerShell—Part 4

Doctor Scripto

Summary: Have a rollback plan for disabling a user in Lync.  Hey, Scripting Guy! Before I shut down all of these Lync accounts on our environment, my boss would like to see what my rollback plan is. Other than restoring from backup, is there a quicker "undo" I can leverage by using Windows PowerShell? —LN  Hello again LN! Honorary Scripting Guy, Sean Kearney, is here to show you how Windows PowerShell can give you a rollback in Lync (well sort of)!      Note This is the fourth part in a series. You might also enjoy reading: One of the interesting things I had to deal with on my last job was implementi...

PowerTip: Remove User from Lync Server 2013 with PowerShell
Jun 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Remove User from Lync Server 2013 with PowerShell

Doctor Scripto

Summary: Learn how to use -whatif to safely remove a user from Lync Server 2013.  I need to remove users from Lync by using PowerShell, but I'm a bit nervous.           Is there some kind of built-in test mode in Lync?  Use the -whatif parameter when you disable the user to show what will happen          without actually changing the system, for example: Disable-CSUser –identity 'Zaphod Beeblebrox' –whatif

Managing Lync Server 2013 with Windows PowerShell—Part 3
Jun 25, 2014
Post comments count 0
Post likes count 0

Managing Lync Server 2013 with Windows PowerShell—Part 3

Doctor Scripto

Summary: Use Windows PowerShell to remove Active Directory users for Lync. Honorary Scripting Guy, Sean Kearney, is here.      Note This is the third part in a series. You might also enjoy reading: Yesterday, we learned that in Lync, you can "disable" a user or you can "remove" a user. We actually disabled the Lync user in that post, which meant that the attributes and information were still in Lync, but the user was unable to access and use Lync. This is like when you disable a user in Active Directory. Today we're going to see how to remove that user, or many users if you need to. Let's keep one key p...

PowerTip: Add a Federation Domain to Lync with PowerShell
Jun 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Add a Federation Domain to Lync with PowerShell

Doctor Scripto

Summary: Use the Lync cmdlets to add an additional domain to Lync for federation access.  I'm working with a client to set up a federation, and I am trying to easily add their list of domains.           How can I do this with Windows PowerShell?  In Lync, use the New-CSAllowedDomain cmdlet: NEW-CSAllowedDomain –identity 'fabrikam.com' NEW-CSAllowedDomain –identity 'contoso.ca'

Managing Lync Server 2013 with Windows PowerShell—Part 2
Jun 24, 2014
Post comments count 0
Post likes count 0

Managing Lync Server 2013 with Windows PowerShell—Part 2

Doctor Scripto

Summary: Use Windows PowerShell to disable Active Directory users for Lync.  Hey, Scripting Guy! I was so happy yesterday! I spun up thousands of users in Lync, and it worked beautifully. But now management has come back and indicated that it should not be enabled for our temporary staff. How can I quickly disable Lync users? —LN  Hello LN, Honorary Scripting Guy, Sean Kearney, is here with more Lync cheer and cmdlets to save the day! Note  This is the second part in a series. You might also enjoy reading Managing Lync Server 2013 with Windows PowerShell—Part 1. First let me explain that in Lync, you h...

PowerTip: Convert to Upper Case with PowerShell
Jun 23, 2014
Post comments count 0
Post likes count 0

PowerTip: Convert to Upper Case with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to easily capitalize a string.  How can I use Window PowerShell to make all the text upper case so it is all in the           same form prior to writing to a database?  Use the ToUpper method from the String class: "string".ToUpper()

Managing Lync Server 2013 with Windows PowerShell—Part 1
Jun 23, 2014
Post comments count 0
Post likes count 0

Managing Lync Server 2013 with Windows PowerShell—Part 1

Doctor Scripto

Summary: Use Windows PowerShell to enable Active Directory users for Lync.  Hey, Scripting Guy! We just spun up our Lync server, and I need to know a very easy way to enable groups of users. I have over 10,000 records to enable and not quite enough coffee to click the mouse button all that fast! —LN  Hello LN, Honorary Scripting Guy, Sean Kearney, is here to show you a way to get all those users enabled without burning out the left mouse button! If you're new to managing Lync Server 2013, your first experience probably has been your visit to the Lync Server Control Panel. You found it well e...

PowerTip: Create an SRV Record in DNS with PowerShell
Jun 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Create an SRV Record in DNS with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell cmdlets to create a server resource record.  Is there was a way to script the creation of my internal server resource records for my Lync deployments?  If you're running Windows Server 2012 R2 or Windows Server 2012,           use the Add-NewDNSServerResourceRecord cmdlet (the following is a one-line command          that is broken for the webpage): Add-DnsServerResourceRecord –zone Contoso.local –name _sip –domainname sip.contoso.local –weight 0 –priority 0 –port 506...

Weekend Scripter: Automating the Preparation of Lync Server 2013—Part 2
Jun 22, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Automating the Preparation of Lync Server 2013—Part 2

Doctor Scripto

Summary: Automate the installation of SQL Server Express and complete the installation of Lync Server 2013. Honorary Scripting Guy, Sean Kearney, is here. Today, we're getting a little nerdy by automating the rest of our Lync server...on a Sunday. Yesterday, we finished with a Windows Server 2012 R2 box with all the features and the Visual C++ 2012 x64 Minimum Runtime package installed. We also have our schema for Active Directory extended. Note  This is the second post in a series about Lync. Before you continue, you might enjoy reading Automating the Preparation of Lync Server 2013—Par...

PowerTip: Extend Active Directory Schema for Lync with PowerShell
Jun 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Extend Active Directory Schema for Lync with PowerShell

Doctor Scripto

Summary: Learn to use the Lync module for Windows PowerShell to extend the Active Directory schema.  Is there an easy way to use Windows PowerShell to install a new Lync server?  After you have the Lync core installed on the server (even if you haven't installed Lync itself),           you can use the Windows PowerShell cmdlets! To extend the forest: Enable-CSAdForest To extend the domain: Enable-CSAdDomain

Weekend Scripter: Automating the Preparation of Lync Server 2013—Part 1
Jun 21, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Automating the Preparation of Lync Server 2013—Part 1

Doctor Scripto

Summary: Prep Windows Server 2012 R2 for a Lync Server 2013 installation. Honorary Scripting Guy, Sean Kearney, is here, and today I'm doing something I've been itching to do for a while...Automate the creation of a Lync server! You see, a while back, our Lync guy left the company. My boss looked at me and said, "You know anything about Lync?" Ever been in one of those situations? Fortunately for me, I had spun up and managed OCS 2007 in the past, so it wasn’t completely scary. One of our biggest challenges was disaster recovery. It appeared somewhere between "Spin up a Lync Se...

PowerTip: Determine PSReadLine Option Configuration
Jun 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Determine PSReadLine Option Configuration

Doctor Scripto

Summary: Use a cmdlet to find the way PSReadLine options are configured.  I recently started using PSReadLine, and I would like to see the way options are configured.           How can I report the options settings?  Use the Get-PSReadLineOption cmdlet.

A Better PowerShell Console with Custom PSReadLine Functions
Jun 20, 2014
Post comments count 0
Post likes count 0

A Better PowerShell Console with Custom PSReadLine Functions

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about a better Windows PowerShell console experience by using custom PSReadLine functions. Microsoft Scripting Guy, Ed Wilson, is here. I was reading an interesting article the other day. The author was talking about movies and history. The author said that in reality it does not matter if a historical movie has any basis in reality at all. The reason is that we really cannot know what things were like—say a thousand years ago. We have glimpses, slivers of light, but by-and-large, a lot of what we perceive is subject to interpretation. We do not even need t...

PowerTip: Unload All Non-Microsoft Modules
Jun 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Unload All Non-Microsoft Modules

Doctor Scripto

Summary: Learn to unload all non-Microsoft Windows PowerShell modules.  Windows PowerShell is acting funny and I want to unload all modules that are not written by Microsoft.           How can I easily do this?  Use Get-Module to find all loaded modules, use the Where-Object cmdlet to filter for authors           that do not match Microsoft, and then pipe the results to the Remove-Module cmdlet: Get-Module | where Author -notmatch 'microsoft' | Remove-Module

Useful Shortcuts from PSReadLine PowerShell Module
Jun 19, 2014
Post comments count 0
Post likes count 0

Useful Shortcuts from PSReadLine PowerShell Module

Doctor Scripto

Summary: Microsoft Scripting Guy Ed Wilson talks about useful shortcuts from the PSReadLine Windows PowerShell module. Microsoft Scripting Guy, Ed Wilson, is here. This is PSReadLine Week. You might also be interested in reading the following posts: One of the really cool things about the PSReadLine Windows PowerShell module is all of the cool shortcut functions that become available. Here is a table of miscellaneous functions that are available. One of the key combinations that I use often is the ShowKeyBindings function, which I access via Ctrl+Alt+?. Note  When using the previous sequence,...

PowerTip: Add Days, Hours, and Minutes to Current Time
Jun 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Add Days, Hours, and Minutes to Current Time

Doctor Scripto

Summary: Use Windows PowerShell to easily add days, hours, and minutes to the current time.  How can I use Windows PowerShell to add one day, two hours, and thirty minutes to the current date and time?  Create a TimeSpan object that represents one day, two hours, and thirty minutes,           then add it to the current date and time that Get-Date retrieves: $ts = New-TimeSpan -Days 1 -Hours 2 -Minutes 30 (get-date) + $ts

Better PowerShell History Management with PSReadLine
Jun 18, 2014
Post comments count 0
Post likes count 0

Better PowerShell History Management with PSReadLine

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using PSReadLine to gain better history support in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Someone might have said that those PowerShellers who do not learn how to use command history are doomed to retype the same commands, but I do not recall ever hearing it. In Windows PowerShell there are five *history cmdlets. Of these, I routinely use Get-History (the alias is h) and Invoke-History (alias is r). To be honest, I do not even use these all that often. One reason, is that the history eventually gets jumbled. Although it is possible...

PowerTip: Use PowerShell to Round Numbers
Jun 17, 2014
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to Round Numbers

Doctor Scripto

Summary: Learn how to use Windows PowerShell to round numbers. Is there an easy way to use Windows PowerShell to round numbers up or down in a computation that produces a large amount of numbers after the decimal point? Use the static Round method from the [math] class:PS C:> $a = 22/7PS C:> $a3.14285714285714PS C:> [math]::Round($a)3PS C:>

A Better PowerShell Command-Line Edit
Jun 17, 2014
Post comments count 0
Post likes count 0

A Better PowerShell Command-Line Edit

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using PSReadLine to improve command-line editing in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today I thought I would try something a bit different. It is hard to show command-line editing with screenshots and tables of shortcuts. So today’s post is basically two parts. The first part includes two tables that I built, which are basically reference material for the PSReadLine command-line enhancements. The second part is a short (less than two minutes) video. I recorded it to illustrate a simple command-line edit. My video is not...

PowerTip: Load PowerShell Modules and See What’s Imported
Jun 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Load PowerShell Modules and See What’s Imported

Doctor Scripto

Summary: Learn to parse load information about modules to see what’s imported. How can I analyze what is imported when a Windows PowerShell module loads? Use the –Verbose switch when importing the module, and redirect the verbose stream to a           text file so you can use Windows PowerShell cmdlets to parse the file. In the following example,          all modules are loaded, verbose output is redirected to a file, and Select-String is used to parse           the file (gmo is an alias ...

The Search for a Better PowerShell Console Experience
Jun 16, 2014
Post comments count 0
Post likes count 0

The Search for a Better PowerShell Console Experience

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the search for a better Windows PowerShell console experience. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of English Breakfast tea. I added bits of spearmint, peppermint, and licorice root, along with a cinnamon stick and some lemon peel, lime peel, and orange peel. It is quite refreshing and has a bit of a bite to it. I picked up some Biscotti yesterday when I made a food run, so I am trying to be careful to not get crumbs in my keyboard. You know I love drinking tea. In particular, I love mixing and blending my own tea ex...

PowerTip: Send Output to Clipboard with PowerShell
Jun 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Send Output to Clipboard with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to easily send output to the clipboard.  How can I easily capture output from the Windows PowerShell console and send it to the Windows Clipboard           so I can paste it into another program?  The standard Windows utility clip.exe accepts pipeline output, for example: Get-EventLog application -Newest 1 | clip

Weekend Scripter: Use PowerShell to Explore Dates
Jun 15, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Explore Dates

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to explore dates in the future. Microsoft Scripting Guy, Ed Wilson, is here. This afternoon, I am sipping a nice cup of Kwai Flower Organic Oolong tea. It is a slightly sweet, mild tea that goes well with jasmine blossoms. It makes for a nice relaxing afternoon, and the slightly woody flavor goes well with Macadamia nuts. Now contrast a nice relaxing afternoon with Friday the 13th. If I want to be prepared for the next Friday the 13th, how can I use Windows PowerShell to get that information for me? Well, it literally took me less th...

PowerTip: Get Unique Numbers by Using PowerShell
Jun 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Get Unique Numbers by Using PowerShell

Doctor Scripto

Summary: Easily get unique numbers from a list by using Windows PowerShell.  How can I use Windows PowerShell to get unique numbers from a list of numbers?  Use the Get-Unique cmdlet, for example: PS C:\> 1,2,2,3,4,4,5 | Get-Unique 1 2 3 4 5

Weekend Scripter: Non-PowerShell Books for PowerShell People
Jun 14, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Non-PowerShell Books for PowerShell People

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, collects a list of cool book recommendations. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I constantly find myself doing is reading. I try to read a lot of different things, fiction, non-fiction, classic literature, and technical. I am always cycling back and reading technical books. I find that I need to know more these days, and I have less time to come up to speed on various topics. Although my primary focus is on Windows PowerShell, I see the need to constantly be learning and reading about various technical topics. In this way, I guess I am a ho...

PowerTip: Use PowerShell to Create DateTime Object for Any Date
Jun 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create DateTime Object for Any Date

Doctor Scripto

Summary: Use Windows PowerShell to easily create a DateTime object X days in the future.  How can I use Windows PowerShell to create a DateTime object for a date at some point in the future?  Use the AddDays method from the DateTime object, for example: (get-date).AddDays(8)

Calling XMLDocument Methods in PowerShell
Jun 13, 2014
Post comments count 0
Post likes count 0

Calling XMLDocument Methods in PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about calling XMLDocument methods in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today is Friday the 13th. Cool. Luckily, I do not have to go anywhere tonight around midnight, by the light of a full moon. But I am going to use Windows PowerShell methods to slice and dice some XML. Luckily, this is a very neat technique, and it will not leave any wayward bits of data laying around. Besides, I am listening to Scripting Cmdlet Style, and that should scare off anything that is non-PowerShell related.     Note  This is the fifth in a series of p...

PowerTip: Find Other Ways to Use Split Method
Jun 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Other Ways to Use Split Method

Doctor Scripto

Summary: Find other ways to use the Windows PowerShell Split method. How can I use Windows PowerShell to find if there are other ways to use the Split method from a String object? Use the PSMethod object that returns from the method when not calling it with parenthesis,           and then call the OverLoadDefinitions property, for example:PS C:> "string".split.OverloadDefinitionsstring[] Split(Params char[] separator)string[] Split(char[] separator, int count)string[] Split(char[] separator, System.StringSplitOptions options)s...

Calling XML Document Properties from Within PowerShell
Jun 12, 2014
Post comments count 0
Post likes count 0

Calling XML Document Properties from Within PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about calling XML document properties from within Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Craig Liebendorfer is back. No, he is not working on the Hey, Scripting Guy! Blog, but he is working on the Script Center as a whole. My old collaborator brings a lot to the table when it comes to bouncing ideas around, taking chances, and thinking outside the box. In fact, in our first recent meeting, we both came up with (about the same time) an idea for a new Script Center Home page. I think it looks really cool, let me know what you think. By t...

PowerTip: Split String with PowerShell
Jun 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Split String with PowerShell

Doctor Scripto

Summary: Easily split a string on multiple characters with Windows PowerShell.  How can I use Windows PowerShell to split a string that contains multiple separator characters (for example, a comma and a semicolon)?  Specify a string with the characters in it to the Split method: PS C:\> $string = "This,is;a;string" PS C:\> $string.Split(',;') This is a string

Using PowerShell to Explore Structure of an XML Document
Jun 11, 2014
Post comments count 0
Post likes count 0

Using PowerShell to Explore Structure of an XML Document

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to explore the structure of an XML document. Microsoft Scripting Guy, Ed Wilson, is here. I don’t know about you, but when I decide to script, I often do a cost/benefit analysis. I am not talking about anything extensive or anything that is even formalized. But I do estimate how long it will take to do something manually, and then I estimate how long it will take to do the same thing with Windows PowerShell. As you may well know, quite often Windows PowerShell wins. But not always. The not always areas are often because I may not k...

PowerTip: Validate XML Document with PowerShell
Jun 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Validate XML Document with PowerShell

Doctor Scripto

Summary: Learn to use Windows PowerShell to validate that an XML document is well formed.  How can I use Windows PowerShell to test that anXML document is well formed?  Use the Test-XML cmdlet from the PSCX: test-xml C:\fso\users.xml Note  PSCX is a community-produced project that is available for free from CodePlex. I have written quite a bit about downloading, installing, and using this great resource. For more information, see this collection of Hey, Scripting Guy! Blog posts.

Exploring XML Document by Using the [XML] Type Accelerator
Jun 10, 2014
Post comments count 0
Post likes count 0

Exploring XML Document by Using the [XML] Type Accelerator

Doctor Scripto

Summary: Learn how to use the [XML] type accelerator to explore XML documents. Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife bought me a pound of English Breakfast tea that she found online somewhere. It is long leaf, robust, and has a hint of earth tones in the bouquet. It makes a wonderfully rich pot of tea. It was a complete surprise when the box showed up on the door step. I added a cinnamon stick, like I normally do, but I thought I would try this tea basically unaltered to get a sense of what it has to offer. In a way, the tea is similar to today’s excursion into XML. Note  This is th...

PowerTip: Display Formatted XML with PowerShell
Jun 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Display Formatted XML with PowerShell

Doctor Scripto

Summary: Use a free cmdlet to display formatted XML with Windows PowerShell.  How can I display formatted XML from within Windows PowerShell?  Use the Format-XML cmdlet from the PSCX project: Format-Xml C:\fso\users.xml Note  For information about the PSCX project, this collection of Hey, Scripting Guy! Blog posts.

Creating an XML Document for Admins
Jun 9, 2014
Post comments count 0
Post likes count 0

Creating an XML Document for Admins

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating XML files. Microsoft Scripting Guy, Ed Wilson, is here. I will be the first to admit that I am not a huge fan of XML. I mean, if I can use a CSV file to store and retrieve the information I need, why do I need XML? Well, there are many times when the nested structure of XML is a more robust option. When dealing with objects inside of objects, a CSV file breaks down. In addition, reading a CSV file is a bit cumbersome when I need to look at the actual CSV file in something like Notepad. For XML, there is Notepad and XML Notepad. XML Notepad XML Note...

PowerTip: Does PowerShell Array Contain a Value?
Jun 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Does PowerShell Array Contain a Value?

Doctor Scripto

Summary: Learn how to verify if a Windows PowerShell array contains a value. I have an array that contains various numbers and I want to see if one of the array elements contains           a specific number. Is there an easy way to use Windows PowerShell so I don't have to iterate through           the array and compare each element to the specific number? Use the Contains method from an array. In the following example, the $array variable contains an array.           The next line checks to see if the number ...

Weekend Scripter: Develop Minimal Footprint with PowerShell and Features on Demand
Jun 8, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Develop Minimal Footprint with PowerShell and Features on Demand

Doctor Scripto

Summary: Guest blogger, Yung Chou, talks about using Windows PowerShell to develop a minimal footprint with Features on Demand. Microsoft Scripting Guy, Ed Wilson, is here. Today I have another guest blog post from my fellow Microsoftee, Yung Chou. Yung is a developer experience evangelist; and therefore, he spends a decent amount of time talking to developers who are using Windows PowerShell. He maintains a blog on WordPress that contains some very useful information: YungChou: Witnessing a Clear Cloudy Day. Take it away Yung... Since Windows 8 and Windows Server 2012, IT has the capability to not only...

PowerTip: Use PowerShell to Display Windows Path
Jun 7, 2014
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to Display Windows Path

Doctor Scripto

Summary: Learn to use Windows PowerShell to display your Windows path.  How can I use Windows PowerShell to inspect my Windows path to see what folders are there and in what order they appear?  Use the $env PS Drive and retrieve the value of the Path variable. By default, it displays as a continuous string,           and it can be a bit difficult to read. Here is the command: $env:path But if you use the –split operator to break the strings at the semicolon, it is more readable: $env:path -split ";"

Weekend Scripter: Cool PowerShell Profile Functions from Bruce Payette
Jun 7, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Cool PowerShell Profile Functions from Bruce Payette

Doctor Scripto

Summary: Windows PowerShell principal SDE, Bruce Payette, shares a couple of cool profile functions. Microsoft Scripting Guy, Ed Wilson, is here. The week of May 19, we had Profile Week. (To read about some great ideas that you can use for your Windows PowerShell profile, see these Hey, Scripting Guy! Blog posts.) I saved one individual's profile for a special post. Today we will look inside Bruce Payette’s profile. For anyone who may not know, Bruce is a principal software development engineer (SDE) on the Windows PowerShell team. Now you know why this is a special post. Bruce supplied three way cool ...

PowerTip: View Directory List as Tree by Using PowerShell
Jun 6, 2014
Post comments count 0
Post likes count 0

PowerTip: View Directory List as Tree by Using PowerShell

Doctor Scripto

Summary:  Learn how to view a directory in a tree view by using Windows PowerShell.  How can I use Windows PowerShell to easily view a directory list as a tree view?  Use the Show-Tree cmdlet from the PowerShell Community Extension Project: Show-Tree e:\data –depth 2 Note  For information about obtaining and installiing the free PSCX modules, see these Hey, Scripting Guy! Blog posts.

Understanding XML and XPath
Jun 6, 2014
Post comments count 0
Post likes count 1

Understanding XML and XPath

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, explores XML and XPath. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that confused me for a long time about using the Get-WinEvent cmdlet is the difference between the –FilterXPath parameter and the –FilterXml parameters. Part of the problem is that there are nearly no examples to be found that illustrate using –FilterXPath. A close look at the syntax of the Get-WinEvent cmdlet, however, does provide a bit of a clue. I include two examples here: Get-WinEvent [[-LogName] <String[]>] [-ComputerName <String>] [-Credential &l...

PowerTip: Use PowerShell to Open Event Log
Jun 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Open Event Log

Doctor Scripto

Summary: Use a Windows PowerShell cmdlet to open the event log viewer.  How can I use a Windows PowerShell cmdlet to open the event log viewer?  Use the Show-EventLog cmdlet.

Using PowerShell to Parse System Log for Windows Updates
Jun 5, 2014
Post comments count 0
Post likes count 0

Using PowerShell to Parse System Log for Windows Updates

Doctor Scripto

Summary: Learn how to use XML and Windows PowerShell to parse the Windows system event log for Windows updates. Microsoft Scripting Guy, Ed Wilson, is here. Sometimes I come up with a solution, and then I go looking for a problem to fix. Not often, but sometimes. This is usually the result of playing around with Windows PowerShell on the weekend, and trying different things until I come up with something I think is cool. This is not one of those occasions. In fact, today’s blog post is pretty important for several reasons. The first reason is that I show how to use an XML filter to retrieve Windows event lo...

PowerTip: Use PowerShell to See Latest Log Entry
Jun 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to See Latest Log Entry

Doctor Scripto

Summary: Easily see the newest log entry by using Windows PowerShell.  How can I use Windows PowerShell to quickly check the most recent entry from a classic event log,           such as the application, system, or security log?  Use the Get-EventLog cmdlet and specify the –newest parameter, for example: Get-EventLog application -new 1    Or use the Get-WinEvent cmdlet: Get-WinEvent application -max 1

Data Mine the Windows Event Log by Using PowerShell and XML
Jun 4, 2014
Post comments count 0
Post likes count 0

Data Mine the Windows Event Log by Using PowerShell and XML

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Get-WinEvent in Windows PowerShell with FilterXML to parse event logs. Microsoft Scripting Guy, Ed Wilson, is here. Today I am sipping a cup of English Breakfast tea. In my pot, I decided to add a bit of spearmint, peppermint, licorice root, lemon peel, orange peel, and lime peel to the tea. The result is a very refreshing cup of tea with a little added zing. XML adds zing to event log queries The other day when I opened the event log on my laptop, I noticed all the red stop signs, and I thought, "Dude, I really need to investigate this." I ...

PowerTip: Find Permissible Event Log Keywords with PowerShell
Jun 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Permissible Event Log Keywords with PowerShell

Doctor Scripto

Summary: Learn to find permissible event log keywords values with Windows PowerShell.  How can I use Windows PowerShell to find examples of keywords when I use a FilterHashTable value           with Get-WinEvent?  Create an instance of the StandardEventKeywords enumeration, and then look at the Static properties: [System.Diagnostics.Eventing.Reader.StandardEventKeywords] | gm -s -MemberType property

Use FilterHashTable to Filter Event Log with PowerShell
Jun 3, 2014
Post comments count 0
Post likes count 0

Use FilterHashTable to Filter Event Log with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using a filter hash table to filter the event log with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. The weather here in Charlotte, North Carolina has turned hot and humid. As a result, the Scripting Wife decided to migrate north for a while. Actually, she is attending a conference in Cincinnati, Ohio. This has given me a bit of extra time to play around with Windows PowerShell and to work on my laptop. The most powerful way to filter event and diagnostic logs by using Windows PowerShell is to use the Get-WinEvent cmdlet. Introduced in Wi...

PowerTip: Open Printer Dialog Box from PowerShell
Jun 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Open Printer Dialog Box from PowerShell

Doctor Scripto

Summary: Open Printer and Devices in Control Panel from within Windows PowerShell.  How can I use Windows PowerShell to open Printer and Devices in Control Panel so I don't have to use the mouse?  Windows 8 introduced the Show-ControlPanelItem cmdlet, which you can use with a wildcard character: Show-ControlPanelItem -Name *print*

Use PowerShell to Troubleshoot Defrag Issues
Jun 2, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Troubleshoot Defrag Issues

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to troubleshoot defrag issues in Windows 8.1. Microsoft Scripting Guy, Ed Wilson, is here. This week, I begin a week-long series about looking at the Windows event and diagnostic logs via Windows PowerShell. I have previously written about this, and you may want to look at some of the previous posts. With the operating system becoming more complicated, and with more demands placed on it, it is inevitable that things will go wrong. However, Windows (especially Windows 8.1) is very robust. This means that a computer may appear to...

PowerTip: Use PowerShell to Test Virtual Hard Disks
Jun 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Test Virtual Hard Disks

Doctor Scripto

Summary: Use Windows PowerShell to test your virtual hard disks.  How can I easily test the virtual hard disks on my Windows 8.1 laptop to ensure that they will work?  Get a collection of all .vhd and .vhdx disks, then pipe the resulting objects to the Test-VHD cmdlet: Get-ChildItem -Path E:\vms\ -Recurse -Include *.vh* | Test-VHD You can shorten the command to: gci E:\vms\ -r -in *.vh* | Test-VHD

Weekend Scripter: Predicting the Future of PowerShell
Jun 1, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Predicting the Future of PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell and the future of the technology. Microsoft Scripting Guy, Ed Wilson, is here. Ahhh…the weekend. This morning, I decided (actually, I decided last night by not setting my alarm clock) to sleep in until the sun gently woke me with it’s warm embrace streaming in the window. It is a much more pleasant way to awaken than the jarring, blaring, ANK ANK ANK sound of my electronic alarm clock. I seriously believe that the engineer who designed this thing laughed heartily as he imagined the effect it would have on a slumbering Scripti...

PowerTip: Use PowerShell to Report Daylight Savings Time
May 31, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Report Daylight Savings Time

Doctor Scripto

Summary: Use Windows PowerShell to report if it is daylight savings time.  How can I use Windows PowerShell to report if it is daylight savings time?  Use the Get-Date cmdlet, and call the IsDaylightSavingTime method from the DateTime object: (Get-Date).IsDaylightSavingTime()

Weekend Scripter: Use PowerShell to Automate Active Directory Accounts
May 31, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Automate Active Directory Accounts

Doctor Scripto

Summary: Guest blogger, Gary Jackson, shares a technique to automate Active Directory accounts. Microsoft Scripting Guy, Ed Wilson, is here. I met Gary Jackson at the Windows PowerShell Summit in April. We talked about some cool things he has been working on, so I invited him to write a guest blog post. First a little about Gary… I am currently a senior database administrator in the healthcare field in Dallas, Texas. I started in the IT industry in 1983 with the Apple IIe. Over the years I’ve managed various systems from OpenVMS, Windows, UNIX, to Netware. Scripting has always been a big part of my d...

PowerTip: Set the PowerShell ISE Zoom Level
May 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Set the PowerShell ISE Zoom Level

Doctor Scripto

Summary: Use a Windows PowerShell command to set the ISE zoom level.  How can I ensure that the Windows PowerShell ISE zoom level is set to 100 percent all the time?  Use the $psISE options, and set the zoom level in your ISE profile: $psISE.Options.Zoom = 100

PowerShell Best Practices: Advanced Functions
May 30, 2014
Post comments count 0
Post likes count 0

PowerShell Best Practices: Advanced Functions

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about best practices for Windows PowerShell advanced functions. Microsoft Scripting Guy, Ed Wilson, is here. This morning, I am again enjoying a cup of my Darjeeling Earl Grey tea. Today I added a bit of rose petal, lemon grass, and a cinnamon stick to the mixture. Match it with a homemade cinnamon raisin scone with a little locally sourced butter, and I am certainly in the mood to work on Scripting Guy blog posts. I was up last night reading Piers Plowman in the original old English. The poem (written more than 650 years ago) is certainly interesting, and it has...

PowerTip: Obtain a List of All Functions in PowerShell
May 29, 2014
Post comments count 0
Post likes count 2

PowerTip: Obtain a List of All Functions in PowerShell

Doctor Scripto

Summary: Learn how to easily find functions in Windows PowerShell.  How can I see what functions exist in my current Windows PowerShell session?  Use the Function drive, for example: dir function:

PowerShell Best Practices: Simple Functions
May 29, 2014
Post comments count 0
Post likes count 0

PowerShell Best Practices: Simple Functions

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell best practices related to simple functions. Microsoft Scripting Guy, Ed Wilson, is here. The first time I saw this tea, I thought, "Dude, what an extravagance." I mean, a fine cup of Darjeeling tea is a true treat. It is mellow, light, and it is lightly aromatic. So why cover up that fine tea with bergamot and make a Darjeeling Earl Grey tea? Well for one thing, it is so wonderful, that it becomes addictive. During my recent trip to Europe, I stopped at nearly a dozen tea shops, and of course, I came back with a couple of very n...

PowerTip: Find a List of PowerShell Type Accelerators
May 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Find a List of PowerShell Type Accelerators

Doctor Scripto

Summary: Use Windows PowerShell to list type accelerators.  How can I find a list of type accelerators available in Windows PowerShell?  Use the Get property from TypeAccelerators class: [PSObject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::Get

PowerShell Best Practices: Simple Scripting
May 28, 2014
Post comments count 0
Post likes count 0

PowerShell Best Practices: Simple Scripting

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell best practices for simple scripts. Microsoft Scripting Guy, Ed Wilson, is here. "Heyyyyy! Script it, baby!" The words of Scripting Cmdlet Style continue to echo through the house. If you have not seen the latest Windows PowerShell community video by Sean Kearney, you should definitely check it out. It is really well done, and so far, it has received four thumbs up on You Tube. When I am working with Windows PowerShell, and the command begins to wrap to the second line, I start thinking about migrating to the Windows PowerShell ISE. If the...

PowerTip: Ensure Compliance with PowerShell Best Practices
May 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Ensure Compliance with PowerShell Best Practices

Doctor Scripto

Summary: Learn how to force Windows PowerShell to comply with basic best practices.  Is there an easy way for me to help Windows PowerShell comply with basic best practices?  Use the Set-StrictMode –Version Latest command to ensure that you cannot reference things such as           uninitialized variables and non-existent properties of an object:  Set-StrictMode -Version latest

PowerShell Best Practices for the Console
May 27, 2014
Post comments count 0
Post likes count 0

PowerShell Best Practices for the Console

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell best practices for the console. Microsoft Scripting Guy, Ed Wilson, is here. This morning, the Scripting Wife and I decided to head to a new breakfast place that had great reviews on Yelp. We grabbed our Surface 2s and headed into town. Teresa had her new Surface 2 RT with 4G, and I took my new Surface 2 Pro with the power keyboard. One of the things that got my attention about this restaurant was the statement that they made their scones in house from fresh ingredients instead of from mixes. They also claimed to have 30 different ty...

PowerTip: Find Disk Partition Information with PowerShell
May 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Disk Partition Information with PowerShell

Doctor Scripto

Summary: Learn how to use a Windows PowerShell function in Windows 8.1 to get partition information.  How can I use Windows PowerShell on my computer running Windows 8.1 to find disk partition information?  Use the Get-Partition function.

PowerShell Best Practices: Examine the Issues
May 26, 2014
Post comments count 0
Post likes count 0

PowerShell Best Practices: Examine the Issues

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about examining the issues surrounding Windows PowerShell best practices. Microsoft Scripting Guy, Ed Wilson, is here. One of the best things about TechEd, no matter where it is held, is the chance to meet up with people who we do not normally get to see. For example, this year in Houston, Texas at TechEd 2014, we had Jaap Brasser in the Scripting Guys booth with us. We first met him at the Dutch PowerShell User Group, and he helped in our booth at TechEd in Madrid last year. But this year when I was speaking at the Dutch PowerShell User Group, he was in China. T...

PowerTip: Use PowerShell to Discover Laptop Webcam
May 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Discover Laptop Webcam

Doctor Scripto

Summary: Use Windows PowerShell to discover a webcam attached to your laptop.  How can I use Windows PowerShell to find a webcam or camera that is attached to my laptop?  Use the Get-CimInstance or the Get-WmiObject cmdlet, examine the Win32_PnpEntity WMI class,          and look for something that matches camera in the caption. By using Get-CimInstance in Windows PowerShell 3.0 or later: Get-CimInstance Win32_PnPEntity | where caption -match 'camera' By using Get-WmiObject in Windows PowerShell 2.0:...

Weekend Scripter: Use PowerShell to Find and Disable Webcams
May 25, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Find and Disable Webcams

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find and disable webcams and cameras. Microsoft Scripting Guy, Ed Wilson, is here. It is really interesting (at least to me) the way certain questions seem to swirl around like trigger fish taking up residence near a coral reef. They keep coming back, although they appear to go away for a certain amount of time. Today’s question is no exception. When webcams first began to make their appearance on laptops, there was a huge rash of activity amongst network admins to remove drivers, disable the devices, or otherwise make them...

PowerTip: See if You Have a PowerShell Profile
May 24, 2014
Post comments count 0
Post likes count 0

PowerTip: See if You Have a PowerShell Profile

Doctor Scripto

Summary: Easily determine if you have a Windows PowerShell profile.  I am not sure if I have a Windows PowerShell profile. How can I easily find out?  Use Test-Path and the $profile automatic variable: Test-Path $PROFILE

What’s in Your PowerShell Profile? Powershell Team Favorites
May 24, 2014
Post comments count 0
Post likes count 0

What’s in Your PowerShell Profile? Powershell Team Favorites

Doctor Scripto

Summary: Microsoft Scripting Guy Ed Wilson talks to members of the Windows PowerShell team about what is in their Windows PowerShell profile. Microsoft Scripting Guy, Ed Wilson, is here. I'm wrapping up the week with profile excerpts from the Windows PowerShell team. There is some really cool stuff here. Hemant Mahawar indicated that he does not use a profile. This is quite common for people who work in Windows PowerShell core. This is also a common theme I have run across from people who teach or otherwise work with customers on a regular basis. The danger, of course, is inadvertently picking up something that i...

PowerTip: Use PowerShell to Display Date Formats
May 23, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Date Formats

Doctor Scripto

Summary: Use Windows PowerShell to easily change the way the date displays on your computer.  How can I use Windows PowerShell to display the date on my computer as a two-digit month, two-digit day,           and two-digit year?  Use the ToString() method from the Get-Date cmdlet. Here are two examples: PS C:\> (get-date).tostring("MM/dd/yy") 05/19/14 PS C:\> (get-date).tostring("MMddyy") 051914

What’s in Your PowerShell Profile? Microsoft PFEs' Favorites
May 23, 2014
Post comments count 0
Post likes count 0

What’s in Your PowerShell Profile? Microsoft PFEs' Favorites

Doctor Scripto

Summary: Microsoft premier field engineers share some of their favorite functions from their Windows PowerShell profiles. Microsoft Scripting Guy, Ed Wilson, is here. Today we will look at some profile excerpts from a few Microsoft premier field engineers (PFEs). Michael Wiley offers the following idea: "I actually got this from Ashley McGlone, but I use it extensively for giving presentations and demos. My $Profile for ISE contains the following lines to make error text more readable on projectors and to increase the font size." # Make error text easier to read in the console pane. $psISE.Options.ErrorBackground...

PowerTip: Import All PowerShell Modules
May 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Import All PowerShell Modules

Doctor Scripto

Summary: Learn to easily import all Windows PowerShell modules.  How can I import all Windows PowerShell modules into my current Windows PowerShell session?  Use the Get-Module cmdlet with the –ListAvailable switch, and pipe the results to the Import-Module cmdlet: Get-Module -ListAvailable | Import-Module You can also use aliases: gmo -l | ipmo

What’s in Your PowerShell Profile? PowerShell MVPs Favorites
May 22, 2014
Post comments count 0
Post likes count 0

What’s in Your PowerShell Profile? PowerShell MVPs Favorites

Doctor Scripto

Summary: Microsoft Windows PowerShell MVPs share some of their favorite functions from their Windows PowerShell profiles. Microsoft Scripting Guy, Ed Wilson, is here. Today I will be sharing some profile goodies provided by Windows PowerShell MVPs. Claus Nielsen stated that in his day-to-day work, he does not use a Windows PowerShell profile. There are several reasons for this, for example, he forgets to move it when he reinstalls his workstation. When he does demo’s, he has a script that puts line numbers in the Windows PowerShell console, which makes accessing history easier. Boe Prox shares a couple of p...

PowerTip: Use PowerShell and WMI to Change Disk Label
May 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell and WMI to Change Disk Label

Doctor Scripto

Summary: Learn how to use Windows PowerShell and WMI to change a disk label.  How can I use Windows PowerShell with WMI to change the disk label on a logical disk?  Beginning with Windows PowerShell 3.0, use the Get-CimInstance cmdlet to retrieve           the logical disk, and then use the Set-CimInstance cmdlet to set the VolumeName: Get-CimInstance win32_logicaldisk -Filter "deviceID = 'c:'" | Set-CimInstance -Property @{volumename = 'SSD'} Note  This technique requires you to start the Windows PowerShell c...

What's in Your PowerShell Profile? Users' Favorites Part 2
May 21, 2014
Post comments count 0
Post likes count 0

What's in Your PowerShell Profile? Users' Favorites Part 2

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks to various Microsoft Windows PowerShell users about what is in their profile. Microsoft Scripting Guy, Ed Wilson, is here. Today I have more items that Microsoft employees have in their profiles. Michael Lyons shared this: To make my Windows PowerShell profile easier to use, I like to customize it with: Here’s my dir function: function GLOBAL:dir {     $cwd = & cmd.exe /c cd 2> $null     if ($cwd -eq $pwd.Path)     {         & cmd.exe /c dir $args  &...

PowerTip: Use PowerShell to Add Hyper-V to Windows 8.1 Laptop
May 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Add Hyper-V to Windows 8.1 Laptop

Doctor Scripto

Summary: Learn how to use Windows PowerShell to add optional features to your laptop running Windows 8.1.  How can I use Windows PowerShell to install Hyper-V on my laptop running Windows 8.1?  Use the Add-WindowsOptionalFeature cmdlet, and choose the –Online option.           The feature name is case sensitive, and must be typed exactly, for example: Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online -All -NoRestart

What's in Your PowerShell Profile? Here Are Some User's Favorites
May 20, 2014
Post comments count 0
Post likes count 0

What's in Your PowerShell Profile? Here Are Some User's Favorites

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks to various Windows PowerShell users about what is in their profiles. Microsoft Scripting Guy, Ed Wilson, is here. I have had this idea floating in my head, and I decided to reach out to some fellow Windows PowerShell experts and enthusiasts in regards to “What is in your profile?” I asked each person to share a portion of their profile with you, our readers. Today I will be sharing ideas from internal Microsoft employees. Alex Lee shared three functions. The functions are called Parse-Script, Find-String, and Count-Lines. Here is what he has to s...

PowerTip: Use PowerShell to Find Things to Get
May 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Things to Get

Doctor Scripto

Summary: Use Windows PowerShell to find commands that “get” stuff. How can I find Windows PowerShell commands that can find stuff about disks or other Windows components? Use the Get-Command cmdlet, specify the verb as Get, and then use wildcard characters to specify the noun.           (In the following examples, GCM is an alias for the Get-Command cmdlet).To find cmdlets that return information about disks:gcm -verb get -noun *disk*To find cmdlets that return information about networks:gcm -verb get -noun *network*To find cmdlets ...

What's In Your PowerShell Profile? Here Are a Few of My Favorites
May 19, 2014
Post comments count 0
Post likes count 1

What's In Your PowerShell Profile? Here Are a Few of My Favorites

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shares a few favorites from his Windows PowerShell profile. Microsoft Scripting Guy, Ed Wilson, is here. I was at the Windows PowerShell Summit a couple weeks ago. When Jason Shirk, a manager on the Windows PowerShell team, was doing a demo, I was able to glance into his Windows PowerShell profile. I was amazed by the number of cool things that were there. I thought, “Hmmmmm...” I have had a Windows PowerShell profile since the early beta days—back when it was called Monad. I hardly consider myself to be a noob, but I am also the first to admit that I...

PowerTip: Time Parts of PowerShell Scripts
May 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Time Parts of PowerShell Scripts

Doctor Scripto

Summary: Learn how to time different parts of your Windows PowerShell scripts. How can I use Windows PowerShell to find which parts of my script are taking the longest           to complete so I can focus on improving them? Use the Measure-Command cmdlet to time any section of script in between two curly braces:Measure-Command {Start-Sleep -Seconds 5}Windows PowerShell automatically outputs the time for that section of script:Days              : 0Hours         ...

Weekend Scripter: PowerShell Speed Improvement Techniques
May 18, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: PowerShell Speed Improvement Techniques

Doctor Scripto

Summary: Microsoft PFE, Dan Sheehan, talks about speeding up Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back Dan Sheehan, who debuted yesterday as a new guest blogger with his post Best Practices for PowerShell Scripting in Shared Environment. Dan recently joined Microsoft as a senior premiere field engineer in the U.S. Public Sector team. Previously he served as an Enterprise Messaging team lead, and was an Exchange Server consultant for many years. Dan has been programming and scripting off and on for 20 years, and he has been working with Windows PowerShell since the relea...

PowerTip: Use Comment-Based Help in Shared Scripts
May 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Use Comment-Based Help in Shared Scripts

Doctor Scripto

Summary: Learn how to leverage Windows PowerShell comment-based Help.  How can I make my scripts easier to use when I share them with friends or colleagues?  People do not need to open and analyze your script if you use the comment-based Help capabilities           of Windows PowerShell. You can provide a description, explain the use of parameters, and provide           a number of examples of script execution.           Use the Get-Help cmdlet to access comment-based Help, use the name of your script, and choose     &n...

Weekend Scripter: Best Practices for PowerShell Scripting in Shared Environment
May 17, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Best Practices for PowerShell Scripting in Shared Environment

Doctor Scripto

Summary: Microsoft PFE, Dan Sheehan, shares Windows PowerShell scripting best practices for a shared environment. Microsoft Scripting Guy, Ed Wilson, is here. Today I would like to welcome a new guest blogger, Dan Sheehan. Dan recently joined Microsoft as a senior premiere field engineer in the U.S. Public Sector team. Previously he served as an Enterprise Messaging team lead, and was an Exchange Server consultant for many years. Dan has been programming and scripting off and on for 20 years, and he has been working with Windows PowerShell since the release of Exchange Server 2007. Overall Dan has over 15 ye...

PowerTip: Use PowerShell to Find Status of Hyper-V
May 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Status of Hyper-V

Doctor Scripto

Summary: Learn to use Windows PowerShell to find the status of Hyper-V on your Windows 8.1 laptop.  How can I use Windows PowerShell to find the status of Hyper-V on my laptop running Windows 8.1?  Use the Get-WindowsOptionalFeature cmdlet and choose the –Online option: Get-WindowsOptionalFeature -Online -FeatureName *hyper*

Troubleshooting PowerShell Scheduled Jobs
May 16, 2014
Post comments count 0
Post likes count 0

Troubleshooting PowerShell Scheduled Jobs

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about troubleshooting Windows PowerShell scheduled jobs. Microsoft Scripting Guy, Ed Wilson, is here. This has been an awesome week at TechEd 2014 in Houston. I can avoid the "Houston we have a problem" joke for the simple reason that the Scripting Wife and I are on our way home to Charlotte, N.C. We saw a tremendous number of Windows PowerShell fans this week, and I can tell you that being the Scripting Guy is a lot of fun when representing a technology as awesome as Windows PowerShell. I mean, dude (or dudette), Windows PowerShell rocks, and it helps ...

PowerTip: View PowerShell Formatting Data
May 15, 2014
Post comments count 0
Post likes count 0

PowerTip: View PowerShell Formatting Data

Doctor Scripto

Summary: Learn how to view the formatting data for a Windows PowerShell type.  How can I use Windows PowerShell to view the formatting data for a particular type?  Examine the output from Get-Member to find the type you are interested in, then use           the Get-FormatData cmdlet. Store the returned object in a variable and explore it           the way you do any other Windows PowerShell object. $f=Get-FormatData -TypeName ModuleInfoGrouping $f.FormatViewDefinition.control $f.FormatViewDefinition.Control.headers

Advanced PowerShell Scheduled Jobs
May 15, 2014
Post comments count 0
Post likes count 0

Advanced PowerShell Scheduled Jobs

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about advanced aspects of Windows PowerShell scheduled jobs. Microsoft Scripting Guy, Ed Wilson, is here. Today I want to look at some of the more advanced aspects of Windows PowerShell scheduled jobs. Windows PowerShell scheduled jobs do not have to be complicated. But because Windows PowerShell scheduled jobs are very flexible, there are many options. Running a scheduled job manually There are two ways to manually run a scheduled job instead of running it as an actual scheduled job with a trigger. The first way is to use the –RunNow parameter when creatin...

Day Three at Scripting Guys Booth–Microsoft TechEd 2014
May 14, 2014
Post comments count 0
Post likes count 0

Day Three at Scripting Guys Booth–Microsoft TechEd 2014

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about day three at the Scripting Guys booth at TechEd 2014 in Houston, Texas. Today the crowds at the Scripting Guys booth continued. Windows PowerShell MVPs, Don Jones, Steve Murawski, Teresa Wilson, and Sean Kearney were on hand at different times. One of the common questions today was about using Windows PowerShell to work with printers...installing printer drivers, configuring printer ports, and connections. Many people came by to say thank you for writing the Hey, Scripting Guy! Blog, or to get their book signed. Marc Adam Carter had a good conversation wit...

PowerTip: Check Status of PowerShell Scheduled Jobs
May 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Check Status of PowerShell Scheduled Jobs

Doctor Scripto

Summary: Learn how to check the status of Windows PowerShell scheduled jobs.  How can I use Windows PowerShell to check the status of a Windows PowerShell scheduled job?  Use the Get-Job cmdlet.

Ask the Experts at TechEd 2014 in Houston
May 14, 2014
Post comments count 0
Post likes count 0

Ask the Experts at TechEd 2014 in Houston

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Ask the Experts at TechEd 2014 in Houston, Texas. Oh man, dude, dude, dude (or dudette). Ask the Experts last night was totally awesome. The Scripting Guys and the Windows PowerShell team had three tables. We occupied an entire section, we had all the seats at the tables filled, and people were standing around in the aisles talking about Windows PowerShell. It was a total geek night. So, at 6:00 last night, they let the table owners (me and the Scripting Wife) come in. A few minutes after we found our tables and set out our signs, our experts began filterin...

Use PowerShell to Create Job that Runs at Startup
May 14, 2014
Post comments count 0
Post likes count 1

Use PowerShell to Create Job that Runs at Startup

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating a job that runs at startup. Microsoft Scripting Guy, Ed Wilson, is here. One of the needs that never seems to change is the need to run a startup script. In the old days, that meant placing a .bat or .vbs file in a startup folder, or listing it in the RUN key in the user folder. But those techniques do not work with Windows PowerShell scripts. That is because, by default, the .ps1 file extension is not associated with PowerShell.exe, but rather, with the ISE or Notepad. Of course you can change this, but it is not recommended. In Windows PowerShell...

Morning and Afternoon–Second Day at TechEd
May 13, 2014
Post comments count 0
Post likes count 0

Morning and Afternoon–Second Day at TechEd

mredwilson

Summary: Microsoft scripting Guy, Ed Wilson, talks about the morning and afternoon of the second day at TechEd 2014 in Houston, Texas. Today was an awesome time at the Scripting Guys booth at TechEd 2014. As it turns out, on Monday we talked to over 1,500 people. Today, we talked to another 1,500 people. In fact, all copies of the Desired State Configuration booklet the PowerShell.org people printed up are now gone. That was 3,000 copies. If you missed out, you can download a copy from the PowerShell.org web site. Here are the two who received the last two copies of the DSC book. We had a lot of questions about ...

PowerTip: View and Keep Results of PowerShell Job
May 13, 2014
Post comments count 0
Post likes count 0

PowerTip: View and Keep Results of PowerShell Job

Doctor Scripto

Summary: Learn how to view and keep the results of a Windows PowerShell job.   Every time I view the results of a Windows PowerShell job, I lose them. How can I save the results for viewing later?  Use the –Keep parameter on the Receive-Job cmdlet. In this example, I look at the results from Job 2,           and keep the results for later use: Receive-Job -id 2 -Keep

What Happens to PowerShell Scheduled Job After Reboot?
May 13, 2014
Post comments count 0
Post likes count 0

What Happens to PowerShell Scheduled Job After Reboot?

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, continues his discussion about Windows PowerShell scheduled jobs. Microsoft Scripting Guy, Ed Wilson, is here. Last night was the Expo floor meet-and-greet at TechEd in Houston. It was a crazy time, and we had literally thousands of people stopping by to say "hi," and to meet up with other Windows PowerShell peeps. It was an awesome opportunity to hang out with so many people who are interested in using Windows PowerShell. The cool thing is that many people had already read yesterday’s post about Windows PowerShell scheduled jobs, and several had questi...

TechEd 2014 Expo Hall Reception
May 12, 2014
Post comments count 0
Post likes count 0

TechEd 2014 Expo Hall Reception

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the Expo Hall at TechEd 2014 in Houston, Texas. Wow…we were, in a word, mobbed. During the entire two and a half hours that the TechEd Expo reception was going on tonight, we were mobbed. It may have been (in fact, was probably), due to our two special guests Jeffrey Snover and Mark Minasi. There were so many people lined up to see and to talk to Jeffrey, that he actually ended up staying  for over an hour and a half. At one point Mark and Jeffrey were sitting side-by-side at the Scripting Guys Booth and tag teaming questions. I overheard one pe...

The Scripting Guys Booth at Tech Ed 2014–Morning of Day One
May 12, 2014
Post comments count 0
Post likes count 0

The Scripting Guys Booth at Tech Ed 2014–Morning of Day One

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the Scripting Guys booth on the first morning of TechEd 2014. Wow! It is 2:00 in the afternoon, Houston time, and we finally had a chance to sit down. The Exhibit Hall is closed for a few hours to give us a chance to rest and  get ready for the evening reception. From the time the hall opened, right after the Keynote address, until now, there was a constant stream of people coming by the Scripting Guys Booth. Marc Adam Carter is helping out at the Scripting Guys Booth this year, and he was immediately swamped with people coming up and asking questions ...

PowerTip: Find Network Adapters Bound to TCP/IP v4
May 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Network Adapters Bound to TCP/IP v4

Doctor Scripto

Summary: Use Windows PowerShell to find network adapters that are bound to TCP/IP v4.  How can I use Windows PowerShell on my computer running Windows 8.1 to find protocol binding           information about network adapters that are bound to TCP/IP v4?  Use the Get-NetAdapterBinding function, and filter on the DisplayName parameter for           things that look like *tcp/ipv4*: Get-NetAdapterBinding -DisplayName *IPv4*

Introduction to PowerShell Scheduled Jobs
May 12, 2014
Post comments count 0
Post likes count 0

Introduction to PowerShell Scheduled Jobs

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, introduces the Windows PowerShell scheduled job feature. Microsoft Scripting Guy, Ed Wilson, is here. In all the hubbub about all the great features introduced in Windows PowerShell 3.0, one (actually more than one) feature was somewhat overlooked. With Windows PowerShell 3.0 bringing features such as workflow, PowerShell Web Access, support for disconnected sessions, CIM cmdlets, updatable Help, module auto loading, and improved Windows PowerShell ISE, it was really understandable that the scheduled job feature was simply overlooked by nearly everyone. This ...

PowerTip: Convert Character Array to String
May 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Convert Character Array to String

Doctor Scripto

Summary: Easily convert a character array to a string in Windows PowerShell.  How can I use Windows PowerShell to convert data that is returning as an array of characters           instead of as a single string?  Use the unary operator, and pass the array. In the following example, the first command returns an           array of characters, and the next the unary operator converts the character array to a single string: PS C:\> $a = (get-module -l)[0].Path | split-path -Parent PS C:\> $a[0] C PS C:\> $b = (,$a) PS C:\> $b[0] C:\Users\ed\Docum...

Scripting Guys Booth Setup at TechEd
May 11, 2014
Post comments count 0
Post likes count 0

Scripting Guys Booth Setup at TechEd

mredwilson

Summary: Microsoft Scripting Guy, Ed Wilson, talks about booth setup at TechEd. WooHoo! It is finally here. This morning, the Scripting Wife and I boarded the shuttle bus to the Houston Convention Center to finish the booth setup, and to sign-off on our booth. We breezed through registration, got our badges and alumni stickers, and headed to the Convention Center exhibition floor. The Scripting Guys booth is in the Resource Zone. The best way to enter is through Hall D...assuming they let you come in that way. Other wise, you need to enter through Hall C, and immediately turn right at the Net App booth. You are l...

Weekend Scripter: Houston, We Don’t Have a Problem…
May 11, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Houston, We Don’t Have a Problem…

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about setting up for TechEd 2014. Microsoft Scripting Guy, Ed Wilson, is here. Yesterday, the Scripting Wife and I flew to Houston for TechEd 2014. We went to the Convention Center, to ensure our shipments arrived on time, and to get the lay of the land, so to speak. Today, we are back at the Convention Center putting the finishing touches on the Scripting Guys booth, and meeting with our booth helpers: Marc Adam Carter and Jaap Brasser. We are also sharing our space again this year with the folks from PowerShell.org, and therefore Don Jones and Jason Helmick are...

Arrived in Houston for TechEd 2014
May 10, 2014
Post comments count 0
Post likes count 0

Arrived in Houston for TechEd 2014

mredwilson

Summary: Ed Wilson talks about arriving in Houston for TechEd 2014. The Scripting Wife and I arrived in Houston for TechEd 2014. Luckily, we were upgraded on our flight out, and I was able to use my new Surface 2 Pro to work on some PowerTips for future Hey, Scripting Guy! Blog posts. Teresa (aka Scripting Wife) decided to play a little game and guess who on the plane was heading to TechEd. Some of the people made it easy. Well duh, they were wearing a TechEd 2013 T-shirt. For others, it was tougher. At any rate, the flight out was uneventful. I was really impressed with the life I obtained on my Microsoft Surfac...

PowerTip: Use PowerShell to Find Grandparent of Path
May 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Grandparent of Path

Doctor Scripto

Summary: Use Windows PowerShell to easily find the grandparent of a path.  How can I use Windows PowerShell to find a directory that is two levels up in a nested path?  Use the Split-Path cmdlet and pipe the results to Split-Path. In the following example,           the path to a Windows PowerShell module is split, and then the parent of that path is split again: (get-module -l)[0].Path | split-path -Parent | Split-Path -Parent

Weekend Scripter: Introducing Script Browser and Script Analyzer
May 10, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Introducing Script Browser and Script Analyzer

Doctor Scripto

Summary: Scott Ge and Bill Grauer share new Windows PowerShell resources: Script Browser and Script Analyzer. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog from Scott Ge and Bill Grauer from Microsoft Customer Service and Support. Take it away Scott and Bill… To write quality script to automate IT, we often want to reference some reliable script samples or invite experts to review the script and provide suggestions. Looking for reliable script samples requires numerous copying and pasting, and switching between webpages and the scripting environment. Additionally, a script re...

PowerTip: Sort a PowerShell Array
May 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Sort a PowerShell Array

Doctor Scripto

Summary: Learn how to easily sort an array of numbers by using Windows PowerShell.  How can I use Windows PowerShell to easily sort an array of numbers stored in a variable?  Use the Sort static method from the [array] .NET Framework class: $a = 1,5,3,8,2,12 [array]::sort($a)

PowerShell Looping: The Continue Statement
May 9, 2014
Post comments count 0
Post likes count 1

PowerShell Looping: The Continue Statement

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using the Continue statement in looping. Microsoft Scripting Guy, Ed Wilson, is here. Dude, dude, dude (or dudette). TechEd 2014 is nearly here. Tomorrow the Scripting Wife and I jump onto a big old hairy plane and head to Houston, Texas for TechEd 2014 North America. We will head to the Convention Center, and begin the task of assembling the Scripting Guys booth. Look for pictures and ad hoc Hey, Scripting Guy! Blog posts as I try to help you join into the virtual awesomeness that is TechEd. If you are going to be there, make sure you keep up-to-date wit...

PowerTip: Verify If File Changes by Computing Hash
May 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Verify If File Changes by Computing Hash

Doctor Scripto

Summary: Use Windows PowerShell and compute a hash to verify if a file changes.  How can I use Windows PowerShell in Windows 8.1 to ensure that my Windows PowerShell profile           does not change without me knowing it?  Use the Get-FileHash cmdlet and store the returned object somewhere (for example, export it           to an XML file, or store the hash in a file or in the registry). When you suspect changes, use the           Get-FileHash cmdlet again, and compare the two objects by using the Co...

PowerShell Looping: Advanced Break
May 8, 2014
Post comments count 3
Post likes count 0

PowerShell Looping: Advanced Break

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about additional uses for the Break statement in looping. Microsoft Scripting Guy, Ed Wilson, is here. This morning, it is cool and the sun is barely up. I am sipping a cup of English Breakfast tea with a spoonful of spearmint and peppermint leaves, and a cinnamon stick. I have my new Surface Power Cover keyboard with my new Surface 2 Pro, and I am sitting on the lanai checking my scripter@microsoft.com email account. One thing that is funny about the Surface Power Cover is that it is selling at a premium price from various outlets on Amazon. The Scripting Wife w...

PowerTip: Use PowerShell to Find Firmware of Virtual Machines
May 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Firmware of Virtual Machines

Doctor Scripto

Summary: Use Windows PowerShell to find the firmware version of your virtual machines on Hyper-V.  How can I use Windows PowerShell to check the version of firmware on my second-generation          virtual machines running Hyper-V in Windows Server 2012 R2?  Use the Get-VM cmdlet to find your second generation virtual machines,           then pipe the virtual machine objects to the Get-VMFirmware cmdlet: get-vm | where generation -eq 2 | Get-VMFirmware Note  This command requires admin rights. 

PowerShell Looping: Basics of the Break
May 7, 2014
Post comments count 0
Post likes count 0

PowerShell Looping: Basics of the Break

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about the basics of using the Break statement in a Windows PowerShell loop. Microsoft Scripting Guy, Ed Wilson, is here. Hmmm, it seems that the Scripting Wife and I just returned from the Windows PowerShell Summit, and yet in four days, we are leaving for TechEd in Houston. Oh, wait. We DID just return from the Windows PowerShell summit. Dude, it rocked, too. We are so looking forward to TechEd. Make sure you stop by the Scripting Guys booth and say "hi." Hey, come hang out at the Scripting Guys booth all week. We have a number of way cool guests who will be s...

PowerTip: Use PowerShell to Find Virtual Machine BIOS Information
May 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Virtual Machine BIOS Information

Doctor Scripto

Summary: Find BIOS information about your virtual machines by using Windows PowerShell.  How can I use Windows PowerShell to find the bios information for a number of older virtual machines           running Hyper-V in Windows Server 2012 R2?  Identify the first generation virtual machines, then pipe the results to the Get-VMBios cmdlet: get-vm | where generation -eq 1 | Get-VMBios Note  This command requires admin rights.

PowerShell Looping: Understanding and Using Do…Until
May 6, 2014
Post comments count 0
Post likes count 1

PowerShell Looping: Understanding and Using Do…Until

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about understanding and using the Do…Until loop. Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife and I are busy getting ready for TechEd 2014 North America, which will be in Houston, Texas this year. It kicks off this Sunday with registration and preconference sessions. This year, TechEd sold out several weeks prior to the event, so there is lots of excitement built up around this event. The Scripting Wife posted her Ideal TechEd Schedule, the Meet and Greet Schedule for the Scripting Guys booth, and a map so you can Find the Scripting Guy...

PowerTip: Use PowerShell to Obtain BranchCache Status
May 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Obtain BranchCache Status

Doctor Scripto

Summary: Learn how to use Windows PowerShell to obtain the status of BranchCache on a computer running Windows 8.  How can I use Windows PowerShell to simplify the process of troubleshooting issues           with BranchCache on several desktops?  Create a CIM session to the troublesome computers, and use the Get-BCStatus function          to return the status information: $cim = New-Cimsession –computername c1, c2, c3 –credential nwtraders\administrator Get-BCStatus –cimsession $cim

PowerShell Looping: Understanding and Using Do…While
May 5, 2014
Post comments count 0
Post likes count 1

PowerShell Looping: Understanding and Using Do…While

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using the Do…While statement in Windows PowerShell scripts. Microsoft Scripting Guy, Ed Wilson, is here. Last week, the Scripting Wife and I were at the Windows PowerShell Summit in Bellevue, Washington. It was an awesome week. We got to reconnect with many old friends, and we also made new ones. I delivered three sessions on Wednesday. Needless to say, I was a bit tired. In fact, the entire week was tiring. I am talking about 16-hour days, and a three-hour time zone change kind of tired. But the energy was buzzing around; and therefore, it was aweso...

PowerTip: Test Certificate by Using PowerShell
May 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Test Certificate by Using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell in Windows 8.1 to test a certificate.  How can I test a certificate to ensure that it is OK in Windows 8.1?  Open the Windows PowerShell console with admin rights, use the Get-ChildItem cmdlet to retrieve certificates           using the certificate provider, pipe the certificates to the Test-Certificate, and specify the test to run.           The following command tests a certificate for SSL use with the specified DNS name: Get-ChildItem -Path Cert:\LocalMachine\my | Test-Certificate -Policy SSL &...

Weekend Scripter: Find the Scripting Guys Booth at TechEd 2014
May 4, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Find the Scripting Guys Booth at TechEd 2014

Doctor Scripto

Summary: The Scripting Wife shares the location of the Scripting Guys booth at TechEd 2014 in Houston. Microsoft Scripting Guy, Ed Wilson, is here. Today Windows PowerShell MVP, Teresa Wilson, aka The Scripting Wife, shares the location of the Scripting Guys booth at TechEd 2014. Take it away Teresa… Hello everyone. If you have never been to an event at the Houston Convention Center, you have missed out on a special treat. This venue is huge. TechEd 2014 is huge. In fact, it sold out weeks ago. This will be an incredible event, and I am excited to be part of it. As you may know, there are many way cool thi...

PowerTip: Use PowerShell to Create Self-Signed Certificate
May 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Self-Signed Certificate

Doctor Scripto

Summary: Use Windows PowerShell in Windows 8.1 to create a self-signed certificate.  How can I create a self-signed certificate in Windows 8.1 for testing purposes?  Use the New-SelfSignedCertificate function from the PKI module,           and specify DNSName and a certificate store location: New-SelfSignedCertificate -DnsName www.nwtraders.com -CertStoreLocation Cert:\LocalMachine\My Note  This function requires that you start the Windows PowerShell console with admin rights.

Scripting Guys Booth Guest Meet and Greet Schedule for TechEd 2014
May 3, 2014
Post comments count 0
Post likes count 0

Scripting Guys Booth Guest Meet and Greet Schedule for TechEd 2014

Doctor Scripto

Summary: The Scripting Wife shares the guest list for the Scripting Guys booth at TechEd 2014. Microsoft Scripting Guy, Ed Wilson, is here. Windows PowerShell MVP, Teresa Wilson (aka The Scripting Wife) is back with us today to share the schedule for guests that will be at the Scripting Guys booth in at TechEd 2014 in Houston. Hello again! I have a working schedule to share with you regarding who you can find at the Scripting Guys booth at specific times. Keep in mind that some of these people may be there at other times, and you are always welcome to stop by to chat. We are sharing the booth with the f...

PowerTip: Use PowerShell to Remove Mapping to Share
May 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Remove Mapping to Share

Doctor Scripto

Summary: Use Windows PowerShell to remove mapping to a SMB file share.  How can I use Windows PowerShell in Windows 8.1 to remove mapping to an SMB file share?  Use the Remove-SMBMapping cmdlet, specify either the local path or the remote path,           and use the –Force parameter to suppress prompts: Remove-SmbMapping -LocalPath j: -Force

Scripting Wife Creates Ideal TechEd 2014 Schedule
May 2, 2014
Post comments count 0
Post likes count 0

Scripting Wife Creates Ideal TechEd 2014 Schedule

Doctor Scripto

Summary: The Scripting Wife creates her ideal Windows PowerShell TechEd 2014 schedule. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blogger, Windows PowerShell MVP, Teresa Wilson, aka the Scripting Wife. Take it away, Teresa… Hello my Windows PowerShell friends. I am so excited! We just returned from the Windows PowerShell Summit, and next week, we get to go to TechEd NA. I will be at the Scripting Guys booth in the Resource Zone during the hours the Expo Hall is open. I will probably leave only long enough to eat lunch because I hate to miss out on seeing everyone who comes by the bo...

PowerTip: Close Open SMB File Shares with PowerShell
May 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Close Open SMB File Shares with PowerShell

Doctor Scripto

Summary: Learn how to close open SMB file shares in Windows 8.1 with Windows PowerShell.  How can I use Windows PowerShell to close a number of SMB file shares that I have open?  Open the Windows PowerShell console with admin rights, and           use the Close-SMBOpenFile function: Close-SmbOpenFile To avoid prompting, use the –Force parameter: Close-SmbOpenFile -Force

PowerShell Looping: The Automatic Foreach
May 1, 2014
Post comments count 0
Post likes count 0

PowerShell Looping: The Automatic Foreach

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell and the automatic Foreach feature. Microsoft Scripting Guy, Ed Wilson, is here. One of my favorite features in Windows PowerShell (since Windows PowerShell 3.0) is what I call the automatic Foreach. Basically, it means that I can access a particular property of a collection by direct access; and therefore, I avoid having to use a Foreach to enumerate through the collection.      Note  This is Part 4 of a four-part series about looping. Today, I conclude the series by talking about the automatic Foreach f...

PowerTip: Use Windows PowerShell to Find Open Files
Apr 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Use Windows PowerShell to Find Open Files

Doctor Scripto

Summary: Use Windows PowerShell 4.0 in Windows 8.1 to find open SMB file shares.  How can I use Windows PowerShell 4.0 to find open SMB file shares           on my Windows 8.1 computer?  Open the Windows PowerShell console with admin rights,           and use the Get-SMBOpenFile function to list all open SMB file shares: Get-SmbOpenFile

PowerShell Looping: Using While
Apr 30, 2014
Post comments count 0
Post likes count 0

PowerShell Looping: Using While

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell looping and looks at using the While statement. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that I see with people coming to Windows PowerShell from VBScript or some other language, is that they seem to like to use the While statement. While there is nothing wrong with While or Do While Loop, or even Do, these are not the easiest things to use in Windows PowerShell.      Note  This is Part 3 of a four-part series about looping. Today I will talk about using While to loop through a colle...

PowerTip: Use PowerShell to Show State of Scheduled Tasks
Apr 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show State of Scheduled Tasks

Doctor Scripto

Summary: Use Windows PowerShell to show scheduled jobs that are ready to run.  How can I use Windows PowerShell 4.0 to find scheduled jobs that are ready to run           on my Windows 8.1 computer?  Use the Get-ScheduledTask cmdlet and filter for a state that is equal to ready: Get-ScheduledTask | where state -eq 'ready'

PowerShell Looping: Using the Foreach-Object Cmdlet
Apr 29, 2014
Post comments count 1
Post likes count 0

PowerShell Looping: Using the Foreach-Object Cmdlet

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using the Foreach-Object cmdlet in Part 2 of the Looping Week series. Microsoft Scripting Guy, Ed Wilson, is here. Today I want to address a major point of confusion for newbie Windows PowerShell scripters. That point is the Foreach-Object cmdlet. Part of the confusion comes with the alias, Foreach, which is the same as the command name, Foreach. But that is only part of the confusion. For people trying to come to grips with looping through a collection, adding the Foreach-Object cmdlet into the mixture is just asking for trouble. Or asking for help. A...

PowerTip: Use PowerShell to Find USB Drives
Apr 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find USB Drives

Doctor Scripto

Summary: Use Windows PowerShell 4.0 function to find USB drives on Windows 8.1.  How can I use Windows PowerShell to find how many drives attached to my system are using USB interfaces?  Open Windows PowerShell 4.0 in Windows 8.1 with admin rights, use the Get-Disk function           to find all disk objects, and then filter for a bustype of USB: get-disk | where bustype -eq 'usb'

Basics of PowerShell Looping: Foreach
Apr 28, 2014
Post comments count 0
Post likes count 1

Basics of PowerShell Looping: Foreach

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using the Windows PowerShell Foreach statement to loop through a collection. Microsoft Scripting Guy, Ed Wilson, is here. When the Scripting Wife and I were in Amsterdam, Windows PowerShell MVP, Jeff Wouters, told me that a lot of people he ran across had problems looping through collections with Windows PowerShell.  Here is a picture of Jeff and me. Basics of looping Looping is a fundamental Windows PowerShell concept. Actually, I take that back. It is a fundamental concept of any programing language, even batch languages. So what is the problem? Mos...

PowerTip: Use PowerShell to Find Expiring Certificates
Apr 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Expiring Certificates

Doctor Scripto

Summary: Use Windows PowerShell to find certificates that are about to expire.  How can I use Windows PowerShell to find certificates that are going to expire within 30 days?  Use the certificate provider and the dynamic parameter –ExpiringInDays: Get-ChildItem cert:\currentUser –Recurse –ExpiringInDays 30

Weekend Scripter: Geeking Out at PowerShell Summit
Apr 27, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Geeking Out at PowerShell Summit

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about geeking out at the Windows PowerShell summit in Bellevue, Washington. Microsoft Scripting Guy, Ed Wilson, is here. One of the things that proves that Windows PowerShell is not going away any time soon (in case you were wondering) is that Windows PowerShell has its own conference. It also has its own user community, and its own community-sponsored organization. This week kicks off the Windows PowerShell Summit in Bellevue, Washington. I am speaking at two sessions, and the Windows PowerShell team is presenting about six sessions. There are people coming from...

PowerTip: Use PowerShell to Look Up Variable Values
Apr 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Look Up Variable Values

Doctor Scripto

Summary: Look up variable values in the caller’s scope.  I’m writing a Windows PowerShell advanced function in a script module. How can I look up the value of           variables set in my caller’s scope?  Use the $PSCmdlet.GetVariableValue() method: [CmdletBinding()] param ( ) $variableValue = $PSCmdlet.GetVariableValue(‘variableName’)

Weekend Scripter: Access PowerShell Preference Variables
Apr 26, 2014
Post comments count 2
Post likes count 0

Weekend Scripter: Access PowerShell Preference Variables

Doctor Scripto

Summary: Windows PowerShell MVP, Dave Wyatt, talks about accessing caller preference variables. Microsoft Scripting Guy, Ed Wilson, is here. Today I would like to welcome a new guest blogger and new Windows PowerShell MVP, Dave Wyatt.      Dave has worked in the IT field for about 14 years as a software developer and a systems administrator/engineer.      He started by writing software in C++ before switching career paths, but he has been writing batch, VBScript,      and Windows PowerShell scripts ever since, to scratch his “developer itch.”     ...

PowerTip: Use PowerShell to Find Dates of Last Defender Scans
Apr 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Dates of Last Defender Scans

Doctor Scripto

Summary: Use Windows PowerShell to find the dates of the last Windows Defender scans.  How can I use Windows PowerShell in Windows 8 to find the dates of the last quick scan and full scan           from Windows Defender?  Use the Get-MpComputerStatus cmdlet and select properties ending in the word age: Get-MpComputerStatus | select *age

Use PowerShell to Find Operating System Version
Apr 25, 2014
Post comments count 1
Post likes count 0

Use PowerShell to Find Operating System Version

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find the version of his Windows operating system. Microsoft Scripting Guy, Ed Wilson, is here. It is not a secret that I love Windows PowerShell. It is not a secret that I also love Windows 8.1 especially on my Surface Pro 2. Disclaimer: I bought my Surface Pro 2 myself at the Microsoft Store in the mall. I paid the same price as everyone else does, and Istood in line to make the purchase just like everyone else does. I did so because I wanted one to take with me on my five week trip to Europe. It absolutely rocked...

PowerTip: Use PowerShell to Display Defender Update Status
Apr 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Defender Update Status

Doctor Scripto

Summary: Use Windows PowerShell to display Windows Defender update status.  How can I use Windows PowerShell to check the update status of Windows Defender on my          computer running Windows 8.1?   Use the Get-MPComputerStatus cmdlet and select properties that contain the word Updated: Get-MpComputerStatus | select *updated

Create and Manage SharePoint Online Sites by Using PowerShell
Apr 24, 2014
Post comments count 0
Post likes count 0

Create and Manage SharePoint Online Sites by Using PowerShell

Doctor Scripto

Summary: Guest blogger, Corey Roth, talks about using Windows PowerShell to create and manage SharePoint online sites. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post by SharePoint MVP, Corey Roth. Corey will be presenting at TechEd 2014 this year in Houston, and he has taken the time to share his thoughts with us today. Here is a little bit about Corey: Corey Roth is an independent SharePoint consultant specializing in solutions in the Oil and Gas industry. Corey is a four-time recipient of the Microsoft MVP award in SharePoint Server. He has always focused on rapid adoption of new M...

PowerTip: Convert JSON File to PowerShell Object
Apr 23, 2014
Post comments count 0
Post likes count 1

PowerTip: Convert JSON File to PowerShell Object

Doctor Scripto

Summary: Easily convert a JSON file to a Windows PowerShell object.  How do I convert a JSON file to a Windows PowerShell object?  Use the Get-Content cmdlet with the Raw parameter: Get-Content -Raw -Path <jsonFile>.json | ConvertFrom-Json

JSON Is the New XML
Apr 23, 2014
Post comments count 0
Post likes count 0

JSON Is the New XML

Doctor Scripto

Summary: June Blender provides a primer about JSON. Honorary Scripting Guy, June Blender, here. Today I'm going to introduce you to JSON. June is a writer for the Azure Active Directory SDK. She is also a frequent contributor to the Hey, Scripting Guy! Blog and for PowerShell.org. She lives in magnificent Escalante, Utah, where she works remotely when she's not out hiking, kayaking, or convincing lost tourists to try Windows PowerShell. She believes that outstanding documentation is a collaborative effort, and she welcomes your comments and contributions. Follow her on Twitter at @juneb_get_help. To rea...

PowerTip: Find Largest File in User Profile with PowerShell
Apr 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Largest File in User Profile with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find the largest file in your user profile.  How can I use Windows PowerShell to find the largest file in my user profile?  Use the Get-ChildItem cmdlet (dir is an alias for the Get-ChildItem), do a recursive search           of your user profile directory, then sort the files by size and select the last file: dir $env:USERPROFILE -Recurse -File | sort length | select -last 1

Remediate Active Directory Members that Don't Support LVR
Apr 22, 2014
Post comments count 2
Post likes count 0

Remediate Active Directory Members that Don't Support LVR

Doctor Scripto

Summary: Ian Farr talks about using Windows PowerShell to find and remediate Active Directory members that don’t support linked-value replication. Microsoft Scripting Guy, Ed Wilson, is here. Today we welcome back Microsoft PFE, Ian Farr, as our guest blogger. To read more of Ian's previous guest posts, see these Hey, Scripting Guy! Blog posts. Ian has also started blogging at PoSh Chap. The keyboard is yours, Ian. This post is a new take on an old challenge… The final cut Like one of my favorite films, Active Directory has stood the test of time. It’s grown over the years with new functio...

PowerTip: Use PowerShell to Find Size of User Profile
Apr 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Size of User Profile

Doctor Scripto

Summary: Use Windows PowerShell to find the size of your user profile.  How can I use Windows PowerShell to find the size of my user profile and to see the size of the largest file in my profile?  Use the Get-ChildItem cmdlet, recurse through your profile directory, pipe the results to           the Measure-Object cmdlet, select the Length property, and add Sum and Maximum.           This command measures the ED directory, and dir is an alias for Get-ChildItem: PS C:\Users> dir .\ed -Recurse ...

PowerShell and TFS: The Basics and Beyond
Apr 21, 2014
Post comments count 1
Post likes count 0

PowerShell and TFS: The Basics and Beyond

Doctor Scripto

Summary: Learn about Windows PowerShell and Team Foundation Server. Microsoft Scripting Guy, Ed Wilson, is here. Today I am happy to introduce a new guest blogger, Susan Ferrell. Susan has spent most of her professional life working with computers, from basement tech startups to high-end datacenters. She’s a senior technical writer at Microsoft. Hi all! Susan here. Unlike most of you reading this, administering Team Foundation Server (TFS) is my primary focus, not Windows PowerShell. In fact, I was pretty much a Windows PowerShell novice until a month ago. However, less than a half hour into my first Window...

PowerTip: Find PowerShell Modules
Apr 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Modules

Doctor Scripto

Summary: Use Windows PowerShell to find Windows PowerShell modules.  How can I use Windows PowerShell to find out what modules are available on my system?  Use the Get-Module cmdlet and specify the –ListAvailable option: Get-Module -ListAvailable

Weekend Scripter: Exploring PowerShell Modules
Apr 20, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Exploring PowerShell Modules

Doctor Scripto

Summary: Use Windows PowerShell to explore Windows PowerShell modules. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I really, really, really like about Windows PowerShell is the fact that it is self-discoverable. I mean, I can use Windows PowerShell to explore Windows PowerShell and to learn about Windows PowerShell. One of the neat features introduced in Windows PowerShell 3.0 was the automatic loading of Windows PowerShell modules. This was an essential feature given the explosion of Windows PowerShell modules that shipped with Windows 8 and Windows Server 2012. In Windows Power...

PowerTip: Use PowerShell to Pause Execution
Apr 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Pause Execution

ScriptingGuy1

Summary: Use Windows PowerShell to pause execution for a specific time to wait for a process to exit.  I have a process that normally exits within four seconds, and I want to pause the execution of my script to wait           for this process to exit. If it does not exit in time, I want an error to occur. How can I easily do this?  Use the Wait-Process cmdlet and specify the name of the process and the wait time: Wait-Process -Timeout 4 -Name notepad In this command, if Notepad does not exit within four seconds, and error occurs. 

Weekend Scripter: Use PowerShell to Hide Processes in Windows
Apr 19, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Hide Processes in Windows

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to easily hide processes in Windows. Microsoft Scripting Guy, Ed Wilson, is here. One of the things I used to have problems with when I was a network administrator, was running scripts on systems without a text box demanding attention from the user. In fact, the power users quickly discovered that if they simply clicked the big X button, they could exempt themselves from my scripts. I soon found out that there was a program I could use to hide the dialogs from the users. It worked, but the program was expensive, and it required a pe...

PowerTip: List All Running Tasks in Windows 8.1
Apr 18, 2014
Post comments count 0
Post likes count 0

PowerTip: List All Running Tasks in Windows 8.1

Doctor Scripto

Summary: Use Windows PowerShell in Windows 8.1 to show all running tasks in Task Scheduler. Sometimes I get CPU spikes on a server. As part of troubleshooting, I need to know the processes and which           are scheduled tasks. Is there a way for Windows PowerShell to show me which tasks are running now? Use the Get-ScheduledTask cmdlet and filter on the State:Get-ScheduledTask | Where { $_.State –eq ‘Running’ }

Windows 8.1 and the Land of Forgotten Modules: Part 5
Apr 18, 2014
Post comments count 0
Post likes count 0

Windows 8.1 and the Land of Forgotten Modules: Part 5

Doctor Scripto

Summary: Explore and discover the additional Windows PowerShell modules in Windows 8.1. Honorary Scripting Guy, Sean Kearney, is here this week. Today, I'll wrap up our journey into the land of modules that are part of Windows 8.1. You also might enjoy reading: Today I’m going to investigate a module that I find particularly useful. One I would have dived over the table for this in my last job. Today, it's the Scheduled Tasks module. Let me grab the PowerShell can open…err…I mean, Get-Command, and crack open that module: Get-Command –Module ScheduledTasks Right off ...

PowerTip: List all Local Printers in Windows 8.1
Apr 17, 2014
Post comments count 0
Post likes count 0

PowerTip: List all Local Printers in Windows 8.1

Doctor Scripto

Summary: Use Windows PowerShell in Windows 8.1 to list locally attached printers.  How can I use Windows PowerShell in Windows 8.1 to give me a list of network-connected printers?  Use the Get-Printer cmdlet and filter on the type of connection: Get-Printer | Where { $_.Type –eq ‘Connection’ }

Windows 8.1 and the Land of Forgotten Modules: Part 4
Apr 17, 2014
Post comments count 0
Post likes count 0

Windows 8.1 and the Land of Forgotten Modules: Part 4

Doctor Scripto

Summary: Explore and discover the additional Windows PowerShell modules in Windows 8.1. Honorary Scripting Guy, Sean Kearney, is here this week. Today's post is the fourth in a series, and today we’re going to delve in the wonders of the Print Management module for Window PowerShell! You also might enjoy reading: It might seem like a simple idea, but I prefer to keep as much to the console as possible. It makes any task I do easily repeatable—even something as simple as identifying printers, features, and drivers, or controlling print jobs, if needed. For that purpose, Windows 8.1 comes...

PowerTip: Use PowerShell to Audit Shares
Apr 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Audit Shares

Doctor Scripto

Summary: Use Windows PowerShell in Windows 8.1 to audit shares on a workstation.  Is there an easy way to use Windows PowerShell to identify shares on a workstation and who has access to them?  Use a combination of the Get-SMBShare and Get-SMBShareAccess cmdlets: Get-SMBShare | Get-SMBShareAccess

Windows 8.1 and the Land of Forgotten Modules: Part 3
Apr 16, 2014
Post comments count 0
Post likes count 0

Windows 8.1 and the Land of Forgotten Modules: Part 3

Doctor Scripto

Summary: Explore and discover the additional Windows PowerShell modules in Windows 8.1. Honorary Scripting Guy, Sean Kearney, is here this week unwrapping more of these little modules I have found in my shiny new Windows 8.1 operating system. You also might enjoy reading: We’ll take a look at a module that’s available on both the workstation and the server. One that is particularly handy for those of us who deal with smaller peer-to-peer environments. I speak of no other module than SMBShare. SMBShare contains all of the cmdlets you’ll ever need to set up and manage shares. This in...

PowerTip: Enable IIS in Windows 8.1 with PowerShell
Apr 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Enable IIS in Windows 8.1 with PowerShell

Doctor Scripto

Summary: Use the DISM cmdlets to enable the built-in IIS component in Windows 8.1.  Is there a quick and easy way to enable IIS in Windows 8.1on my developer laptops?  With Windows 8.1, you only need to enter one line in Windows PowerShell: Enable-WindowsOptionalFeature –online –featurename IIS-WebServerRole

Windows 8.1 and the Land of Forgotten Modules: Part 2
Apr 15, 2014
Post comments count 0
Post likes count 0

Windows 8.1 and the Land of Forgotten Modules: Part 2

Doctor Scripto

Summary: Explore and discover the additional Windows PowerShell modules in Windows 8.1. Honorary Scripting Guy, Sean Kearney, is here this week to go where no Scripter has boldly gone before! Into the modules that are often overlooked in Windows 8.1! “Dude! No!” “Dude, yes!” Yesterday we saw that Windows PowerShell allows you to manage settings for search and for Windows Defender. These settings could even be stored from machine to machine in an XML file to set up standard configurations in a peer-to-peer environment. For more, see Windows 8.1 and the Land of Forgotten Modul...

PowerTip: Update Windows Defender with PowerShell
Apr 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Update Windows Defender with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell cmdlets in Windows 8.1 to update the antivirus definitions.  How can I use Windows PowerShell, rather than navigating the GUI, to force updates for Windows Defender?  In Windows 8.1, you can execute the following cmdlet and bring the Windows Defender up to date: Update-MPSignature

Windows 8.1 and the Land of Forgotten Modules: Part 1
Apr 14, 2014
Post comments count 0
Post likes count 0

Windows 8.1 and the Land of Forgotten Modules: Part 1

Doctor Scripto

Summary: Explore and discover the additional Windows PowerShell modules in Windows 8.1. Honorary Scripting Guy, Sean Kearney, is here this week to have a little interesting fun. We’re going to dive undercover and take a look at some of the additional modules that are built-in to Windows 8.1 that you may not be aware of. Or possibly you were, but you’re like me—you looked at that big pile of modules and had one word to say: “Whoa!” Or if you were Ed, it would be, “Whoa! Dude!” But today I had some time to play about, and I decided to see what each module could do...

PowerTip: List Contents of DNS Zone with PowerShell
Apr 13, 2014
Post comments count 0
Post likes count 0

PowerTip: List Contents of DNS Zone with PowerShell

Doctor Scripto

Summary: Use the DNS server cmdlets in Windows Server 2012 R2 to show contents of a zone.  I used to take screenshots and print screens to document my DNS server zones. Can I do this with Windows PowerShell?  To list all zones in a DNS server, in Windows Server 2012 R2 use the Get-DNSServerZone           Windows PowerShell cmdlet.

Windows Server 2012 R2 Network Cmdlets: Part 7
Apr 13, 2014
Post comments count 0
Post likes count 0

Windows Server 2012 R2 Network Cmdlets: Part 7

Doctor Scripto

Summary: Manage DNS server settings with Windows PowerShell in Windows Server 2012 R2. Honorary Scripting Guy, Sean Kearney, is here. Our final part of the Windows PowerShell Network Week series has arrived. You also might enjoy reading: Today I’m going to show you a couple of really cool and easy ways to work with your DNS server. These are things I never had working in the field that would have made my life easier. I remember going to sites and wishing I had an easy way to pull the configuration of a DNS server and store it away for later use. Well, now I can! Built into Windows Server 2012&n...

PowerTip: List DHCP Server Clients with PowerShell
Apr 12, 2014
Post comments count 0
Post likes count 0

PowerTip: List DHCP Server Clients with PowerShell

Doctor Scripto

Summary: Use the DHCP server cmdlets in Windows Server 2012 R2 to show current clients.  How can I use Windows PowerShell to show my current DHCP server clients?  Use the Get-DHCPServerv4scope and Get-DHCPServerv4Lease cmdlets piped together: Get-DHCPServerv4scope | Get-DHCPServerv4Lease 

Windows Server 2012 R2 Network Cmdlets: Part 6
Apr 12, 2014
Post comments count 0
Post likes count 0

Windows Server 2012 R2 Network Cmdlets: Part 6

Doctor Scripto

Summary: Manage DHCP server settings in Windows Server 2012 R2 with Windows PowerShell. Honorary Scripting Guy, Sean Kearney, is here. This weekend, I’m getting a little geeky. I’m going to continue with more of Windows PowerShell and the network cmdlets. This is the sixth part in a series called Windows PowerShell Network Week. You also might enjoy reading: Today I’m going to investigate the cool new cmdlets for managing the DHCP server! Oh I wish I had these at my last job! We were deploying new workstations and imaging systems. For this to work, I needed to send a Wake on Lan to the wo...

PowerTip: Use PowerShell to Get DNS Settings
Apr 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get DNS Settings

Doctor Scripto

Summary: Use Windows PowerShell to retrieve local DNS server addresses.  With IPconfig, I used to pipe output to the FIND command to filter only DNS information.           Is there a better way to do this in Windows Server 2012 R2?  Use the Get-DnsClientServerAddress cmdlet: Get-DnsClientServerAddress | Select-Object –ExpandProperty ServerAddresses

Windows Server 2012 R2 Network Cmdlets: Part 5
Apr 11, 2014
Post comments count 0
Post likes count 0

Windows Server 2012 R2 Network Cmdlets: Part 5

Doctor Scripto

Summary: Use Windows PowerShell to work with IP addresses and DNS.  Hey, Scripting Guy! How can I add the DNS settings to the network adapter in Windows Server 2012 R2? I’m a little lost on this one. —RJ  Hello RJ, Honorary Scripting Guy, Sean Kearney, is here today to pour out some more PowerShell love. This is the fifth part in a series called Windows PowerShell Network Week. You also might enjoy reading: I keep thinking of that line from Star Wars, “…and now the circle is complete.” Well, at least mostly for setting up a basic network configuration. We h...

PowerTip: Use PowerShell to Get IP Addresses
Apr 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get IP Addresses

Doctor Scripto

Summary: Use Windows PowerShell to retrieve IP addresses.  Is there a way to use Windows PowerShell to check IP addresses without use IPconfig?  In Windows Server 2012 R2, use the new Get-NetIPAddress cmdlet: Get-NetIPAddress If you like the output in a table, use: Get-NetIPAddress | Format-Table

Windows Server 2012 R2 Network Cmdlets: Part 4
Apr 10, 2014
Post comments count 0
Post likes count 0

Windows Server 2012 R2 Network Cmdlets: Part 4

Doctor Scripto

Summary: Use Windows PowerShell to work with IP addresses in Windows Server 2012 R2.  Hey, Scripting Guy! Now that we have Windows PowerShell cmdlets to use throughout Windows Server 2012 R2, is there any easier way to assign IP addresses to network adapters? —EL  Hello EL, Honorary Scripting Guy, Sean Kearney, is here today, unlocking more of the Power of the network cmdlets. This is the fourth part in a series called Windows PowerShell Network Week. You also might enjoy reading: When I first tried script to set an IP address on a server, it was without good "fiend" (...

PowerTip: Use PowerShell to Rename Network Adapter
Apr 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Rename Network Adapter

Doctor Scripto

Summary: Use Windows PowerShell to rename network adapters in Windows Server 2012 R2.  Is there a way to use Windows PowerShell in Windows Server 2012 R2 to rename a network adapter?  Use the Rename-NetAdapter cmdlet.           For example, to rename the network adapter called “Ethernet” to “ManagementPort”: Rename-NetAdapter “Ethernet” –NewName “ManagementPort”

Windows Server 2012 R2 Network Cmdlets: Part 3
Apr 9, 2014
Post comments count 0
Post likes count 0

Windows Server 2012 R2 Network Cmdlets: Part 3

Doctor Scripto

Summary: Use PowerShell to identify and disable network adapters in Windows Server 2012 R2.  Hey, Scripting Guy! I would love to know if there is an easy way to work with my physical adapters in a Windows Server 2012 R2 environment. Specifically, can you show me which adapters are live? —TM  Hello TM, Honorary Scripting Guy, Sean Kearney, is here today, unlocking more of the Power of the network cmdlets. This is the third part in a series called Windows PowerShell Network Week. You also might enjoy reading: Yesterday, we discovered that working with the Windows Firewall wit...

PowerTip: Use PowerShell to List Firewall Rules
Apr 8, 2014
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to List Firewall Rules

Doctor Scripto

Summary: Use Windows PowerShell to list firewall rules configured in Windows Server 2012 R2.  How can I use Windows PowerShell to show the inbound firewall rules in Windows Server 2012 R2 that are enabled?  Use the Get-NetFirewallRule cmdlet to get the entire list, and then           filter on the Enabled and Direction properties: Get-NetFirewallRule | Where { $_.Enabled –eq ‘True’ –and $_.Direction –eq ‘Inbound’ }

Windows Server 2012 R2 Network Cmdlets: Part 2
Apr 8, 2014
Post comments count 0
Post likes count 0

Windows Server 2012 R2 Network Cmdlets: Part 2

Doctor Scripto

Summary: Use Windows PowerShell to enable, disable, and configure firewall rules in Windows Server 2012 R2.  Hey, Scripting Guy! I see there are some new Windows PowerShell cmdlets for managing the built-in Windows Server 2012 R2 firewall. Could you lend a friend a hand and give me some help in learning how to use them? —JD  Hello JD, Honorary Scripting Guy, Sean Kearney, is here, delving further into the wonderful world of Windows PowerShell and the new network cmdlets. This is the second part in a series called Windows PowerShell Network Week. You also might enjoy reading Win...

PowerTip: Use PowerShell to Get List of Network Teams
Apr 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get List of Network Teams

Doctor Scripto

Summary: Learn how to use the NetSwitchTeam module in Windows PowerShell to list network teams.  How can I use Windows PowerShell in Windows Server 2012 R2 to list all the network teams?  Use the Get-NetSwitchTeam cmdlet: GET-NetSwitchTeam …or to show all teams starting with the name Prod: GET-NetSwitchTeam –name “Prod*”

Windows Server 2012 R2 Network Cmdlets: Part 1
Apr 7, 2014
Post comments count 0
Post likes count 0

Windows Server 2012 R2 Network Cmdlets: Part 1

Doctor Scripto

Summary: Discover Windows PowerShell cmdlets and modules in Windows Server 2012 R2 for networking.  Hey, Scripting Guy! I used to use netsh.exe to try to automate my server configurations. I can deal with it, but I heard that you can do a lot of this with Windows PowerShell in Windows Server 2012 R2. Do you know how I figure out which cmdlets to use? —BP  Hello BP, Honorary Scripting Guy, Sean Kearney, is here. Today kicks off Windows PowerShell Network Week. I’m going to introduce a new and better way to manage networking in the Windows Server environment by using t...

PowerTip: Use PowerShell to Display Known Colors
Apr 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Known Colors

Doctor Scripto

Summary: Boe Prox shows how to find all known colors on your computer.  How can I use Windows PowerShell to find known colors on my computer and their hex representations?  Use the Add-Type cmdlet as follows: Add-Type –assemblyName PresentationFramework [windows.media.colors] | Get-Member -static -Type Property | Select -Expand Name| ForEach {     [pscustomobject] @{         ARGB = "$([windows.media.colors]::$_)"         Color = $_     } }  ARGB        &n...

Weekend Scripter: Build a Clock Widget by Using PowerShell and WPF
Apr 6, 2014
Post comments count 0
Post likes count 1

Weekend Scripter: Build a Clock Widget by Using PowerShell and WPF

Doctor Scripto

Summary: Boe Prox shows how to use Windows PowerShell to build a clock widget. Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. Here's a bit about me: Boe Prox is a Microsoft MVP in Windows PowerShell and a senior Windows system administrator. He has worked in the IT field since 2003, and he supports a variety of different platforms. He is a contributing author in PowerShell Deep Dives with chapters about WSUS and TCP communication. He is a moderator on the Hey, Scripting Guy! forum, and he has been a judge for the Scripting Games since 2010. He re...

PowerTip: Use PowerShell to List Only Directories
Apr 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List Only Directories

Doctor Scripto

Summary: Learn how to use Windows PowerShell to show all directories.  How can I use Windows PowerShell to list ONLY directories in a folder structure?  Use Get-ChildItem on the target folder and specify the Directory parameter: Get-ChildItem C:\Foo –recurse -directory

Weekend Scripter: Organize Music Collection with PowerShell
Apr 5, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Organize Music Collection with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell and free utilities to clean up your directory structure and organize MP3s. Honorary Scripting Guy, Sean Kearney, is here. Today I was staring at a big pile of MP3s on my computer. It was actually a consolidation from several different machines. Old Media Player stuff, junk from a previous iTunes installation from years back, some things my kids had. There are probably duplicates and untagged MP3s. And add to that… I had some from a Windows Home Server that had a drive system go “funny” because I (in my great and powerful wisdom as an ITpro who would try anything ...

PowerTip: Use PowerShell to Display Pop-Up Window
Apr 4, 2014
Post comments count 1
Post likes count 0

PowerTip: Use PowerShell to Display Pop-Up Window

Doctor Scripto

Summary: Learn how to display a pop-up window by using Windows PowerShell.  How can I use Windows PowerShell to display a pop-up window to a user when a script or function has completed?  There are several ways to display a pop-up window, but the following command doesn’t require           loading assemblies prior to creating the window: $wshell = New-Object -ComObject Wscript.Shell $wshell.Popup("Operation Completed",0,"Done",0x1) Note  For more information, see Popup Method.

Build a Tool that Uses Constrained PowerShell Endpoint
Apr 4, 2014
Post comments count 0
Post likes count 0

Build a Tool that Uses Constrained PowerShell Endpoint

Doctor Scripto

Summary: Boe Prox shows how to create a tool that can leverage a remote constrained endpoint to perform a task.  Hey, Scripting Guy! How can I create a tool that my Help Desk admins can use to audit and restart services, while limiting their access to the server? —TJ  Hello SH, Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the final part in a series of five posts about Remoting Endpoints. The series includes: To wrap up our week about Windows PowerShell remoting endpoints, I am going to apply the knowledge that I shared this week to c...

PowerTip: Restore Default PSSession Endpoints
Apr 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Restore Default PSSession Endpoints

Doctor Scripto

Summary: Learn how to restore default PSSession endpoints.  How do I restore my default PSSession endpoints if I accidently unregistered them?  Use Enable-PSRemoting to automatically rebuild the remote endpoints on your system: Get-PSSessionConfiguration Enable-PSRemoting –Force #Now try it again Get-PSSessionConfiguration   Name          : Microsoft.PowerShell PSVersion     : 4.0 StartupScript : RunAsUser     : Permission    : BUILTINAdministrators AccessAllowed, BUILTINRemote Manage...

Use Delegated Administration and Proxy Functions
Apr 3, 2014
Post comments count 0
Post likes count 0

Use Delegated Administration and Proxy Functions

Doctor Scripto

Summary: Boe Prox shows how to create a secure PSSession endpoint by using delegated administration and a proxy function.  Hey, Scripting Guy! There are some great things that I can do with a constrained Windows PowerShell endpoint. But I want to allow a user (who may not have the necessary rights) to run a query on a remote system. Is this possible? —KP  Hello SH, Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the fourth part in a series of five posts about Remoting Endpoints. The series includes: Building a constrained Windows PowerS...

PowerTip: Test a PSSession Configuration File
Apr 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Test a PSSession Configuration File

Doctor Scripto

Summary: Learn how to test a PSSession configuration file.  How do I ensure that my PSSession configuration is valid?  Use the Test-PSSessionConfigurationFile cmdlet to see if the file is valid (True) or not (False). Test-PSSessionConfigurationFile –Path ConstrainedSession.pssc True

Build Constrained PowerShell Endpoint Using Configuration File
Apr 2, 2014
Post comments count 0
Post likes count 0

Build Constrained PowerShell Endpoint Using Configuration File

Doctor Scripto

Summary: Boe Prox teaches you how to build a constrained endpoint by using a configuration file.  Hey, Scripting Guy!, is there a better way to lock down my remote endpoint by using something other than a startup script? —SH  Hello SH, Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the third part in a series of five posts about Remoting Endpoints. The series includes: In yesterday’s post, I was able to restrict the commands that are available from a remote Windows PowerShell session by using a startup script to create a constrain...

PowerTip: List Remote PowerShell Endpoint Configurations
Apr 1, 2014
Post comments count 0
Post likes count 0

PowerTip: List Remote PowerShell Endpoint Configurations

Doctor Scripto

Summary: Learn how to list remote Windows PowerShell endpoint configurations.  How can I list remote Windows PowerShell endpoint configurations?  Connect-WSMan -ComputerName dc1           sl WSMan:           Get-ChildItem dc1\Plugin\microsoft* And here is the output: WSManConfig: Microsoft.WSMan.Management\WSMan::dc1\Plugin Type            Keys                          &nb...

Build Constrained PowerShell Endpoint Using Startup Script
Apr 1, 2014
Post comments count 0
Post likes count 0

Build Constrained PowerShell Endpoint Using Startup Script

Doctor Scripto

Summary: Learn how to build a constrained endpoint by using a startup script. Hey, Scripting Guy!, how do I lock-down my remote endpoint to only certain commands? —GH Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. This is the second part in a series of five posts about Remoting Endpoints. The series includes: As seen at the end of yesterday’s post, I was able to restrict the commands that are available from a remote Windows PowerShell session by using a constrained endpoint. Today I am going to show you how to create a constrained endpoint by usin...

PowerTip: Find Default Session Config Connection in PowerShell
Mar 31, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Default Session Config Connection in PowerShell

Doctor Scripto

Summary: Find the default session configuration connection in Windows PowerShell.  How can I determine what default session configuration I can connect to?  Use the $PSSessionConfigurationName automatic variable           to view the default session configuration: PS C:\Users\Administrator> $PSSessionConfigurationNamehttp://schemas.microsoft.com/powershell/Microsoft.PowerShell

Introduction to PowerShell Endpoints
Mar 31, 2014
Post comments count 0
Post likes count 0

Introduction to PowerShell Endpoints

Doctor Scripto

Summary: Learn about Windows PowerShell endpoints and how they relate to remoting.  Hey, Scripting Guy! I keep hearing about Windows PowerShell endpoints and constrained endpoints related to remote management. Can you tell me more about these? —KP  Hello, KP. Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. Here's a bit about me: Boe Prox is a Microsoft MVP in Windows PowerShell and a senior Windows system administrator. He has worked in the IT field since 2003, and he supports a variety of different platforms. He is a contributing author in ...

PowerTip: Use PowerShell to Save Verbose Messages in Output File
Mar 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Save Verbose Messages in Output File

Doctor Scripto

Summary: Learn how to use Windows PowerShell to save verbose messages from a script in an output file.  How can I use Windows PowerShell to save the verbose messages from a script in an output file?  Use the redirection operator that directs verbose messages (stream #4) to a file: PS C:\> .\MyScript.ps1 -Verbose  4> VerboseMessages.txt

Understanding Streams, Redirection, and Write-Host in PowerShell
Mar 30, 2014
Post comments count 0
Post likes count 0

Understanding Streams, Redirection, and Write-Host in PowerShell

Doctor Scripto

Summary: June Blender explains how to understand and use streams in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today guest blogger, June Blender, explains how to understand and use streams in Windows PowerShell. To read more from June, see these Hey, Scripting Guy! Blog posts. Note  Since the writing of this post, some of the information has changed with the introduction of the information stream in Windows PowerShell 5.0. Read about it here: Welcome to the Powershell Information Stream. And now, here's June... My first introduction to streams in computing was a really positive ...

PowerTip: Use PowerShell to Find Internet Explorer Settings
Mar 29, 2014
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to Find Internet Explorer Settings

ScriptingGuy1

Summary: Learn how to use Windows PowerShell to find Internet Explorer settings.  How can I use Windows PowerShell to explorer the various settings for Internet Explorer?  Use the Get-Item cmdlet and explore the Internet Explorer main hive for the current user: get-item 'HKCU:\Software\Microsoft\Internet Explorer\Main'

Weekend Scripter: Change Internet Explorer Start Page via PowerShell
Mar 29, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Change Internet Explorer Start Page via PowerShell

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to change the Internet Start page on his Microsoft Surface . Microsoft Scripting Guy, Ed Wilson, is here. It is no secret that I love my Microsoft Surface. Just before our trip to Europe, I bought a nice Microsoft Surface Pro 2 with extra memory and disk space. The thing is fast and light. With my real-touch keyboard (left over from my Surface RT), it is a great laptop replacement. I love the fact that it has Windows PowerShell 4.0, and even the Windows PowerShell 4.0 ISE. To me it is great. I stuff it in my camera backpac...

PowerTip: Find Processes with Process ID Less Than 1000
Mar 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Processes with Process ID Less Than 1000

ScriptingGuy1

Summary: Use Windows PowerShell to find processes with a process ID that is less than 1000.  How can I use Windows PowerShell to find all processes that have a process ID less than 1000?  Use the Get-Process cmdlet, pipe the resulting objects to the Select-Object cmdlet, choose the process name,           and create a custom property that displays True if the process ID is less than 1000: Get-Process | select name, @{L='Pid below 1000';E={$_.pid -lt 1000}}

Manage Office 365 SharePoint with Modules
Mar 28, 2014
Post comments count 0
Post likes count 0

Manage Office 365 SharePoint with Modules

ScriptingGuy1

Summary: Learn how to use Office 365 SharePoint Online modules to manage Office 365 SharePoint. Microsoft Scripting Guy, Ed Wilson, is here. In a couple of days, the Scripting Wife and I will be at the Dutch PowerShell User Group in Amsterdam. If you are anywhere in the area, you should try to come and check it out. I will be making two presentations: There will be at least two Windows PowerShell MVPs in attendance, and it will be an all-day event beginning at 08:30 on April 2, 2014. Come check it out, you will be glad you did.      Note  This is the fifth in a series of Hey, Scripting Guy! Blog posts whe...

PowerTip: Use PowerShell to Check Validity of User Certificates
Mar 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Check Validity of User Certificates

ScriptingGuy1

Summary: Learn how to quickly check user certificates by using Windows PowerShell.  How can I use Windows PowerShell to check the validity of user certificates without engaging in a manual process?  Use the certificate provider to obtain a list of certificate objects, and           pipe the results to the Test-Certificate cmdlet: gci Cert:\CurrentUser\my -Recurse | Test-Certificate -AllowUntrustedRoot

Use PowerShell to Manage Exchange Online in Office 365
Mar 27, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Manage Exchange Online in Office 365

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell implicit remoting to manage Exchange Online users. Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am looking over my presentations for the PowerShell Summit in Bellevue, Washington. It will be April 28 – 30, 2014, and I am making three presentations. So I need to prepare. There will be a bunch of really cool Windows PowerShell people speaking and attending. This is the stuff that geeks dream about. The Scripting Wife will also be there. Don’t miss out.      Note  This is the fourth in a series of Hey, Scripting Guy!...

PowerTip: Find Aliases Exported by PowerShell Module
Mar 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Aliases Exported by PowerShell Module

ScriptingGuy1

Summary: Find aliases that were exported from a Windows PowerShell module.  How can I find aliases that were exported from a particular module on my system?  Use the Get-Command cmdlet, specify the module, pipe the results to the          Foreach-Object cmdlet, and then look for aliases: Get-Command -Module CimCmdlets | foreach { Get-Alias -Definition $_.name -ea 0 }

Use PowerShell to Manage Office 365 Users
Mar 26, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Manage Office 365 Users

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to manage Office 365 users. Microsoft Scripting Guy, Ed Wilson, is here. The weather here in Charlotte has been nearly perfect recently. I love spring. It offers hope, and it seems to be a time of renewed commitments. A quick trip to the garden center, and the Scripting Wife and I return with bundles of flowers and other stuff to plant. It is the very essence of hope. We hope they will thrive. We hope to enjoy their blooms in the future. We hope they will not overtake the rest of our garden. Ah, lots of hope.     &nbs...

PowerTip: Get PowerShell Printer Examples
Mar 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Get PowerShell Printer Examples

ScriptingGuy1

Summary: Learn how to get only printer examples that are related to Windows PowerShell.  How can I quickly and easily see only examples of Windows PowerShell commands that are related to printing          in Help?  Use the Get-Command cmdlet, then pipe the results to the Foreach-Object cmdlet and call Get-Help: Get-Command -Noun printer* | Foreach-Object {get-help $_.name -ex} | more

Use PowerShell to Explore Office 365 Installation
Mar 25, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Explore Office 365 Installation

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to explore his Office 365 tenant installation. Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife and I are sore from our weekend spent doing yard work. I am not much of an outdoor kind of geek, and so my excursions are normally limited to going to and from the mailbox, or to and from the woodworking shop. It has been years since I laid outside and worked on my tan, played in a summer softball league, or for that matter hit the links in pursuit of the elusive little white ball. But the Scripting Wife wanted some he...

PowerTip: Use PowerShell to Check if Computer Is Up
Mar 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Check if Computer Is Up

ScriptingGuy1

Summary:  Learn how to use Windows PowerShell to quickly check to see if a computer is up.  How can I use Windows PowerShell to see if a computer is up?  Use the Test-Connection cmdlet to send a ping (icmp packet) to the remote computer.           If you specify the –Quiet parameter, it returns only True or False. Test-Connection -BufferSize 32 -Count 1 -ComputerName 192.168.0.41 -Quiet

Getting Started with Office 365 and PowerShell
Mar 24, 2014
Post comments count 0
Post likes count 0

Getting Started with Office 365 and PowerShell

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about getting started with Office 365 and Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a nice cup of First Flush Charleston Tea. I added bits of spearmint, peppermint, cinnamon stick, lemon, and local honey to the mixture. It is very good, and it helps me focus in the morning. I am sitting on the lanai and checking my email on my Surface 2 Pro. The morning weather is really damp. If I close my eyes, I can hear seagulls, and perhaps enjoy the sweet fragrance of hibiscus flowers, and hear the rustle of pa...

PowerTip: Create XML with PowerShell
Mar 23, 2014
Post comments count 0
Post likes count 0

PowerTip: Create XML with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to create XML.  How can I use Windows PowerShell to easily create an XML representation of my service names and status?  Use the Get-Service cmdlet to retrieve the service information, select the name and status properties,           and pipe the results to the ConvertTo-XML cmdlet. Then to facilitate post processing of the information,           store the results in a variable: $xml = Get-Service | select name, Status | ConvertTo-Xml

Weekend Scripter: Use PowerShell to Investigate File Signatures—Part 2
Mar 23, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Investigate File Signatures—Part 2

Doctor Scripto

Summary: Windows PowerShell MVP, Boe Prox, concludes this two-part series about investigating file signatures with Windows PowerShell and the .NET Framework. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Boe Prox, for the conclusion of the two-part series he started yesterday. Also read Use PowerShell to Investigate File Signatures—Part 1. Today I am going to demo a function that I wrote and discuss a couple of items that I came across while investigating the file signatures. But first, I am going to talk about a couple of things that helped shape the direction of my function, which i...

PowerTip: Convert Output to Use Specific Delimiter
Mar 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Convert Output to Use Specific Delimiter

Doctor Scripto

Summary: Use Windows PowerShell to convert output to a specific delimiter.  How can I use Windows PowerShell to select process name and paged system memory, plus separate the output with a colon?  Use the Get-Process cmdlet to retrieve the process information, select the name,           add the PagedSystemMemorySize property, pipe the output to the ConvertTo-CSV cmdlet,           and specify the delimiter as “:”: Get-Process | select name, PagedSystemMemorySize | ConvertTo-Csv -Delimiter ":"

Weekend Scripter: Use PowerShell to Investigate File Signatures—Part 1
Mar 22, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Investigate File Signatures—Part 1

Doctor Scripto

Summary: Windows PowerShell MVP, Boe Prox, talks about investigating file signatures by using Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. This weekend we have a two-part series from guest blogger, Boe Prox… When you work with File Server Resource Manager (FSRM), one of the cool things that you can do is block files, based on file type. This allows a system administrator to prevent various types of files from being saved to a specified drive or folder, based on the requirement. For instance, let’s say that you want to prevent executables (*.exe) and iso image files (*.iso) from be...

PowerTip: Use PowerShell to Document DSN Names
Mar 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Document DSN Names

ScriptingGuy1

Summary: Learn how to easily document DSN names by using Windows PowerShell.  How can I use Windows PowerShell to find what DSN names are defined on my system?  On your computer running Windows 8.1, use the Get-OdbcDsn function.

Use Dynamic Parameters to Populate List of Printer Names
Mar 21, 2014
Post comments count 0
Post likes count 0

Use Dynamic Parameters to Populate List of Printer Names

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use dynamic parameters to populate a list of printer names. Microsoft Scripting Guy, Ed Wilson, is here. Using a Windows PowerShell function to send a test page to a printer is pretty cool (see Use PowerShell to Send Test Page to a Printer). But it would be even better if I did not have to type the name of the printer. I know I can use the Get-Printer function in Windows 8.1 to list all of my printers (and I can use a CIM session to do this remotely), so why can’t I run that script to create my list of available printers? It turns out that I can do t...

PowerTip: Use PowerShell to Find What’s New
Mar 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find What’s New

ScriptingGuy1

Summary: Learn how to find what’s new in Windows PowerShell 4.0.  How can I find what is new in Windows PowerShell 4.0?  Use Update-Help to update the Help files, then use the Get-Help cmdlet,           specify the category of HelpFile, and look for “4.0”: Get-Help -Category helpfile "4.0"

Use PowerShell to Send Test Page to a Printer
Mar 20, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Send Test Page to a Printer

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to send a test page to a printer. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping an awesome orange-cream tea that I picked up at a tea shop in Leipzig, Germany. It smells wonderful, and it tastes just like a Dreamcicle that I used to eat when I was a kid. That orange candy-covered vanilla ice cream was just the thing for hot, humid days when I was growing up in Florida. I have absolutely fallen in love with this tea.   Anyway, something else I have fallen in love with is all the printer cmdlets available...

PowerTip: Find Printer Ports by Using PowerShell
Mar 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Printer Ports by Using PowerShell

ScriptingGuy1

Summary:  Use Windows PowerShell to find printer ports.   How can I use a Windows PowerShell function to enumerate printer ports on my system?  Use the Get-PrinterPort function. By default, it returns all local printer ports.

Creating a Port Scanner with Windows PowerShell
Mar 19, 2014
Post comments count 0
Post likes count 0

Creating a Port Scanner with Windows PowerShell

ScriptingGuy1

Summary: Microsoft Scripting Guy, Ed Wilson, talks about creating a port scanner with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. The other day, I needed to access my printer. Unfortunately, after several networking changes, I did not remember the IP address of my printer. However, I did know that the printer sets up a web server. It was this web server that I needed to access so I could make some changes to the way the printer was handling default forms. But dude, I did not know the IP address, and I did not want to have to rummage around in my network documentation to find the particular pr...

Find PowerShell Providers that Support Transactions
Mar 18, 2014
Post comments count 0
Post likes count 0

Find PowerShell Providers that Support Transactions

Doctor Scripto

Summary: Learn how to find Windows PowerShell providers that support transactions.  I want to use transactions, but I am not sure if the provider I need to use actually supports transactions. How can I be sure?  Use the Get-PSProvider cmdlet, and filter the capabilities of transactions: Get-PSProvider | where capabilities -match 'transactions'

Taking on Iron Scripter Competition at PowerShell Saturday 007
Mar 18, 2014
Post comments count 0
Post likes count 0

Taking on Iron Scripter Competition at PowerShell Saturday 007

Doctor Scripto

Summary: Chris Campbell explains his resolution process for the the Iron Scripter competition at PowerShell Saturday 007. Microsoft Scripting Guy, Ed Wilson, is here. Today we welcome back guest blogger, Chris Campbell. It has been just over a month since I got back from PowerShell Saturday 007 in Charlotte, and it was a blast! The talks were excellent; and overall, it was just a lot of fun. Besides having the opportunity to speak, the highlight for me was the Iron Scripter competition run by Jim Christopher. The rules were simple. Whoever finishes first wins, you can use any resource, and no compl...

PowerTip: Use PowerShell to Find Blog Posts
Mar 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Blog Posts

Doctor Scripto

Summary: Use Windows PowerShell to easily find blog posts via RSS.  How can I use Windows PowerShell to find a list of Hey, Scripting Guy! Blog posts without           a lot of development work?  Use the Invoke-RestMethod cmdlet and specify the URI for the Hey, Scripting Guy! Blog RSS feed: $uri = http://blogs.technet.com/b/heyscriptingguy/atom.aspx (Invoke-RestMethod $uri).title

Using the Windows Azure REST APIs with PowerShell
Mar 17, 2014
Post comments count 0
Post likes count 0

Using the Windows Azure REST APIs with PowerShell

Doctor Scripto

Summary: Microsoft support escalation engineer, James Kehr, talks about using the Windows Azure REST APIs with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have James Kehr, a Windows availability support escalation engineer, as our guest blogger… Application programming interfaces, more commonly called an APIs because it’s a ridiculously long name to type, have traditionally been the playground of programmers. Administrators, which I will call admins because it is a ridiculously long title to type, have generally not played with APIs because, well, we’re not program...

PowerTip: Use PowerShell to Create Zip Archive
Mar 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Zip Archive

Doctor Scripto

Summary: Learn how to use Windows PowerShell to easily create a zip archive.  How can I use Windows PowerShell to create a zip archive of a folder on my system?  Use Get-ChildItem from PSCX to copy the files, and pipe the output to the Write-Zip cmdlet: Get-Childitem c:\fso -Recurse | Write-Zip -IncludeEmptyDirectories -OutputPath C:\fso_bu\fso.zip Note: I have written several blog posts about the Windows PowerShell Community Extension Project. For more information about obtaining the PSCX module, see these Hey, Scripting Guy! Blog posts.

PowerTip: PowerShell One-Liner to Find Virtual Machine
Mar 15, 2014
Post comments count 0
Post likes count 0

PowerTip: PowerShell One-Liner to Find Virtual Machine

Doctor Scripto

Summary: Use Windows PowerShell 4.0 to find a virtual machine.  How can I use Windows PowerShell 4.0 to find a virtual machine when I only have partial name information so I can stop it or make other changes as required?  Use the Get-VM cmdlet to return virtual machine objects, use the dotted Where, and filter with a script block.           Add the name property, and use a regular expression (or wild card) to match the virtual machine          that you are interested in. The following command finds a virtual machine with a name t...

PowerTip: Use PowerShell to Find SMB Shares
Mar 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find SMB Shares

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find SMB shares.   How can I use Windows PowerShell to easily find a list of all the SMB shares on my Windows 8.1 laptop?  Use the Get-SMBShare function.

PowerTip: Find More Information about Windows PowerShell Jobs
Mar 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Find More Information about Windows PowerShell Jobs

Doctor Scripto

Summary: Learn how to discover more information about Windows PowerShell jobs. How can I learn more about Windows PowerShell jobs? To find out more about any Windows PowerShell topic, research the Help files for each cmdlet:Get-Help Start-Job –ShowWindowTo discover the job related cmdlets:Get-Command *jobNot everything is job-related, but the PrintJob cmdlets can be easily filtered. You’re looking for the cmdlets in these two modules: –PSScheduledJob and Microsoft.PowerShell.Core.The last place to look is the _about files:Get-Help about*job*

PowerShell Jobs Week: Jobs in the Enterprise
Mar 8, 2014
Post comments count 0
Post likes count 0

PowerShell Jobs Week: Jobs in the Enterprise

Doctor Scripto

Summary: Richard Siddaway looks at how you can use Windows PowerShell jobs in your enterprise. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the seventh, and last, post in a series that, hopefully, will shine the spotlight on Windows PowerShell jobs, remind people of their capabilities, and encourage their greater adoption. The full series comprises: The focus on this series has been on Windows PowerShell jobs, including learning about the core job cmdlets, using the –AsJob parameter, running jobs on remote machines, and figur...

PowerTip: Protect the Data Produced by PowerShell Jobs
Mar 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Protect the Data Produced by PowerShell Jobs

Doctor Scripto

Summary: Learn how to protect the data in a Windows PowerShell job.  How can I protect the data that is produced by a Windows PowerShell job?  If the job is running and your Windows PowerShell session or computer crashes, you’ll lose the data.           One possibility is that you can write the data to disk before the job finishes so that its available if the           session or machine stops. This would be a good approach for overnight jobs where the machine           is unattended and might be restarted by an outside pro...

PowerShell Jobs Week: Job Processes
Mar 7, 2014
Post comments count 0
Post likes count 0

PowerShell Jobs Week: Job Processes

Doctor Scripto

Summary: Richard Siddaway looks at how Windows PowerShell jobs actually run. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the sixth in a series of posts that, hopefully, will shine the spotlight on Windows PowerShell jobs, remind people of their capabilities, and encourage their greater adoption. The full series comprises: The focus on this series has been on Windows PowerShell jobs, including learning about the core job cmdlets, using the –AsJob parameter, running jobs on remote machines, and figuring out how scheduled jobs ...

PowerTip: Stop a PowerShell Job
Mar 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Stop a PowerShell Job

Doctor Scripto

Summary: Learn how to stop an unwanted Windows PowerShell job. How can I stop an over-running Windows PowerShell job? Even though this is not something you’d normally do, creating an infinite loop is a common (and           potentially, very embarrassing) error. This job will run forever:Start-Job -ScriptBlock {while ($true){sleep -Seconds 10}}When you realize that your job is over-running, use the Stop-Job cmdlet:Stop-Job -Id 14You can then hide the evidence by using Remove-Job to delete the job. You can test the data in the stopped job with Recei...

PowerShell Jobs Week: Jobs and Workflows
Mar 6, 2014
Post comments count 0
Post likes count 0

PowerShell Jobs Week: Jobs and Workflows

Doctor Scripto

Summary: Richard Siddaway introduces you to using the Windows PowerShell job engine with your Windows PowerShell workflows. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the fifth in a series of posts that, hopefully, will shine the spotlight on Windows PowerShell jobs, remind people of their capabilities, and encourage their greater adoption. The full series comprises: The focus on this series has been on Windows PowerShell jobs, including learning about the core job cmdlets, using the–AsJob parameter, running jobs on remote machines...

PowerTip: Use PowerShell to Discover Tasks Associated with Scheduled Jobs
Mar 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Discover Tasks Associated with Scheduled Jobs

Doctor Scripto

Summary: Use Windows PowerShell to discover the tasks that are associated with your scheduled jobs.  How can I use Windows PowerShell to discover the scheduled tasks that are associated with my scheduled jobs?  In Windows 8 or Windows Server 2012, use the Get-ScheduledTask cmdlet: £> Get-ScheduledTask -TaskName test1 | Format-List TaskPath, TaskName, State TaskPath : \Microsoft\Windows\PowerShell\ScheduledJobs\ TaskName : Test1 State    : Ready On earlier operating systems, you need to look in the Task Scheduler, I’m afraid. 

PowerShell Jobs Week: Scheduled Jobs
Mar 5, 2014
Post comments count 0
Post likes count 0

PowerShell Jobs Week: Scheduled Jobs

Doctor Scripto

Summary: Richard Siddaway introduces you to scheduled PowerShell jobs. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the fourth in a series of posts that, hopefully, will shine the spotlight on Windows PowerShell jobs, remind people of their capabilities, and encourage their greater adoption. The full series comprises: So far, you’ve discovered the core cmdlets for working with Windows PowerShell jobs, investigated using WMI and CIM cmdlets in jobs, and learned how to run jobs on remote machines. Today we go off on a little bit of a t...

PowerTip: Use PowerShell to Find Job Help
Mar 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Job Help

Doctor Scripto

Summary: Learn how to find more Help about the Windows PowerShell job engine.  How can I find out more about Windows PowerShell jobs?  One of the best ways to discover anything about Windows PowerShell is to read the Help files           and work through the examples that are presented. Each of the cmdlets has its own Help file, for instance: Get-Help Start-Job –ShowWindow There are also a set of about_ files: £> doc about*job* | select name  Name----about_Jobsabout_Job_Detailsabout_Remote_Jobsabout_Scheduled_Jobsabout_Scheduled_Jobs_Advancedabout_Scheduled_J...

PowerShell Jobs Week: Remote Jobs
Mar 4, 2014
Post comments count 0
Post likes count 0

PowerShell Jobs Week: Remote Jobs

Doctor Scripto

Summary: Richard Siddaway introduces you to Windows PowerShell jobs on remote machines. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the third in a series of posts that, hopefully, will shine the spotlight on Windows PowerShell jobs, remind people of their capabilities, and encourage their greater adoption. The full series comprises: So far, you’ve seen how to use the core Job cmdlets and the –AsJob parameter, and we discovered the interesting aspects of the CIM cmdlets and CDXML. One of biggest selling points for Windows Power...

PowerTip: Use PowerShell to Keep Job Data
Mar 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Keep Job Data

Doctor Scripto

Summary: Learn how to use Windows PowerShell to keep job data available for future use. How can I keep my job data?One of the frustrating things about using the Window PowerShell job cmdlets is that if you’re not careful,           you lose the data in your job when you access the job. The following command returns the job’s data,           but it also deletes that data:Receive-Job -Id 8If you want the data available, use the –Keep parameter:Receive-Job -Id 10 –KeepUsing –Keep is a good habit to get into. It&r...

PowerShell Jobs Week: WMI and CIM Jobs
Mar 3, 2014
Post comments count 0
Post likes count 0

PowerShell Jobs Week: WMI and CIM Jobs

Doctor Scripto

Summary: Richard Siddaway introduces you to WMI and CIM jobs in Windows PowerShell. Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the second in a series of posts that, hopefully, will shine the spotlight on Windows PowerShell jobs, remind people of their capabilities, and encourage their greater adoption. The full series comprises: Last time, you saw how to use the Windows PowerShell job cmdlets. But there is another way to start jobs. Many cmdlets have an –AsJob parameter, for instance: Get-WmiObject [-Class] <string> [[-P...

PowerTip: Control Job Starts with PowerShell
Mar 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Control Job Starts with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to control which jobs start when.  How can I use Windows PowerShell to complete a group of jobs before I start more jobs?    Use the Start-Job cmdlet, for example, to start 3 long running processes: Start-Job {<long running process 1>} Start-Job {<long running process 2>} Start-Job {<long running process 3>} Then use Wait-Job to stop further processing. It works at the prompt, or even better, in a script: Get-Job | Wait-Job After your jobs have completed, you can run more jobs: Start-Job {<long running process 4&g...

PowerShell Jobs Week: Introduction to PowerShell Jobs
Mar 2, 2014
Post comments count 0
Post likes count 0

PowerShell Jobs Week: Introduction to PowerShell Jobs

Doctor Scripto

Summary: Richard Siddaway introduces you to Windows PowerShell jobs.  Hey, Scripting Guy! I’ve just starting learning Windows PowerShell, and I have some long running tasks to perform. What’s the best way of running these tasks? —LJ  Hello LJ, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. LJ, you need to use Windows PowerShell jobs for your long running tasks. Jobs are an area of Windows PowerShell that I feel is neglected. The headline piece of functionality in Windows PowerShell 2.0 was remoting. In many respects, Windows ...

PowerTip: List Outlook Contacts with PowerShell
Mar 1, 2014
Post comments count 0
Post likes count 0

PowerTip: List Outlook Contacts with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to list contacts in Microsoft Outlook.  How can I use Windows PowerShell to programmatically connect to Outlook to get the Contacts list?  Connect by using ComObject, and select the objects you need: $Outlook=NEW-OBJECT –comobject Outlook.Application $Contacts=$Outlook.session.GetDefaultFolder(10).items $Contacts | Format-Table FullName,MobileTelephoneNumber,Email1Address

Weekend Scripter: Create Entries for Birthdays from Outlook Contacts List
Mar 1, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Create Entries for Birthdays from Outlook Contacts List

Doctor Scripto

Summary: Use Windows PowerShell to access your Outlook Contacts list and create calendar entries for birthdays. Honorary Scripting Guy, Sean Kearney here. And today is my birthday! You would think that being an IT person with Microsoft Outlook and other resources in front of me, it would be very easy to track birthdays. You would THINK that. But I’m…let’s say…absent minded. Now the interesting thing is that in many cases, I will track a lot of the birthdays in my Contacts when I create them within Outlook. For example, here is one for a fake person called Mr. Smith: As you can see I hav...

PowerTip: Search All WMI Namespaces with PowerShell
Feb 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Search All WMI Namespaces with PowerShell

Doctor Scripto

Summary: Learn to look for WMI classes in all WMI namespaces by using Windows PowerShell.  How can I use Windows PowerShell to search all WMI namespaces so that           I can find all WMI classes that are related to batteries?  Use the Get-WmiObject cmdlet, start at the Root namespace, and make sure to use the –recurse switch: Get-WMIObject -Namespace root -ClassName *battery* -list -recurse -EA 0

Use WMI and PowerShell to Create Collection Query Rules
Feb 28, 2014
Post comments count 0
Post likes count 0

Use WMI and PowerShell to Create Collection Query Rules

Doctor Scripto

Summary: Microsoft PFE, Heath Lawson, talks about using Windows PowerShell and WMI to create collection query rules. Microsoft Scripting Guy, Ed Wilson, is here. Heath Lawson is back with us today for Part 3 in his series. You can catch up by reading Part 1 and Part 2: Howdy y’all! Heath here. This is the last in a series of three posts about Windows PowerShell for System Center Configuration Manager Administrators. This session is going to be a bit different because we’re not going to use the built-in Configuration Manager cmdlets. “But Heath,” you say, “I know nothing else. The...

PowerTip: Find Network Adapters for all Virtual Machines
Feb 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Network Adapters for all Virtual Machines

Doctor Scripto

Summary: Use Windows PowerShell to find the network adapter names for all virtual machines.  How can I use Windows PowerShell on my laptop running Windows 8.1 to find the name           of the network adapter that is used by each of my virtual machines?  Use the Get-VM cmdlet to retrieve all of the virtual machines,           and pipe the result to the Get-VMNetworkAdapter: Get-Vm | Get-VMNetworkAdapter Note: This command must be run with Admin rights.

Use PowerShell to Set Configuration Manager Properties
Feb 27, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Set Configuration Manager Properties

Doctor Scripto

Summary: Microsoft PFE, Heath Lawson, talks about using Windows PowerShell to set advanced properties in Configuration Manager. Microsoft Scripting Guy, Ed Wilson, is here. Back today is Heath Lawson. You may want to read the first post of this series before you begin this post: Apply Common PowerShell Concepts to Configuration Manager. Greetings! Heath here. I’m back with another post in the series about Windows PowerShell for the System Center Configuration Manager Admin. In the last post, we explored using the native Windows PowerShell cmdlets for Configuration Manager to create a device collection. We s...

PowerTip: Find All PowerShell Providers
Feb 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Find All PowerShell Providers

Doctor Scripto

Summary: Use Windows PowerShell to find providers on your system.  How can I use Windows PowerShell to find all the Windows PowerShell providers on my system           and what drives might be exposed?  Use the Get-PSProvider cmdlet.

Apply Common PowerShell Concepts to Configuration Manager
Feb 26, 2014
Post comments count 0
Post likes count 0

Apply Common PowerShell Concepts to Configuration Manager

Doctor Scripto

Summary: Microsoft PFE, Heath Lawson, talks about applying common Windows PowerShell concepts to Configuration Manager. Microsoft Scripting Guy, Ed Wilson, is here. Today we welcome guest blogger, Heath Lawson. Heath is a System Center premier field engineer based in Kansas City, Missouri. He often posts about System Center-related scripting and automation in his blog, HeLaw's Blog: System Center...Tying it all together! Heath Lawson here, checking in for the first of three posts. My background is heavy in Configuration Manager, although I love all aspects of automation and scripting, so the opportunity to w...

PowerTip: Use PowerShell to Count Hops to Server
Feb 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Count Hops to Server

Doctor Scripto

Summary: Use Windows PowerShell to count hops to a server.  On my computer running running Windows 8.1, how can I use Windows PowerShell to verify           the number of hops to my server?  Use the Test-NetConnection function and the –TraceRoute parameter,           specify the server name, choose the TracerOut property, and get the count: (Test-NetConnection -TraceRoute -ComputerName "www.contoso.com").traceroute.count 

Using PowerShell to Migrate DHCP Servers: Part 2
Feb 25, 2014
Post comments count 0
Post likes count 0

Using PowerShell to Migrate DHCP Servers: Part 2

Doctor Scripto

Summary: Microsoft PFE, Ian Farr, continues his quest to use Windows PowerShell to migrate DHCP servers. Microsoft Scripting Guy, Ed Wilson, is here. Ian Farr is back today. You should read the first part of this series before getting into this one: Using PowerShell to Migrate DHCP Servers: Part  1. Episode 2: Return of the Scripter A scripter’s strength flows from the PowerShell. In Episode 1: A New Hope, we began our scripter training. We imported the configuration from a split-scope DHCP infrastructure on computers running Windows Server 2003 to two DHCP servers running Windows Server&nbs...

PowerTip: Use PowerShell to Display DHCP Addresses
Feb 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display DHCP Addresses

Doctor Scripto

Summary: Use Windows PowerShell to display DHCP addresses in Windows 8.  How can I use Windows PowerShell on my computer running Windows 8 to find IPV4 addresses           that are supplied by DHCP?  Use the Get-NetIPAddress function, and specify that the prefix origin is DHCP.           You can also specify that the address is IPV4, and use other options to help identify what you seek,           for example: Get-NetIPAddress -AddressState preferred -AddressFamily ipv4 -Type unicast -PrefixOrigin dhcp

Using PowerShell to Migrate DHCP Servers: Part 1
Feb 24, 2014
Post comments count 0
Post likes count 0

Using PowerShell to Migrate DHCP Servers: Part 1

Doctor Scripto

Summary: Microsoft PFE, Ian Farr, talks about using Windows PowerShell to migrate DHCP servers. Microsoft Scripting Guy, Ed Wilson, is here. Today we welcome back guest blogger, Ian Farr. Episode 1:  A New Hope In a galaxy very, very near to here, when you are not cleaning-up droids, you administer a DHCP infrastructure in Windows Server 2003 with two servers in a split scope configuration. Because extended support for Windows Server 2003 ends on the July 14, 2015, you’ve read about the new features in Windows Server 2012, and you want some DHCP failover goodness! (For more information, see Step-...

PowerTip: Use PowerShell to Find Start Apps
Feb 23, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Start Apps

Doctor Scripto

Summary: Learn how to use Windows PowerShell to easily find start apps.  How can I use Windows PowerShell to find a particular app amid the clutter of small app icons on my           Windows 8.1 device?  Use the Get-StartApps cmdlet and filter on the name—          for example, to find an application that begins with the letter G: Get-StartApps | where name -like "g*"

Weekend Scripter: Pin PowerShell Script to Start Screen
Feb 23, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Pin PowerShell Script to Start Screen

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about pinning a Windows PowerShell script to the Windows 8.1 Start screen. Microsoft Scripting Guy, Ed Wilson, is here. The other day, the Scripting Wife and I had a couple of neighbors over for dinner. While munching on snacks, he said that he had recently upgraded his laptop from Windows 7 to Windows 8. His initial impression was that Windows 7 was for work, but Windows 8 was for play, and he needs to use his laptop to accomplish work. He said, “Everything is at least five or six clicks away.” I told him he was trying too hard, a...

PowerTip: Get the Latest PowerShell Help
Feb 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Get the Latest PowerShell Help

Doctor Scripto

Summary: Learn how to get the latest Windows PowerShell Help online.  I do not have Admin rights so I cannot update my local Windows PowerShell Help.          How can I access the latest updated Help online?  Use the –online switched parameter with the Get-Help cmdlet: get-help Get-Process -Online

PowerTip: Personalize Your Copy of PowerShell
Feb 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Personalize Your Copy of PowerShell

Doctor Scripto

Summary: Easily add your user name to your Windows PowerShell console window.  I often start multiple Windows PowerShell consoles with different credentials.           To avoid getting confused, how can I change the window title to my user name?  Use the $host automatic variable, and change the WindowTitle property to the user name: $host.ui.RawUI.WindowTitle = $env:USERNAME

PowerTip:  Find Status of PowerShell Preference Variables
Feb 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Status of PowerShell Preference Variables

Doctor Scripto

Summary:  Easily find the status of Windows PowerShell Preference variables. How can I see the preference settings that I can change with Windows PowerShell? Look at variables that contain the word Preference  in their name by using the Get-ChildItem           and looking at the Variable drive:Get-ChildItem variable:*preferenceNote  To see all of the Windows PowerShell Preference variables, see about_Preference_Variables. Many of the Preference variables are not present on the Variable drive unl...

PowerTip: Use PowerShell to Find User Profile Path
Feb 19, 2014
Post comments count 0
Post likes count 2

PowerTip: Use PowerShell to Find User Profile Path

Doctor Scripto

Summary: Use Windows PowerShell to find the user profile path.  How can I easily get information about the folder and path to the profile for a currently signed-in user?  Use the Env: PowerShell drive, and select the UserProfile environmental variable: $env:USERPROFILE

PowerTip: Find Information about PowerShell Errors
Feb 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Information about PowerShell Errors

Doctor Scripto

Summary:  Use Windows PowerShell to find information about Windows PowerShell errors.  How can I find more information about a specific error when I look at the $error automatic variable?  The $error automatic variable contain rich objects. For example, the InvocationInfo property shows           what code was called that generated the error.           The following illustrates how to find the most recent error (error 0): $Error[0].InvocationInfo Note  Tab expansion works for this.

PowerTip: Is It a PowerShell Alias?
Feb 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Is It a PowerShell Alias?

Doctor Scripto

Summary: Quickly find multiple Windows PowerShell aliases.  I have a bunch of Windows PowerShell commands I have been using, but they seem to act strangely sometimes.          I need to know if they are aliases or real commands. How can I tell?  Use the Get-Alias cmdlet to look up aliases and resolve them to Windows PowerShell cmdlet names.           You can do this in a single command because the –Name parameter accepts an array of aliases, for example: Get-Alias -Name sort, select, foreach, where, dir, cls

2014 Winter PowerShell Scripting Games Wrap Up #1
Feb 17, 2014
Post comments count 0
Post likes count 0

2014 Winter PowerShell Scripting Games Wrap Up #1

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shares what he noticed while grading the 2014 Winter PowerShell Scripting Games entries. Microsoft Scripting Guy, Ed Wilson, is here. So the 2014 Winter PowerShell Scripting Games are over. One of the cool things about this year’s Winter Games is that they were team events. This means that groups formed and tackled some pretty difficult scenarios as a team. This also means that the quality of the submissions was extremely high. I thought it would be interesting to go over some of the things I noticed while grading the submissions this year. Use of aliases I have...

PowerTip: Start Hidden Process with PowerShell
Feb 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Start Hidden Process with PowerShell

Doctor Scripto

Summary: Use a Windows PowerShell cmdlet to start a hidden process.  How can I launch a hidden process by using a Windows PowerShell cmdlet?  Use the Start-Process cmdlet and specify a window style of hidden: Start-Process -WindowStyle hidden -FilePath notepad.exe

Weekend Scripter: Use PowerShell to Start Hidden Process
Feb 16, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Start Hidden Process

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to start a hidden process. Microsoft Scripting Guy, Ed Wilson, is here. This morning I decided to try something a bit different. I am having a cup of English Breakfast tea, but I added strawberry leaves, blackberry leaves, marshmallow root, and a cinnamon stick. It is a nice pot of tea. Very relaxing, and just thing to help start the day. Using the Invoke-CimMethod cmdlet One of the nice thing about using the CIM cmdlets, is that they work with Windows Management Instrumentation (WMI). They use standard WMI classes, and so the techn...

PowerTip: Include Expressions in a String in PowerShell
Feb 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Include Expressions in a String in PowerShell

Doctor Scripto

Summary: Learn how to include expressions in a string in Windows PowerShell. How do I include expressions in a string in Windows PowerShell? They're not replaced correctly in a           double-quoted string:PS C:> $p = Get-Process PowerShellPS C:>"The $p.Name process uses the $p.StartInfo.WindowStyle window style."The System.Diagnostics.Process (powershell).Name process uses the System.Diagnostics.Process (powershell).StartInfo.WindowStyle window style. Enclose the values in a new variable:PS C:>"The $($p.Name) process uses the $($p.StartInfo.WindowStyle) window style....

String Formatting in Windows PowerShell
Feb 15, 2014
Post comments count 1
Post likes count 1

String Formatting in Windows PowerShell

Doctor Scripto

Summary: Learn about using formatted strings in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, here. Today we have another guest blog by June Blender. To read more of June’s previous posts, see these Hey, Scripting Guy Blog posts. Now, here’s June… I recently had the opportunity to help the Windows Azure and ASP.NET product teams with some Windows PowerShell automation. Although I was supposed to be the helper, I probably learned more from the interaction than anyone else. I learned about Windows Azure and the Azure module for Windows PowerShell. And I learned a whole bunch about Windo...

PowerTip: Use PowerShell to Configure IP Address in Windows Server 2012 R2
Feb 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Configure IP Address in Windows Server 2012 R2

Doctor Scripto

Summary: Use the new cmdlets in Windows Server 2012 R2 to set up an IP address on a computer with one network adapter.  How can I use Windows PowerShell to configure an IP address in Windows Server 2012 R2?  Use the Get-NetAdapter and Add-NewIPAddress cmdlets together.    For the IP address of 10.0.0.5, with a gateway of 10.0.0.1, and 24 bits for the subnet mask (255.255.255.0): $IPAddress=”10.0.0.5” $Gateway=”10.0.0.1” $Prefix=24 Get-NetAdapter | NEW-NetIPAddress -IPAddress $IPAddress -Defaultgateway $Gateway -Prefixlength $Prefix

A PowerShell Valentine’s Day Special
Feb 14, 2014
Post comments count 0
Post likes count 0

A PowerShell Valentine’s Day Special

ScriptingGuy1

Summary: Microsoft Scripting Guy Ed Wilson talks about a Windows PowerShell Valentine’s Day special and the 14 things he loves about Windows PowerShell. Microsoft Scripting Guy Ed Wilson is here. Well, it was several months ago when Microsoft Senior IT Pro Evangelist Blain Barton and I were talking. I said, you know we need to think about doing a holiday special. He said, "Valentines Day." I said, "Really?" He said, "Sure. Why not?" Why not indeed. So over the next few weeks, we begin to think about a way to do it. We got Chis Caldwell involved and the idea began to take shape....

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 5
Feb 14, 2014
Post comments count 0
Post likes count 0

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 5

Doctor Scripto

Summary: Preconfigure a virtual machine as a domain controller including Windows PowerShell Desired State Configuration and DHCP.  Hey, Scripting Guy! I saw how we could build the virtual machines from a template. Were you teasing us about creating a new domain controller in this lab environment? I’d really love to see the script that would configure a domain controller in a lab virtual machine! —RR  Hello RR, Honorary Scripting Guy, Sean Kearney, about to release the Kraken of Knowledge. Yes my good friend, with our current setup, we can set up that virtual machine to autostart to the point...

PowerTip: Create New Item in Registry with PowerShell
Feb 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Create New Item in Registry with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to create an entry in the Windows registry structure.  How do I create an entry in the Windows registry with Windows PowerShell?  Use the New-ItemProperty cmdlet to add the information you need.           For example, the following command makes a new name called StartMeUp with a value of Runit.exe           under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run: $RegistryPath=”HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" $Name=”StartMeUp” $V...

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 4
Feb 13, 2014
Post comments count 0
Post likes count 0

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 4

Doctor Scripto

Summary: Attach a VHD to a new virtual machine and modify the operating system for additional customizations.  Hey, Scripting Guy! With that prepped VHD file, how much work will it take to create an actual virtual machine? Possibly with some customizations? —MM  Hello MM, Honorary Scripting Guy, Sean Kearney, is here to raise a little Shell!      Note This post is the fourth in a five-part series. To catch up, read:  As you read in the previous posts, we have a bootable VHD hot and ready to go! Now we want to do a few more things. My goal for you is not only to easily ...

PowerTip: Mount ISO or VHD File with PowerShell
Feb 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Mount ISO or VHD File with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to mount an ISO or VHD file.  I can double-click an ISO file to access it in Windows 8.1, but is there a Windows PowerShell           cmdlet that will do that for me?  Use the Mount-DiskImage cmdlet and specify the file name: For an ISO file: MOUNT-DISKIMAGE C:\ISO\MYCDFile.ISO Or for a VHD file: MOUNT-DISKIMAGE C:\VHD\VirtualMachine.VHD

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 3
Feb 12, 2014
Post comments count 0
Post likes count 0

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 3

Doctor Scripto

Summary: Copy a VHD file template and inject an Unattend.xml file in preparation for attachment to a VHD file.  Hey, Scripting Guy! Yesterday you were showing us how to edit the Unattend.XML file. How can we easily inject that into a virtual machine and maybe turn that into a virtual machine?  —RD  Hello RD, Never fear. Honorary Scripting Guy, Sean Kearney, is here to help you save the day with more Windows PowerShell!      Note  Today's post is the third in a five-part series. To catch up, read:  If you’ve played around with Windows 8.1 you have not...

PowerTip: Use PowerShell to Edit XML File
Feb 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Edit XML File

Doctor Scripto

Summary: Use Windows PowerShell to load an XML file for easy editing.  Hey Scripting Guy! Is there an easy way to load and edit an XML file in Windows PowerShell?  It’s so easy that you might miss it if you blink. Create an XML object. With that, you can load, save, and edit properties directly: $XMLfile=NEW-OBJECT XML $XMLfile=load(“MyXMLFile.XML”) $XMLFile.property.otherproperty=”Gibberish” $XMLFile.save(“MyXMLFile.XML”)

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 2
Feb 11, 2014
Post comments count 0
Post likes count 0

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 2

Doctor Scripto

Summary: Use an Unattend.xml file and edit it directly with Windows PowerShell.  Hey, Scripting Guy! I saw yesterday that by using a free script called Convert-WindowsImage.ps1, I could convert Windows from a WIM file and make a bootable VHD. Is there any way to get past the initial startup screens or maybe even define the computer name? —KR  Hello KR, Honorary Scripting Guy, Sean Kearney, here to continue making your life smoother and quicker with Windows PowerShell. Note  This is the second part of a five-part series. To catch up, read Set Up a Lab with Windows PowerShell and Free Micr...

PowerTip: Identify Letter of Mounted ISO or VHD File with PowerShell
Feb 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Identify Letter of Mounted ISO or VHD File with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to identify the letter of a mounted ISO or VHD file in Windows Server 2012 R2 or Windows 8.1.  I know I can mount ISOs and VHD files in Windows 8.1, but is there a way to programmatically know what           the drive letter is without checking the GUI and playing with DiskPart?  Pipe the output of Get-DiskImage to Get-Volume or Get-Disk and Get-Partition: For an ISO file: GET-DISKIMAGE filename.iso | GET-VOLUME For a VHD file: GET-DISKIMAGE filename.vhd | GET-DISK | GET-PARTITION

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 1
Feb 10, 2014
Post comments count 0
Post likes count 0

Set Up a Lab with Windows PowerShell and Free Microsoft Software: Part 1

Doctor Scripto

Summary: Use the freely available Convert-WindowsImage.ps1 to extract multiple bootable VHD files for Hyper-V Server 2012 R2.  Hey, Scripting Guy! Is there an easier way to create a VHD file that already has the operating system, rather than installing it and clicking Next…Next…Next? I’d like something that could spin up a simple machine like it was a template. —JA  Hello JA, Honorary Scripting Guy, Sean Kearney, is here. Funny you should ask. I was poking about with that idea the other day. I decided for a good simple lab, I would need the following: Ideally t...

PowerTip: Show Desired State Configuration Cmdlets
Feb 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Show Desired State Configuration Cmdlets

Doctor Scripto

Summary: Get a list of the new Windows PowerShell cmdlets for Desired State Configuration with one line.  How do I see the cmdlets that are available for the new feature in Windows PowerShell 4.0 called           Desired State Configuration?  Target the PSDesiredStateConfiguration module with the Get-Command cmdlet: Get-Command –module PSDesiredStateConfiguration

Weekend Scripter: My Very First PowerShell Saturday!
Feb 9, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: My Very First PowerShell Saturday!

Doctor Scripto

Summary: Windows PowerShell MVP reports from the field on his first visit to North Carolina and Windows PowerShell Saturday. NOTE: Sean became sick, and was unable to attend the PowerShell Saturday event. However, if he had attended, this is what would have happened. We wish Sean a speedy recovery. Honorary Scripting Guy, Sean Kearney, here…recovering from an over-poweringly cool day! PowerShell people, PowerShell people there! Scripters, automaters, everywhere! It was like going to a mini-PowerShell Summit! It started off my flight from Ottawa, and I was picked up by none other than fellow MVP and birthd...

PowerTip: Use PowerShell to Get Length of a Number
Feb 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Length of a Number

Doctor Scripto

Summary:  Use Windows PowerShell to easily get the length of a number.  I want to know the length of a number, but when I use the Length property, it comes back as 1.           How can I get the actual length?  First convert the number to a string, and then get the length of the string: (12345).tostring().length

Weekend Scripter: Scripting Wife Talks about PowerShell Saturday 007
Feb 8, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Scripting Wife Talks about PowerShell Saturday 007

Doctor Scripto

Summary: The Scripting Wife talks about Windows PowerShell Saturday 007 in Charlotte, North Carolina. The Microsoft Scripting Guy, Ed Wilson, is gone. He is busy taking pictures, and conversing with various people attending Windows PowerShell Saturday here in Charlotte, North Carolina. Instead of the Script Monkey (aka, Ed) you have me, The Scripting Wife at the helm. I would like to say that it is nice, sunny, and warm here in Charlotte. Often it is. But today, it is actually rainy and cold. Instead of hampering attendance, I think it actually boosted it. I mean, what is better to do on a rainy Saturday than lis...

PowerTip: Use PowerShell to Count Types of Photos
Feb 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Count Types of Photos

Doctor Scripto

Summary: Use Windows PowerShell to count the different types of photo files on your computer.  How can I use Windows PowerShell to figure out how many of each type of photo file I have on my computer?  Use the Get-ChildItem cmdlet to retrieve specific types of photograph files, and then pipe the results to the           Group-Object cmdlet, group on the Extension property, and use the –NoElement switch to remove            individual file information: Get-ChildItem -Recurse -Include *.jpg, *.cr2, *.png, ...

Use PowerShell to Find Files that Have Not Been Accessed
Feb 7, 2014
Post comments count 3
Post likes count 1

Use PowerShell to Find Files that Have Not Been Accessed

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find files that have not been accessed for some time.  Hey, Scripting Guy! On our server, we have tons of files. Unfortunately, many of them haven’t been accessed for years. I know the cost of storage is coming down, but the management overhead and cost of building new datacenters does not come down. In fact, it is going up. So we need a way to identify files that have not been accessed in a long time. If we could delete them, it would be even better. —AB  Hello AB, Microsoft Scripting Guy, Ed Wilson, is her...

PowerTip: Use PowerShell to Count Photos
Feb 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Count Photos

Doctor Scripto

Summary: Learn to use Windows PowerShell to count the number of photographs you have on your computer.  How can I use Windows PowerShell to count all the photographs I have on a specific drive?  Use the Get-ChildItem cmdlet to find all of the photos, and then pipe the results to the           Measure-Object cmdlet. The following command counts the number of .jpg and .crc files on drive E: Get-ChildItem -Recurse -Include *.jpg, *.cr2 -Path e:\ | Measure-Object

Use PowerShell to Find Metadata from Photograph Files
Feb 6, 2014
Post comments count 1
Post likes count 0

Use PowerShell to Find Metadata from Photograph Files

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to obtain metadata from photo files.  Hey, Scripting Guy! I need some help. I have thousands of photo files on my computer. I need to bring some order to them. I know that I can use Get-ChildItem from Windows PowerShell, and I can find the size of files and names of files. But I need to access information that is more specific to the photos, such as what camera was used, what the F-stop was, and the photo resolution. I know there are expensive software programs that might provide this information, but the information must come ...

PowerTip:  Get a Directory Listing of Multiple Folders
Feb 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Get a Directory Listing of Multiple Folders

Doctor Scripto

Summary:  Learn how to get a directory listing of multiple folders.  How can I use Windows PowerShell to look at the contents of multiple folders at once?  Use the Get-ChildItem cmdlet, and specify more than one folder for the path, for example: Get-ChildItem –path c:\fso,c:\music  

List Music File Metadata in a CSV and Open in Excel with PowerShell
Feb 5, 2014
Post comments count 0
Post likes count 1

List Music File Metadata in a CSV and Open in Excel with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shares a function that gets file metadata, and then he writes the information to a CSV file.  Hey, Scripting Guy! Getting basic file properties such as the file name, the size of a file, and the directory that a file resides in is pretty cool. But when I go into a folder that contains music files, I see much more information, such as the name of the music group, the type of music, and how long the song will play. Can I get that type of information via Windows PowerShell? —DD  Hello DD, Microsoft Scripting Guy, Ed Wilson, is here. In just a few days it will be time ...

PowerTip: Create a CSV File in PowerShell
Feb 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Create a CSV File in PowerShell

Doctor Scripto

Summary: Learn how to easily create a CSV file in Windows PowerShell.  How can I create a CSV file so I can open data that I output to the Windows PowerShell console to manipulate it in Microsoft Excel?  Pipe the data to the Export-CSV cmdlet and use the –NoTypeInformation switch, for example: Get-Process | Select name, PM | export-csv -Path c:\fso\proc.csv -NoTypeInformation

Use PowerShell to Create CSV File to Open in Excel
Feb 4, 2014
Post comments count 1
Post likes count 0

Use PowerShell to Create CSV File to Open in Excel

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about exporting a directory list to a CSV file and opening the file in Microsoft Excel with Windows PowerShell.  Hey, Scripting Guy! I have a lot of music files that reside in nested folders. I would like to be able to look at the file information in Microsoft Excel so that I can find, for example, the largest files, or sort them by directory name. Is there an easy way to do this by using Windows PowerShell? —GB  Hello GB, Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a nice cup of Darjeeling tea with a cinnamon stick in i...

PowerTip:  Use PowerShell to Find Hidden Files
Feb 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Hidden Files

Doctor Scripto

Summary:  Use Windows PowerShell to find hidden files.  How can I use Windows PowerShell to see all hidden and system files when I look for files?  Use the –Force parameter when you type the command, for example: Get-ChildItem -Path c: -Force

List Files in Folders and Subfolders with PowerShell
Feb 3, 2014
Post comments count 2
Post likes count 0

List Files in Folders and Subfolders with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to list files in folders and subfolders.  Hey, Scripting Guy! I am an old VBScript guy. I love using VBScript, and I have done so for nearly 15 years. One reason I love VBScript so much is that, to me, it is easy to use. It is also very powerful. But after attending TechEd the last several years, it appears that Microsoft is moving away from VBScript, and is embracing Windows PowerShell. So, I am trying to learn Windows PowerShell. What I am doing is when I need to make a change to an existing VBScript script, I  attempt to use Windows PowerShell to do the same task. I am...

PowerTip: Use PowerShell to Verify UI Culture
Feb 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Verify UI Culture

Doctor Scripto

Summary: Use Windows PowerShell to verify user interface culture.  I have several language installations of Windows on my network, and prior to running a script, I would like to use           Windows PowerShell to verify the input culture so I can choose the correct operating system.  Use the Get-UICulture cmdlet and choose the Name or the LCID property: (Get-UICulture).name (Get-UICulture).LCID

Weekend Scripter:  Use PowerShell to Migrate to Active Directory On-Premises
Feb 2, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Migrate to Active Directory On-Premises

Doctor Scripto

Summary: Microsoft PFE, Asia Gandecka, talks about using Windows PowerShell to migrate users from Windows Azure Active Directory to Active Directory on-premises. Microsoft Scripting Guy, Ed Wilson, is here. Let’s welcome a new guest blogger, Asia Gandecka… I have been with Microsoft since 2011 working as a a premier field engineer. I support the SharePoint infrastructure, Office 365, and SharePoint Online. SharePoint and Windows PowerShell work closely together, but it wasn’t until Office 365 when I decided to take a stab at Windows PowerShell. I have found it very handy at allowing me to...

PowerTip: Clear All Events from Event Logs by Using PowerShell
Feb 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Clear All Events from Event Logs by Using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to clear all events from all event logs.  How can I use Windows PowerShell to clear all events from all traditional event logs to make it easier           to find events when I am troubleshooting an intermittent issue on my server?  Use the Get-EventLog cmdlet to retrieve a list of traditional event logs, and the Clear-EventLog cmdlet          to clear the event logs: Clear-EventLog -LogName (Get-EventLog -List).log –WhatIf If this is what you want to do, remove the –WhatIf parameter: Clear-...

Weekend Scripter: Using AutoSpInstaller and AutoSpSourceBuilder
Feb 1, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Using AutoSpInstaller and AutoSpSourceBuilder

Doctor Scripto

Summary: Guest blogger, Brian Lalancette, talks about how AutoSpInstaller and AutoSpSourceBuilder work together. Microsoft Scripting Guy, Ed Wilson, is here. After nearly four years, guest blogger, Brian Lalancette, is back to give us an update. Brian, take it away… Unbelievably, it’s coming up on nearly four years since my last post on the Hey, Scripting Guy! Blog. A lot has improved in AutoSPInstaller since I discussed its introduction in my post, The AutoSPInstaller Windows PowerShell Script. Now there is SharePoint 2013 support, of course. But there is also the ability to provision pretty mu...

PowerTip: Learn to Use Where or ForEach in PowerShell 4.0
Jan 31, 2014
Post comments count 0
Post likes count 0

PowerTip: Learn to Use Where or ForEach in PowerShell 4.0

Doctor Scripto

Summary: Learn the easy way to use Where or ForEach in Windows PowerShell 4.0. I am running Windows PowerShell 4.0 and I want to know the easy way to use Where or ForEach. In Windows PowerShell 4.0, object arrays have a built-in .Where() and .ForEach() methods.           You can use these methods to filter objects or perform operations with each object in the array.For example, to use the Where() method to filter for a specific process name, run this command:@(Get-Process).Where({ $PSItem.Name -eq 'notepad'; }).To iterate ov...

Comparing PowerShell PSSessions and CIM Sessions
Jan 31, 2014
Post comments count 3
Post likes count 0

Comparing PowerShell PSSessions and CIM Sessions

Doctor Scripto

Summary: Guest blogger, Trevor Sullivan, compares Windows PowerShell PSSessions and CIM sessions. Microsoft Scripting Guy, Ed Wilson, is here. Today we have the exciting conclusion to Honorary Scripting Guy, Trevor Sullivan’s guest blog series on CIM. To see more of Trevor’s guest posts, see these Hey, Scripting Guy! Blog posts. You can reach Trevor on Twitter (https://twitter.com/pcgeek86) or follow him on his blog, Trevor Sullivan's Tech Room, Minding the gap between administration and development.      Note  This is the fifth in a of five blog series by Trevor where he talks specifically about using the CIM ...

PowerTip:  Use PowerShell to Retrieve CIM Methods
Jan 30, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Retrieve CIM Methods

Doctor Scripto

Summary: Learn how to use Windows PowerShell to retrieve CIM methods.  How can I use Windows PowerShell to dynamically obtain a list of CIM methods?  Use the following script: Clear-Host;   $ClassList = Get-CimClass;  foreach ($CimClass in $ClassList) {    foreach ($CimMethod in $CimClass.CimClassMethods) {        $Method = [PSCustomObject]@{            Class = $CimClass.CimClassName;            MethodName = $CimMethod.Name;  ...

Invoking CIM Methods with PowerShell
Jan 30, 2014
Post comments count 0
Post likes count 0

Invoking CIM Methods with PowerShell

Doctor Scripto

Summary: Guest blogger, Trevor Sullivan, talks about invoking CIM methods via Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have another guest post from Trevor Sullivan. Trevor is an Honorary Scripting Guy, and a recognized Microsoft Community Contributor (MCC). To see more of Trevor’s guest posts, see these Hey, Scripting Guy! Blog posts.      Note  This is the fourth in a series of five posts by Trevor where he talks specifically about using the CIM cmdlets.      To catch up, read the following posts: Here’s Trevor… In yesterday’s post, we talked about reading and writing C...

PowerTip: Copy Information to the Clipboard with PowerShell
Jan 29, 2014
Post comments count 0
Post likes count 0

PowerTip: Copy Information to the Clipboard with PowerShell

Doctor Scripto

Summary: Learn how to easily copy information to the clipboard by using Windows PowerShell.  How can I use Windows PowerShell to copy WMI information to the Windows Clipboard           so I can use it in another application?  Use the external clip.exe utility to copy Windows PowerShell pipeline output to your Windows clipboard!           For example, to get a list of WMI classes in the root\cimv2 namespace on your computer and then           copy the list to the Windows clipboard, run the following command: (Get-CimClass | S...

Use PowerShell to Manipulate Information with CIM
Jan 29, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Manipulate Information with CIM

Doctor Scripto

Summary: Guest blogger, Trevor Sullivan, talks about using Windows PowerShell and CIM to manipulate information. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post from Trevor Sullivan. Trevor is an Honorary Scripting Guy, and a recognized Microsoft Community Contributor (MCC). To see more of Trevor’s guest posts, see these Hey, Scripting Guy! Blog posts. You can reach Trevor on Twitter (https://twitter.com/pcgeek86) or follow him on his blog, Trevor Sullivan's Tech Room, Minding the gap between administration and development.      Note  This is the third in a series of five posts by Trevor...

PowerTip: Find Commands in Specific PowerShell Modules
Jan 28, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Commands in Specific PowerShell Modules

Doctor Scripto

Summary:  Learn how to find commands in specific Windows PowerShell modules.  How can I find all the commands in the CIMCmdlets Windows PowerShell module?  Use the Get-Command cmdlet and specify the module name, for example: Get-Command -Module CIMCmdlets

Introduction to the CIMCmdlets PowerShell Module
Jan 28, 2014
Post comments count 0
Post likes count 0

Introduction to the CIMCmdlets PowerShell Module

Doctor Scripto

Summary: Guest blogger, Trevor Sullivan, talks about using the CIM module in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post from Trevor Sullivan. Trevor is an Honorary Scripting Guy, and a recognized Microsoft Community Contributor (MCC). To see more of Trevor’s guest posts, see these Hey, Scripting Guy! Blog posts. You can reach Trevor on Twitter (https://twitter.com/pcgeek86) or follow him on his blog, Trevor Sullivan's Tech Room, Minding the gap between administration and development. Note  This is the second in a series of five posts by Trevor where he will ta...

PowerTip: Find PowerShell Cmdlets that Accept CIM Session
Jan 27, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Cmdlets that Accept CIM Session

Doctor Scripto

Summary:  Learn how to find all Windows PowerShell cmdlets that accept a CIM session.  How can I find a list of all the Windows PowerShell cmdlets that accept a CIM session?  Use the Get-Command cmdlet and specify the –CimSession parameter: Get-Command -Parameter CimSession Note  If you rely on dynamic loading of modules and you have not loaded a module, this command will not report it. To ensure accurate results, load all of the modules first: Get-Module -ListAvailable | Import-Module 

What is CIM and Why Should I Use It in PowerShell?
Jan 27, 2014
Post comments count 1
Post likes count 1

What is CIM and Why Should I Use It in PowerShell?

Doctor Scripto

Summary: Honorary Scripting Guy and guest blogger, Trevor Sullivan, explores CIM and using it with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post from Trevor Sullivan. Trevor is an Honorary Scripting Guy and a recognized Microsoft Community Contributor (MCC). To see more of Trevor’s guest posts, see these Hey, Scripting Guy! Blog posts. You can reach Trevor on Twitter (https://twitter.com/pcgeek86) or follow him on his blog, Trevor Sullivan's Tech Room, Minding the gap between administration and development. Note  This is the first in a series of five posts by Tre...

PowerTip: Find Day of the Week by Using PowerShell
Jan 26, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Day of the Week by Using PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find the day of the week.  How can I use Windows PowerShell to easily find the day of the week—for example, Monday,           Tuesday, or Wednesday?  Use the Get-Date cmdlet to return a DateTime object, and ten select the DayOfTheWeek property: (get-date).DayOfWeek

Weekend Scripter: Modify DNS Settings via Windows PowerShell
Jan 26, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Modify DNS Settings via Windows PowerShell

Doctor Scripto

Summary: Guest blogger, Gershon Levitz, talks about modifying DNS settings with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger, Gershon Levitz. Gershon is a senior technical writer for Hyper-V at Microsoft. The floor is yours, Gershon... There are times when I need to change the DNS settings and use specific DNS servers. Then after I am done, I want to go back and use the DNS settings provided by DHCP. I can make these changes manually, but it would require a number of manual steps. Because I needed to do this on a regular basis, I investigated how to automate t...

PowerTip: Use PowerShell to Choose Random Letters
Jan 25, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Choose Random Letters

Doctor Scripto

Summary: Use Windows PowerShell to choose random letters.  How can I use Windows PowerShell to arrange five letters in a random order?  Use the Get-Random cmdlet, specify the letters as input values,           and then use the –count parameter to specify how many to choose: Get-Random -InputObject 'a','b','c','d','e' -Count 5

Using PowerShell ISE Snippets to Remember Tricky Syntax
Jan 25, 2014
Post comments count 2
Post likes count 0

Using PowerShell ISE Snippets to Remember Tricky Syntax

Doctor Scripto

Summary: Use Windows PowerShell ISE code snippets to ease the burden of tricky-to-remember syntax. Microsoft Scripting Guy, Ed Wilson, is here. Today Jonathan Medd, Windows PowerShell MVP, is with us to share some Windows PowerShell goodness. Take it away, Jonathan… Often when I am teaching students who are new to Windows PowerShell, one of their complaints (apart from my poor jokes during the class) is, “How do I remember which of these braces and brackets to use for the different types of things I am trying to do?” For instance, they quite regularly get mixed up about when to use parentheses:...

PowerTip: Use PowerShell to Show Path to All Your Profiles
Jan 24, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show Path to All Your Profiles

Doctor Scripto

Summary: Use Windows PowerShell to show the path to all your Windows PowerShell profiles.  How can I use Windows PowerShell to see the path to all of my Windows PowerShell profiles—          not only the current host or current user profile?  Use the $profile automatic variable, pipe the results to the Format-List cmdlet,           and then use the –force parameter to force it to show all paths: $PROFILE | Format-List -Force

Create Backups of Virtual Machines in Windows Azure by using PowerShell
Jan 24, 2014
Post comments count 0
Post likes count 0

Create Backups of Virtual Machines in Windows Azure by using PowerShell

Doctor Scripto

Summary: Guest blogger, Keith Mayer, talks about using Windows PowerShell to manage cloud-based backups. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back Keith Mayer as our guest blogger today. This is Part 1 of a two-part series. In Part 2, we’ll restore virtual machines in Windows Azure from these backups. Keith Mayer is a senior technical evangelist at Microsoft, and he focuses on the Windows infrastructure, datacenter virtualization, systems management, and the private cloud. Keith has over 20 years of experience as a technical leader of complex IT projects, in diverse roles, including network...

PowerTip: Find PowerShell Aliases that Rename Commands
Jan 23, 2014
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Aliases that Rename Commands

Doctor Scripto

Summary: Use Windows PowerShell to find aliases that rename commands.  How can I find Windows PowerShell aliases that rename commands?  Use the Get-Alias cmdlet, pipe the results to Where-Object, and look for a hyphen in the name: Get-Alias | Where name -Match '-' | select name, definition

Avoiding PowerShell Scripting Pitfalls
Jan 23, 2014
Post comments count 0
Post likes count 0

Avoiding PowerShell Scripting Pitfalls

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shares an excerpt from his book, Windows PowerShell Best Practices that discusses scripting pitfalls. Microsoft Scripting Guy, Ed Wilson, is here. Today I have an excerpt from my new book, PowerShell Best Practices, which is published by Microsoft Press. In the excerpt today, I talk about avoiding Windows PowerShell scripting pitfalls. This is something that I saw a lot when I was judging the Scripting Games entries. Complicated constructors If you do not have support from cmdlets when you develop an idea for a script, this indicates that there may be a better way to ...

PowerTip: Find All Two-Letter PowerShell Aliases
Jan 22, 2014
Post comments count 0
Post likes count 0

PowerTip: Find All Two-Letter PowerShell Aliases

Doctor Scripto

Summary: Find all two letter aliases.  How can I see all defined two-letter Windows PowerShell aliases?  Use the Get-Alias cmdlet and a wildcard character combination: Get-Alias ??

Use PowerShell to Find Two-Letter Alias Combinations
Jan 22, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Find Two-Letter Alias Combinations

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about finding all two-letter alias combinations by using Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today I have an excerpt from my new book, PowerShell Best Practices, which is published by Microsoft Press. The two-letter alias namespace is rather large, but how large is it really? You must take every letter in the a–z range and pair them with every other letter in the a–z range to get the answer. If you are good with math, you already know that there are 676 possible letter combinations. However, if your math skills are a bit ...

PowerTip: Find Aliases for Your Favorite PowerShell Commands
Jan 21, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Aliases for Your Favorite PowerShell Commands

Doctor Scripto

Summary: Find aliases for your favorite Windows PowerShell commands.  How can I find shortcut names for the long command names I am always typing when I work from the Windows PowerShell console?  Use the Get-Alias cmdlet and specify the name of the long command you want to shorten           in the –definition parameter. The following technique returns aliases for the Get-CimClass cmdlet: Get-Alias -Definition Get-CimClass Note  Not all cmdlets have aliases, but you can easily create your own by using the New-Alias cmdlet.

Understanding Tradeoffs When Searching for a String
Jan 21, 2014
Post comments count 0
Post likes count 0

Understanding Tradeoffs When Searching for a String

Doctor Scripto

Summary:  Microsoft Scripting Guy, Ed Wilson, provides an excerpt from his new book, Windows PowerShell Best Practices, about searching for strings. Microsoft Scripting Guy, Ed Wilson, is here. Today I have an excerpt from my new book, PowerShell Best Practices , which is published by Microsoft Press. When you are searching for a string, you can use at least three operators: −contains, −like, or −match. The −contains operator The most confusing of the bunch is the −contains operator. This is not due to its complexity of use, but rather, to an attempt at understanding when ...

PowerTip: Find WMI Classes that Support Updates
Jan 20, 2014
Post comments count 0
Post likes count 0

PowerTip: Find WMI Classes that Support Updates

Doctor Scripto

Summary: Use Windows PowerShell to find WMI classes that support updates.  How can I use Windows PowerShell to find WMI classes that support updates?  Use the Get-CimClass cmdlet in Windows PowerShell 4.0 or Windows PowerShell 3.0,           and then search for the SupportsUpdate qualifier: Get-CimClass -QualifierName supportsupdate

Using PowerShell CIM Cmdlets to Explore WMI Classes
Jan 20, 2014
Post comments count 0
Post likes count 0

Using PowerShell CIM Cmdlets to Explore WMI Classes

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shares an excerpt about WMI and CIM from his book, Windows PowerShell Best Practices. Microsoft Scripting Guy, Ed Wilson, is here. Today I have an excerpt from my new book, Windows PowerShell Best Practices, which is published by Microsoft Press. The CIM cmdlets in Windows PowerShell support multiple ways of exploring WMI. They work well when you are working in an interactive fashion. For example, Tab expansion expands the namespace when you use the CIM cmdlets; thereby permitting exploring namespaces that might not otherwise be very discoverable. You can even use thi...

PowerTip: Use PowerShell to List Restore Points
Jan 19, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List Restore Points

Doctor Scripto

Summary: Use Windows PowerShell to list computer restore points.  How can I use Windows PowerShell to list computer restore points on your desktop?  Open Windows PowerShell with Admin rights and use the Get-ComputerRestorePoint cmdlet: Get-ComputerRestorePoint

Tuning SQL Server Management Operations
Jan 19, 2014
Post comments count 0
Post likes count 0

Tuning SQL Server Management Operations

Doctor Scripto

Summary: Microsoft PFE, Thomas Stringer, talks about using Windows PowerShell and tuning SQL Server Management operations. Microsoft Scripting Guy, Ed Wilson, is here. I would like to welcome back guest blogger, Thomas Stringer… I spend a lot of time talking with customers and working with them regarding how they can manage their large enterprise SQL Server environments seamlessly with Windows PowerShell and automation engineering in general. Fun puzzles and obstacles always come along, and they cause me to think outside of the box, and possibly veer off “the norm” when I am reaching out to a l...

PowerTip: Use PowerShell to Create Computer Restore Point
Jan 18, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Computer Restore Point

Doctor Scripto

Summary: Use Windows PowerShell to create a computer restore point.  How can I use Windows PowerShell to create a computer restore point before I make changes to the system?  Open the Windows PowerShell console with Admin rights, use the Checkpoint-Computer cmdlet,           and specify a description, for example: Checkpoint-Computer -Description ok 

Avoid Account Lockout: Use PowerShell to Find Old Mobile Devices
Jan 18, 2014
Post comments count 0
Post likes count 0

Avoid Account Lockout: Use PowerShell to Find Old Mobile Devices

Doctor Scripto

Summary: Guest blogger, Tim Bolton, talks about using Windows PowerShell to find old mobile devices that may cause account lockout. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back, guest blogger, Tim Bolton… One of the most common issues we have been seeing lately is user accounts being locked out due to an mobile device that has been replaced or upgraded. Unfortunately, it is still trying to access their Exchange Server email account. 99% of the time, the user will claim that the old device is not in use, but when they see these results, they realize that their kids are using their device, and t...

PowerTip: Use PowerShell to Find Networking Counters
Jan 17, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Networking Counters

Doctor Scripto

Summary:  Use Windows PowerShell to find networking counters.  How can I use Windows PowerShell to find networking counters?  Use the Get-Counter cmdlet and the –ListSet parameter, select the CounterSetName property, and           filter on names related to networking. The following command returns sets related to IPv6: Get-Counter -ListSet * | select countersetname | where countersetname -match 'ipv6'

Gathering Network Statistics with PowerShell
Jan 17, 2014
Post comments count 0
Post likes count 0

Gathering Network Statistics with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about various ways to gather network statistics by using Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Hey, it is nearly the weekend! This means we are one week closer to Windows PowerShell Saturday #007... PowerShell Saturday #007 will be held in Charlotte, North Carolina on February 8, 2014. This will be an awesome chance to meet and to learn from some of the best PowerShellers around. In fact, five of the speakers are also speakers at the PowerShell Summit this year. There are a limited number of tickets still available for this event, so yo...

PowerTip: Get Network Adapter Power Management Settings
Jan 16, 2014
Post comments count 0
Post likes count 0

PowerTip: Get Network Adapter Power Management Settings

Doctor Scripto

Summary:  Use Windows PowerShell to get network adapter power management settings in Windows 8.1.  How can I use Windows PowerShell to get the network adapter power management settings           on my Window 8.1 computer?  Use the Get-NetAdapterPowerManagement function and specify the name of the network adapter to query: Get-NetAdapterPowerManagement -Name ethernet

Use PowerShell to Work with Network Adapter Power Settings
Jan 16, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Work with Network Adapter Power Settings

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to work with network adapter power settings. Microsoft Scripting Guy, Ed Wilson, is here. Today I want to continue my network adapter series, but first... PowerShell Saturday #007 will be held in Charlotte, North Carolina on February 8, 2014. This will be an awesome chance to meet and to learn from some of the best PowerShellers around. In fact, five of the speakers are also speakers at the PowerShell Summit this year. There are a limited number of tickets still available for this event, so you’ll want to sign up now. Th...

PowerTip: Use PowerShell to Show Connected Physical Adapters
Jan 15, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show Connected Physical Adapters

Doctor Scripto

Summary:  Use the Get-NetAdapter function to show physical network adapters that are connected.  How can I use Windows PowerShell to see which physical network adapters on my Windows 8.1 computer           are up and connected?  Use the –physical parameter with the Get-NetAdapter function, and filter for a status of Up: Get-NetAdapter -physical | where status -eq 'up'

Using PowerShell to Find Connected Network Adapters
Jan 15, 2014
Post comments count 0
Post likes count 0

Using PowerShell to Find Connected Network Adapters

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about ways to use Windows PowerShell to find connected network adapters. Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am enjoying a nice pot of Oolong green tea. This tea has a great taste, especially when I add a bit of jasmine flowers. Oolong green tea steeps best if the water temperature is 185 degrees F—it really comes alive and is bursting with flavor. PowerShell Saturday #007 will be held in Charlotte, North Carolina on February 8, 2014. This will be an awesome chance to meet and to learn from some of the best PowerShellers arou...

PowerTip: Rename Network Adapter with PowerShell
Jan 14, 2014
Post comments count 0
Post likes count 0

PowerTip: Rename Network Adapter with PowerShell

Doctor Scripto

Summary:  Use Windows PowerShell to rename the net adapter.  How can I use Windows PowerShell and Windows 8 to rename my network adapter?  Use the Get-NetAdapter function to retrieve the specific network adapter and           pipe the results to the Rename-NetAdapter function: Get-NetAdapter –Name Ethernet | Rename-NetAdapter –NewName MyRenamedAdapter

Renaming Network Adapters by Using PowerShell
Jan 14, 2014
Post comments count 0
Post likes count 0

Renaming Network Adapters by Using PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about various ways to rename network adapters by using Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. I am sitting here sipping a cup of tea made from English Breakfast, peppermint and spearmint leaves, strawberry leaves, licorice root, and a cinnamon stick. It is delightfully refreshing. I am working on Windows PowerShell Saturday #007 that will be in Charlotte. PowerShell Saturday #007 will be held in Charlotte, North Carolina on February 8, 2014. This will be an awesome chance to meet and to learn from some of the best PowerShellers around. ...

PowerTip: Use PowerShell to Enable All Network Adapters
Jan 13, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Enable All Network Adapters

Doctor Scripto

Summary: Use Windows PowerShell to enable all network adapters.  How can I use Window PowerShell to quickly enable all network adapters on my Windows 8.1 laptop?  Use the Get-NetAdapter and the Enable-NetAdapter commands: Get-NetAdapter | ? status -ne up | Enable-NetAdapter

Enabling and Disabling Network Adapters with PowerShell
Jan 13, 2014
Post comments count 0
Post likes count 1

Enabling and Disabling Network Adapters with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks using Windows PowerShell to enable and disable network adapters. Microsoft Scripting Guy, Ed Wilson, is here. Today I have spent much of the day working with the various speakers who will be speaking at Windows PowerShell Saturday #007 in Charlotte, North Carolina. We have finalized the schedule. Woo Hoo!! The speaker list was set over a month ago, but certain speakers want to speak in the morning or in the afternoon. Some have more than one session and want to speak back-to-back, or not back-to-back. Others want to be opposite someone else so they can attend a s...

PowerTip: Use PowerShell to Find Protocol Binding on Network Adapters
Jan 12, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Protocol Binding on Network Adapters

Doctor Scripto

Summary: Use Windows PowerShell to find which protocols are bound to your network adapters.  How can I use Windows 8.1 and Windows PowerShell 4.0 to show which enabled protocols           are bound to my network adapters?  Use the Get-NetAdapter cmdlet to retrieve all of the network adapters on your system,           pipe it to the Get-NetAdapterBinding cmdlet, and filter on enabled is equal to True: Get-NetAdapter | Get-NetAdapterBinding | ? enabled -eq $true

Weekend Scripter: Use PowerShell to Identify Network Adapter Characteristics
Jan 12, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Identify Network Adapter Characteristics

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to identify network adapter characteristics. Microsoft Scripting Guy, Ed Wilson, is here. Today I am kicking off Network Adapter Week. Note  PowerShell Saturday #007 will be held in Charlotte, North Carolina on February 8, 2014. This will be an awesome chance to meet and to learn from some of the best PowerShellers around. In fact, five of the speakers are also speakers at the PowerShell Summit this year. There are a limited number of tickets still available for this event, so you’ll want to sign up now. The Scripting Wi...

PowerTip: Predefine Cmdlet Parameters in Variable
Jan 11, 2014
Post comments count 0
Post likes count 0

PowerTip: Predefine Cmdlet Parameters in Variable

Doctor Scripto

Summary: Pass a cluster of parameter values by using an array.  Is there an easy way to write Windows PowerShell commands to handle two separate domains           (for example, production and development) and their credentials?  Define them in an array that contains the parameter names and their values. For example, to pass           the IP address of a domain controller and credentials as a single variable to the Get-ADUser cmdlet: $DC=”192.168.1.5” $Cred=(GET-CREDENTIAL) $CommonParameters=@{‘Server’=$DC;’Credenti...

Weekend Scripter: Wow! I Didn’t Know You Could Do That in PowerShell!
Jan 11, 2014
Post comments count 0
Post likes count 0

Weekend Scripter: Wow! I Didn’t Know You Could Do That in PowerShell!

Doctor Scripto

Summary: Discover the power of the “double splat.” Honorary Scripting Guy, Sean Kearney, here filling in for our good friend, Ed. He’s keeping himself inside where it’s warm. I’m here in Canada typing really fast to keep even warmer! It’s 31 degrees below Celsius here in Ottawa, don’t cha know? I was developing a solution that needed to authenticate against two Active Directory domains, and the client threw in a twist during development (yes, these things happen). During this process, I discovered a cool trick called “double splatting.” In my script, I first n...

PowerTip: Use PowerShell to Remove a File Share
Jan 10, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Remove a File Share

Doctor Scripto

Summary: Use Windows PowerShell to remove SMB file shares.  How can I use Windows PowerShell to delete an SMB file share that is no longer used on           my computer running Windows 8?  Open the Windows PowerShell console with Admin rights, locate the file share, and pipe it to the           Remove-SMBShare function (to avoid confirmation messages, set the confirmation level to $false): Get-SmbShare -Name fso | Remove-SmbShare -Confirm:$false

PowerShell and Excel: Fast, Safe, and Reliable
Jan 10, 2014
Post comments count 1
Post likes count 0

PowerShell and Excel: Fast, Safe, and Reliable

Doctor Scripto

Summary: Microsoft PowerShell MVP, Tobias Weltner, talks about Windows PowerShell and Excel interaction. Microsoft Scripting Guy, Ed Wilson, is here. Let’s welcome back guest blogger, Tobias Weltner… Microsoft Excel is a great tool to share Windows PowerShell data. However, the scripting tactics have changed from the good old VBScript times. Let’s take a look at how Windows PowerShell can output data to Excel fast, safe, and reliably. Out-GridView: Built-in “mini-Excel” Before I touch Excel, let’s first look at its little cousin, which ships with Windows PowerShell: Out-GridVi...

PowerTip: Use PowerShell to Create New File Share
Jan 9, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create New File Share

Doctor Scripto

Summary: Use Windows PowerShell to create a file share.  How can I use Windows PowerShell on my computer running Windows 8 to create a new file share?  Open the Windows PowerShell console with Admin rights, then use the New-SmbShare function,          and specify a file name and path: New-SmbShare -Name fso -Path c:\fso

Use PowerShell to Get Account Lockout and Password Policy
Jan 9, 2014
Post comments count 1
Post likes count 0

Use PowerShell to Get Account Lockout and Password Policy

Doctor Scripto

Summary: Microsoft guest blogger and PFE, Ian Farr, talks about using Windows PowerShell to get account lockout and password policies. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Ian Farr. Ian is a Microsoft PFE in the UK. Recently, I was asked how to retrieve a domain’s Account Lockout Policy and Password Policy with Windows PowerShell. Both are stored as attributes on each domain’s Domain Naming Context. In fact, when you update these policies with the Group Policy Management Console, it is the role of the domain’s PDC emulator to write the changes to the header of...

PowerTip: Use PowerShell to Get Information about SMB Sessions
Jan 8, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get Information about SMB Sessions

Doctor Scripto

Summary: Get information about the sessions between SMB clients and the SMB server. .  How can I use Windows PowerShell to get information about the sessions between           server message block (SMB) clients and the SMB server on my computer running Windows 8?  Open the Windows PowerShell console with Admin rights, and use the Get-SmbSession function.

2014 PowerShell Heroes announced
Jan 8, 2014
Post comments count 0
Post likes count 0

2014 PowerShell Heroes announced

ScriptingGuy1

SUMMARY: Announcing the 2014 Windows PowerShell heroes from PowerShell.Org The PowerShell.Org community announced today the results of their 2014 PowerShell Heroes poll. The community results are in. You can read the complete announcement on PowerShell.Org. The five 2014 PowerShell Heroes are listed here: 1. Teresa Wilson, aka the Scripting Wife – she has been instrumental in helping to organize PowerShell Saturday, setting up Windows PowerShell user groups including being the administrative support for the Charlotte User group,  working with PowerShell.Org and the PowerScripting PodCast. She is also a...

The 2014 PowerShell Community Predictions
Jan 8, 2014
Post comments count 0
Post likes count 0

The 2014 PowerShell Community Predictions

Doctor Scripto

Summary: Honorary Scripting Guy and PowerShell MVP, Don Jones, makes his Windows PowerShell community predictions for 2014.Microsoft Scripting Guy, Ed Wilson, is here. Today I invited Don Jones, Windows PowerShell MVP and Honorary Scripting Guy, to write some predictions for 2014. And now, here’s Don… 2014 is shaping up to be a big year for the Windows PowerShell community. Let’s start with what’s on tap for PowerShell.org: But PowerShell.org certainly isn’t the beginning or the end of the awesomeness that is the Windows PowerShell community, and I hope you’ll...

PowerTip: Disable Module Autoload in PowerShell
Jan 7, 2014
Post comments count 0
Post likes count 0

PowerTip: Disable Module Autoload in PowerShell

Doctor Scripto

Summary: Learn how to disable module autoloading in Windows PowerShell.  How can disable module autoloading in Windows PowerShell?  Set the value of $PSModuleAutoLoadingPreference to “none”: $PSModuleAutoLoadingPreference = "none"

PowerTip: Use PowerShell to List Virtual Machines
Jan 6, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List Virtual Machines

Doctor Scripto

Summary: Use Windows PowerShell to list all virtual machines.  How can I use Windows PowerShell to get a list of virtual machines and their state on my Windows 8 laptop?  Open Windows PowerShell with Admin rights, and use the Get-VM cmdlet.

Top Five 2013 Hey, Scripting Guy! Blog Posts
Jan 6, 2014
Post comments count 0
Post likes count 0

Top Five 2013 Hey, Scripting Guy! Blog Posts

Doctor Scripto

Summary: The Scripting Wife reveals the top five Hey, Scripting Guy! Blog posts for 2013. Microsoft Scripting Guy, Ed Wilson, is here. As you all know, the Scripting Wife is very active in the Windows PowerShell community, and she loves to help where she can. I decided to challenge her to write a few blog posts this week. Here is the first one. Take it away Teresa… When Ed challenged me to write some posts, I took the sneaky road and said, “Sure, I will write about the top blog posts from 2013 and the top scripts in the Script Center Repository.  I don’t think this is what Ed was expecting...

PowerTip: Enable App Background Task Logging with PowerShell
Jan 5, 2014
Post comments count 0
Post likes count 0

PowerTip: Enable App Background Task Logging with PowerShell

Doctor Scripto

Summary: Learn how to enable app background task logging with Windows PowerShell.  How can I use Windows PowerShell to enable app background task logging in Event Viewer on my Windows 8.1 laptop?  Open Windows PowerShell with Admin rights and use the Enable-AppBackgroundTaskDiagnosticLog cmdlet.

Use PowerShell to Import Group Policy Objects
Jan 5, 2014
Post comments count 0
Post likes count 0

Use PowerShell to Import Group Policy Objects

Doctor Scripto

Summary: Microsoft PFE, Ian Farr talks about using Windows PowerShell to import Group Policy Objects. Microsoft Scripting Guy, Ed Wilson, is here. Yesterday, guest blogger, Ian Farr talked about backing up Group Policy Objects  (GPOs) in his post Using PowerShell to Back Up Group Policy Objects. He continues his GPO series today… The challenge Welcome back! Part 1 looked at my script, Comprehensive Group Policy Backup Script. Part 2 is about a Group Policy import script. Previously done, you say? True, but I have yet to find a script that mirrors all of the following configuration items to a test doma...

PowerTip: Use PowerShell to Display Inbound Firewall Rules
Jan 4, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Inbound Firewall Rules

Doctor Scripto

Summary: Use Windows PowerShell to display inbound firewall rules. How can I use  Windows PowerShell to display the enabled inbound firewall rules for my Windows 8.1 laptop? Use the Show-NetFirewallRule function, filter on the Enabled and the Direction properties,           and select the display name for readability:Show-NetFirewallRule | where {$_.enabled -eq 'true' -AND $_.direction -eq 'inbound'}| select displayname

Using PowerShell to Back Up Group Policy Objects
Jan 4, 2014
Post comments count 0
Post likes count 0

Using PowerShell to Back Up Group Policy Objects

Doctor Scripto

Summary: Guest blogger, Ian Farr, talks about using Windows PowerShell to back up Group Policy Objects. Microsoft Scripting Guy, Ed Wilson, is here. Today I am happy to welcome back a recent new guest blogger, Ian Farr. Here is what Ian had to say about himself: I started out writing UNIX shell scripts to automate simple tasks. Then as a Windows IT pro, I discovered VBScript, and it ignited a passion for automation. Over the years, I've used batch files, KiXtart, JScript, HTAs, Perl, JavaScript, and Python. I love solving problems with scripts, and I've written code for several large enterprise environm...

PowerTip: Find Windows Azure Database with PowerShell
Jan 3, 2014
Post comments count 0
Post likes count 0

PowerTip: Find Windows Azure Database with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to get Windows Azure database.  How can I use Windows PowerShell to get my Windows Azure database?  1. Run the Add-AzureAccount cmdlet to refresh the account information in your Windows PowerShell session           (expires in 12 hours).           2. Run Get-AzureSqlDatabaseServer to get the database server in your account. Your SQL Server           databases are associated with your database server.           3. Run Get-AzureSqlDatabase for the databases that are asso...

Security Series: Using PowerShell to Enable BYOD—Part 3
Jan 3, 2014
Post comments count 0
Post likes count 0

Security Series: Using PowerShell to Enable BYOD—Part 3

Doctor Scripto

Summary: Guest blogger and security expert, Yuri Diogenes, completes his series about enabling BYOD. Microsoft Scripting Guy, Ed Wilson, is here. Today’s guest blogger is Yuri Diogenes, who continues his security series about enabling BYOD. Yuri is a senior knowledge engineer, and he is a coauthor of the book Windows Server 2012 Security from End to Edge and Beyond. You can follow him on Twitter at @YuriDiogenes. This is the last post of a series, and before we start, I would like to recap what has been documented so far: This post will continue the Contoso IT story to embrace “bring your own device” (B...

PowerTip: Determine If PowerShell Command Exists
Jan 2, 2014
Post comments count 0
Post likes count 0

PowerTip: Determine If PowerShell Command Exists

Doctor Scripto

Summary: Use Get-Help to determine if a Windows PowerShell command exists.  How can I find if a Windows PowerShell command (cmdlet or function) exists in my version of Windows PowerShell?  Use the Get-Help cmdlet. If Help returns, you can read about the command.           If it does not return, follow up with Get-Command: get-help my-coolfunction get-command my-coolfunction

Leverage Registry Key Time Stamps via PowerShell
Jan 2, 2014
Post comments count 0
Post likes count 0

Leverage Registry Key Time Stamps via PowerShell

Doctor Scripto

Summary: Guest blogger, Rohn Edwards, talks about leveraging registry key time stamps via Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we wrap-up a four-part series from Rohn Edwards, co-founder of the Mississippi PowerShell User Group. If you have not already done so, you may want to read the previous posts in the series: Note  To follow today’s examples, you’ll need the Add-RegKeyMember and Get-ChildItem functions from the previous two posts. If you’ve been following along, you now have the ability to see the last time that a registry key was modified from w...

PowerTip: Use PowerShell to Display Network Adapter Stats
Jan 1, 2014
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Network Adapter Stats

Doctor Scripto

Summary: Use Windows PowerShell to display network adapter statistics.  How can I use Windows PowerShell to display the network adapter statistics on my Windows 8.1 laptop?  Use the Get-NetAdapterStatistics function.

Create a Proxy Function to Display Registry Key Time Stamps
Jan 1, 2014
Post comments count 0
Post likes count 0

Create a Proxy Function to Display Registry Key Time Stamps

Doctor Scripto

Summary: Guest blogger, Rohn Edwards, discusses creating a Windows PowerShell proxy function to display registry key time stamps. Microsoft Scripting Guy, Ed Wilson, is here. Happy New Year to you all. Guest blogger, Rohn Edwards, is back with us today to continue his series about retrieving registry key last-modified time stamps. Be sure to read the following blog posts before you start reading the post today, if you have not already done so. Yesterday, we built a Windows PowerShell advanced function that gets information from registry keys that isn’t normally exposed to Windows PowerShell. Our functio...

Get Windows Azure Active Directory Tenant ID in Windows PowerShell
Dec 31, 2013
Post comments count 0
Post likes count 0

Get Windows Azure Active Directory Tenant ID in Windows PowerShell

Doctor Scripto

Summary: Get your Windows Azure Active Directory tenant ID in Windows PowerShell. How can I get my Windows Azure Active Directory tenant ID in Windows PowerShell? Use the Add-AzureAccount cmdlet to add your Windows Azure account to Windows PowerShell:PS C:> Add-AzureAccount          Then use Get-AzureAccount to get the tenant ID:PS C:>(Get-AzureAccount).ActiveDirectories.ActiveDirectoryTenantID

Reusing PowerShell Registry Time Stamp Code
Dec 31, 2013
Post comments count 0
Post likes count 0

Reusing PowerShell Registry Time Stamp Code

Doctor Scripto

Summary: Guest blogger, Rohn Edwards, discusses reusing code that obtains the last-modified time stamp from the registry. Microsoft Scripting Guy, Ed Wilson, is here. Today is the last day of the year, but don’t despair. We are here to share some Windows PowerShell goodies with you.  Welcome back Rohn Edwards as our guest blogger this week... In yesterday’s post, Use PowerShell to Access Registry Last-Modified Time Stamp, we covered how to use Windows PowerShell and P/Invoke to get information from registry keys that isn’t normally available to WMI and the .NET Framework. We covered how to ...

PowerTip: Use PowerShell to Find Registry Access
Dec 30, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Registry Access

Doctor Scripto

Summary: Use Windows PowerShell to find registry access.  How can I use Windows PowerShell to get the ACL for a registry key?  Use the Get-ACL cmdlet on a key in a Windows PowerShell registry drive.           The following example shows access to the HKLM\Software\Microsoft key: Get-acl HKLM:\SOFTWARE\Microsoft

Use PowerShell to Access Registry Last-Modified Time Stamp
Dec 30, 2013
Post comments count 0
Post likes count 0

Use PowerShell to Access Registry Last-Modified Time Stamp

Doctor Scripto

Summary: Guest blogger, Rohn Edwards, talks about using Windows PowerShell to access the last-modified time stamp in the registry. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Rohn Edwards. Rohn is one of the cofounders of the Mississippi PowerShell User Group. I’m not sure how many of you know this, but the registry stores the last-modified time for every registry key. Unfortunately, it’s not that accessible. Regedit won’t let you get it interactively, although you can get it if you export the key as a text file and then open the file. There are also third-party tools that will let ...

PowerTip: Use PowerShell to Disable Network Adapter
Dec 29, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Disable Network Adapter

Doctor Scripto

Summary: Use Windows PowerShell to disable a network adapter.  How can I use Windows PowerShell to disable a network adapter on my Windows 8.1 laptop named Wireless?  Use the Disable-NetAdapter cmdlet and provide the name of Wireless to the command: Disable-NetAdapter –name wireless

Weekend Scripter: Using PowerShell to Replace STSADM
Dec 29, 2013
Post comments count 0
Post likes count 0

Weekend Scripter: Using PowerShell to Replace STSADM

Doctor Scripto

Summary: Learn about a Windows PowerShell script to replace STSADM –o enumallwebs in SharePoint. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back today guest blogger, Brian Jackett. Brian is a senior premier field engineer at Microsoft who has specialized in SharePoint development, Windows PowerShell, and Project Server since 2008. Brian is a steering committee member of the Buckeye SharePoint User Group and coauthor of Microsoft SharePoint 2010: Creating and Implementing Real-World Projects. He enjoys giving back to the community through giving presentations, planning and volunteering at conferenc...

PowerTip: Get Time Difference between Dates with PowerShell
Dec 28, 2013
Post comments count 0
Post likes count 0

PowerTip: Get Time Difference between Dates with PowerShell

Doctor Scripto

Summary: Use New-TimeSpan to produce the time difference between two dates.  I know I can subtract dates, but is there a Windows PoweShell cmdlet to show me the time difference between dates?  Use New-TimeSpan and supply the information!          For example, to show the difference between today and the upcoming New Year: $StartDate=(GET-DATE) $EndDate=[datetime]”01/01/2014 00:00” NEW-TIMESPAN –Start $StartDate –End $EndDate

Weekend Scripter: Use PowerShell to Host New Year’s Eve Countdown Clock
Dec 28, 2013
Post comments count 0
Post likes count 0

Weekend Scripter: Use PowerShell to Host New Year’s Eve Countdown Clock

Doctor Scripto

Summary: Use [DATETIME] variables and arrays to produce a countdown timer. Honorary Scripting Guy, Sean Kearney, here filling in for our good friend, Ed. With the New Year coming up in a few days, I decided to present something silly and geeky. I want to use Windows PowerShell to produce a New Year’s countdown timer. Figuring out the difference between two dates and times in Windows PowerShell is actually surprisingly easy. That is one of the reasons I love using and playing with Windows PowerShell…the difficult is usually very easy! So first we need define the time to countdown to. We’re going...

PowerTip: Use PowerShell to Create Hash Table
Dec 27, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Create Hash Table

Doctor Scripto

Summary: Use a Windows PowerShell cmdlet to create a hash table.  How can I use Windows PowerShell to create a hash table if do not remember the special syntax?  Use the ConvertFrom-StringData cmdlet, and put each key-value pair on its own line.           (You can perform this on a single line by using backtick character plus n (`n) for a new line): PS C:\> convertfrom-stringdata "a=1`nb=2`nc=3" Name                         &nbs...

Phantom Elements in a Hash Table
Dec 27, 2013
Post comments count 0
Post likes count 0

Phantom Elements in a Hash Table

Doctor Scripto

Summary: Microsoft PFE and guest blogger, Chris Wu, talks about working with hash tables. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Chris Wu… Admittedly, hash tables didn’t catch my attention when I started using Windows PowerShell, but over time it has proven to be one of my favorites. This is largely thanks to its ability to assign names to values for fast lookup. Hash tables store key-value (or name-value) pairs, which means typically we use strings as keys to locate corresponding values. Windows PowerShell also takes keys from the command line as strings. So the fol...

PowerTip: Display a Blinking Message by Using PowerShell
Dec 26, 2013
Post comments count 0
Post likes count 0

PowerTip: Display a Blinking Message by Using PowerShell

Doctor Scripto

Summary: Use this one-line Windows PowerShell command to display a blinking message.  Is there a one-line command that I could use to blink a message in the Windows PowerShell console to get the users attention?  Pipe a range of numbers to the Foreach-Object cmdlet (% is an alias), clear the screen in the Begin block,           and then display the message, pause, clear the screen, and pause in the Process block: 1..3 | % -begin {cls} -process {"hello";sleep 1;cls;sleep 1}

PowerShell Report for a Windows Failover Cluster
Dec 26, 2013
Post comments count 0
Post likes count 0

PowerShell Report for a Windows Failover Cluster

Doctor Scripto

Summary: Use Windows PowerShell to create a report for a Windows failover cluster. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Rhys Campbell… I’m involved in the administration of several Failover Clusters, and I wanted to be able to easily report on these and get an alert for any changes in status. Enter Windows PowerShell. This Windows PowerShell script uses various FailoverCluster cmdlets to write information about a Windows Failover Cluster to a HTML file and copy this to a web server directory root. The script also tracks changes to the state of the cluster and sends...

PowerTip: Add Computer to Security Group with PowerShell
Dec 25, 2013
Post comments count 0
Post likes count 0

PowerTip: Add Computer to Security Group with PowerShell

Doctor Scripto

Summary: Use Active Directory PoweShell cmdlets to add a computer to a security group.  How can I use Windows PowerShell to add a computer to a security group?  Use the Add-ADGroupMember cmdlet, and remember to use the SAM account name on the computer: To add a computer called “STATION01” to a security group called “RDPEnabled”: ADD-ADGroupMember “RDPEnabled” –members “STATION01$” Note  The SAM account name has a “$” added to its name.

‘Twas the Night Before Scripting: Part 5
Dec 25, 2013
Post comments count 0
Post likes count 0

‘Twas the Night Before Scripting: Part 5

Doctor Scripto

Summary: Tonight, our Admin friend learns to migrate group memberships. Microsoft Scripting Guy, Ed Wilson, here. If you missed it, be sure to watch Sean’s video: Just Script It! Also to catch up with our story, read:  And now, our conclusion… During the past four days, we encountered a friend who (with the aid of Dr. Scripto) has learned some basic scripting to accomplish his holiday tasks far more readily. Now he is about to complete his work by deploying and migrating domains. And now we begin To work to the end, To aid in the help Of our good Admin friend.   The users were re...

PowerTip: Show Group Members with PowerShell
Dec 24, 2013
Post comments count 0
Post likes count 0

PowerTip: Show Group Members with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to get a list of group members in Active Directory.  How can I use Windows PowerShell to regularly show who is in an Active Directory group, for example, Domain Admins?  To show who is in the Domain Admins group in Active Directory, run the following command: Get-ADGroupMember DomainAdmins If you’d like to view this in a nicer format, use: Get-ADGroupMember DomainAdmins | FORMAT-Table

‘Twas the Night Before Scripting: Part 4
Dec 24, 2013
Post comments count 0
Post likes count 0

‘Twas the Night Before Scripting: Part 4

Doctor Scripto

Summary: Dr. Scripto shows our Admin friend how to determine which groups a computer is a member of. Microsoft Scripting Guy, Ed Wilson, here. If you missed it, be sure to watch Sean’s video: Just Script It! Also to catch up with our story, read:  Take it away, Sean… When we last were within our reading, the good Dr. Scripto showed our former non-scripter how to find cmdlets within a module—and furthermore, how to obtain the necessary Help for basic use. The weight of the pressure had begun to ease off our happy admin.  He actually foresaw being home with his family for the ...

PowerTip: Create Computer Account in Active Directory with PowerShell
Dec 23, 2013
Post comments count 0
Post likes count 0

PowerTip: Create Computer Account in Active Directory with PowerShell

Doctor Scripto

Summary: Use the Active Directory module to create a new computer account.  How can I use Windows PowerShell to create a computer account in Active Directory? To create a new computer called ScriptoPC, execute the following line in an Active Directory environment           with a domain controller running Windows Server 2012 R2, Windows Server 2012, or Windows Server 2008 R2: New-ADcomputer –name “ScriptoPC” –SamAccountName “ScriptoPC”

Cmdlets Roasting on an Open Fire
Dec 23, 2013
Post comments count 0
Post likes count 0

Cmdlets Roasting on an Open Fire

Doctor Scripto

Summary: Are there new cmdlets in the Active Directory PowerShell module in Windows Server 2012 R2? Microsoft Scripting Guy, Ed Wilson, is here. Today we have an extra guest post from Ian Farr, who explores if there are new cmdlets in the Active Directory PowerShell module in Windows Server 2012 R2. I like it when Christmas comes early… Are there any additional cmdlets included in the Active Directory PowerShell module in Windows Server 2012 R2? Let’s look… I ran (Get-Command -Module ActiveDirectory).count on a computer running Windows Server 2012 (HALODC01) ...

‘Twas the Night Before Scripting: Part 3
Dec 23, 2013
Post comments count 0
Post likes count 0

‘Twas the Night Before Scripting: Part 3

Doctor Scripto

Summary: Dr. Scripto teaches our Admin friend how to find cmdlets in a module and get Help. Microsoft Scripting Guy, Ed Wilson, here. If you missed it yesterday, see Sean’s latest video: Just Script It! Also be sure to read:  Yesterday we saw how Dr. Scripto aided our good Administrator friend, a person who had never scripted, modify multiple users in Active Directory.  Yet there was still much left to do on this project, including deployment of workstations, oh my! And so we continue with our third badly rhyme-filled session… And so it continued Yet not deep in the night, For Powe...

PowerTip: Set Custom Attributes in Active Directory
Dec 22, 2013
Post comments count 0
Post likes count 0

PowerTip: Set Custom Attributes in Active Directory

Doctor Scripto

Summary: Use the Set-ADUser cmdet to modify custom attributes.  How can I use Windows PowerShell to modify a custom attribute in Active Directory?  Use the Set-ADUser cmdlet and it’s –add, -replace, and –remove parameters to adjust custom attributes. For example, to update the Info attribute in Active Directory and replace it with a new value: SET-ADUSER john.smith –replace @{info=”John Smith is a Temporary Contractor”}

‘Twas the Night Before Scripting: Part 2
Dec 22, 2013
Post comments count 0
Post likes count 0

‘Twas the Night Before Scripting: Part 2

Doctor Scripto

Summary: Dr. Scripto helps an Admin learn how to easily modify custom attributes in Active Directory. Microsoft Scripting Guy, Ed Wilson, here. If you missed it yesterday, see Sean’s latest video: Just Script It! Also be sure to read yesterday’s post before you start on today’s: ‘Twas the Night of Before Scripting: Part 1. Here’s Sean… In yesterday’s episode, we encountered an Administrator who was near tears due to the time constraints of a massive project and the bad timing of it occurring during the holidays. Magically from a spark of ozone, our good friend Dr. Script...

PowerTip: Create a Secure Password with PowerShell
Dec 21, 2013
Post comments count 0
Post likes count 0

PowerTip: Create a Secure Password with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to make a plain text entry into a secure password.  Is there a way I can use Windows PowerShell and my working script to make a secure string password without using Read-Host? Use the ConvertTo-SecureString cmdlet:$MyBoringPassword=”OhThisCouldBeSecure!ButEverybodyIsReadingThisOnTheInternet!”To convert this to a SecureString, which is typically needed when you create a new user in Active Directory, execute:$SecurePassword=CONVERTTO-SecureString –asplaintext –force –string $MyBoringPassword

‘Twas the Night of Before Scripting: Part 1
Dec 21, 2013
Post comments count 0
Post likes count 0

‘Twas the Night of Before Scripting: Part 1

Doctor Scripto

Summary:  Dr. Scripto teaches a non-scripting Administrator to easily create users in Active Directory. Microsoft Scripting Guy, Ed Wilson, here. Returning once again to delight us all with a little holiday merriment is Honorary Scripting Guy, Sean Kearney. Other than his habit of occasionally singing off-key Windows PowerShell music, he has taken on the challenge of writing an annual holiday Hey, Scripting Guy! Blog special. This year, the Scripting Guys proudly present to you in 3-D PowerShell-O-Rama Vision, the latest holiday edition. But before you rush to read today’s post, see Sean’s l...

PowerTip: Debug a Workflow with PowerShell 4.0
Dec 20, 2013
Post comments count 0
Post likes count 0

PowerTip: Debug a Workflow with PowerShell 4.0

Doctor Scripto

Summary: Use Windows PowerShell 4.0 to debug a workflow. How do I set a breakpoint in a Windows PowerShell script workflow? Add the workflow to a script and use Set-PSBreakpoint to set a line breakpoint in the workflow:Set-PSBreakpoint -Script C:Test-MyWorkflow1.ps1 -Line 12 ID Script                           Line Command   Variable  Action-- ------                  ...

Security Series: Using PowerShell to Enable BYOD–Part 2
Dec 20, 2013
Post comments count 0
Post likes count 0

Security Series: Using PowerShell to Enable BYOD–Part 2

Doctor Scripto

Summary: Guest blogger and security expert, Yuri Diogenes, continues his series about enabling BYOD. Microsoft Scripting Guy, Ed Wilson, is here. Today’s guest blogger is Yuri Diogenes, who continues his security series about enabling BYOD. Yuri is a senior knowledge engineer, and he is a coauthor of the book Windows Server 2012 Security from End to Edge and Beyond. You can follow him on Twitter at @YuriDiogenes. In the first part of this series, Security Series: Using PowerShell to Enable BYOD–Part 1, I explained how to enable device registration to allow IT to have awareness of the user’s device and have th...

PowerTip: Use PowerShell to Discover Console Colors
Dec 19, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Discover Console Colors

Doctor Scripto

Summary:  Use Windows PowerShell to discover console color assignment.  How can I see what colors are assigned in the Windows PowerShell console?  Use the Get-Host cmdlet and expand the PrivateData property: (get-host).privatedata

Migrating Host-Named Site Collections
Dec 19, 2013
Post comments count 0
Post likes count 0

Migrating Host-Named Site Collections

Doctor Scripto

Summary: Guest blogger and Microsoft PFE, Chris Weaver, talks about using Windows PowerShell to migrate host-named site collections. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back today to guest blogger, Chris Weaver… This week I was onsite with a customer in North Carolina. They were migrating to SharePoint 2013, but they hit an issue with support. The issue was that they had an excessive number of web applications, and they needed to find a way to reduce those applications but still maintain their URLs.   In SharePoint 2013, the recommended way of doing this was to use host-named sit...

PowerTip: PowerShell One-Liner to Find Short Aliases
Dec 18, 2013
Post comments count 0
Post likes count 0

PowerTip: PowerShell One-Liner to Find Short Aliases

Doctor Scripto

Summary:  Use this Windows PowerShell one-liner to find one-, two-, three-, and four-letter aliases.  How can I use a Windows PowerShell one-liner to find the number of default aliases that are one, two, three,           and four letters long?  Use the range operator to create an array with 1 through 4 numbers, pipe the results to the       Foreach-Object cmdlet, multiply the number with a wildcard character, and pipe the results to Measure: 1..4 | % {(gal ("?"*$_) | measure).count} 

Store PowerShell Profile on SkyDrive
Dec 18, 2013
Post comments count 0
Post likes count 0

Store PowerShell Profile on SkyDrive

Doctor Scripto

Summary: Guest blogger, JD Platek, talks about storing the Windows PowerShell profile on SkyDrive. Microsoft Scripting Guy, Ed Wilson, is here. Today I would like to introduce a new guest blogger. Please welcome JD Platek. JD has been in IT since 2003, and he is an Exchange Server 2010 and Office 365 MCM. He has supported many industries, plus he has enjoyed having the opportunities to travel the world because of IT. Most of his career has been in the Exchange world, which lead him to learn and love Windows PowerShell. JD is a consultant for Microsoft in Singapore. He supports and regularly presents at the ...

PowerTip: Use PowerShell to List App Background Task Info
Dec 17, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to List App Background Task Info

Doctor Scripto

Summary: Use Windows PowerShell to list app background task information.  How can I use Windows PowerShell to find performance information about app background tasks on my laptop running Windows 8.1?  Open Windows PowerShell with Admin rights. Use the Get-AppBackgroundTask cmdlet,           and include the complete name of the app and the –IncludeResourceUsage switch.           Select the PerfInfo property and expand it. Get-AppBackgroundTask -PackageFamilyName Microsoft.SkypeApp_kzf8qxf38zg5c -IncludeResourceUsag...

Use PowerShell to Work with RODC Accounts
Dec 17, 2013
Post comments count 0
Post likes count 0

Use PowerShell to Work with RODC Accounts

Doctor Scripto

Summary: Microsoft premier field engineer, Ian Farr, talks about using Windows PowerShell to work with RODC accounts. Microsoft Scripting Guy, Ed Wilson, is here. Today I would like to introduce a new guest blogger, Ian Farr. Ian tells us about himself: I started out writing UNIX shell scripts to automate simple tasks. Then as a Windows IT pro, I discovered VBScript, and it ignited a passion for automation. Over the years, I've used batch files, KiXtart, JScript, HTAs, Perl, JavaScript, and Python. I love solving problems with scripts, and I've written code for several large enterprise environments. I now wo...

PowerTip: Use PowerShell to Display a Routing Table
Dec 16, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display a Routing Table

Doctor Scripto

Summary: Use Windows PowerShell to display your routing table.  How can I use Windows PowerShell to display the routing table on my Windows 8.1 laptop?  Use the Get-NetRoute function.

PowerTip: Use PowerShell to Find DNS Suffix Search List
Dec 16, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find DNS Suffix Search List

Doctor Scripto

Summary: Use Windows PowerShell to find a DNS suffix search list.  How can I use Windows PowerShell to find how DNS is configured on my computer running Windows 8.1         in terms of domain suffix search lists?  Use the Get-DnsClientGlobalSetting function.

PowerShell Above and Beyond the Minimum Requirements
Dec 16, 2013
Post comments count 0
Post likes count 0

PowerShell Above and Beyond the Minimum Requirements

Doctor Scripto

Summary: Two Microsoft Windows PowerShell experts get extreme with the standard Hello World script. Microsoft Scripting Guy, Ed Wilson, is here. Last month at the Charlotte PowerShell User Group meeting, we played around with some scenarios, and we had each of the attendees work through the tasks to see the various ways they would come up with to solve the scenario. Jason Walker and Brian Wilhite, both Microsoft PFEs and Windows PowerShell enthusiasts decided that they wanted to go above and beyond the  answer that I provided. Here is Jason to kick off their effort… Windows PowerShell doesn’t al...

PowerTip: Kick Off Formal WinSat Evaluation
Dec 15, 2013
Post comments count 0
Post likes count 0

PowerTip: Kick Off Formal WinSat Evaluation

Doctor Scripto

Summary: Kick off a formal WinSat evaluation on your computer running Windows 8.1.  How can I use Windows PowerShell to run a formal WinSat evaluation on my computer running Windows 8.1?  Open the Windows PowerShell console with Admin rights, and use the WinSat utility: WinSat formal

Weekend Scripter: Configure HyperV on Windows 8 Computer
Dec 15, 2013
Post comments count 0
Post likes count 0

Weekend Scripter: Configure HyperV on Windows 8 Computer

Doctor Scripto

Summary: Guest blogger, Greg Lindsay, tells how to configure Hyper-V on a computer running Windows 8.1 or Windows 8. Microsoft Scripting Guy, Ed Wilson, is here. Today we welcome a new guest blogger, Greg Lindsay. In Greg’s own words: I am a technical writer for Windows Server. I have written documentation for Network Access Protection (NAP), DNS, DHCP, and IP Address Management (IPAM). You might already have experience using Windows Virtual PC in Windows 7, which enables you to run virtual machines on a client operating system. You can still install Windows Virtual PC in Windows 8, but ...

PowerTip: Use PowerShell to Clear DNS Cache
Dec 14, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Clear DNS Cache

Doctor Scripto

Summary: Clear the client DNS cache by using Windows PowerShell.  How can I use Windows PowerShell to clear the client DNS cache on my computer running Windows 8.1? Use the Clear-DNSClientCache cmdlet.

Working with Task Scheduler XML
Dec 14, 2013
Post comments count 0
Post likes count 0

Working with Task Scheduler XML

Doctor Scripto

Summary: Guest blogger, Jason Morgan, talks about using XML to work with the Task Scheduler. Microsoft Scripting Guy, Ed Wilson, is here. Today I am proud to introduce Jason Morgan as the newest guest blogger for the Hey, Scripting Guy! Blog. I ran across Jason at the first meeting of the Northern Virginia (NOVA) PowerShell User Group meeting. The Scripting Wife and I were hanging out, and I asked him if he would like to contribute. Today’s excellent post is the result of that collaboration. First, a little bit about Jason… Jason Morgan has been working in IT since 2004. He is an engineer for V...

PowerTip: Use PowerShell to Find Connections to Remote Servers
Dec 13, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Connections to Remote Servers

Doctor Scripto

Summary: Use Windows PowerShell to find connections to remote servers.  How can I use Windows PowerShell while I am troubleshooting my computer to find what           connections are made to remote servers via port 80?  Use the Get-NetTCPConnection command, specify the remote port of 80, and select the remote addresses: Get-NetTCPConnection -RemotePort 80 | SELECT RemoteAddress

Using the PowerShell Contains Operator
Dec 13, 2013
Post comments count 0
Post likes count 0

Using the PowerShell Contains Operator

Doctor Scripto

Summary:  Microsoft Scripting Guy, Ed Wilson, talks about using the Windows PowerShell Contains operator to work with arrays. Microsoft Scripting Guy, Ed Wilson, is here. Today I am happy to provide you with an excerpt from my book Windows PowerShell 3.0 Step by Step, published by Microsoft Press. Examine contents of an array To verify input that is received from the command line, you can use the Contains operator to examine the contents of an array of possible values. This following technique illustrates an array of three values that is created and stored in the variable $noun. The Contains operator is the...

PowerTip: Use PowerShell to Show IP Interface Overview
Dec 12, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Show IP Interface Overview

Doctor Scripto

Summary: Use Windows PowerShell to provide an overview of IP interfaces.  How can I use Windows PowerShell to provide me with a quick overview of the IP interfaces on my computer?  In your computer running Windows 8.1, use Windows PowerShell 4.0, and call the Get-NetIPInterface command.   

Understanding the PowerShell While Statement
Dec 12, 2013
Post comments count 0
Post likes count 0

Understanding the PowerShell While Statement

Doctor Scripto

Summary: Learn how to use the While statement in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today I am happy to provide you with an excerpt from my new book Windows PowerShell 3.0 Step by Step, published by Microsoft Press. In VBScript, you had the While…Wend loop. An example of using the While…Wend loop is the WhileReadLineWend.vbs script. The first thing you do in the script is create an instance of the FileSystemObject, and store it in the objFSO variable. You then use the OpenTextFile method to open a test file, and you store that object in the objFile variable. You then u...

PowerTip: Find Net Route with PowerShell
Dec 11, 2013
Post comments count 0
Post likes count 0

PowerTip: Find Net Route with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to find a net route to a remote host.  How can I use the Find-NetRoute function in Windows 8.1 to find a route to a remote host if I do not have the IP address?  Use the Resolve-DnsName command to find the IP address of the remote host,           and feed the results to the Find-NetRoute command: Find-NetRoute -RemoteIPAddress (Resolve-DnsName www.microsoft.com).ip4address

Use PowerShell to Create Remote Session
Dec 11, 2013
Post comments count 0
Post likes count 0

Use PowerShell to Create Remote Session

Doctor Scripto

Summary: Learn how to use Windows PowerShell to create a remote management session. Microsoft Scripting Guy, Ed Wilson, is here. Today I am happy to provide you with an excerpt from my new book, Windows PowerShell 3.0 Step by Step, published by Microsoft Press. For a simple configuration on a single remote machine, entering a remote Windows PowerShell session is the answer. To enter a remote Windows PowerShell session, use the Enter-PSSession cmdlet to create an interactive remote Windows PowerShell session on a target machine. If you do not supply credentials, the remote session impersonates your current sign-i...

PowerTip: Use PowerShell to Display Routing Table
Dec 10, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Routing Table

Doctor Scripto

Summary: Use Windows PowerShell to display the routing table.  How can I use Windows PowerShell to display the routing table?  In your computer running Windows 8.1, use Windows PowerShell 4.0, and call the Get-NetRoute command.

Use PowerShell to Create Registry Keys
Dec 10, 2013
Post comments count 0
Post likes count 0

Use PowerShell to Create Registry Keys

Doctor Scripto

Summary: Use Windows PowerShell to create and manage registry keys. Microsoft Scripting Guy, Ed Wilson, is here. Today I am happy to provide you with an excerpt from my book, Windows PowerShell 3.0 Step by Step, published by Microsoft Press. Note  The registry contains information that is vital to the operation and configuration of your computer. Serious problems could arise if you edit the registry incorrectly. Therefore, it is important to back up your system prior to attempting to make any changes. For information about backing up your registry, see article 322756 in the Microsoft Knowledge Base. For gen...

PowerTip: Use PowerShell to Resolve DNS Names
Dec 9, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Resolve DNS Names

Doctor Scripto

Summary: Use Windows PowerShell to find IP addresses for DNS names.  How can I use Windows PowerShell to resolve a DNS name to an IP address?  With Windows PowerShell 4.0 in Windows 8.1, use the Resolve-DnsName command,           and then select the IP4address from the results: (Resolve-DnsName www.microsoft.com).ip4address

Find Hidden Message Embedded in Image
Dec 9, 2013
Post comments count 0
Post likes count 0

Find Hidden Message Embedded in Image

Doctor Scripto

Summary: Learn how to find a hidden message embedded in an image. Microsoft Scripting Guy, Ed Wilson, is here. Today we have an extra post from Shane Nelson with a recap of an interesting challenge presented to us at our Charlotte PowerShell User Group. Shane is an associate Windows system administrator for a large-scale healthcare provider in the southeast U.S. He has worked in IT for since 2008. Along with his team, he helps manage and support Windows servers and Microsoft Exchange. Take it away, Shane… Windows PowerShell MVP, Jim Christopher, presented us with a challenge: Find the hidden message that h...

See How Naming Makes PowerShell Easy to Learn
Dec 9, 2013
Post comments count 0
Post likes count 0

See How Naming Makes PowerShell Easy to Learn

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shares an excerpt from his book, Windows PowerShell 3.0 Step by Step, which explains how the Windows PowerShell naming convention makes it easy to learn. Microsoft Scripting Guy, Ed Wilson, is here. Today I am happy to provide you with an excerpt from my book, Windows PowerShell 3.0 Step by Step, published by Microsoft Press. One of the great things about Windows PowerShell is the verb–noun naming convention. In Windows PowerShell, the verbs indicate an action to perform, such as Set to make a change or Get to retrieve a value. The noun indicates the item with w...

PowerTip: Use PowerShell to Get WinSat Score on Windows 8.1
Dec 8, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get WinSat Score on Windows 8.1

Doctor Scripto

Summary:  Use Windows PowerShell to read the WinSat score on your computer running Windows 8.1.  How can I use Windows PowerShell to obtain the WinSat score from my computer running Windows 8.1, if I cannot find the utility I used on earlier versions of Windows?  Use the Get-CimInstance cmdlet and read the values from the Win32_WinSat WMI class: Get-CimInstance Win32_WinSAT

Weekend Scripter:  Who are the Administrators?
Dec 8, 2013
Post comments count 0
Post likes count 0

Weekend Scripter: Who are the Administrators?

Doctor Scripto

Summary: Guest blogger, Bill Stewart, talks about using Windows PowerShell to find administrators. Microsoft Scripting Guy, Ed Wilson, is here. Hello everyone. It is the weekend, and guest blogger, Bill Stewart is going to share his time and knowledge today. Bill is a scripting guru and a moderator for the Official Scripting Guys Forum... As you know, an administrator of a Windows computer is a member of the computer’s local Administrators group. This is a special built-in group, so any user or group that’s a member of this special group is an administrator on the computer. We can see who the members ...

PowerTip: Use PowerShell to Subtract Timespans
Dec 7, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Subtract Timespans

Doctor Scripto

Summary: Subtract timespans by using Windows PowerShell.  How can I use Windows PowerShell to subtract 2 days and 14 hours from 12 days and 1 hour to determine the amount of time left on a project?  Create two timespans using the New-Timespan cmdlet, and then subtract them from each other: (New-TimeSpan -Days 12 -Hours 1) - (New-TimeSpan -Days 2 -Hours 14)

Weekend Scripter: Create an HTML Server Report with PowerShell
Dec 7, 2013
Post comments count 0
Post likes count 0

Weekend Scripter: Create an HTML Server Report with PowerShell

Doctor Scripto

Summary: Guest blogger, Matthew Kerfoot, talks about using Windows PowerShell to create an HTML server report. Microsoft Scripting Guy, Ed Wilson, is here. Today I would like to welcome a new guest blogger, Matthew Kerfoot… I'm a Windows PowerShell enthusiast with strong interests in automating systems administration. I write a blog called The Overnight Admin where I like to share Windows PowerShell scripts, tips, and functions. I also tweet about Windows PowerShell at @mkkerfoot                          The following function utilizes WMI t...

PowerTip: Use PowerShell to Display Network Adapter Bindings
Dec 6, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Display Network Adapter Bindings

Doctor Scripto

Summary:  Use Windows PowerShell to display network adapter bindings.  How can I use Windows PowerShell in Windows 8 to display network adapter bindings?  Use the Get-NetAdapter cmdlet to retrieve your network adapter, and pipe it to Get-NetAdapterBinding: Get-NetAdapter -Name ethernet | Get-NetAdapterBinding -AllBindings

Solving Office Holiday Gift-Giving Conundrums with PowerShell
Dec 6, 2013
Post comments count 0
Post likes count 0

Solving Office Holiday Gift-Giving Conundrums with PowerShell

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about a project to assign secret pals at work. He ropes one of the managers into the project. During my one-on-one last week with my manager, Adina, she mentioned doing something to help people who work from remote locations feel more like part of the team. Because I work remotely, I was all ears. She had a great idea: Assign random secret pals. You have to find out all you can about the secret pal, and then send them something that is unique to them—their interests, hobbies, or tastes. Of course, the present is something small, which also makes it a b...

Security Series: Using PowerShell to Enable BYOD–Part 1
Dec 6, 2013
Post comments count 0
Post likes count 0

Security Series: Using PowerShell to Enable BYOD–Part 1

Doctor Scripto

Summary: Guest blogger and security expert, Yuri Diogenes, talks about using Windows PowerShell to enable BYOD. Microsoft Scripting Guy, Ed Wilson, is here. Today’s guest blogger is Yuri Diogenes, who is bringing us the beginning of a new security series. Yuri is a senior knowledge engineer, and he is a coauthor of the book Windows Server 2012 Security from End to Edge and Beyond. You can follow him on Twitter at @YuriDiogenes. Take it away, Yuri… The explosion of mobile devices and how users are connecting to resources online changed the way users consume information, and this change has arriv...

PowerTip: Use Special Formatting from Types XML File in WMI
Dec 5, 2013
Post comments count 0
Post likes count 0

PowerTip: Use Special Formatting from Types XML File in WMI

Doctor Scripto

Summary: Use special formatting from the types .xml file to choose properties in Windows PowerShell and WMI.  How can I use Windows PowerShell to find the status of the BIOS on my computer without viewing the default output?  Use the special PSStatus view when you select properties: Get-WmiObject win32_bios | select psstatus

Getting Started with PowerShell: The Basics of WMI
Dec 5, 2013
Post comments count 0
Post likes count 0

Getting Started with PowerShell: The Basics of WMI

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about querying WMI in this excerpt of his book, Windows PowerShell 3.0 First Steps. Microsoft Scripting Guy, Ed Wilson, is here. Today I have the last excerpt from my new Microsoft Press book, Windows PowerShell 3.0 First Steps. In most situations, when you use WMI, you are performing some sort of query. Even when you are going to set a particular property, you still need to execute a query to return a dataset that enables you to perform the configuration. (A dataset includes the data that come back to you as the result of a query, that is, it is a set of data.)...

PowerTip: Use PowerShell to Get List of Authorized Root Certificates
Dec 4, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Get List of Authorized Root Certificates

Doctor Scripto

Summary: Use Windows PowerShell to get a list of authorized root certificates for the current user.  How can I examine the authorized root certificates for the current user?  Use the Get-ChildItem cmdlet (dir is an alias) and explore the cert:\CurrentUser\AuthRoot folder: dir Cert:\CurrentUser\AuthRoot

Getting Started with PowerShell: The Certificate Provider
Dec 4, 2013
Post comments count 0
Post likes count 0

Getting Started with PowerShell: The Certificate Provider

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using the Windows PowerShell Certificate provider. Microsoft Scripting Guy, Ed Wilson, is here. Today I have an excerpt from my new Microsoft Press book, Windows PowerShell 3.0 First Steps. To find information about the Windows PowerShell Certificate provider, use the Get-Help cmdlet. If you are unsure what topics in Help may be related to certificates, you can use the wildcard character asterisk (*) parameter. This command is shown here: Get-Help *cer* The Certificate provider gives you the ability to sign scripts, and it allows Windows PowerShell to work...

PowerTip: Use PowerShell to Write Process Information to Text File
Dec 3, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Write Process Information to Text File

Doctor Scripto

Summary: Use Windows PowerShell to write process information to a text file.  How can I use Windows PowerShell to document information about currently running processes by writing the information to a text file?  Use the Get-Process cmdlet and pipe the results to the Out-File cmdlet: Get-Process | Out-File -FilePath c:\fso\process.txt

Getting Started with PowerShell: Text Files
Dec 3, 2013
Post comments count 0
Post likes count 0

Getting Started with PowerShell: Text Files

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to work with text files. Microsoft Scripting Guy, Ed Wilson, is here. Good morning! Today I have an excerpt from my new book, Windows PowerShell 3.0 First Steps, which was recently published by Microsoft Press. One of the easiest methods to store data is in a text file. In the following image, the output from the Get-Volume function displays in the Windows PowerShell console. The output formats nicely in columns, and it contains essential information about the volumes on a Windows 8 laptop.  Redirect and append The easie...

PowerTip: Use PowerShell to Group Processes in Windows
Dec 2, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Group Processes in Windows

Doctor Scripto

Summary: Use Windows PowerShell to group the numbers of processes in Windows.    How can I use Windows PowerShell to determine the number of processes that are running—          for example, if I notice that there are multiple copies of the same processes running? Use the Get-Process cmdlet, group the output on the Name property, and sort the count           where there is more than one instance of the process.In Windows PowerShell 4.0 or Windows PowerShell 3.0:Get-Process | group name | sort count -Descending | where count...

Getting Started with PowerShell: The Pipeline
Dec 2, 2013
Post comments count 0
Post likes count 0

Getting Started with PowerShell: The Pipeline

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shares an excerpt from his new Windows PowerShell book. Microsoft Scripting Guy, Ed Wilson, is here. Today, I have an excerpt from my recently published book, Windows PowerShell 3.0 First Steps. This book is published by Microsoft Press. The Windows PowerShell pipeline takes the output from one command, and sends it as input to another command. By using the pipeline, you are able to do things such as find all computers in one specific location and restart them. This entails two commands: Passing the objects from one command to a new command makes Windows Powe...

PowerTip: Find User Name for a Process
Dec 1, 2013
Post comments count 0
Post likes count 0

PowerTip: Find User Name for a Process

Doctor Scripto

Summary:  Use Windows PowerShell to find the user who owns a process.  How can I use Windows PowerShell 4.0 in Windows 8.1 to determine who owns a process?  Use the –IncludeUserName switch with the Get-Process cmdlet: Get-Process -IncludeUserName

Weekend Scripter: Determine Process that Locks a File
Dec 1, 2013
Post comments count 0
Post likes count 0

Weekend Scripter: Determine Process that Locks a File

Doctor Scripto

Summary: Guest blogger, Adam Driscoll, talks about using Windows PowerShell to determine which process is locking a file. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blogger, Adam Driscoll... It’s quite common to run into the issue where a process is locking a particular file. Attempting to delete or open the file can result in an error message when another process has exclusive access to the file. Unfortunately, Windows PowerShell nor the .NET Framework expose a simple way of determining which process is locking the file. Determine which process is locking the file requires quite a f...

PowerTip: Find PowerShell Version
Nov 30, 2013
Post comments count 0
Post likes count 0

PowerTip: Find PowerShell Version

Doctor Scripto

Summary: Easily find your Windows PowerShell version.  Is there a single command I can use to find the version of Windows PowerShell I am running, plus the version of           WSMan and the .NET Framework command-line reference (CLR)?  Use the $PSVersionTable automatic variable to display the Windows PowerShell version,           WSMan stack information, .NET Framework CLR version information, and other information: PS C:\> $PSVersionTable

Weekend Scripter: WMF, PowerShell, and Exchange Server Compatibility
Nov 30, 2013
Post comments count 0
Post likes count 0

Weekend Scripter: WMF, PowerShell, and Exchange Server Compatibility

Doctor Scripto

Summary: Microsoft PFE and guest blogger, Mike Pfeiffer, talks about Windows PowerShell and Exchange Server compatability. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blogger who we haven’t seen for a while. Mike Pfeiffer is a premier field engineer for Microsoft. Since we last had Mike as a guest blogger, he has published a new book: Microsoft Exchange Server 2013 PowerShell Cookbook: Second Edition. Take it away Mike… As you know, the version of the Windows Management Framework (WMF) that is installed on your server determines which versions of Windows PowerShell you can use....

PowerTip: Use PowerShell to Clear the Trusted Hosts File
Nov 29, 2013
Post comments count 0
Post likes count 1

PowerTip: Use PowerShell to Clear the Trusted Hosts File

Doctor Scripto

Summary: Use Windows PowerShell to clear the trusted hosts file. How can I use Windows PowerShell to clear all values from my trusted hosts file?The trusted hosts file is part of the WSMAN configuration, and the easiest way to clear it is to use Clear-Item:£> Get-Item -Path WSMan:localhostClientTrustedHosts | fl Name, ValueName  : TrustedHostsValue : server02,10.10.54.201£> Clear-Item -Path WSMan:localhostClientTrustedHosts -Force£> Get-Item -Path WSMan:localhostClientTrustedHosts | fl Name, ValueName  : TrustedHostsValue :Note  If you don’t use the&n...

Remoting Week: Non-Domain Remoting
Nov 29, 2013
Post comments count 0
Post likes count 1

Remoting Week: Non-Domain Remoting

Doctor Scripto

Summary: Richard Siddaway explains how to use Windows PowerShell remoting to access machines that aren’t in your domain.  Hey, Scripting Guy! I’ve just starting learning Windows PowerShell, and I understand how to use it as a scripting language and shell on the local machine. How do I work with remote machines? —AP  Hello AP, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the final part of a series of five posts about remoting. To catch up on the previous posts, see: So far in this series, you have seen how to p...

PowerTip: Remove PowerShell Web Access Authorization Rules
Nov 28, 2013
Post comments count 0
Post likes count 0

PowerTip: Remove PowerShell Web Access Authorization Rules

Doctor Scripto

Summary: Learn how to remove Windows PowerShell Web Access authorization rules. How can I remove Windows PowerShell Web Access authorization rules that are no longer required? If you can identify the rule, use Remove-PswaAuthorizationRule from the PowerShellWebAccess module:Remove-PswaAuthorizationRule -Id 1~or~Get-PswaAuthorizationRule -RuleName 'server02 AD admin only' | Remove-PswaAuthorizationRuleTo remove all rules for a particular server:Get-PswaAuthorizationRule | where Destination -eq 'manticoreserver02' | Remove-PswaAuthorizationRuleTo remove rules based on the configuration...

Remoting Week: Remoting Security
Nov 28, 2013
Post comments count 0
Post likes count 0

Remoting Week: Remoting Security

Doctor Scripto

Summary: Richard Siddaway explains how to secure Windows PowerShell remoting sessions.  Hey, Scripting Guy! I’ve just starting learning Windows PowerShell, and I understand how to use it as a scripting language and shell on the local machine. How do I work with remote machines? —AP  Hello AP, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the fourth part of a series of five posts about remoting: You have seen how you can access remote systems by using the ComputerName parameter of various cmdlets. This is very good ...

PowerTip: Use PowerShell to Discover Certificate Thumbprints
Nov 27, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Discover Certificate Thumbprints

Doctor Scripto

Summary: Use Windows PowerShell to discover certificate thumbprints. How can I use Windows PowerShell to discover the thumbprints of certificates that are installed on my machine? Interrogate the certificate store, which is exposed as the cert: drive:Get-ChildItem -Path cert: -Recurse | select Subject, FriendlyName, Thumbprint | Format-ListYou will see a lot of entries like this:Subject      : OU=Go Daddy Class 2 Certification Authority, O="The Go Daddy Group, Inc.", C=USFriendlyName : Go Daddy Class 2 Certification AuthorityThumbprint   : 2796BAE63F1801E2772...

Remoting Week: Configuring Remoting
Nov 27, 2013
Post comments count 0
Post likes count 0

Remoting Week: Configuring Remoting

Doctor Scripto

Summary: Richard Siddaway explains how to configure remoting.  Hey, Scripting Guy! I’ve just starting learning WindowsPowerShell, and I understand how to use it as a scripting language and shell on the local machine. How do I work with remote machines? —AP  Hello AP, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the third part in a series of five posts about remoting. The series includes: In the first post, you saw how Windows PowerShell supplies a number of options for individual cmdlets to access remote machines....

PowerTip: Determine Version of WSMAN on Remote Computer
Nov 26, 2013
Post comments count 0
Post likes count 0

PowerTip: Determine Version of WSMAN on Remote Computer

Doctor Scripto

Summary: Use Windows PowerShell to determine the version of WSMAN running on a remote computer. How can I use Windows PowerShell to determine the version of WSMAN that is running on remote computers?    Use Test-WSMAN:Test-WSMan -ComputerName myserverwsmid           : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsdProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsdProductVendor   : Microsoft CorporationProductVersion  : OS: 0.0.0 SP: 0.0 Stack: 2.0If you also want to see the operating system vers...

Remoting Week: Remoting Sessions
Nov 26, 2013
Post comments count 0
Post likes count 0

Remoting Week: Remoting Sessions

Doctor Scripto

Summary: Richard Siddaway explains how to use WindowsPowerShell remoting sessions.  Hey, Scripting Guy! I’ve just starting learning Windows PowerShell, and I understand how to use it as a scripting language and shell on the local machine. But how do I work with remote machines? —AP  Hello AP, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the second part of a series of five posts about remoting. The series includes: In my Remoting Recap post, you saw that you can use Invoke-Command to send a command to a remote mach...

PowerTip: Use PowerShell to Find Key of WMI Class
Nov 25, 2013
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to Find Key of WMI Class

Doctor Scripto

Summary: Use Windows PowerShell to find the key of a WMI class. How can I use Windows PowerShell to discover the property that has the key qualifier for a WMI class?   Use Get-CimClass and iterate through the properties:$class = Get-CimClass -ClassName Win32_Processforeach ($property in $class.CimClassProperties) { $property | select -ExpandProperty Qualifiers | foreach {   if ($_.Name -eq 'key'){     $property   } } }

Remoting Week: Remoting Recap
Nov 25, 2013
Post comments count 0
Post likes count 0

Remoting Week: Remoting Recap

Doctor Scripto

Summary: Richard Siddaway explains various ways to interact with remote machines.  Hey, Scripting Guy! I’ve just starting learning Windows PowerShell, and I understand how to use it as a scripting language and shell on the local machine. How do I work with remote machines? —AP  Hello AP, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. This is the first part of a series of five posts about remoting: Let’s start at the beginning and recap the various ways you can access a remote machine through Windows PowerShell. When y...

Announcing the 2013 Honorary Scripting Guys
Nov 24, 2013
Post comments count 0
Post likes count 0

Announcing the 2013 Honorary Scripting Guys

Doctor Scripto

Summary: The Honorary Scripting Guys are announced for 2013. Microsoft Scripting Guy, Ed Wilson, is here. Today, I have an exciting announcement! Drum roll please… dadadadadadada…CLING! Yes, for the third time ever, we have official Honorary Scripting Guys to announce! Yes, that’s right. What does it take to become an official Honorary Scripting Guy? It takes an extreme commitment to the scripting community, a remarkable dedication helping to spread the good word about Windows PowerShell, and a relentless pursuit of excellence in producing exceptional content. To read more about the Honorary S...

Psst…Charlotte PowerShell Saturday Details Leaked
Nov 24, 2013
Post comments count 0
Post likes count 0

Psst…Charlotte PowerShell Saturday Details Leaked

Doctor Scripto

Summary: The Scripting Wife reveals the session details for the Charlotte Windows PowerShell Saturday event.Microsoft Scripting Guy, Ed Wilson, is here. Today I will turn the keyboard over to the lovely Scripting Wife. Teresa, the screen is yours… Hello fellow PowerShellers!  I am so excited to be involved in the planning and co-organizing of PowerShell Saturday #007, which will be held in Charlotte, North Carolina on Feb 8, 2014. Today I want to share the list of speakers and sessions. Remember, there could be some slight modifications as life happens all around us; but this is a prett...

PowerTip: Find Missed Runs on Scheduled Task or Job
Nov 23, 2013
Post comments count 0
Post likes count 0

PowerTip: Find Missed Runs on Scheduled Task or Job

Doctor Scripto

Summary: Use Windows PowerShell to find the number of missed runs on a scheduled task or scheduled job. How can I use Windows PowerShell to find the number of missed runs on a scheduled task or scheduled job?  Use the scheduled task cmdlets:PS C:> Get-ScheduledTask -TaskName MyScheduledJob | Get-ScheduledTaskInfo LastRunTime        : 10/16/2013 10:20:20 AMLastTaskResult     : 0NextRunTime        : 10/17/2013 10:20:20 AMNumberOfMissedRuns : 0TaskName         ...

Using Scheduled Tasks and Scheduled Jobs in PowerShell
Nov 23, 2013
Post comments count 0
Post likes count 0

Using Scheduled Tasks and Scheduled Jobs in PowerShell

Doctor Scripto

Summary: Learn about using scheduled tasks and scheduled jobs in Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today Dave Bishop, senior technical writer on the Windows Server team, and June Blender, senior programming writer on the Windows Azure Active Directory team, investigate scheduled tasks and scheduled jobs in Windows PowerShell. And now, here’s June… Windows PowerShell 3.0 introduced dozens of new modules and thousands of new cmdlets. Much of this was the work of Microsoft teams building Windows PowerShell interfaces for Windows tools. In the mix were two modules that soun...

PowerTip: Export PowerShell Cmdlet Information
Nov 22, 2013
Post comments count 0
Post likes count 0

PowerTip: Export PowerShell Cmdlet Information

Doctor Scripto

Summary: Use Windows PowerShell to export cmdlet information to a text format other than .csv.  How can I export Windows PowerShell cmdlet information to a format other than .csv so I can use it in another application?  Use the Export-CSV cmdlet and specify a different deliminiter. For example, if your application needs           a colon separator instead of a comma, you can use the following type of command: Get-Process | Export-Csv -Path c:\fso\proc.csv -Delimiter ':' -NoTypeInformation

Use PowerShell to Rename Files in Bulk
Nov 22, 2013
Post comments count 0
Post likes count 0

Use PowerShell to Rename Files in Bulk

Doctor Scripto

Summary: Learn how to use Windows PowerShell to rename files in bulk. Microsoft Scripting Guy, Ed Wilson, is here. Matt Tisdale is back today with another solution to a situation at work… I received a call from a gentleman named Cristofer this afternoon. He had a business need and he heard from someone that Windows PowerShell could help. I told him that I am sure Windows PowerShell can help—and that was before I even heard the question. His immediate need was to rename almost 250 files that are located in various folders on the file system. He needed to find all files with a specific character string...

PowerTip: Save PowerShell Cmdlet Info as CSV File
Nov 21, 2013
Post comments count 0
Post likes count 0

PowerTip: Save PowerShell Cmdlet Info as CSV File

Doctor Scripto

Summary: Save Windows PowerShell cmdlet information as a .csv file.  How can I save information from a Windows PowerShell cmdlet as a .csv file so I can open it in Excel for processing? Pipe the Windows PowerShell cmdlet information to the Export-CSV cmdlet, specify the path to store the file,           and use the –NoTypeInformation switch: Get-Process | Export-Csv -Path c:\fso\proc.csv  –NoTypeInformation