Sauter la navigation

Archives de Catégorie Windows Server 2008 R2

Pour ceux que ça pourrait intéresser, voici un problème sur lequel je suis tombé récemment. Lors de l’installation de SQL Server 2008 SP1 en cluster, sur Windows Server 2008 R2, dans des machines virtuelles VMWare, dans l’étape de configuration de l’instance, on obtenais toujours une erreur “Adresse réseau non valide”. Il nous était impossible d’aller plus loin, le wizard nous en empêchait.

Pour résoudre le problème, il faut que l’administrateur de VMWare désinstalle les Shared Folders des VMTools. Attention, il ne faut pas seulement décocher la case, il faut désinstaller les VMWare Tools et les réinstaller sans les Shared Folders.

Une autre nouveauté intéressante de Windows Server 2008 R2, c’est la commande Getmac. Ça retourne tout simplement l’adresse MAC d’un ordinateur, local ou à distance. Pratique pour les admin de DHCP.

Si on regarde l’aide de la commande, ça donne ce qui suit.

C:\Users\marteldo>getmac /?

GETMAC [/S system [/U username [/P [password]]]] [/FO format] [/NH] [/V]

Description:

This tool enables an administrator to display the MAC address

for network adapters on a system.

Parameter List:

/S system Specifies the remote system to connect to.

/U [domain\]user Specifies the user context under

which the command should execute.

/P [password] Specifies the password for the given

user context. Prompts for input if omitted.

/FO format Specifies the format in which the output

is to be displayed.

Valid values: “TABLE”, “LIST”, “CSV”.

/NH Specifies that the “Column Header” should

not be displayed in the output.

Valid only for TABLE and CSV formats.

/V Specifies that verbose output is displayed.

/? Displays this help message.

Examples:

GETMAC /?

GETMAC /FO csv

GETMAC /S system /NH /V

GETMAC /S system /U user

GETMAC /S system /U domain\user /P password /FO list /V

GETMAC /S system /U domain\user /P password /FO table /NH

Une nouveauté très intéressante de Windows Server 2008 R2 est la corbeille de Active Directory, AD Recycle bin. Donc si vous avez détruit un objet dans AD, c’est maintenant possible de le récupérer. Mais par défaut elle n’est pas activée. Et pour s’en servir, il n’y a pas d’environnement graphique, tout se passe en PowerShell. Voici les commandes pour activer la corbeille de AD.

-Ouvrez PowerShell.

-Importer d’abord AD Module.

PS C:\Windows\system32> Import-Module ActiveDirectory

-Activez la corbeille, AD Recycle Bin.

PS C:\Windows\system32> Enable-ADOptionalFeature ‘Recycle Bin Feature’ -Scope ForestOrConfigurationSet -Target internal.com

WARNING: Enabling ‘Recycle Bin Feature’ on ‘CN=Partitions,CN=Configuration,DC=internal,DC=com’ is an irreversible action! You will not be able to disable ‘Recycle Bin Feature’ on ‘CN=Partitions,CN=Configuration,DC=internal,DC=com’ if you proceed.

Confirm

Are you sure you want to perform this action?

Performing operation “Enable” on Target “Recycle Bin Feature”.

[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Y”): Y

PS C:\Windows\system32> Get-ADObject “CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=Internal,DC=com ” -property msDS-DeletedObjectLifetime

DistinguishedName Name ObjectClass ObjectGUID

—————– —- ———– ———-

CN=Directory Service,CN=Wi… Directory Service nTDSService c6bf2481-527f-4f22-b737-06…

 

Par défaut, les objets sont disponibles 180 jours après avoir été effacés. Vous pouvez changer ce délai de la façon suivante.

-Changez le nombre de jours qu’un objet peut être restauré de la corbeille AD, AD Recycle Bin (défaut=180 jours).

PS C:\Windows\system32> Set-ADObject -Identity “CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=Inte nal,DC=com” -Partition “CN=Configuration,DC=Internal,DC=com” -Replace:@{“msDS-DeletedObjectLifetime” = 365}

-Savoir après combien de jours un object peut être restauré de la corbeille AD avant d’être détruit de façon permanente.

PS C:\Windows\system32> Get-ADObject “CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=Internal,DC=co ” -property msDS-DeletedObjectLifetime

DistinguishedName : CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=Internal,DC=com

msDS-DeletedObjectLifetime : 365

Name : Directory Service

ObjectClass : nTDSService

ObjectGUID : c6bf2481-527f-4f22-b737-063e6e4b9609

Voici maintenant comment faire pour restaurer un objet détruit. Attention, les objets ayant été détruit avant d’activer la corbeille ne peuvent pas être récupérés.

-Énumérez tous les objets détruits et leurs attributs.

PS C:\Windows\system32> Get-ADObject -Filter ‘isdeleted -eq $true -and name -ne “Deleted Objects”‘ -IncludeDeletedObject s -Properties *

accountExpires : 9223372036854775807

badPasswordTime : 0

badPwdCount : 0

CanonicalName : internal.com/Deleted Objects/Bob Tremblay DEL:6c191fd0-9c32-415f-b0b3-bfc90804e5a9

CN : Bob Tremblay DEL:6c191fd0-9c32-415f-b0b3-bfc90804e5a9

codePage : 0

countryCode : 0

Created : 9/9/2009 2:44:52 PM

createTimeStamp : 9/9/2009 2:44:52 PM

Deleted : True

Description :

DisplayName : Bob Tremblay

DistinguishedName : CN=Bob TremblayADEL:6c191fd0-9c32-415f-b0b3-bfc90804e5a9,CN=Deleted Objects,DC=inte rnal,DC=com

dSCorePropagationData : {12/31/1600 7:00:00 PM}

givenName : Bob

instanceType : 4

isDeleted : True

LastKnownParent : OU=QC,DC=internal,DC=com

lastLogoff : 0

lastLogon : 128980987712861184

lastLogonTimestamp : 128980987711767448

logonCount : 13

Modified : 9/22/2009 2:01:08 PM

modifyTimeStamp : 9/22/2009 2:01:08 PM

msDS-LastKnownRDN : Bob Tremblay

Name : Bob Tremblay DEL:6c191fd0-9c32-415f-b0b3-bfc90804e5a9

nTSecurityDescriptor : System.DirectoryServices.ActiveDirectorySecurity

ObjectCategory :

ObjectClass : user

ObjectGUID : 6c191fd0-9c32-415f-b0b3-bfc90804e5a9

objectSid : S-1-5-21-3743925592-2628212703-1424770472-1105

primaryGroupID : 513

ProtectedFromAccidentalDeletion : False

pwdLastSet : 128969954927321178

sAMAccountName : Bob

sDRightsEffective : 15

sn : Tremblay

userAccountControl : 66048

userPrincipalName : Bob@internal.com

uSNChanged : 36896

uSNCreated : 12788

whenChanged : 9/22/2009 2:01:08 PM

whenCreated : 9/9/2009 2:44:52 PM

-Récupérez les informations pour restaurer un utilisateur.

PS C:\Windows\system32> Get-ADObject -Filter ‘isdeleted -eq $true -and name -ne “Deleted Objects”‘ -IncludeDeletedObject s -Properties * | Format-List samAccountname,displayName,lastknownparent

samAccountname : Bob

displayName : Bob Tremblay

lastknownparent : OU=QC,DC=internal,DC=com

 

-Restaurez l’objet, dans ce cas-ci, l’utilisateur Bob.

PS C:\Windows\system32> Get-ADObject -Filter ‘samaccountname -eq “Bob”‘ -IncludeDeletedObjects | Restore-ADObject

Suivre

Get every new post delivered to your Inbox.