Power Tips

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus


13 Free SQL Tools from Idera


Free Ebook: Mastering Powershell

Welcome to the archive of tips delivered through Tobias' Tip of the Day RSS Feed and Your Power Tip of the Day email. Subscribe in the sidebar to get the latest tips!

Sort by: Most Recent | Most Viewed | Most Commented
  • Accessing an SQL Database with a Connection String

    In a previous tip we explained how you can construct the connection string to a SQL database. Whether you use this to create the connection string, or whether you create a connection string from scratch does not matter – provided you have a valid...
  • Getting SQL Server Connection String

    If you’d like to contact an SQL Server database via PowerShell, you need a connection string. The connection string contains all pieces of information needed to contact the SQL server instance. Traditionally, it is not trivial to construct such...
  • Updating Your Office Phone Number in Active Directory

    If you have installed the free RSAT tools from Microsoft, you can use PowerShell to update information stored in your AD user account, for example your office phone number. Whether you are allowed to commit this change depends on your enterprise security...
  • Adding Custom Attributes to AD Objects

    If you’d like to add custom attributes to an AD object, simply use a hash table, and add the desired attribute names and their values. Then use Set-ADUser (available in the ActiveDirectory module shipping with the free RSAT tools from Microsoft...
  • Cloning Active Directory Security Settings

    Whenever you add delegation rights to an AD object (i.e. allow a user to manage the members of an organizational unit), you really invoke a change of security settings for the given AD object. AD security descriptors can be very complex. Cloning AD security...
  • Get Command History as File

    The built-in PowerShell ISE editor that ships with PowerShell 3.0 or better can be customized, and you can add your own menu items. When you run the following code, you will find a new menu item “Get Command History” in your Add-ons menu that...
  • Simple AD Group Management

    Provided you have downloaded and installed Microsoft’s free RSAT tools, managing AD groups and group members is very simple. Here are some lines of code that can serve as examples on how to get started: #requires -Version 1 -Modules ActiveDirectory...
  • Using PowerShell Help

    To access the full PowerShell help, you first need to download help information from the Internet. Simply launch a PowerShell console with full Administrator privileges: PS> Start-Process -FilePath powershell.exe -Verb runas Néxt, download the...
  • Setting AD Account Expiration Date

     

    Normal 0 false false false DE X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-ansi-language:DE;}

    ...
  • Bulk-Remove Protection for Accidental Deletion in AD

    By default, AD objects are protected from accidental deletion. To remove this protection for all objects in a given scope (i.e. all objects in an organizational unit and below), try this code: #requires -Version 1 -Modules ActiveDirectory Get-ADObject...
  • First Steps Automating AD

    When you download the free RSAT tools from Microsoft, these include the ActiveDirectory module. It contains a rich set of cmdlets to manage Active Directory accounts. Provided you are connected to an Active Directory, you can use the following samples...
  • Changing Local Administrator Account Password

    To access local user accounts and assign a new password, you can use the low-level WinNT: namespace. Note: you do need Administrator privileges to assign new passwords. This script would assign a new password for the local Administrator account: #requires...
  • Encrypting Text

    There are many ways to encrypt text. Here is an approach that does not use an explicit “secret”. Instead, the secret is defined as your identity plus your machine. When you encrypt text using ConvertTo-TextEncrypted, the result can only be...
  • Moving Outdated Log Files to Archive

    Occasionally, you may want to move files to an archive folder when they are older than a given number of days. Here is an example that illustrates the basic strategy on how to identify outdated files, and how to move them to an archive: #requires -Version...
  • Create Benign “Task Kill” Application

    In a previous tip we showed how you can select applications and kill them immediately. All unsaved data in the applications would get lost. Here is a more sophisticated approach. It lists all applications, and you can select those you want to end (hold...
< Previous 1 2 3 4 5 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.