Archive for category Windows Server 2008
Forcibly Remove Dfs Nameserver
Posted by edwgon in 64-bit, Active Directory, dfs, domain controller, folder redirection, management, Microsoft, Windows Server 2008, Windows Server 2012 R2 on June 11, 2017
The following steps can be used to remove a Dfs nameserver that no longer exists in your environment.
- Log on to a Dfs server
- Open an elevated command line
- We’re going to use dfsutil with the following parameters: dfsutil diag unmapdomroot \<domainname><DFSname> \<DFSrootserver><DFSshare>
- As a sample: dfsutil diag unmapdomroot \\DfsRootName\DfsFolderName \\Server_to_remove\DfsFolderName
- No need to reboot just wait for replication
Renaming Windows Domain Controllers
Posted by edwgon in 64-bit, administrator, command line parameters, dfs, domain controller, Microsoft, Netdom, reboot, registry, Windows Server 2008, Windows Server 2012 R2, Windows Server Feature on June 10, 2017
The following are the steps needed to rename a domain controller; the steps have been tested up to Windows Server 2016.
Note: If your DC is also acting as a Dfs nameroot server, make sure you remove the nameserver from Dfs first!
From an elevated command line, type the following commands:
- Add the new domain controller name NEW_DC; we’re replacing OLD_DC
NETDOM COMPUTERNAME OLD_DC.companydomain.com /ADD:NEW_DC.companydomain.com - Designate the new name as the primary computer name; OLD_DC gets removed and NEW_DC is new primary name
NETDOM COMPUTERNAME OLD_DC.companydomain.com /MAKEPRIMARY:NEW_DC.companydomain.com - Reboot domain controller
- Now, let’s remove the old domain controller name from Active Directory
NETDOM COMPUTERNAME NEW_DC.companydomain.com /REMOVE:OLD_DC.companydomain.com - Sync all DCs
In the event that you didn’t notice the warning on top and you went ahead and renamed the domain controller and you had Dfs services running on it, here are some instructions on how to manually remove Dfs nameserver and fix the issue.
- Log on to the recently renamed domain controller
- Open Regedit.exe
- Go to HKLM\Software\Microsoft\DFS\Roots\domainV2
- Delete the key found under domainV2 and reboot your server
- Next, remove the Dfs share from the server
- Now you can delete the Dfs folder
- Done
Get Active Network Adapter
Posted by edwgon in Microsoft, Microsoft System Center Configuration Manager 2012 R2 SP1, Network, powercli, PowerShell, SCCM 2012, Utilities, Windows Server 2008, Windows Server 2012 R2 on May 18, 2016
Recently I had the need to create a script to find out what was the active network adapter in our server, so after some ideas from the web, I came up with a one line PowerShell script that helped me achieve my goal.
Note: Get-NetAdapter is a PowerShell commandlet that’s present on Windows 8 and Windows Server 2012 R2. This command will not work on Windows 7.
Get-NetAdapter | Where-Object {($_.LinkSpeed -eq “1 Gbps”) -and ($_.Status -eq ‘Up’)}
In this line, I’m basically getting the adapter with status ‘Up’ and with a linkspeed equals to ‘1 Gbps’. One can change LinkSpeed property to match your server’s network adapter speed(s).
Last Server Reboot
Posted by edwgon in administrator, http://schemas.google.com/blogger/2008/kind#post, last reboot, management, reboot, script, Windows Server 2008 on November 22, 2013
I had a need to find out when was the last time my Windows servers were rebooted, so I found a piece of PowerShell code that I modified to suit my needs.
- Excel must be installed on the computer running the script
- You will need server admin access to perform query
- A text file with a list of servers, no need to add \\ before server name
<# read parameter and assign it to $textFile
we're only expecting one parameter, which is the path to a
file containing a list of server/computer names #>
$textFile = $args[0]
# Let's make sure the file actually exists
If (($textFile -ne $null) -and (Test-Path $textFile))
{
# Create an Excel object file to show output
$excelApp = New-Object -comobject Excel.Application
$excelApp.visible = $True
$b = $excelApp.Workbooks.Add()
$excelWorksheetColumns = $b.Worksheets.Item(1)
$excelWorksheetColumns.Cells.Item(1,1) = "Server"
$excelWorksheetColumns.Cells.Item(1,2) = "IP Address"
$excelWorksheetColumns.Cells.Item(1,3) = "Last Boot Time"
$d = $excelWorksheetColumns.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True
$d.EntireColumn.AutoFit()
$excelWorksheetRow = 2
# read the contents of the file
$fileContents = Get-Content $textFile
ForEach ($computerName in $fileContents)
{
# if server is IP Enabled, we're going to get DNS Host Name and its IP Address
$networkAdapterConfiguration = Get-WmiObject Win32_NetworkAdapterConfiguration -computername $computerName | Where {$_.IpEnabled -Match "True"}
# collect and display, to Excel sheet, server's FQDN and IP address
ForEach ($detailsNetworkAdapterConfiguration in $networkAdapterConfiguration)
{
$excelWorksheetColumns.Cells.Item($excelWorksheetRow, 1) = $detailsNetworkAdapterConfiguration.DNSHostName
$excelWorksheetColumns.Cells.Item($excelWorksheetRow, 2) = $detailsNetworkAdapterConfiguration.IPAddress
}
$date = New-Object -com WbemScripting.SWbemDateTime
$computerOsInfo = Get-WmiObject Win32_OperatingSystem -computername $computerName
ForEach ($memberComputerOsInfo in $computerOsInfo)
{
$date.value = $memberComputerOsInfo.lastBootupTime
If ($memberComputerOsInfo.Version -eq "5.2.3790" )
{
$excelWorksheetColumns.Cells.Item($excelWorksheetRow, 3) = $date.GetVarDate($True)
}
Else
{
$excelWorksheetColumns.Cells.Item($excelWorksheetRow, 3) = $date.GetVarDate($False)
}
}
# move to the next Excel rows by 1
$excelWorksheetRow = $excelWorksheetRow + 1
}
}
Else
{
# Checking user input and displaying a warning if no proper syntax was used
Write-host "`nPath was not found, or no parameter was used.`nPlease run: Get-Help Get-LastReboot" -ForegroundColor Yellow
}
<#
.SYNOPSIS
View the last time a computer was rebooted.
.DESCRIPTION
This script will display the last time the computer was rebooted.
The script will require one parameter, the path to the text file containing the list of computer names.
.LINK
Get-LastReboot
.EXAMPLE
Example 1 - Simple use
Get-LastReboot C:\SomeFolder\ListOfServers.txt
#>
No OST for Outlook 2010 on a Terminal Server
Posted by edwgon in Group Policy Object, http://schemas.google.com/blogger/2008/kind#post, loopback processing mode, MS Office 2010, OST, OST files, outlook 2010, terminal server, Windows Server 2008 on July 9, 2013
We had installed Microsoft Office 2010 on our Windows 2008 R2 Terminal Servers, and we didn’t customize the Office 2010 installation. I was looking for a way to prevent Outlook from generating a new OST file whenever a new user logged on to our Terminal Servers, in addition, I wanted the Outlook profile to be generated automatically.
Enter Group Policy Objects!
Since these policies are applied only for the TS servers, I moved the the computer accounts to a new Organization Unit (OU) that I created for these servers. I linked the new GPO to this OU. There are many documents that show how to do these steps, so I won’t be going over this.
The key point to remember for this GPO to work is: loopback processing mode
The above is true especially if your TS servers inherit policies from top level GPOs.
In my case, I was concerned about making changes to the user configuration section, to be more specific, to the Outlook 2010 settings.
The screenshot basically shows what needs to be done in order to achieve this goal.
From a GUID to its GPO name.
Posted by edwgon in Group Policy Object, GUID, http://schemas.google.com/blogger/2008/kind#post, PowerShell, Windows Server 2008 on December 11, 2012
Numerous times I had the issue, when troubleshooting a group policy object error, in which I only had the GPO’s GUID, but not its actual name. Well, it turns out that there is a powershell applet that performs a search in AD, using the GUID, and it returns the GPO’s full description for you.
- Open Widnows PowerShell Modules
- Type: get-gpo
- Paste that GUID and press ENTER
Recent Comments