2014年5月9日 星期五

Fortigate 硬體檢測 HQIP


摘錄自 http://www.huagai.com/technology.aspx?UID=348&SortID=0&key=

Fortigate-100A3.00,build0474,061228    技術部   王俊                      2007-12-7

目的:飛塔防火牆出現問題時用於設備硬件狀態的一種手段
前期準備:首先下載思科TFTP服務器模擬器 地址:http://www.onlinedown.net/soft/33433.htm
然後去http://emea.fortinet.net/fortinet/aht/  去下載做HQIP所需的文件 註:文件後綴名*.img
HQIP文件要放到TFTP服務器的根目錄下

那麼現在可以正式開始了
第一步:打開TFTP服務器

圖-1
標題欄的地址是192.168.1.96 這個地址是本機的地方 即:把基本模擬成TFTP服務器 這個地址要是192.168.1.0網段 即和FORTIGATE的內網口地址一個網段,先把它晾這裡。


第二步:打開超級終端
開始----程序---附件---通訊—超級終端

圖-2
這裡的名字可以隨便填

圖-3
這裡選COM 1口

圖-4
這裡點以下還原為默認值
 
圖-5
隨後就正式進入超級終端界面了
這是可以幫FORTIGATE通電了~通電後出現以下界面

圖-6
通電後不停按空格鍵(其實是按任意鍵)
然後選個G\F\B\C\Q\H
這裡我們做的是HQIP所以選擇G

圖-7
第一個選項輸入TFTP標題欄的地址
第二個選項輸入FORTIGATE內網口地址
第三個文件是之前準備好的HQIP文件
然後按回車
TFTP服務器中會有進度顯示

圖-8
一直到成功!

圖-9
超級終端會讓你選擇D\B\R選擇R
在選擇R的同時用交叉線把所有接口一對一連起來 以FORTIGATE 100A為例
 
 
 
 
FortiGate-100A:    INTERNAL
                 +-----------+
                [4] [3] [2] [1] [DMZ2] [DMZ1] [WAN2] [WAN1]
                 +   +   +   +    +      +      +      +
                 |   |   |   +----+      |      |      |
                 |   |   +---------------+      |      |
                 |   +--------------------------+      |
                 +-------------------------------------+
http://emea.fortinet.net/fortinet/aht/  飛塔網站上有各個型號的不同接法供參考

一直到出現這個界面


==============Fortinet Hardware Quick Inspection Report ==================


                      BIOSIntegrity Check:      PASS
                         PCIDevice Check:      PASS
            System Configuration Verification:      PASS
                             Memory Test:      PASS
                                CPU Test:      PASS
                CPU/MEM Performance Test:      PASS
                                USB Test:      FAIL
                     FortiASIC Device Test:      PASS
                                 IDE Test:      PASS
                     Network Controller Test:      PASS


==============Fortinet Hardware Quick Inspection FAILED ==================

USB Testrequires loopback cables.
Failure onthis test may be caused by bad cable or poor connection.
Checkwirings before taking further actions.


這裡可以根據分析結果來判斷設備問題~


 下面是一份完整的 飛塔60  HQIP記錄

FGT60(11:24-04.25.2005)                       
Ver:04000000           
Serialnumber:FGT-603907503437                             
RAMactivation             
TotalRAM: 128MB               
Enablingcache...Done.                     
ScanningPCI bus...Done.                       
AllocatingPCI resources...Done.                               
EnablingPCI resources...Done.                             
ZeroingIRQ settings...Done.                           
VerifyingPIRQ tables...Done.                            
Boot up,boot device capacity: 30MB.                                   
Press anykey to display configuration menu...                                             
.
[G]:  Get firmware image from TFTP server.                                         
[F]:  Format boot device.                        
[Q]:  Quit menu and continue to boot with defaultfirmware.                                                          
[H]:  Display this list of options                               

EnterG,F,Q,or H:                

EnterG,F,Q,or H:                

EnterTFTP server address [192.168.1.168]: 192.168.1.96                                                      
Enterlocal address [192.168.1.188]: 192.168.1.99                                                
Enterfirmware image file name [image.out]: FG-60-HQIP.img                                                          
MAC:00:09:0f:17:57:d8                    
###  
Total3876448 bytes data downloaded.                                   
Verifyingthe integrity of the firmware image.                                             

