Sometimes windows will not activate if the current network the machine is on can’t be redirected to the license servers easily.

The easiest way to activate a server on a restricted network it to find out the activation server hostname and port then manually specify it.

The following commands are all that are needed to discover the hostname and port of and activated server, force a server to activate and manually specify a server to use for activation.

Finding out windows licence server information

slmgr /dlv

Shows KMS or MAK depending on activation type

Forcing windows to activate

slmgr /ato

Manually specifing licence server

slmgr /skms <domain-name>:<port>

Note: The default port is 1688

For more info on the slmgr visual basic script

https://technet.microsoft.com/en-us/library/ff793409.aspx