Adding/Changing Windows Registry values using PowerShell

You can use PowerShell to change registry values in Windows. Below, I give a few different examples of how to use the cmdlet in varies scenarios. From the Microsoft knowledge base article http://support.microsoft.com/kb/154596 How to configure RPC dynamic port allocation to work with firewalls, below is the PowerShell way, using 4 separate PowerShell cmdlets in the same order: New-Item -Path HKLM:\Software\Microsoft\Rpc\Internet New-ItemProperty -Path HKLM:\Software\Microsoft\Rpc\Internet -Name Ports -PropertyType MultiString -Value 5984-5994 New-ItemProperty -Path HKLM:\Software\Microsoft\Rpc\Internet -Name PortsInternetAvailable -PropertyType String -Value Y New-ItemProperty -Path HKLM:\Software\Microsoft\Rpc\Internet -Name UseInternetPorts -PropertyType String -Value Y To disable IPv6, run the following cmdlet: New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters -Name DisabledComponents…

Export SCOM 2010 alerts to TXT/CSV file using PowerShell

You can use PowerShell to export alerts from SCOM 2010 to a CSV file with lots of information included. Please note, exported alerts are listed in Greenwich Mean Time (GMT) time zone. #Closed Critical Alerts get-scomalert -criteria ‘ResolutionState=255 AND Severity>=2’ | select MonitoringObjectDisplayName,Name,Severity,ResolutionState,TimeRaised,TimeResolved,Parameters | export-csv c:\ClosedCriticalAlerts.txt #New Critical Alerts get-scomalert -criteria ‘ResolutionState=0 AND Severity>=2’ | select MonitoringObjectDisplayName,Name,Severity,ResolutionState,TimeRaised,Parameters | export-csv c:\NewCriticalAlerts.txt #New Warning Alerts get-scomalert -criteria ‘ResolutionState=0 AND Severity>=2’ | select MonitoringObjectDisplayName,Name,Severity,ResolutionState,TimeRaised,Parameters | export-csv c:\NewWarningAlerts.txt Resolution State 0 = New 255 = Closed Severity Values for Alerts 0 = INFORMATIONAL 1 = WARNING 2 = CRITICAL

Export list of mail enabled users from Exchange 2010

Use PowerShell to export a list of mail enabled users from Exchange 2010: Get-User -ResultSize Unlimited | Where { $_.RecipientType -eq ‘UserMailbox’ } | ft firstname,lastname,samaccountname The following command will export the list to a CSV file: Get-User -ResultSize Unlimited | Where { $_.RecipientType -eq ‘UserMailbox’ } | select firstname,lastname,samaccountname | export-csv c:\MailEnabledUsers.txt

Use PowerShell to get members of an Active Directory (AD) group

To get a list of members of an AD security group using PowerShell, run the following from the Active Directory Module for Windows PowerShell. Get-ADGroupMember “<GroupName>” | Select Name, SamAccountName, objectClass Or, to get a list of user ojectClasses only, run: Get-ADGroupMember “<GroupName>” | where {$_.objectclass-eq “user”} | Select Name, SamAccountName Similar, to get a list of group ojectClasses only, run: Get-ADGroupMember “<GroupName>” | where {$_.objectclass-eq “group”} | Select Name, SamAccountName

Using imagex.exe, Sysprep and WinPE to clone a Windows 7 PC

This guide is a step-by-step or a walkthrough to assist you in cloning a Windows 7 machine with all its Windows Updates, Software and settings, so that you can deploy onto another PC/computer without having to sit in front of it and manually install the many software packages one by one. Also if you have download limits with your internet connection like my Dad does, this will save double downloading of the same thing. E.g. Windows Updates and Office Updates. Tools you will need for this are as follows: A WinPE disk with imagex.exe included on it. You can either…

Windows Server 2012 Hyper-V server command line configuration

Build a Hyper-V Server 2012 or Windows Server 2012 with Hyper-V from the command line including Server Core network configuration, whether it be PowerShell or Command Prompt. Please note, this roughly covers configurations for both a single server with a single NIC, and a server to be used in a failover cluster using several NICs including iSCSI. These are not an exact order of steps to follow, but more so my notes that I use when building a server which I follow roughly. So a fairly good technical knowledge is needed to follow and understand this. I have included a…

Windows Server 2008 R2 IIS v7.5 HTTP Redirect – The proper way, best practice

The following covers the correct way to setup an HTTP redirect in IIS 7.5 without setting up the HTTP redirect from the Default Web Site. This is to avoid getting the HTTP redirection getting inherited to all the virtual directories underneath and also to avoid breaking the /exchange to /owa redirection.  The proper way to do this is to set the redirection on the iisstart.htm file itself. In IIS Manager, highlight the Default Web Site (DWS) and on the center pane, click on contents view. Right click on iisstart.htm and then select Switch to features view. Screenshot 1: Now on…

Installing SCOM 2012 agent on a non-domain workgroup Windows Server Core computer using the command line

The following are the list of steps that I took to install the Operations Manager (OpsMgr) 2012 agent on a workgroup based Windows Server Core 2008 R2 computer using certificates and without using a gateway server. Sometimes you might have a few servers in a workgroup e.g. DMZ that need to be monitored, so the below are the exact steps I took with the help of this article from Microsoft http://support.microsoft.com/kb/947691 In fact, these steps for the certificate template, requesting certificates, adding certificates to the local computer store and using the momcertimport tool are all exactly the same for adding…

Remotely Managing IIS on Windows Server Core 2008 R2

You might get an error when trying to manage a remote IIS server core session using the IIS management console from a remote computer. You might receive the following error message.   Could not connect to the specified computer. Details: Unable to connect to the remote server There are three things that you need to do all on the server core machine running IIS: Run the following command: Dism /online /enable-feature /featurename:IIS-ManagementService Enable Remote Management: Set EnableRemoteManagement to 1 under HKLM\Software\Microsoft\WebManagement\Server Start the Web Management Service as this is set to manual: Net start wmsvc