- Dev Blogs
- Scripting Blog [archived]
The “Hey, Scripting Guys!” blog has been retired. There are many useful posts in this blog, so we keep the blog here for historical reference. However, some information might be very outdated and many of the links might not work anymore.
New PowerShell content is being posted to the PowerShell Community blog where members of the community can create posts by submitting content in the GitHub repository.
Scripting Blog [archived]
Formerly known as the "Hey, Scripting Guy!" blog
Latest posts
PowerTip: Using Set-ADUser with multi-valued attributes
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
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
Using New-Alias to create easier to remember shortcuts in PowerShell
Using PowerShell to View and Remove Wireless Profiles in Windows 10 – Part 4
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
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
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
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
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
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...