Total28000kB unzipped.                      
Save asDefault firmware/Run image without saving:[D/R]?                                                       
...........................                          
Reading boot image 1970152 bytes.                                 
Initializingfirewall...                       
Initializing   eth0, MAC:00:09:0F:17:5                                    
Initializing   eth1, MAC:00:09:0F:17:57:DA                                         
Initializing   eth2, MAC:00:09:0F:17:57:D9                                         
Initializing   eth3, MAC:00:09:0F:17:57:D8                                         
4interface(s) initialized.                          
NETworkBurn-in Test(netbt) device loaded.                                         

Testprogram loading(61,Build044,May  4 200515:50:22) ...                                                         
Startingtest 61......                     

TestBegin at Thu Oct 25 01:33:53 2007                                      

ModelName:             [FGT-60]                               
Unit BIOSVersion:      [04000000]                                 
UnitFortinet SN:      [FGT-603907503437]                                         
Unit OEMSN:            [FGT-603907503437]                                         
UnitFirst MAC:         [00090f1757d8]                                     


BIOSIntegrity Check PASS.                         

CheckingPCI devices...                      
Lookingfor [0x06011106](VT8601 [Apollo ProMedia]) at 00:00.00 ...Found.                                                                       
Lookingfor [0x86011106](VT8601 [Apollo ProMedia AGP]) at 00:01.00 ...Found.                                                                            
Lookingfor [0x400115BC](FortiASIC CP2) at 00:0D.00 ...                                                      
        No device [0x400115BC](FortiASIC CP2)found at 00:0D.00(0x400510CA).                                                                            


PCIdevices check failed.                        

Gatheringsystem information......                                 

Gatheringsystem information OK!                               

Verifysystem configuartion                          

Verifysystem configuartion PASS                               

1. Systeminformation                    
        model name      : VIA Samuel 2                                     
        CPU number      : 1                           
        CPU MHz         : 400                            
        CPU MIPS        : 799                            
        Compact Flash   : 32MB CompactFlash Card                                               
        size            : 30 MB                              
        Compact Flash   : 32MB CompactFlash Card                                               
        size            : 30 MB                              
        Total Memory    : 125188 KB                                   

        Total 4 net port(s) found.                                 

        internal(eth3) macaddress:      00:09:0F:17:57:D8                                                        
        dmz(eth2) macaddress:   00:09:0F:17:57:D9                                                 
        wan1(eth1) macaddress:  00:09:0F:17:57:DA                                               
        wan2(eth0) macaddress:  00:09:0F:17:57:DB                                                



2. Memorytest             
        Free memory is 88060KB.                              
        pagesize=4096,pagesizemask=FFFFF000                                           
        Detecting memory(117MB)...      [Done, 63MB will be tested]                                                                   

        STRESS->MEM-> 1.StuckAddress...                                       
        STRESS->MEM-> 1.Stuck AddressPASSED.                                            
        STRESS->MEM-> 2.Random value...                                      
        STRESS->MEM-> 2.Random valuePASSED.                                           
        STRESS->MEM-> 3.XORcomparison...                                        
        STRESS->MEM-> 3.XOR comparison PASSED.                                             
        STRESS->MEM-> 4.SUBcomparison...                                        
        STRESS->MEM-> 4.SUB comparisonPASSED.                                             
        STRESS->MEM-> 5.MULcomparison...                                        
        STRESS->MEM-> 5.MUL comparisonPASSED.                                             
        STRESS->MEM-> 6.DIVcomparison...                                        
        STRESS->MEM-> 6.DIV comparisonPASSED.                                             
        STRESS->MEM-> 7.ORcomparison...                                       
        STRESS->MEM-> 7.OR comparisonPASSED.                                            
        STRESS->MEM-> 8.ANDcomparison...                                        
        STRESS->MEM-> 8.AND comparisonPASSED.                                             
        STRESS->MEM-> 9.SequentialIncrement...                                              
        STRESS->MEM-> 9.SequentialIncrement PASSED.                                                   
        STRESS->MEM-> Round    0 completed in 53 seconds (0 errors).                                                                   

        Release memory done.                           


3. CPUtest OK !               
        Free memory is 87960KB.                              

4. Streamtest             
        vvvvvvvvvv                 
        Function      Rate (MB/s)   RMS time    Min time     Max time                                                                     
        Copy:          96.6554       0.3311       0.3311       0.3312                                                                    
        Scale:        147.0623       0.2177       0.2176       0.2183                                                                    
        Add:          154.6935       0.3103       0.3103       0.3103                                                                    
       Triad:        132.0655       0.3635       0.3                                                   

