How to set IPv4 as preferred IP on Windows Server using PowerShell

IPv6 InternetSometimes working with Lync and Skype for Business I see that the services are trying to contact other servers or localhost which returns an IPv6 address. If the service is set to run only on IPv4 the service will fail and not find the listening interface since it is not listening on IPv6. In these cases I do not disable IPv6 but prefer IPv4. This needs to be done in registry and a reboot is required after the change. Do not disable IPv6 on the network card because that will not work.

Here is a simple way to do it using PowerShell

Break #In case you paste this in to PowerShell ISE and press run script:)
#Check if IPv4 IP address is preferred
#If the reply is IPv6 address, run following registry setting to just prefer ipv4 and reboot
New-ItemProperty “HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\” -Name “DisabledComponents” -Value 0x20 -PropertyType “DWord”
#If DisabledComponents exists, use the set cmdlet
Set-ItemProperty “HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\” -Name “DisabledComponents” -Value 0x20
#You need to reboot the computer in order for the changes to take effect

Check the values below for other options

  1. Type 0 to re-enable all IPv6 components (Windows default setting).
  2. Type 0xff to disable all IPv6 components except the IPv6 loopback interface. This value also configures Windows to prefer using IPv4 over IPv6 by changing entries in the prefix policy table. For more information, see Source and destination address selection.
  3. Type 0x20 to prefer IPv4 over IPv6 by changing entries in the prefix policy table.
  4. Type 0x10 to disable IPv6 on all nontunnel interfaces (both LAN and Point-to-Point Protocol [PPP] interfaces).
  5. Type 0x01 to disable IPv6 on all tunnel interfaces. These include Intra-Site Automatic Tunnel Addressing Protocol (ISATAP), 6to4, and Teredo.
  6. Type 0x11 to disable all IPv6 interfaces except for the IPv6 loopback interface.


Installing OCS 2007 R2 Prerequisites on Windows Server 2008

[tweetmeme source=”stalehansen” only_single=false]OCS 2007 R2 is now supported on Server 2008 R2 as base OS and as domain functional level. There is some specific prerequisites that need to be installed for Server 2008 R2. I have created a new guide for Server 2008 R2 here:

Commands to install the necessary prerequisites for OCS 2007 R2 on Windows Server 2008 SP2

Front End on Windows Server 2008
ServerManagerCmd -i web-windows-auth web-mgmt-compat web-mgmt-console web-http-logging msmq-server msmq-directory powershell was-process-model was-config-apis desktop-experience rsat-addc

Installs the following components:

  • [Web-Windows-Auth] – Windows Authentication
  • [Web-Mgmt-Compat] – IIS 6 Management Compatibility
  • [MSMQ-Server] – Message Queuing Server
  • [MSMQ-Directory] – Directory Service Integration
  • [RSAT-ADDC] – Active Directory Domain Controller Tools
  • [WAS-Process-Model] – Process Model
  • [WAS-Config-APIs] – Configuration APIs
  • [Web-Mgmt-Console] – IIS Management Console
  • [Web-Http-Logging] – HTTP Logging
  • [PowerShell] – Windows PowerShell
  • [Desktop-Experience] – Desktop Experience                                   

The last 3 in the list are not required, but they are highly recommended. IIS 7.0 Management Console is IMHO much easier to use than the IIS 6.0 version. The logging tools often come in handy when troubleshooting OCS IIS issues and PowerShell makes working with OCS WMI values a piece of cake.

NOTE: If you are to run the create pool wizard from the Front End server, you also need the MS SQL Native Client: X64 Package (sqlncli.msi) – 7963 KB
Also check out this post of mine whether to run create pool on OCS  Front End or Back End SQL server:

Office Communicator Phone Edition deployment on Windows Server 2008
ServerManagerCmd -i Web-Static-Content

Installs the following components in addition to Front End prerequisites:

  • [Web-Static-Content] – Static Content

