zoukankan      html  css  js  c++  java
  • 根据CSV找出USBGroup中计算机对应的用户

    <USB.CSV>
    Hostname,Username
    CNHZPD-TEST1,User1
    CNHZLN-01234567,User2
     
    $group = "CN=Enable_CDUSB_CHNHGHWin7&8,OU=Groups,OU=Hangzhou - China,OU=TCS - China,OU=TCS - China,DC=apac,DC=TCS,DC=com"
    $cmdbdesktop = Import-Csv -Path 'F:IvanHZCMDB~~01--Non GE DST.csv'
    $cmdblaptop = Import-Csv -Path 'F:IvanHZCMDB~~02--Laptop.csv'
    $machines = Get-ADGroup -Filter * -SearchBase $group | Get-ADGroupMember | Get-ADComputer -Properties *
    foreach($adesktop in $cmdbdesktop) {
        foreach($machine in $machines) {
            if($machine.name -eq $adesktop.hostname) {
                $machine | select name , @{N='owner';E={$adesktop.username}}
            }
        }
    }
    foreach($alaptop in $cmdblaptop) {
        foreach($machine in $machines) {
            if($machine.name -eq $alaptop.hostname) {
                $machine | select name , @{N='owner';E={$alaptop.username}}
            }
        }
    }
  • 相关阅读:
    省选测试29
    省选测试28
    省选测试27
    省选测试26
    省选测试25
    最小费用最大流Dinic
    省选测试24
    省选测试23
    省选测试22
    省选测试21
  • 原文地址:https://www.cnblogs.com/IvanChen/p/4487727.html
Copyright © 2011-2022 走看看