Forum

AD deki Computer He...
 
Bildirimler
Hepsini Temizle

AD deki Computer Hesaplarının Company attribute larına şirket bilgileri girilmesi

6 Yazılar
2 Üyeler
0 Likes
501 Görüntüleme
(@nasrineymar)
Gönderiler: 103
Reputable Member
Konu başlatıcı
 

Merhaba Ortamda 3.500 tane client var. AD deki Computer Hesaplarımızın Company attribute larına şirket bilgilerini girmem gerekiyor.

Birden fazla company ismi bulunmaktadır.

Yani özet olarak 3.500 tane client'ın Attribute Editor / Company <not set> kısmına company bilgisini nasıl girebilirim. Bir script veya farklı bir alternatifler var mıdır?

Örnek olarak company, computer, user display ve site bilgisi aşağıda olduğu gibidir.

Company Name                User Display Name                             Computer Name                  Site
-------------------               -----------------                                ---------------------               -----
Westport Technologies         Roberto Baggio                              OBERTO-BAGGIO                  BRA
Westport Carpark                 Paul Gascoigne                             PAUL-GASCOIGNE                 ENG
Westport PrimeClass             Jürgen Klinsmann                         JURGEN-KLINSMANN             DEU
Westport Terminal Operat.    Joel Campbell                                JOEL-CAMPBELL                    F RA
Westport V.I.P                      Kylie Minogue                               KYLIE-MINOGUE                   AUS
Westport Holding A.S            Oliveira Bebeto                             OLIVEIRA-BEBETO               ABD

Teşekkürler

Kenan

 

 

 
Gönderildi : 21/06/2018 16:58

(@FerhatIndi)
Gönderiler: 467
Honorable Member
 

Daha once buna benzer birsey yapmistim,

Bu user company icin

        Import-Csv c:\files\companyusers.csv |ForEach-Object {
    Set-ADUser $_.samAccountName -Replace @{
        company = $_.Company
    }
}

Bu computer company  icin.

        Import-Csv c:\files\companycomputers.csv |ForEach-Object {
    Set-ADComputer -Identity $_.Identity -Replace @{
        company = $_.Company
    }
}

 

Tek tekyapmak istersen 

set-ADComputer -Identity michaels-imac-3 -Replace  @{
        company = "mycompany"  }

 

 
Gönderildi : 21/06/2018 19:39

(@nasrineymar)
Gönderiler: 103
Reputable Member
Konu başlatıcı
 

Merhaba Hocam,

 

öncelikle çok teşekkür ederim bilgilendirmeniz için.

 

Hocam,

 

aşağıdaki komutu çalıştırdım fakat olmadı.

 

Import-Csv C:\files\companycomputers.csv |ForEach-Object {Set-ADComputer -Identity $_.Identity -Replace @{company = $_.Company}}

 

şöyle bir hata mesajı alıyorum.

 

Set-ADComputer : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:1 char:84
+ ... uter -Identity $_.Identity -Replace @{company = $_.Company}}
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

Set-ADComputer : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:1 char:84
+ ... uter -Identity $_.Identity -Replace @{company = $_.Company}}
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

Set-ADComputer : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:1 char:84
+ ... uter -Identity $_.Identity -Replace @{company = $_.Company}}
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

PS C:\files>

 

Not: 

Tek tekyapmak istedeğimde komut çalışıyor.  Fakat csv dosyasını imort ettiğimde ise hata mesajı alıyorum.

set-ADComputer -Identity michaels-imac-3 -Replace  @{
        company = "mycompany"  }

set-ADComputer -Identity ROBERTO-BAGGIO -Replace  @{company = "Westport Technologies."} bu komut çalışıyor.

 

 

 
Gönderildi : 21/06/2018 21:27

(@FerhatIndi)
Gönderiler: 467
Honorable Member
 

Merhaba Hocam,

 

öncelikle çok teşekkür ederim bilgilendirmeniz için.

 

Hocam,

 

aşağıdaki komutu çalıştırdım fakat olmadı.

 