5. TestASIC DES Encrypt and Decrypt.                                    
        Open device /dev/fpga0 error:No suchdevice                                                   

6. TestCompact Flash and Harddisk.                                  
        Compact Flash(/dev/hda) Model:32MBCompactFlash Card                                                           
        Size:32112640(bytes)                            
        Testing write/read to compactflash(/dev/hda):                                                     
        vvvvvvv              
        Read/write test PASS.Write/Read Rate:    1.35MBPS/    4.17MBPS                                                                       


7. TestUSB ports.                 
        Testing device /dev/ttyusb0 ...                                      
        :FAILED in open device(No suchdevice).                                               
        Testing device /dev/ttyusb1 ...                                      
        :FAILED in open device(No suchdevice).                                              

8. TestNetwork interface controller.                                    
Wire thenetwork ports as follow for NIC loopback test.                                                      
     INTERNAL            
  +-----------+              
 [4] [3] [2] [1] [DMZ] [WAN1] [WAN2]                                   
  V  +   +   +   +      +      +                                 
      |  |   +----+      |     |                                 
      |  +---------------+      |                                 
      +--------------------------+                                  

Initializing   eth0, MAC:00:09:0F:17:57:DB                                         
Initializing   eth1, MAC:00:09:0F:17:57:DA                                         
Initializing   eth2, MAC:00:09:0F:17:57:D9                                          
Initializing   eth3, MAC:00:09:0F:17:57:                                     
4interface(s) initialized.                          
        Network traffic test between internaland dmz...                                                       
Try tostart netbt device...                           
Interface   eth3 pair: [me 00:09:0F:17:57:D8]     <3>[he 00:09:0F:17:57:D9]                                                                          
Interface   eth2 pair: [me 00:09:0F:17:57:D9]     <3>[he 00:09:0F:17:57:D8]                                                                          
Total 2pairs configurated.                          
NETBTdevice started.                    
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<  64> eth2.tx:    154596     9275760       0                                                       
<  64> eth2.rx:    154596     9275760       0      0  15459      9      0                                                                          
<  64> eth3.tx:    154596     9275760       0      0  15459      9                                                                   
<  64> eth3.rx:    154596     9275760       0      0  15459      9      0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                     
<128> eth2.tx:    136496     16925440       0     0   13649     15                                                                   
<128> eth2.rx:    136496     16925440       0     0   13649     15     0                                                                          
<128> eth3.tx:    136496     16925440       0     0   13649     15                                                                   
<128> eth3.rx:    136496     16925440       0     0   13649     15     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<256> eth2.tx:    112159     28263940       0     0   11215     23                                                                    
<256> eth2.rx:    112159     28263940       0     0   11215     23     0                                                                          
<256> eth3.tx:    112159     28263940       0     0   11215     23                                                                   
<256> eth3.rx:    112159     28263940       0     0   11215     23     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<512> eth2.tx:     79733     40504108       0     0    7973     33                                                                   
<512> eth2.rx:     79733     40504108       0     0    7973     33     0                                                                          
<512> eth3.tx:     79733     40504108       0     0    7973     33                                                                   
<512> eth3.rx:     79733     40504108       0     0    7973     33     0                                                                           
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<1024>eth2.tx:     49612     50603728       0     0    4961     40                                                                   
<1024>eth2.rx:     49612     50603728       0     0    4961     40     0                                                                          
<1024>eth3.tx:     49612     50603728       0     0    4961     40                                                                   
<1024>eth3.rx:     49612     50603728       0     0    4961     40     0                                                                          
----------------------------------------------------------------------------                                                                           
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<1518>eth2.tx:     35982     54476254       0     0    3598    43                                                                   
<1518>eth2.rx:     35982     54476254       0     0    3598     43     0                                                                          
<1518>eth3.tx:     35982    54476254       0      0   3598     43                                                                   
<1518>eth3.rx:     35982     54476254       0     0    3598     43     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                     
<  64> eth2.tx:    155166     9311414       0      0  15516      9                                                                   
<  64> eth2.rx:    155145     9310154       0      0  15514      9     0                                                                          
<  64> eth3.tx:    155166     9311414       0      0  15516      9                                                                   
<  64> eth3.rx:    155166     9311414       0      0  15516      9      0                                                                          
Stopnetbt device.                 
        PASSED             

        Network traffic test between internaland wan1...                                                         
