Archive for category administrator
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
List All Disks (VMDKs) In A Virtual Machine (ESXi)
Posted by edwgon in administrator, disks, esxi, filename, http://schemas.google.com/blogger/2008/kind#post, powercli, PowerShell, virtual, virtual machines, vmdk, vmdks, vmware on March 31, 2015
Using VMware PowerCLI, PowerShell, there’s a nifty way to get a list of all VMDKs associated with a virtual machine(s).
Here’s the command:
For this sample, I chose to output the following fields:
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
#>
Use the asset tag on a DELL Latitude E6500 as the computer name
Posted by edwgon in administrator, asset tag, computer name, Configuration manager 2012, dell, http://schemas.google.com/blogger/2008/kind#post, latitude E6500, OS Deployment on February 28, 2013
Background
So I ran into an interesting bug with our DELL Latitude E6500 models and Microsoft’s SCCM 2012.
First off, in our environment we use the BIOS service tag information on all our DELL devices as the computer name in Windows 7. I’m able to get this information during the Task Sequence (TS) by means of using a VB script.
The script I mention above works on all our DELL computer and laptop models, with the exception of the DELL Latitude E6500 laptop models.
The Bug
On a DELL Latitude E6500, with the BIOS updated to the latest version, it looks like the BIOS asset tag information is somewhat misleading. If you view the information, you’ll see the asset tag information, but what you don’t see are the trailing spaces after the asset tag information. For instance, if the BIOS asset tag information on a laptop reads X1234, there are 5 trailing spaces after it, and these white spaces do not show!
Note: We use a tool called asset.exe, from DELL, to modify the asset information and the owner information in the BIOS. This tool works well on many of DELL computers and laptops.
SCCM 2012 and The Bug
During a SCCM Task Sequence (TS) job, we collect the asset information and we use this information as the Windows 7 computer account. The TS works perfectly until the last step: Setup is applying system settings – at this point, the TS fails with the message: Windows could not parse or process the unattend answer file for pass [specialize]…
The TS fails completely and you’re left with a computer whose OS isn’t working.
SCCM logs give a hint on what went wrong. In case you don’t know, those logs can be retrieved from the broken machine and the logs (setupact.log and setuperr.log) are located at: C:\Windows\Panther\UnattendGC
In our case, both files showed the following error message:
2013-02-27 15:35:17, Error [Shell Unattend] ComputerName: failed to set the computer name [hr=0x80070057][gle=0x00000057]
2013-02-27 15:42:30, Error [windeploy.exe] Setup.exe failed, returning exit code [0x1f]
2013-02-27 15:42:30, Error [windeploy.exe] Failure occured during online installation. Online installation cannot complete at this time.; hr = 0x80004005
2013-02-27 15:43:42, Error [windeploy.exe] Setup.exe failed, returning exit code [0x1f]
2013-02-27 15:43:42, Error [windeploy.exe] Failure occured during online installation. Online installation cannot complete at this time.; hr = 0x80004005
The Workaround (not a fix)
Basically, I used asset.exe and deleted the current asset tag and re-typed it, but this time I added 5 letters to the end. In other words, my command line looked like this:
asset.exe X1234ABCDE
X1234 is the asset tag information (a.k.a my Windows 7 computer name); however, ABCDE is the workaround to make sure those blank spaces don’t break the TS.
After the TS finished, then I logged on as a local administrator and renamed the computer name to X1234 – life is good again!
Note: During this entire troubleshooting process we updated the laptop BIOS, and this didn’t seem to fix the issue.
I hope this helps someone out there.
Create New Local Administrator From Command Line
Posted by edwgon in administrator, Configuration manager 2012, http://schemas.google.com/blogger/2008/kind#post, local user, OS Deployment, SCCM 2012, windows 7, windows 7 x64, wmic on May 1, 2012
The following command line tools will allow you to:
- Create a new local user account
- Set the account from step 1 to password never expire
- Add the account from step 1 to the local “Administrators” group
Recent Comments