Showing posts with label Server. Show all posts
Showing posts with label Server. Show all posts

Tuesday, June 27, 2017

Server 2012 R2 Evaluation won't register

Building new server you run into things sometimes that are annoying or weird. One of those can registration and activation. 

Building some new 2012 R2 Standard server and I couldn't register the server. It kept saying the activation code was wrong. 

Well there is a VERY easy fix for this. 

I found it here.
https://social.technet.microsoft.com/Forums/windows/en-US/4211c642-b15d-49ea-8124-f0628aa0f92e/activate-windows-server-2012-evaluation-standard-version-with-a-product-key-oem?forum=winserver8gen&prof=required

Run this code to change it from evaluation.

DISM /online /Set-Edition:<edition ID> /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula


Change <edition ID> to the edition you have the licence for eg.

DISM /online /Set-Edition:ServerStandard /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula

You will need to reboot, so keep that in mind. 

The one thing that the source where i found this doesn't tell you is, you still need to activate your server with your key. 

So go to the Server Manager > Local Server > Properties > Click Activate next to Product ID > Enter your information.

Enjoy.


Tuesday, February 2, 2016

Robocopy to the backup rescue

Robocopy to the backup rescue


So recently I had a client that had a SBS 2008 box that had a RAID issue. It had what known as a Punctured RAID , I will call it PR in this post. You can more on that here: http://www.dell.com/support/Article/us/en/04/438291/EN. The wonderful thing about a PR is they rear their ugly head till its too late. Well this client was too late.

The main reason I found out about this PR is that this clients Backup Exec kept failing. After fighting with the Backup Exec for over a week I finally found in the error logs something about this PR. This is what was making the Backup Exec fail. I could get into a lengthy discussion on this and at some point in time I might do that. 

Needless to  say because we couldn't use anything we threw at this server to back it up with out failing, and we tried a lot of options, I decided to use robocopy to try and keep at least a file level backup running for this server till we came up with a final solution for this issue. 

So this is the script I ended up making. I ran this as a nightly scheduled task with System user privileges. 

I know the script is kinda hacky and could be written better and more efficiently but it has a lot going on in it and I wanted to share. 

So basically it stops some services, robocopys files to an external drive then starts the services back up. 

With the mir option in the robocopy it made the copy very fast every night because it only grabbed what had been modified.

I used "net stop" and "net start" for some of the services.
I also used Powershell command Stop-Service  and Start-Services to start/start other services.

I broke out the main directories in the c: drive so that i could log what was happening in each directory when the robocopy ran.
In the robocopy sections I used the options:
/MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
/XJD :: eXclude Junction points for Directories.
/R:n :: number of Retries on failed copies: default 1 million.
/W:n :: Wait time between retries: default is 30 seconds.
/TEE :: output to console window, as well as the log file
/LOG:file :: output status to LOG file (overwrite existing log).






net stop msexchangeadtopology /y
net stop msftesql-exchange /y
net stop msexchangeis /y
net stop msexchangesa /y
net stop iisadmin /y

PowerShell.exe -Command "Stop-Service *sql* -Force"




robocopy "c:\Boot"  "F:\Backuprobocopy\Boot" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyBoot.log"
robocopy "c:\dell"  "F:\Backuprobocopy\dell" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopydell.log"
robocopy "c:\drivers"  "F:\Backuprobocopy\drivers" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopydrivers.log"
robocopy "c:\ExchangeSetupLogs"  "F:\Backuprobocopy\ExchangeSetupLogs" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyExchangeSetupLogs.log"
robocopy "c:\inetpub"  "F:\Backuprobocopy\inetpub" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyinetpub.log"
robocopy "c:\OpenManage"  "F:\Backuprobocopy\OpenManage" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyOpenManage.log"
robocopy "c:\PerfLogs"  "F:\Backuprobocopy\PerfLogs" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyPerfLogs.log"
robocopy "c:\Program Files"  "F:\Backuprobocopy\Program Files" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyProgram Files.log"
robocopy "c:\Program Files (x86)"  "F:\Backuprobocopy\Program Files (x86)" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyProgram Files (x86).log"
robocopy "c:\ProgramData"  "F:\Backuprobocopy\ProgramData" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyProgramData.log"
robocopy "c:\Scripts"  "F:\Backuprobocopy\Scripts" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyScripts.log"
robocopy "c:\Shared Data"  "F:\Backuprobocopy\Shared Data" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyShared Data.log"
robocopy "c:\Users"  "F:\Backuprobocopy\Users" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyUsers.log"
robocopy "c:\Windows"  "F:\Backuprobocopy\Windows" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyWindows.log"
rem robocopy "c:\WSUS"  "F:\Backuprobocopy\WSUS" /MIR /XJD    /w:1 /r:1 /V /tee /log:"f:\backuprobocopyWSUS.log"





net start msexchangeadtopology /y
net start msftesql-exchange /y
net start msexchangeis /y
net start msexchangesa /y
net start iisadmin /y

PowerShell.exe -Command "Start-Service -name """MSsql*""" " 

PowerShell.exe -Command "Start-Service -name """MSExchange*""" "

PowerShell.exe -Command "Start-Service -name """BackupExec*""" "










Thursday, August 13, 2015

Get Server Hardware specs–PowerShell

 

 

This script loops through a text list and get information using Get-WmiObject. Then dumps it to an array then to a Grid View.

 

 

# Get Server Hardware specs

# 2015 Edward

# CPU / RAM / Disk Size / IP Address

 

 

 

 

##### Set Variables #######

$fileCount = 0

$List = @()

$i = 0

 

 

 

#get the list of servers to scan from serverlist.txt

$serverlist = "C:\scripts\computers.txt"

 

 

 

 

#get the count of servers for updates to the user.

 

$fileCount = (Get-Content $serverlist | Measure-Object).Count

 

 

 

#Loop the server list.

foreach ($server in Get-Content $serverlist) {

 

#increment the number of records proccessed

$i++

 

#Write to the screen whats happening.

Write-Progress -activity "Connecting to server $server" -status "Scanning: $i of $($fileCount)" -percentComplete (($i / $fileCount)  * 100)

 

#do a try if there is an issue spit out the error.

try {

 

    #IF there is an error stop and go to the next record.

    $ErrorActionPreference = 'Stop'

       

    $bios = Get-WmiObject Win32_BIOS -ComputerName $server

    Write-Progress -activity "Scanning server $server -  getting BIOS information" -status "Scanning: $i of $($fileCount)" -percentComplete (($i / $fileCount)  * 100)

 

    Write-Progress -activity "Scanning server $server - getting Processor information" -status "Scanning: $i of $($fileCount)" -percentComplete (($i / $fileCount)  * 100)

    $Proc = Get-WmiObject Win32_processor -ComputerName $server | Select-Object -First 1

   

 

    Write-Progress -activity "Scanning server $server - getting Memory information" -status "Scanning: $i of $($fileCount)" -percentComplete (($i / $fileCount)  * 100)

    $memory = Get-WmiObject Win32_physicalmemory -ComputerName $server

   

 

    Write-Progress -activity "Scanning server $server - getting System information" -status "Scanning: $i of $($fileCount)" -percentComplete (($i / $fileCount)  * 100)

    $system= Get-WmiObject Win32_ComputerSystem -ComputerName $server

   

 

    Write-Progress -activity "Scanning server $server - getting Disk information" -status "Scanning: $i of $($fileCount)" -percentComplete (($i / $fileCount)  * 100)

    $disks = Get-WmiObject -class Win32_LogicalDisk -ComputerName $server -Filter {DriveType=3}

   

 

 

    $disklist = " "

    foreach ($disk in $disks) {

        IF ($disklist -eq " "){$putAcomma = ""} ELSE {$putAcomma = ", "}  

        $size = [math]::Round(([int64]$disk.Size / 1073741824))

        $disklist = $disklist + $putAcomma + $disk.DeviceID + " " + [string]$size + " GB"

    }

    Write-Progress -activity "Scanning server $server" -status "Scanning: $i of $($fileCount)" -percentComplete (($i / $fileCount)  * 100)

 

 

    #Set the array for the output.

 

    $List += [pscustomobject]@{

    'ComputerName'         = $server

    'Manufacturer'        = $bios.Manufacturer

    'Model'               = $system.Model

    'BIOS Version'        = $bios.Version

    'Serial Number'       = $bios.SerialNumber

    'Processor Number'    = $system.NumberOfProcessors

    'Processor Name'      = $proc.name

    'CPUs'                 = $system.NumberOfLogicalProcessors

    'Speed (MHZ)'          = $proc.CurrentClockSpeed

    'RAM (GB)'             = $system.TotalPhysicalMemory / 1GB -as [int]

    'Used RAM slot'       = $memory.count

    'DiskList'             = $disklist

    }

 

    } catch {

    $List += [pscustomobject]@{

    'ComputerName'         = $server

    'CPUs'                 = " ERROR "

    'Speed (MHZ)'          = " ERROR "

    'RAM (GB)'             = " ERROR "

    'DiskList'             = $error[0].exception

    }

  }

 

}

 

write-progress -activity "Completed."

$List | Out-GridView

 

 

Friday, December 13, 2013

Error 0x80070002 occurred while verifying known folder

ISSUE:

Server is getting a general Warning message speradically a lot. Its a Warning so not a big deal but it does raise concern.
Here is the error:

- System
  - Provider
   [ Name]  Microsoft-Windows-KnownFolders
   [ Guid]  {8939299F-2315-4C5C-9B91-ABB86AA0627D}
   EventID 1002
   Version 0
   Level 3
   Task 0
   Opcode 0
   Keywords 0x8000000000000000
  - TimeCreated
   [ SystemTime]  2013-12-13T05:30:22.504632600Z
   EventRecordID 6590
   Correlation
  - Execution
   [ ProcessID]  10080
   [ ThreadID]  5392
   Channel Microsoft-Windows-Known Folders API Service
   Computer **********************
  - Security
   [ UserID]  S-1-5-18
- EventData
  hrError 0x80070003
  FolderId {B97D20BB-F46A-4C97-BA10-5E3608430854}
  Path C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup 

So yeah a lot of these are happening with various folders.

RESOLUTION:

I was doing some reading and found out that this specific error had to do with some folders missing in a default profile area. One of the readings fixes was, make the missing folders. What a great idea.

There are several easy ways to make the folders:

CMD
Use can use the MD, make directory option.

MD "C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs"

Windows Explorer
Just go to the folder area and make the missing folder. Make sure you make the full path if more than one folder is missing.

Copy the Default profile on the system.
Every system has a profile that it uses as a template for making a new user profile. So I copied it and pasted it in the missing directory. Note: I did not verify that ALL the missing folders where there. I figured since its a warning, I will wait out the log file and see any othere missing folders show up.


Update: welp that didn't work.. Still getting Error

0x80070002 occurred while verifying known folder {b4bfcc3a-db2c-424c-b029-7fe99a87c641} with path 'C:\Windows\system32\config\systemprofile\Desktop'.

and it does exist.

So i did some more digging and ran across this post, http://tqaforum.net/discussion/37146/known-folders-errors-in-event-viewer/p4,  about how there are 2 system folders in windows 64 bit.. I totally forgot this. So I copied the folders to the SysWOW64. I am thinking this will fix the issue. We shall see.

Wednesday, December 4, 2013

Windows Command-Line Reference A-Z List (not 2012)


INFO:

Here is nice little list of commands that can be run on windows from the command line. This applies to: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, and Windows Vista.

http://technet.microsoft.com/en-us/library/cc772390(v=ws.10).aspx

NOTES

Some of the commands only work for specific OS's. Example "Freedisk" is a Vista and Windows server 2008 command. So check before you try and use. 

Thursday, May 9, 2013

DHCP server settings from a 2003 to a 2008 server

Issue: 

Need to move DHCP server settings from a 2003 server to a 2008 server.

Solution:

I know there is a way to do this using netsh Will list info on that.

How is it going to work:

Dump the database from old server to a file.
Transfer that file to the new server.
Import the old DB in to the DHCP DB.

The work: 

  •  I used the Microsoft Article ID: 962355
    • http://support.microsoft.com/kb/962355
      • Here are the steps I followed them.
        • Export the DHCP database from Windows 2003:

          1.                   On the Windows 2003 DHCP server, navigate to a command prompt

          2.                   Type the following Command: netsh

          3.                   Type the following Command: DHCP

          4.                   Type the following Command: server <\\Name or IP Address>

          5.                   Type the following Command: export c:\w2k3DHCPdb all

          Note You must have local administrator permissions to export the data.

          Import the DHCP database

          1.       Copy the exported DHCP database file to the local hard disk of the Windows Server 2008-based computer.

          2.       Install the DHCP Role on the server.

          3.       Stop the DHCP server service on the server.  To do this, follow these steps:

          a.       Log on to the target DHCP server by using an account that is a member of the local Administrators group.

          b.      Click Start, click Run, type cmd in the Open box, and then click OK.

          c.       At the command prompt, type net stop DHCPserver , and then press ENTER. You receive a "The Microsoft DHCP Server service is stopping. The Microsoft DHCP Server service was stopped successfully" message.

          d.      Type exit, and then press ENTER.

          4.       Delete the DHCP.mdb file under c:\windows\system32\DHCP folder.

          5.       Start the DHCP server service.

          6.       Right-click on the Command Prompt (cmd) and select run as administrator, to open the cmd prompt using elevated privileges.

          Note You must have local administrator permissions to import the data.

          7.       Type the following Command: netsh

          8.       Type the following Command: DHCP

          9.       Type the following Command: server <\\Name or IP Address>

          10.   Type the following Command: import c:\w2k3DHCPdb

          11.   Restart DHCP and verify the database has moved over properly.  
    • To verify the new server worked, after the old server was off, I released my DHCP lease.
      • cmd (with admin privileges)
        • ipconfig /release
    • Then I renewed the IP Address
      • cmd (with admin privileges)
        • ipconfig /renew
    • Now I made sure the new DHCP server was there.
      • cmd (with admin privileges)
        • ipconfig /all
          • Look for the DHCP server that gave the new lease.

The Result

The longest part of this job was building up the new server. This was a cake job after getting all the steps in front of me.