Try tostart netbt device...                           
Interface   eth3 pair: [me 00:09:0F:17:57:D8]     <3>[he 00:09:0F:17:57:DA]                                                                          
Interface   eth1 pair: [me 00:09:0F:17:57:DA]     <3>[he 00:09:0F:17:57:D8]                                                                          
Total 2pairs configurated.                          
NETBTdevice started.                    
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<  64> eth1.tx:    153289     9197340       0      0  15328      9                                                                   
<  64> eth1.rx:    153289     9197340       0      0  15328      9      0                                                                           
<  64> eth3.tx:    153289     9197340       0      0  15328      9                                                                   
<  64> eth3.rx:    153289     9197340       0      0  15328      9      0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  M bps                                                                    
<128> eth1.tx:    134640     16695296       0     0   13464     15                                                                   
<128> eth1.rx:    134640     16695296       0     0   13464     15     0                                                                          
<128> eth3.tx:    134640     16695296       0     0   13464     15                                                                    
<128> eth3.rx:    134640     16695296       0     0   13464     15     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<256> eth1.tx:    111890    28196152       0      0  11189     23                                                                   
<256> eth1.rx:    111890     28196152       0     0   11189     23     0                                                                          
<256> eth3.tx:    111890     28196152       0     0   11189     23                                                                   
<256> eth3.rx:    111890     28196152       0     0   11189     23     0                                                                           
----------------------------------------------------------------------------                                                                          
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<512> eth1.tx:     80420     40853104       0     0    8042     33                                                                   
<512> eth1.rx:     80420     40853104       0     0    8042     33     0                                                                          
<512> eth3.tx:     80420     40853104       0     0    8042     33                                                                   
<512> eth3.rx:     80420     40853104       0     0    8042     33     0                                                                          
------------------------------------------------------------------------------                                                                              
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<1024>eth1.tx:     49572     50562928       0     0    4957     40                                                                   
<1024>eth1.rx:     49572     50562928       0     0    4957     40     0                                                                          
<1024>eth3.tx:     49572     50562928       0     0    4957     40                                                                   
<1024>eth3.rx:     49572     50562928       0     0    4957     40     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                     
<1518>eth1.tx:     35921     54383900       0     0    3592     43                                                                   
<1518>eth1.rx:     35921     54383900       0     0    3592     43     0                                                                           
<1518>eth3.tx:     35921     54383900       0     0    3592     43                                                                   
<1518>eth3.rx:     35921     54383900       0     0    3592     43     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  M bps                                                                    
<  64> eth1.tx:    153751     9226514       0      0  15375      9                                                                   
<  64> eth1.rx:    153751     9226514       0      0  15375      9      0                                                                          
<  64> eth3.tx:    153751     9226514       0      0  15375      9                                                                    
<  64> eth3.rx:    153751     9226514       0      0  15375      9      0                                                                          
Stopnetbt device.                 
        PASSED              

        Network traffic test between internaland wan2...                                                        
Try tostart netbt device...                           
Interface   eth3 pair: [me 00:09:0F:17:57:D8]     <3>[he 00:09:0F:17:57:DB]                                                                          
Interface   eth0 pair: [me 00:09:0F:17:57:DB]     <3>[he 00:09:0F:17:57:D8]                                                                          
Total 2pairs configurated.                          
NETBTdevice started.                    
-------------------------------------------------                                              
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                     
<  64> eth0.tx:    152193     9131580       0      0  15219      9                                                                   
<  64> eth0.rx:    152193     9131580       0      0  15219      9      0                                                                          
<  64> eth3.tx:    152193     9131580       0      0  15219      9                                                                   
<  64> eth3.rx:    152193     9131580       0      0  15219      9      0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<128> eth0.tx:    135133     16756428       0     0   13513     15                                                                    
<128> eth0.rx:    135133     16756428       0     0   13513     15     0                                                                          
<128> eth3.tx:    135133     16756428       0     0   13513     15                                                                   
<128> eth3.rx:    135133     16756428       0     0   13513     15     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<256> eth0.tx:    111220     28027312       0     0   11122     23                                                                   
<256> eth0.rx:    111220     28027312       0     0   11122     23     0                                                                          
<256> eth3.tx:    111220     28027312       0     0   11122     23                                                                   
<256> eth3.rx:    111220     28027312       0     0   11122     23     0                                                                           
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<512> eth0.tx:     76606     38915592       0     0    7660     32                                                                   
<512> eth0.rx:     76606     38915592       0     0    7660     32     0                                                                          
<512> eth3.tx:     76606     38915592       0     0    7660     32                                                                   
<512> eth3.rx:     76606     38915592       0     0    7660     32     0                                                                          
------------------------------------------------------------------------------                                                                              
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<1024>eth0.tx:     49520     50509888       0     0    4952     40                                                                   
<1024>eth0.rx:     49520     50509888       0     0    4952     40     0                                                                          
<1024>eth3.tx:     49520     50509888       0     0    4952     40                                                                   
<1024>eth3.rx:     49520     50509888       0     0    4952     40     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                     
<1518>eth0.tx:     35976     54467170       0     0    3597     43                                                                   
<1518>eth0.rx:     35976     54467170       0     0    3597     43     0                                                                          
<1518>eth3.tx:     35976     54467170       0     0    3597     43                                                                   
<1518>eth3.rx:     35976     54467170       0     0    3597     43     0                                                                          
------------------------------------------------------------------------------                                                                             
  Interface  |  packets |   bytes   |dropped|errors|pks/sec|  Mbps                                                                    
