IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Serveur Discussion :

Script PowerShell Création OU [WS 2008 R2]


Sujet :

Windows Serveur

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre à l'essai
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2012
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Novembre 2012
    Messages : 4
    Par défaut Script PowerShell Création OU
    Bonjour tlm,

    Je suis bloquer dans la création d'un script pour la création OU dans active directory

    Voici ou je suis bloquer:



    Voici mon script:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    $objDomain = [ADSI]"LDAP://localhost:389/dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Groupes_Globaux")
    $objOU.SetInfo()
     
    $objDomain = [ADSI]"LDAP://ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Direction")
    $objOU.SetInfo()
    $objDomain = [ADSI]"LDAP://ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Secretaires")
    $objOU.SetInfo()
    $objDomain = [ADSI]"LDAP://ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Comptables")
    $objOU.SetInfo()
    $objDomain = [ADSI]"LDAP://ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Infographie")
    $objOU.SetInfo()
    $objDomain = [ADSI]"LDAP://ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Informatique")
    $objOU.SetInfo()
    $objDomain = [ADSI]"LDAP://ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Marketing")
    $objOU.SetInfo()
    $objDomain = [ADSI]"LDAP://ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    $objOU = $objDomain.Create("organizationalUnit", "ou=OU_Ventes")
    $objOU.SetInfo()
    Et voici le résultat que j'aimerai obtenir

    Créer une OU, dans cette OU créer une OU enfant et dans cette OU enfant créer deux OU enfant.

    Voici en image le résultat souhaité




    J'espère avoir été le plus clair possible

    Si vous avez besoin de plus de renseignement demander les.

    Merci d'avance

  2. #2
    Membre à l'essai
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2012
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Novembre 2012
    Messages : 4
    Par défaut
    Voici comment indiquer le chemin pour la création d'une OU

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    création-path 'ou=ou3,ou=ou2,ou=ou1,dc=domain,dc=com'
    Voici dans le script

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    New-ADOrganizationalUnit -Name OU_Groupes_Globaux -Path "dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Direction -Path "ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Users_Direc -Path "ou=OU_Direction,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Ordis_Direc -Path "ou=OU_Direction,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    
    New-ADOrganizationalUnit -Name OU_Comptable -Path "ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Users_Compt -Path "ou=OU_Comptable,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Ordis_Compt -Path "ou=OU_Comptable,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    
    New-ADOrganizationalUnit -Name OU_Secretaire -Path "ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Users_Secre -Path "ou=OU_Secretaire,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Ordis_Secre -Path "ou=OU_Secretaire,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    
    New-ADOrganizationalUnit -Name OU_Infographie -Path "ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Users_Infogra -Path "ou=OU_Infographie,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Ordis_Infogra -Path "ou=OU_Infographie,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    
    New-ADOrganizationalUnit -Name OU_Informatique -Path "ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Users_Informa -Path "ou=OU_Informatique,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Ordis_Informa -Path "ou=OU_Informatique,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    
    New-ADOrganizationalUnit -Name OU_Marketing -Path "ou=OU_Groupes_Globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Users_Mark -Path "ou=OU_Marketing,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    New-ADOrganizationalUnit -Name OU_Ordis_Mark -Path "ou=OU_Marketing,ou=OU_Groupes_globaux,dc=srvtest,dc=local"
    Info trouver ici
    http://blogs.technet.com/b/heyscript...y-26-2010.aspx

    PS: Merci Winnie 007

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Création logiciel avec script PowerShell
    Par skylex95 dans le forum VB.NET
    Réponses: 0
    Dernier message: 30/08/2012, 00h45
  2. [PowerShell] création d'un script powershell de récupération d'un user
    Par Leaffy dans le forum Scripts/Batch
    Réponses: 4
    Dernier message: 14/05/2012, 21h37
  3. [PowerShell] script powershell pour création utilisateur
    Par dirsang dans le forum Scripts/Batch
    Réponses: 5
    Dernier message: 28/09/2010, 17h15
  4. [IBExpert]Recuperer le script de création de la BD ?
    Par Sitting Bull dans le forum Outils
    Réponses: 2
    Dernier message: 01/10/2004, 11h15
  5. Réponses: 3
    Dernier message: 24/10/2003, 21h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo