change windows 2012 to core mode

downloadFound yourself considering hyper-v? Microsoft has come a long way and is now becoming more popular as a serious contender in the hypervisor area. My preference is still VMware, but some businesses may find their Microsoft allegiance makes hyper-v a valid option.

Note, i do not consider Microsoft a “cheaper” solution in any circumstance. The current state of hyper-v, SDN options, clustering and VMM management falls very short of what VMware has out of the box. Anyhow, if you do choose windows, here is how you remove the GUI – hopefully saving you a little bit of RAM and reducing the running footprint open for attacks and vulnerabilities….

 

 

Powershell commands to convert between the following windows modes;

Full Server -> Server Core with GUI Management (Minimal Server Interface)

Uninstall-WindowsFeature Server-Gui-Shell -Restart

Full Server -> Server Core

Uninstall-Windowsfeature Server-Gui-Mgmt-Infra -Restart

Uninstall-WindowsFeature Server-Gui-Shell -Restart

Server Core -> Full Server

Install-WindowsFeature Server-Gui-Shell -Restart

Server Core with GUI Management (Minimal Server Interface) -> Full Server

Install-WindowsFeature Server-Gui-Shell -Restart

Note : always use windows firewall. If possible also consider AV solution to further protect your hosts.

SQL Server Setup – Error code 0x84B30002

SQL Server Setup has encountered the following error:
No feature were uninstalled during the setup execution. The requested features may not be installed. Please review the summary.txt logs for further details.
Error code 0x84B30002.

Follow the below steps it may help to uninstall, Before follow this procedure please make sure you have some idea about registry

1. Open Registry Editor
2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
3. Browse Ids one by one and identify the GUIDs for SQL Server 2008
4. Run the below command for all SQL Server 2008 Guids one by one

msiexec /x “GUID”

SQL Express – Backup Plan

SQL express doesn’t have the luxury of SQL maintenance plans, but you can still write a SQL script to dump a database to a particular location and run it via task scheduler on a daily basis.

Create SQL query and save it to a particular location… (NightlyBackup.sql)

DECLARE @pathName NVARCHAR(512)

SET @pathName = ‘D:\SQL Backup\database_‘ + Convert(varchar(8), GETDATE(), 112) + ‘.bak’

BACKUP DATABASE [database] TO DISK = @pathName WITH NOFORMAT, NOINIT, NAME = N’db_backup’, SKIP, NOREWIND, NOUNLOAD, STATS = 10

Create cmd / bat and save to similar location to above… (Backup DB to disk.cmd)

sqlcmd -S servername\INSTANCENAME -U sqluser -P sqluserpassword -i “NightlyBackup.sql”

forfiles /p “C:\SQLBackupLocation” /m *.bak /s /d -2 /c “cmd /c del @file : date >= 7 days >NUL”

Create windows task schedule event to run above at 5:30pm everyday. 

activate windows from command line – slmgr

Temporarily extend evaluation period (limited execution – see output below)…

C:\Windows\System32>cscript slmgr.vbs /rearm

C:\Windows\System32>shutdown -r -t 1

Show detailed license information…

C:\Windows\System32>cscript slmgr.vbs /dlv

License Status: Initial grace period
Time remaining: 43200 minute(s) (30 day(s))
Remaining Windows rearm count: 0

Activate windows…

C:\Windows\System32>cscript slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

C:\Windows\System32>cscript slmgr.vbs /ato

Will require access to the internet – most of the time the issues are either time sync or connectivity to internet.

http://support.microsoft.com/kb/921471 Windows activation fails and may generate error code 0x8004FE33

To do this, configure the following list of CRLs to be unauthenticated on the proxy server:
http://go.microsoft.com/
https://sls.microsoft.com/
https://sls.microsoft.com:443
http://crl.microsoft.com/pki/crl/products/MicrosoftRootAuthority.crl
http://crl.microsoft.com/pki/crl/products/MicrosoftProductSecureCommunications.crl
http://www.microsoft.com/pki/crl/products/MicrosoftProductSecureCommunications.crl
http://crl.microsoft.com/pki/crl/products/MicrosoftProductSecureServer.crl
http://www.microsoft.com/pki/crl/products/MicrosoftProductSecureServer.crl
https://activation.sls.microsoft.com

Active Directory- redirect default Containers to Organisational Units

One really useful tidbit I picked up last week –

Redirusr & redircmp

Configures the default OU for computers and users so they don’t appear in the default containers when they are added (effectively meaning they only get root domain policies).

As you would guess – it helps keep the default AD containers clean by placing machines straight into an OU and also applying any policies attached.

 

windows 2012 change key from evaluation to standard

get current version;

dism /online /get-currentedition

Deployment Image Servicing and Management tool
Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Current edition is:

Current Edition : ServerStandardEval

dism /online /set-edition:ServerStandard /ProductKey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx /AcceptEula

Deployment Image Servicing and Management tool
Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Starting to update components…
Starting to install product key…
Finished installing product key.

Removing package Microsoft-Windows-ServerStandardEvalEdition~31bf3856ad364e35~amd64~~6.2.9200.16384
[==========================100.0%==========================]
Finished updating components.

Starting to apply edition-specific settings…
Finished applying edition-specific settings.

The operation completed successfully.
Restart Windows to complete this operation.
Do you want to restart the computer now? (Y/N)

note : you must change evaluation edition to standard before promoting to a domain controller. you cannot change a DC in eval mode to standard and are forced to demote the server before changing the edition.

windows 2012 – dedup

If you have some archive data that you would like to copy onto a  win 2012 server, but dont know how to estimate the end volume size (if VM etc). Start small – about 1/2 of the total capacity of the drive. Robocopy the data onto the drive until nearly full, manually run dedupe, wait until complete, continue robocopy, repeat and rinse. There will be occasions where you will run out of disk space at that point its time to extend your disk.

You will need to enable deduplication on the file server, either hit the GUI or use the following to enable the module;

Import-Module ServerManager
Add-WindowsFeature -name FS-Data-Deduplication

The powershell commands that you’ll use;

Enable-DedupVolume E:
(enables E drive for deduplication)

Set-DedupVolume E: -MinimumFileAgeDays 0
(default is 5 days – which may be sufficient for achival type files)

Start-DedupJob E: –Type Optimization
(manually starts dedup on E drive)

Get-DedupJob
(shows status of currently running dedup and scheduled dedup jobs)

I have used the following powershell script to continually run the dedup process on my archive drive (during migration work). Checks if dedup processes are running – if not execute dedup on archive drive.


cls
$x = 1
while ($x = 1)
{
$dedupcheck = Get-Dedupjob | Out-String;
if ($dedupcheck -eq "") {
echo "starting dedup process on F drive";
Start-DedupJob F: -type Optimization;
};
echo "dedup jobs running - sleeping for 2 min";
sleep 120;
echo "";
get-dedupstatus;
echo "";
}

powershell – move machine types to certain OUs in active directory


-------------- select additional parameters ----------------------

Get-ADComputer -Filter * -Properties ipv4Address, OperatingSystem, OperatingSystemServicePack | Format-table name, ipv4*, operatingsystem

-------------- move script -----------------

[cmdletbinding()]

param (
[parameter(mandatory=$true)]
$TargetOU
)

Import-Module ActiveDirectory
$Domain = [ADSI]""
$DN=$domain.distinguishedName
$SourcePath = "CN=Computers," + $DN
$Computers = Get-ADComputer -Filter * -SearchBase $SourcePath
if(!$Computers) {
write-host "No Computers are found in default container"
return
}
foreach ($Computer in $Computers) {
if(!(Move-ADObject $Computer -TargetPath $TargetOU)) {
$Status = "SUCCESS"
} else {
$Status = "FAILED"
}
$OutputObj = New-Object -TypeName PSobject
$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.Name.tostring()
$OutputObj | Add-Member -MemberType NoteProperty -Name SourcePath -Value $SourcePath
$OutputObj | Add-Member -MemberType NoteProperty -Name DestinationPath -Value $TargetOU
$OutputObj | Add-Member -MemberType NoteProperty -Name Status -Value $Status
$OutputObj
}

 

 

 

 

KMS count

Getting the KMS count up over the initial threshold is a pain when you only have one server or one workstation to start with. Typically you need at least 5 servers or 25 client machine requesting activation before it will work.

This guy here as created a nice .exe that will trick KMS into thinking it has received all the required requests…

http://forums.mydigitallife.info/threads/39665-KMS-Client-Emulator-for-Increasing-KMS-Server-Client-Count

KMS Client