<  64> eth0.tx:    152806     9169814       0      0  15280      9                                                                    
<  64> eth0.rx:    152806     9169814       0      0  15280      9      0                                                                          
<  64> eth3.tx:    152806     9169814       0      0  15280      9                                                                   
<  64> eth3.rx:    152806     9169814       0      0  15280      9      0                                                                          
Stopnetbt device.                 
        PASSED             



        Network traffic test between inter                                       
        Network traffic test between internaland wan1: PASSED                                                              
        Network traffic test between internaland wan2: PASSED                                                             

Test Endat Thu Oct 25 01:39:22 2007                                   
ElapsedTime: 329 Seconds(5m29s).                                 



==============Fortinet Hardware Quick Inspection Report ==================


                    BIOS Integrity Check:      PASS
                        PCI Device Check:      FAIL
       System Configuration Verification:      PASS
                             Memory Test:      PASS
                                CPU Test:      PASS
                CPU/MEM Performance Test:      PASS
                                USB Test:      FAIL
                   FortiASIC Device Test:      FAIL
                                IDE Test:      PASS
                 Network Controller Test:      PASS


==============Fortinet Hardware Quick Inspection FAILED ==================

USB Testrequires loopback cables.
Failureon this test may be caused by bad cable or poor connection.
Checkwirings before taking further actions.

2014年4月23日 星期三

AD限制domain user 自行加入網域

 
 
限制一般使用者帳號無法將電腦加入網域以文找文
摘錄自
gavint 在天空部落發表於14:53:40 | Windows
 
我們公司用的是Windows Server 2008 R2 的 AD,一般使用者可以自行將電腦加入公司網域,但有十次的限制,不過我們希望一般使用者無法自行將電腦加入公司網域,要由資訊處人員協助加入才可以。
  1. 登入 DC。
  2. 執行「群組原則管理」。
  3. 展開「樹系 / 網域 / <Domain> / Domain Controllers」。
  4. 在「Default Domain Controllers Policy」上按滑鼠右鍵,點選編輯
  5. 展開「電腦設定 / 原則 / Windows 設定 / 安全性設定 / 本機原則 / 使用者權限指派」。
  6. 點擊「將工作站新增至網域」。
  7. 將 Authenticated Users 移除。
  8. 並將 Domain Admins 或允許加入網域的帳號新增到該項目中即可。

2014年4月17日 星期四

AD 大量建置帳號

摘錄自http://www.dotblogs.com.tw/kaoht/archive/2011/11/27/59633.aspx

導入AD的第二步

建立公司使用者帳號
公司目前有900左右員工,使用電腦人數約310位左右
我自行開立帳號密碼一個約5分鐘那310位就要我將近26小時間建立帳號,這樣我應該甚麼事情都不用做了
目前MS公司有5種建立大量帳號方式,我採用CSVDE方式建立.
下列人員範例

objectClass,sAMAccountName,dn
user,Petergr," CN=Peter Graham,OU=Newport,DC=cp,dc=com"
user,Janiebo," CN=Janie Bourne,OU=Newport,DC=cp,dc=com"
user,Edgardu," CN=Edgar Dunn,OU=Newport,DC=cp,dc=com"
user,Belindaha," CN=Belinda Hart,OU=Newport,DC=cp,dc=com"
user,Mayja," CN=May Jamieson,OU=Newport,DC=cp,dc=com"
user,Leroyot," CN=Leroy Ota,OU=Newport,DC=cp,dc=com"
 
將上列的檔案複製後建立adduser.csv檔案,放到AD主機上我放在c:\CSVDE\中
 
開啟命令提示字元
 
csvde.exe -i -f "c:\CSVDE\CSVDE_adduser.csv"
 
// 匯入後 intAccValue = 514  表示帳號無啟動
 
自動將上列帳號建立完成,但是建立帳號後,此帳號還是無法請用因為沒有密碼.
 
 //再將下面用記事本存成XXX.vbs 但OU要改
strContainer = "OU=CSVOU ,"  //"OU=XXXX, OU=ZZZZ,"
 
將下列檔案複製後變成AccountControl.vbs
 
Option Explicit
Dim objOU, objUser, objRootDSE
Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
strContainer = "OU=CSVOU ,"
intAccValue = 544
strContainer = strContainer & strDNSDomain
set objOU =GetObject("LDAP://" & strContainer )
intCounter = 0
      For each objUser in objOU
          If objUser.class="user" then
          objUser.SetPassword "P@ssw0rd"
          objUser.SetInfo
          objUser.Put "userAccountControl", intAccValue
          objUser.SetInfo
          intCounter = intCounter +1
          strLastUser = objUser.Get ("name")
          End if
       next
WScript.Echo intCounter & " Users change pwd next logon.  Value " _
& intAccValue
WScript.Quit
' End of User Account example VBScript
 
放到AD主機上執行後所有人的密碼,都會此用"P@ssw0rd"為預設密碼
 
這樣我大量建立帳號號時間只花了10分鐘將所以帳號密碼設定完成.
 
以上參數請依自己公司狀況調整,請不要照抄使用.

CSVDE指令 教學

摘錄自http://rritw.com/a/bianchengyuyan/C__/20131008/430545.html

用CSVDE命令導入導出AD配置

//用Excel表把屬性作出存成csv,來然後再用csvde匯入
csvde -i -f c:\xxx.csv


範例 C:\Users\Administrator>csvde -i -f c:\cuser_160315.csv -j c:\
若不在目錄下檔案路徑記得要打, -j c:\ 是把錯誤或匯入資訊log匯出




CSVDE 全稱为 Comma Separated Value Data Exchange。CSV(comma-separated value)文件實際上只是一個將數據以逗號分隔的文本文件。CSVDE可以在不影響當前配置的情況下導出AD配置信息,也可以將AD配置導入到一個新安 裝的AD中。將AD配置導入到正在使用的域中將會直接影響整個系統,因此最好僅在測試環境中進行導入實驗。

一、導出

導出所有AD配置:

csvde -f output.csv

-r: 按LDAP字段過滤

僅一個條件時:
csvde -f users.csv -r "objectCategory=person"
多個條件相“與”:
輸出屬於user對象類型,並且類別为person的所有項目:
csvde -f users.csv -r "(&(objectClass=user)(objectCategory=person))"
多個條件相“或”:
輸出userAccountControl值为514或者546或者66050的所有項目:
csvde -f accountControl.csv -r "(|(useraccountcontrol=514)(useraccountcontrol=546)(useraccountcontrol=66050))"
{!}INFO:關於userAccountControl,請参考lesca博客《UserAccountControl基本屬性、功能對照、常見功能組合》一文。

-d: 按DN中的字段過滤

關於DN的介紹請参考lesca博客的《什麼是DN(Distinguished Names)》一文。下面舉幾個例子:
csvde -d "OU=TEST,DC=lesca,DC=bit" -f example.csv
csvde -d "CN=Users,DC=lesca,DC=bit" -f example.csv

-L: 指定LDAP輸出字段

csvde -f example.csv -l "DN, objectClass, givenName, sn, name"

綜合舉例:

csvde -d "OU=Test,dc=lesca,dc=bit" -m -n -f example.csv -r objectClass=user -l "name, objectCategory, DN"
以下幾個参數值的注意:
  • -m 用於排除諸如ObjectGUID, objectSID, pwdLastSet, samAccountType之類的屬性
  • -n 禁止輸出二進制值

二、導入