NOTE: It exists default MIME types for both the .xml and the .cat extensions that is used by the updater. There is however no default for the .nbt extension and you need to configure it manually. See this post on how to do it

Monitoring Server on Windows Server 2008
ServerManagerCmd -i msmq-server msmq-directory

Installs the following components:

  • [MSMQ-Server] – Message Queuing Server
  • [MSMQ-Directory] – Directory Service Integration

CWA Server on Windows Server 2008
ServerManagerCmd -i web-windows-auth web-digest-auth web-basic-auth web-mgmt-compat web-mgmt-console web-common-http web-ISAPI-ext web-ISAPI-filter web-request-monitor web-http-redirect web-http-logging

Installs the following components:

  • [Web-Windows-Auth] – Windows Authentication
  • [Web-Digest-Auth] – Digest Authentication
  • [Web-Basic-Auth] – Basic Authentication
  • [Web-Mgmt-Compat] – IIS 6 Management Compatibility
  • [Web-Mgmt-Console] – IIS Management Console
  • [Web-Common-Http] – Common-http-features
  • [Web-ISAPI-Ext] – ISAPI Extensions
  • [Web-ISAPI-Filter] – ISAPI Filters
  • [Web-Request-Monitor] – Request Monitor
  • [Web-Http-Redirect] – HTTP Redirection
  • [Web-Http-Logging] – HTTP Logging

Mediation Server on Windows Server 2008
ServerManagerCmd -i rsat-addc

Installs the following components:

  • [RSAT-ADDC] – Active Directory Domain Controller Tools 

To view a full listing of ServerManagerCmd commands see this page:

Post used as a reference for this post

Migrate from Server 2000 DC to Server 2008 DC

I was doing some research before a domain migration at a customer site when I found this great forum post over at the techarena forum.

The general steps to migrate from Windows Server 2000 to Windows Server 2008 is almost the same as the steps to migrate from Windows Server 2003 to Windows Server 2008.

Old server: Windows Server 2000 box
New server: Windows Server 2008 box

  1. Verify that Windows 2000 SP4 have been installed on the old server and Windows Server 2008 SP1 have been installed on the new server.  Note: the domain functional level should be in Windows 2000 native mode for the Windows 2000 domain
  2. Upgrade the Windows 2000 forest schema by running “adprep /forestprep” command on old server. Note: you can copy the adprep folder from the Windows Server 2008 installation disc to the old server to run “adprep /forestprep”. The location is \source\adprep on the installation disc.
  3. Upgrade the Windows 2000 domain schema by running “adprep /domainprep” command on old server
  4. Verify the new server’s TCP/IP configuration has been pointed to existing DNS server.
  5. Add new server to existing Windows 2000 domain as a member server.
  6. Run dcpromo on new server to promote it as an additional domain controller in existing Windows 2000 domain, afterwards you may verify the installation of Active Directory.
  7. Enable Global Catalog on new server and manually Check Replication Topology and afterwards manually trigger replication to synchronize Active Directory database between 2 replica.
  8. Disable Global Catalog on old server.
  9. Use NTDSUTIL utility to transfer all the 5 FSMO roles from old server to new server. You’d better transfer FSMO roles via GUI method instead of using NTDSUTIL.
  10. Install DNS component on new server and configure it as a new DNS Server(Active Directory Integrated-Zone is preferred). Note: all the DNS configuration need to be transferred from the existing DNS Server.
  11. Migrate DHCP service from Windows Server 2000 to Windows Server 2008. Migrate File Sharing service. You can also use robocopy.exe from the Windows Server Resource kit to copy the files and maintain NTFS permissions.
    For the shares, the shares definitions and permissions are stored in the following registry key on the server: “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares”. If you export out the whole key and import in the new server, and if you have the files and folders in the same path as in the old server, then you will retain all you shares and share permissions.
  12. It’s better to make the old DC offline for several days and check whether everything works normally with the new server online. If so, you may let the old DC online and run DCPROMO to demote it.

For more information, please refer to: