Windows Tech Blog's is technical blog covering topics such as Windows troubleshooting, technologies and security
Thursday, May 16, 2013
Internet links not working in Outlook 2010. "General Failure. The URL Was: http://xxx.com, etc. Application not Found"
This summary is not available. Please
click here to view the post.
Monday, April 22, 2013
Script to add machines to a WSUS group automatically
#Script to add machines to a WSUS group automatically: #The script needs Admin credentials and the WSUS Administration Console installed on the machine where it runs #Initialize Variables $wsusGroup = [string] "ServerGroupC" $wsusParentGroup = [string] "All Computers" $date = get-date $date = [string] $date.day + $date.month + $date.year + $date.hour + $date.minute $succeslog = [string] ".\logs\" + $date + "_success.log" $errorlog = [string] ".\logs\" + $date + "_errors.log" $WindowsUpdateServer= [string] "winupdate.uvm.edu" $useSecureConnection = [bool] $true $portNumber = [int] "443" #Instantiate Objects: #Required WSUS Assembly – auto installed with WSUS Administration Tools [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") if (!$wsus) { $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WindowsUpdateServer,$useSecureConnection,$portNumber) } $serverList = Get-Content ".\srvlist.txt" $updateGroups = $Wsus.GetComputerTargetGroups() $updateGroup = $UpdateGroups | Where-Object{$_.Name -eq $wsusgroup} | Where-Object{$_.getparenttargetgroup().name -eq $wsusparentgroup} $computerScope = new-object Microsoft.UpdateServices.Administration.ComputerTargetScope $computerScope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::All $computers = $wsus.GetComputerTargets($computerScope) $wsusServers = @() $WsusServersShortNames = @() #Create arrays: # $wsusServer = Array of WSUS Computer objects # $wsusServerShortName = Array strings, with one server RDN per line Write-Host "Collecting Server List from WSUS…" $computers | foreach-object { $wsusServer = $_.FullDomainName #cut off DNS suffix and store shortname $wsusServerShortName = $WsusServer.split(‘.’)[0] $wsusServers += $WsusServer $wsusServersShortNames += $wsusServerShortName } #End ForEach $computers #loop to add servers to group ForEach ($server in $serverList) { #Check if server Netbios name is present in WSUS, if present move to group – if not log an error $wsusComputer = $wsusServersShortNames | Where-Object {$_ -eq $server.Trim()} #Checks for a match in WSUS for the current server in the import list. If ($wsusComputer) { $searchStr = [string] $server.Trim() + "\." #String representing a RegEx match for the relative part of the server FQDN $wsusComputer1 = $wsusServers | where-object {$_ -match $searchStr } #Get a WSUS computer object representing the current server in the import list. If ($wsusComputer1.getType().Name -match "string") { #Current $wsusComptuer1 must be a [string] object, or next step will fail. Write-Host "$wsusComputer1 will be added to $($updateGroup.name) group" $computer = $wsus.GetComputerTargetByName($wsusComputer1) $updateGroup.AddComputerTarget($computer) out-file -append -inputobject "$Server added to $($updategroup.name) group" -filepath $succeslog } Else { #More than one server was matched in WSUS – this will happen if your regEx is not properly formed. write-host "count $($wsusComputer1.count)" Out-File -append -inputobject "$werver has ambiguous name – check server in WSUS and add to group manually" -filepath $errorlog } } #End If $wsusComputer Else { Write-Host "$Server not found in WSUS" out-file -append -inputobject "$Server not found in WSUS" -filepath $errorlog } }
#End ForEach $server
Wednesday, April 17, 2013
Computers Are Not Appearing In the Correct Computer Groups
Client-side targeting is when you use Group Policy or registry settings to move computers into target groups. For more information about how to set up client-side targeting, see Deploying Microsoft Windows Server Update Services. There are a number of reasons why computers might not appear in groups when you are using client-side targeting. Use the following information to try to resolve this problem.
Verify that the WSUS console is set to use client-side targeting
By default, the WSUS server is set to use server-side targeting. If you are using client-side targeting, you need to set an option on the WSUS server. For more information about how to set up client-side targeting, see Deploying Microsoft Windows Server Update Services.
Verify that target computer group names match groups on the WSUS server
Make sure the name of the target computer group in Group Policy matches the name of the computer group on the WSUS server. Check the Group Policy object (GPO) or the registry setting where you enabled client-side targeting. Make sure that there are no discrepancies between the name of the computer group used in Group Policy and the name of the group used on the server. If WSUS cannot find a computer group on the server reported by a client computer, it loads the computer into the Unassigned Computers group.
Wait an hour for changes to take effect
If you make a change to group membership by using client-side targeting and the client computer has already contacted the WSUS server, it takes an hour for the server to change the computer’s group membership. This is because WSUS uses cookies to manage group membership with client-side targeting and these cookies are set to expire after one hour.
If you cannot wait an hour, use command-line options to reset the cookie and initiate detection. For information about how to use command-line options, see Deploying Microsoft Windows Server Update Services.
Script client side targeting
With the command line WuInstall (http://www.wuinstall.com), you can also script client side targeting without having to change the registry manually:
wuInstall /install (or whatever) /targetgroup "Your WSUS Target Group"
With the /targetgroup switch, you can specify the group you want to have in the TargetGroup key … WuInstall changes the registry during execution, and then back to the old values.
wuInstall /install (or whatever) /targetgroup "Your WSUS Target Group"
With the /targetgroup switch, you can specify the group you want to have in the TargetGroup key … WuInstall changes the registry during execution, and then back to the old values.
Tuesday, April 16, 2013
Step-by-Step Migration DHCP from Windows Server 2003 to Windows Server 2008 R2 with Windows Server Migration Tools
I see every day question about DHCP server migration from Windows 2003 to Windows Server 2008 R2, which is why I am writing this article.
I think some people have no information about Windows Server 2008 R2 new feature (Windows Server Migration Tools). With this new feature, you can easily complete DHCP migration. I'll show how you can use this function and I hope that helps people solve their problems.
First basic Infos:
I use Windows Server 2003 R2, if you have Windows Server 2003, all steps are same.
Windows DHCP Server 2003 Name: DC-2003R2.Contoso.com
Windows DHCP Server 2003 IP Address: 192.168.1.150
My Windows DHCP Server 2003 config in TestLab:
Let's go:
First, we must installing PowerShell and .NET Framework on Windows Server 2003.
After installing, click Start, All Programs, Windows PowerShell, click Windows PowerShell.
Run this command:
Net stop “DHCP Server”
After runing, you can see result: The DHCP Server services was stopped successfully.
Now, we install DHCP role on Windows Server 2008 R2. Open Server Manager console, right click on Roles, click Add Roles.
Select DHCP Server, click Next.
Click Next.
Select the network connections that the DHCP Server will use for servicing clients. In my test Lab is 192.168.1.151 (I use IPv4), then click Next
On Parent domain write your Doman Name (my Domain name is Contoso.com), on Preferred and Alternate DNS server IPv4 address, write your DNS IP address (my DNS IP address 192.168.1.150 and 192.168.1.151), after writing clickValidate, then click Next.
I don't have WINS Servers, I select WINS is not required for applications on this network, then click Next (If you have WINS Servers, select WINS is required for applications on this network then write your WINS Server IP address on Preferred and Alternate WINS server IP address).
Click Next.
I don't use IPv6, select Disable DHCPv6 stateless mode for this server, then click Next.
I use Contoso\Administrator account on Use currect crendentials for authorize DHCP sever in AD DS, then click Next.
Now, we can our settings, if is correct, click Install.
After installig, click Close.
Now, install Windows Server Migration Tools feature on Windows Server 2008 R2. Open Server Manager console, right click on Features, click Add Features.
Select Windows Server Migration Tools, then Next.
Click Install.
After installing, click Close.
Click Start, Administrative Tools, Windows Server Migration Tools, then click Windows Server Migration Tools.
Go to ServerMigrationTools folder. Run this command:
cd C:\Windows\System32\ServerMigrationTools
I run ls command and see which files are in ServerMigrationTools folder.
We find a description of utility SmigDeploy by the following command:
.\SmigDeploy.exe /?
To migrate DHCP server running on Server 2003, you created a deployment package using the following command:
.\SmigDeploy.exe /package /architecture x86 /os ws03 /path c:\SMIGDeploy
Folder SMIGDeploy\SMT_ws03_x86 was created successfully.
Content folder.
SMIGDeploy folder must be copied on Windows DHCP Server 2003.
Windows Server 2008 R2
Windows Server 2003
We can run directly from the folder SmigDeploy.exe snap-in to start the Windows Server Migration Tools in Windows Powershell.
We find the cmdlets for migration with this command.
Get-Command –PSSnapin Microsoft.windows.servermanager.migration
We learn about the commands with this command.
Get-help Get-SmigServerFeature
Run Get-SmigServerFeature command (Gets the set of all Windows features that can be migrated from the local server or from the migration store).
Result returns, Windows DHCP server 2003 is valid for migration.
To export the DHCP settings from server 2003 to 2008 R2, create new folder on Windows 2008 R2, for example DHCPData, then share this folder with read and change permissions.
After creating and sharing DHCPData folder, run thic command on Windows 2003.
Export-SmigServerSetting -featureID DHCP -User All -Group -path \\DC-2008R2\DHCPData -Verbose
Now, set a password.
Export was completed successfully:
The folder was created a new DHCP svrmig.mig file, this file will be imported in new Windows DHCP Server 2008 R2.
I run this command and delete my Windows DHCP Server 2003 (This command deletes the server with the DNS name of Contoso.com and an IP address of 192.168.1.150 from the list of servers in Active Directory. This effectively removes any authorization for the DHCP Server service to run).
Netsh DHCP delete server DC-2003R2.Contoso.com 192.168.1.150
Open PowerShell on Windows Server 2008 R2 and stop DHCP Services. Run this command.
Net Stop "DHCP Server"
Now, run this command for migration.
Add-PSSnapin microsoft.windows.servermanager.migration
Import DHCP Configuration Data, points to the folder DHCPData. Run this command.
Import-SmigServerSetting -featureid DHCP -User All -Group -Force -path \\DC-2008R2\DHCPData -Verbose
After finishing, run this command.
Set-service DHCPServer –startuptype automatic
Now, start DHCP Services with this command.
Start-Service DHCPServer
Authorize the DHCP server with this command.
Netsh DHCP add server DC-2008R2.Contoso.com 192.168.1.151
DHCP Server has been migrated successfully.
I think some people have no information about Windows Server 2008 R2 new feature (Windows Server Migration Tools). With this new feature, you can easily complete DHCP migration. I'll show how you can use this function and I hope that helps people solve their problems.
First basic Infos:
I use Windows Server 2003 R2, if you have Windows Server 2003, all steps are same.
Windows DHCP Server 2003 Name: DC-2003R2.Contoso.com
Windows DHCP Server 2003 IP Address: 192.168.1.150
My Windows DHCP Server 2003 config in TestLab:
Let's go:
First, we must installing PowerShell and .NET Framework on Windows Server 2003.
- Windows PowerShell 1.0 Localized Installation Package for Windows Server 2003 and for Windows XP ORWindows PowerShell 2.0 and Windows Remote Management (WinRM) 2.0 (KB968930)
- Microsoft .NET Framework 3.5
After installing, click Start, All Programs, Windows PowerShell, click Windows PowerShell.
Run this command:
Net stop “DHCP Server”
After runing, you can see result: The DHCP Server services was stopped successfully.
Now, we install DHCP role on Windows Server 2008 R2. Open Server Manager console, right click on Roles, click Add Roles.
Select DHCP Server, click Next.
Click Next.
Select the network connections that the DHCP Server will use for servicing clients. In my test Lab is 192.168.1.151 (I use IPv4), then click Next
On Parent domain write your Doman Name (my Domain name is Contoso.com), on Preferred and Alternate DNS server IPv4 address, write your DNS IP address (my DNS IP address 192.168.1.150 and 192.168.1.151), after writing clickValidate, then click Next.
I don't have WINS Servers, I select WINS is not required for applications on this network, then click Next (If you have WINS Servers, select WINS is required for applications on this network then write your WINS Server IP address on Preferred and Alternate WINS server IP address).
Click Next.
I don't use IPv6, select Disable DHCPv6 stateless mode for this server, then click Next.
I use Contoso\Administrator account on Use currect crendentials for authorize DHCP sever in AD DS, then click Next.
Now, we can our settings, if is correct, click Install.
After installig, click Close.
Now, install Windows Server Migration Tools feature on Windows Server 2008 R2. Open Server Manager console, right click on Features, click Add Features.
Select Windows Server Migration Tools, then Next.
Click Install.
After installing, click Close.
Click Start, Administrative Tools, Windows Server Migration Tools, then click Windows Server Migration Tools.
Go to ServerMigrationTools folder. Run this command:
cd C:\Windows\System32\ServerMigrationTools
I run ls command and see which files are in ServerMigrationTools folder.
We find a description of utility SmigDeploy by the following command:
.\SmigDeploy.exe /?
To migrate DHCP server running on Server 2003, you created a deployment package using the following command:
.\SmigDeploy.exe /package /architecture x86 /os ws03 /path c:\SMIGDeploy
Folder SMIGDeploy\SMT_ws03_x86 was created successfully.
Content folder.
SMIGDeploy folder must be copied on Windows DHCP Server 2003.
Windows Server 2008 R2
Windows Server 2003
We can run directly from the folder SmigDeploy.exe snap-in to start the Windows Server Migration Tools in Windows Powershell.
We find the cmdlets for migration with this command.
Get-Command –PSSnapin Microsoft.windows.servermanager.migration
We learn about the commands with this command.
Get-help Get-SmigServerFeature
Run Get-SmigServerFeature command (Gets the set of all Windows features that can be migrated from the local server or from the migration store).
Result returns, Windows DHCP server 2003 is valid for migration.
To export the DHCP settings from server 2003 to 2008 R2, create new folder on Windows 2008 R2, for example DHCPData, then share this folder with read and change permissions.
After creating and sharing DHCPData folder, run thic command on Windows 2003.
Export-SmigServerSetting -featureID DHCP -User All -Group -path \\DC-2008R2\DHCPData -Verbose
Now, set a password.
Export was completed successfully:
The folder was created a new DHCP svrmig.mig file, this file will be imported in new Windows DHCP Server 2008 R2.
I run this command and delete my Windows DHCP Server 2003 (This command deletes the server with the DNS name of Contoso.com and an IP address of 192.168.1.150 from the list of servers in Active Directory. This effectively removes any authorization for the DHCP Server service to run).
Netsh DHCP delete server DC-2003R2.Contoso.com 192.168.1.150
Open PowerShell on Windows Server 2008 R2 and stop DHCP Services. Run this command.
Net Stop "DHCP Server"
Now, run this command for migration.
Add-PSSnapin microsoft.windows.servermanager.migration
Import DHCP Configuration Data, points to the folder DHCPData. Run this command.
Import-SmigServerSetting -featureid DHCP -User All -Group -Force -path \\DC-2008R2\DHCPData -Verbose
After finishing, run this command.
Set-service DHCPServer –startuptype automatic
Now, start DHCP Services with this command.
Start-Service DHCPServer
Authorize the DHCP server with this command.
Netsh DHCP add server DC-2008R2.Contoso.com 192.168.1.151
DHCP Server has been migrated successfully.
Subscribe to:
Posts (Atom)