



From the release of Windows Server 2008 you can choose when you install the OS between the Full or the Core version of Windows. The Core version has most of the functionnalities of the Full but lose its graphical interface (GUI).
In this particular configuration, most of Windows administrator will be lost. You can hopefully manage remotely the server using the well known MMC consoles but there are a lot of basic tasks that will require manual configuration.
If you try this savor you’ll find some included scripts to enable/disable Windows Update or Remote Desktop but that’s all.
There is however a tool named “Core Configurator” available in 2 version (2.0 for R2 and 1.1 for R1) that enable you to easily configure your Server Core.
The following can be done:
There is another tool (in command line this time) named Core Configuration Console R2 (also exist for R1). It does most of the jobs (perhaps more than Core Configurator) and it’s worth having a look on it.
Keep in mind that you can also manage Server Core using:




PowerShell utilise la puissance du Framework .Net et permet donc d’utiliser les classes de celui-ci avec une très grande facilité dans vos scripts.
Dans cet exemple, je vais vous montrer comment faire une résolution DNS à partir de la classe Net.Dns du Framework.
[System.Net.Dns]::GetHostentry("blog.paux.fr")
Le résultat sera (en fonction si votre entrée est un simple alias ou un vrai nom d’hôte) :
HostName Aliases AddressList
-------- ------- -----------
dedibox2.jeanb-net.com {} {88.191.92.204}
On peut biensûr décorer un peu tout ça en pipant une liste de nom d’hôtes depuis un fichier, rediriger ça dans une grille via out-gridview (nouveauté PS2.0 !). (A noter que si vous voulez non pas avoir le nom d’hôte mais vraiment votre input, vous pouvez le rajouter via la commande Add-Member, testez avec et sans vous verrez).
gc .\hosts.txt |% { [System.Net.Dns]::GetHostentry($_) | Add-Member -Name Host -MemberType NoteProperty -Value $_ -PassThru } | Select Host,AddressList | out-gridview
On peut biensûr faire des résolutions inverses (IPv4 ou IPv6).
[System.Net.Dns]::GetHostentry("2001:4860:a005::68";)
La classe Dns du Framework reste sommaire, il n’est pas possible de résoudre autre chose que ça (impossible de récupérer les NS, MX, SOA, TXT etc.) mais on peut pour cela utiliser d’autres classes qui implémentent un autre resolver (ou utilisant de manière plus approfondie celui de Windows)




PowerShell uses the power of .Net Framework thus you can leverage .Net classes in your PowerShell scripts.
In this example I’ll show you how you can perform DNS lookups using the Net.Dns class :
[System.Net.Dns]::GetHostentry(“blog.paux.fr”)
The result will be (depending if your input is a A or CNAME) :
HostName Aliases AddressList
-------- ------- -----------
dedibox2.jeanb-net.com {} {88.191.92.204}
You can obviously pipe a list of hostname to this command and if you need to keep the original name you can add it to the resulted object and display it in a grid (new to PS2.0 !):
gc .\hosts.txt |% { [System.Net.Dns]::GetHostentry($_) | Add-Member -Name Host -MemberType NoteProperty -Value $_ -PassThru } | Select Host,AddressList | out-gridview
You can of course do the same with an IP address (or an IPv6 address):
[System.Net.Dns]::GetHostentry("2001:4860:a005::68")
The class in .Net Framework stay basic so you can’t resolve NS, SOA, MX or TXT records for example but you can try to use other classes as this implementation of a resolver in C# or using this one (that use the internal DNS resolver of Windows)




If you often use PowerShell as script language you well know the out-* and export-* cmdlets.
I often use export-csv and open the result in Excel or out-GridView in PowerShell v2 (useful cmdlet BTW) for a nice graphical interface. I sometime use Excel API to create an Excel sheet directly or to import data but something was missing : simplicity.
These are an excellent solutions but why don’t we use Excel directly with an out-excel cmdlet ?
I just found this cmdlet there : http://pathologicalscripter.wordpress.com/out-excel/ and it is working very well ! So have fun using it.


More Options ...
Categories
Tag Cloud
Blog RSS
Comments RSS

Void « Default
Life
Earth
Wind
Water
Fire
Light 