PowerTip: Use PowerShell to Create Hash Table

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…

0

PowerTip: Display a Blinking Message by Using PowerShell

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…(read more)

0

PowerTip: Add Computer to Security Group with PowerShell

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”…

0

PowerTip: Show Group Members with PowerShell

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…

0

PowerTip: Create Computer Account in Active Directory with PowerShell

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,…

0

PowerTip: Set Custom Attributes in Active Directory

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”}

0

PowerTip: Create a Secure Password with PowerShell

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…

0

PowerTip: Debug a Workflow with PowerShell 4.0

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 — ——                           —- ——-   ——– …

0

PowerTip: Use PowerShell to Discover Console Colors

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

0

PowerTip: PowerShell One-Liner to Find Short Aliases

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…

0