導入CSV到AD的指令很簡單:
CSVDE -i -k -f test.csv
用Excel可以方便地生成CSV文件,具體操作方法可以見参考鏈接[1]和[3]。本節我們主要討論CSV文件的結構。CSV至少需要三個字段:objectClass, sAMAccountName, DN。下表列出了這些必填字段的用途:
必填屬性
屬性 功能
objectClass 對象類型,通常为user
sAMAccountName Domain\LogonName中的LogonName
DN Distinguished Names(了解更多
除此以外,導入用戶時還可以增加一些額外信息,下面罗列了其他常用可選屬性的功能:
可選屬性
屬性 功能
userAccountControl 用戶账戶控制(了解更多
userPrincipalName UPN,如lesca@lesca.bit
givenName
SN
initials 姓名縮寫
CN 和DN中的CN字段相同(自動設置)
name 和CN相同(自動設置)
description 描述
title 職位名稱
department 部門
displayName 顯示名稱
c 國家代碼,如CN表示中國
co 國家,如China(自動設置)
st
l 城市
company 公司名稱
mail 用戶電子郵件
streetAddress 公司街道地址
postalCode 郵政編碼
physicalDeliveryOfficeName 辦公地點
telephoneNumber 固定電話號碼
mobile 移動電話號碼
facsimileTelephoneNumber 傳真號碼
ipPhone IP電話
wWWHomePage 網站主頁

三、CSVDE的不足

  • 無法創建账戶密碼
  • 無法創建OU

2014年4月10日 星期四

AD 改電腦名稱 DNS 會出現的問題

摘錄自 http://blog.miniasp.com/post/2010/01/12/Rename-Computer-after-upgrade-DC-may-fail-DNS-operation.aspx

我有兩台網域主控站(DC),我將 dc1 所有 FSMO 角色與 Global Catalog 都移轉至 dc2 之後,然後將 dc1 降級,但卻發現 dc2 上面的 DNS 卻會殘留許多 dc1 的 SRV 紀錄,也就是 dc1 在降級時在 dc2 的 DNS 的紀錄並沒有正確同步,導致即便再將 dc1 再次升級成 DC 後,在 dc1 的 DNS 無法正確設定,而錯就錯在之前曾經將 dc1 的電腦名稱修改過,而且是在已經成為網域主控站的時候修改的。
如下圖是我在 dc1 降級後,從 dc2 的 DNS 服務看到的結果,dc1 的 SRV 紀錄並未被移除:

追查到最後的我終於發現在 dc1 的 DNS 無法正常運作的原因!
由於我是在 Hyper-V 下架設 AD 環境,當初我在將 dc1 升級成 DC 後發現電腦名稱忘了改(是一串亂碼那種),然後我就「大膽的」修改電腦名稱,當時畫面是有提醒成員電腦可能會短暫查詢不到 DNS 而出問題題,由於是測試環境就不疑有雷的按下「確定」,然後 AD 也一直都很正常的運作中!(也許是還沒出問題罷了)
直到我將 dc1 給降級,才發現一切都開始變的不穩定,而我重新將 dc1 升級成 DC 後也不見改善,重要的是 dc1 的 DNS 服務運作不正常,在伺服器管理員中出現紅色的警告符號,說 DNS 尚未設定之類的錯誤訊息。
然後我進入 dc1 的 DNS 服務並一個節點一個節點的打開,終於發現在 domain.local\_msdcs 下面的 NS 紀錄竟然放的是修改電腦名稱之前的「伺服器完整網域名稱」,所以才導致 DNS 無法正確設定!
 
當我將「伺服器完整網域名稱」改正之後,重新啟動 DNS 服務,就一切風平浪靜了!
我覺得這應該是 Windows Server 2008 R2 (含前版) 的 Bug,但避開這個 Bug 最有效的方式就是:
  1. 記得在作業系統安裝完成之後就設定好電腦名稱
  2. 不要在升級為網域主控站之後才修改電腦名稱
  3. 修改了完電腦名稱後必須再次查看 DNS 紀錄是否有漏改的地方(這問題以後的版本或許會解決)

Win7 IDE轉ACHI 不用重灌

摘錄自 http://blog.xuite.net/yh96301/blog/81388614-SATA%E7%A1%AC%E7%A2%9F%E7%94%B1IDE%E6%94%B9%E7%82%BAAHCI%E6%A8%A1%E5%BC%8F

 

SATA硬碟由IDE改為AHCI模式

使用SATA硬碟,已經以IDE模式安裝完成的Windows 7桌上型電腦,電腦開機以後直接按鍵盤的「Delete」鍵進入BIOS,將硬碟由IDE改為AHCI模式〈AHCIAdvanced Host Controller Interface進階主機控制器介面,它是Intel所主導的一項技術,可以發揮SATA硬碟的潛在加速功能,大約可增加30%的硬碟讀寫速度,適用於ASAT2以上的硬碟〉,重新開機以後卻出現「停止 0X0000007B INACCESSABLE_BOOT_DEVICE」的錯誤,Windows 7無法順利開啟,應該要如何設定,才能將SATA硬碟的模式更改為AHCI模式呢,以加速硬碟的存取速度呢?說明如下:
1.開啟Windows 7以後,點選「開始」,在「搜尋程式及檔案」的欄位輸入「regedit」,按鍵盤的「Enter」開啟登錄編輯程式。


2.開啟的登錄編輯程式如下圖所示,準備修改登錄檔案〈修改登錄檔案請注意!勿任意修改,如果修改錯誤,可能會造成電腦無法開機〉。

3.展開「HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services」。

4.選擇「msahci」的「Start」檔案,檔案的數值資料目前設定為「3」,如下圖所示。

5.對著「Start」按滑鼠右鍵,點選「修改」。

6.將「數值資料」改為「0」,點選「確定」。

7.關閉「登錄編輯程式」,結束登錄檔案的修改。

8.點選「開始\重新啟動」,重新開啟Window 7

9.開機後,按鍵盤的「Delete」按鍵進入BIOS設定,按鍵盤的方向鍵,選擇「Adcanced」的「Integrated Peripherals」,準備更改硬碟的設定。更多的BIOS設定詳見:設定SATA硬碟為AHCIIDE模式設定BIOS的開機順序為光碟優先

10.按鍵盤向下方向鍵選擇「onboard ASTA Mode」,再按鍵盤的「Enter」鍵,確認選取。

11.如下圖所示,SATA硬碟目前的設定為Native IDE模式。

12.按鍵盤的向下方向鍵,選擇AHCI模式,按鍵盤的「Enter」鍵確認選取。

13.如下圖所示,SATA硬碟已經更改為AHCI模式。按鍵盤的「F10」鍵,再按鍵盤的「Enter」鍵,確認BIOS的更改,重新啟動電腦。

14.Windows 7重新啟動以後,點選「開始」,對著「電腦」按滑鼠右鍵,點選「管理」。

15.選擇「裝置管理員」。

16.開啟「IDE ATA/ATAPI控制器」,顯示硬碟已經更改為AHCI模式。

2014年1月28日 星期二

用 NLite 製作含驅動程式的系統安裝光碟

摘錄至 Dr.j
81eeb381e3e9df79ba87914d9d8bca4417603b4f 因為隨身碟、光碟實在太方便,現在大多數的電腦早就已經不搭配1.44吋磁碟機了。最麻煩的就是在裝機時還得要透過它來安裝SATA驅動程式才行。其實是 有辦法可以將各種驅動程式加到Windows XP的安裝光碟中的,網路上就有不少人提供整合SP3的光碟供網友下載。製作整合包並不是件難事,透過nLite這款免費工具就可以辦得到。
nLite的功能相當強大,除了加入Windows沒有內建的驅動程式、整合SP更新套件以外,還可以設定安裝參數,安裝多台電腦時相當方便。 而SATA的驅動程式在主機板隨附的光碟中都可以找到,或者到主機板廠商網站,下載有SATA、AHCI等關鍵字的驅動程式都可使用。
不過,Dr.J還是要再次提醒大家,雖然Windows XP快要隨著Windows 7的到來而走向淘汰,但是還是要使用正版軟體,或者可以嘗試挑戰Ubuntu之類的開放授權系統。

Step 1

到網址「www.nliteos.com/download.html」下載nLite 1.49版,小心別點到一旁的廣告。

Step 2

nLite有內建中文介面,支援Windows 2000、XP與Server 2003等版本。

Step 3

接著會要你選擇兩個位置,一個是Windows安裝光碟所在的位置,另外一個是整合驅動程式後的儲存資料夾。選完以後程式就會自動將光碟內容轉入資料夾中。

Step 4

nLite可以用來整合SP、Service Pack、Windows更新和驅動程式,記得要勾選最後一項「可開機ISO映像檔」, 燒錄光碟比較方便。

Step 5

主機板驅動程式中的AHCI就是安裝時所需的驅動程式,如果是執行檔的話就先解壓縮, 透過程式選擇加入後, 記得勾選「正規的PNP驅動程式」。

Step 6

接著程式就會自動進行整合工作,將整合完畢的ISO檔案燒錄在光碟上就可以正常安裝。