Import-Csv C:\files\companycomputers.csv |ForEach-Object {Set-ADComputer -Identity $_.Identity -Replace @{company = $_.Company}}

 

şöyle bir hata mesajı alıyorum.

 

Set-ADComputer : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:1 char:84
+ ... uter -Identity $_.Identity -Replace @{company = $_.Company}}
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

Set-ADComputer : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:1 char:84
+ ... uter -Identity $_.Identity -Replace @{company = $_.Company}}
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

Set-ADComputer : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:1 char:84
+ ... uter -Identity $_.Identity -Replace @{company = $_.Company}}
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

PS C:\files>

 

Not: 

Tek tekyapmak istedeğimde komut çalışıyor.  Fakat csv dosyasını imort ettiğimde ise hata mesajı alıyorum.

set-ADComputer -Identity michaels-imac-3 -Replace  @{
        company = "mycompany"  }

set-ADComputer -Identity ROBERTO-BAGGIO -Replace  @{company = "Westport Technologies."} bu komut çalışıyor.

 

 

 

Pardon benim hatam

ForEach-Object  input u pipelineden , foreach, allah ne verdiyse alir

soyle olmasi lazim 

 

Import-Csv c:\files\companycomputers.csv | foreach {Set-adcomputer $_.Identity -Replace @{
        company = $_.company}}

 

 
Gönderildi : 22/06/2018 00:16

(@nasrineymar)
Gönderiler: 103
Reputable Member
Konu başlatıcı
 

Hocam tekrardan merhabalar,

Göndermiş oldğunuz komutu tekar çalıştırdım fakat yine hata mesajı aldım.

 

Komutu iki şekilde çalıştırdım.

Import-Csv c:\files\companycomputers.csv | foreach {Set-adcomputer $_.Identity -Replace @{company = $_.company}}

Import-Csv c:\files\companycomputers.csv | foreach {Set-adcomputer $_.Identity -Replace @{company=$_.company}} (boşulkarı sildim)

 

C:\files altındaki companycomputers.csv dosyasının içeriği ise şu şekildedir.

set-ADComputer -Identity PAUL-GASCOIGNE -Replace @{company = "Westport Carpark"}
set-ADComputer -Identity JURGEN-KLINSMANN -Replace @{company = "Westport PrimeClass"}
set-ADComputer -Identity JOEL-CAMPBELL -Replace @{company = "Westport Terminal Operat."}
set-ADComputer -Identity KYLIE-MINOGUE -Replace @{company = "Westport V.I.P"}
set-ADComputer -Identity OLIVEIRA-BEBETO -Replace @{company = "Westport Holding A.S"}

 

Yani sizin gönderdiğiniz komutu çalıştırdığımda ise aşağıdaki hata mesajı alınıyor.

 

teşekkür ederim Hocam ilgi ve yardımlarınız için

 

 

 

PS C:\> Import-Csv C:\files\companycomputers.csv | foreach {Set-ADComputer $_.Identity -Replace @{company = $_.company}}
Set-ADComputer : Cannot validate argument on parameter 'Replace'. The argument is null or an element of the argument collection contains a null value.
At line:1 char:89
+ ... ntity -Replace @{company = $_.company}}
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

Set-ADComputer : Cannot validate argument on parameter 'Replace'. The argument is null or an element of the argument collection contains a null value.
At line:1 char:89
+ ... ntity -Replace @{company = $_.company}}
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

Set-ADComputer : Cannot validate argument on parameter 'Replace'. The argument is null or an element of the argument collection contains a null value.
At line:1 char:89
+ ... ntity -Replace @{company = $_.company}}
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

PS C:\>

 
Gönderildi : 22/06/2018 11:02

(@FerhatIndi)
Gönderiler: 467
Honorable Member
 

 

 

Powershell ISE kullanirsan, daha cok hareket alani olur, bide  Import-Module ActiveDirectory kullan basa, csvde asagidaki gibi olun. Scripti az once tekrar denedim ,bende calisiyor


Identity, Company
pc1,company1

 
Gönderildi : 22/06/2018 12:08

Paylaş: