2012-12-09

Adfind

http://www.joeware.net/freetools/tools/adfind/index.htm


adfind –b <Search Base> -s <Search Scope> -f <Search Filter> attributesDesired

1.所以對域中所有計算機對象的DN 和說明的查詢應為:
adfind –b dc=contoso,dc=com –s subtree –f (objectcla​​ss=computer) dn description

2.對所有用戶對象的查詢如下所示:
adfind –b dc=contoso,dc=com –s subtree –f "(&(objectcategory=person) (objectcla​​ss=user))" dn description

Forfiles


http://technet.microsoft.com/en-us/library/cc753551(WS.10).aspx
Syntax

forfiles [/p Path] [/m SearchMask] [/s] [/c Command] [/d[{+ | -}] [{MM/DD/YYYY | DD}]]

Parameters

/p Path
指定您要在其上開始搜尋的 Path。預設資料夾為目前的工作目錄,您可以透過輸入句點 (.) 來指定。
/m SearchMask
依據 SearchMask 來搜尋檔案。預設的 SearchMask 為 *.*。
/s
指示 forfiles 在子目錄中搜尋。
/c Command
在每個檔案上執行指定的 Command。您必須將帶有空格的命令字串包含在引號中。預設的 Command 為 "cmd /c echo @file"。
/d[{+ | -}] [{MM/DD/YYYY | DD}]
選取日期大於等於 (+) 或小於等於 (-) 指定日期的檔案,其中 MM/DD/YYYY 是指定的日期,而 DD 是目前日期減去 DD 天。如果您未指定 + 或 -,則會使用 +。DD 的有效範圍為 0 - 32768。
/?
在命令提示字元上顯示說明。
Remarks

Forfiles 最常使用於批次檔案中。

Forfiles /s 與 dir /s 類似。
下列表格列出了您可以在 /cCommand 命令字串中使用的變數。

變數 描述
@file 檔案名稱

@fname 不含副檔名的檔案名稱

@ext 副檔名

@path 檔案的完整路徑

@relpath 檔案的相對路徑

@isdir 如果檔案類型是目錄,則判斷值是 TRUE,否則判斷值是 FALSE。

@fsize 檔案大小 (以位元組為單位)

@fdate 檔案上的上次修改日期戳記

@ftime 檔案上的上次修改時間戳記

使用 forfiles,您可以在多個檔案上執行命令,或將引數傳送到多個檔案。例如,您可以在樹狀目錄中帶有 *.txt 副檔名的所有檔案上執行 TYPE 命令。或者,您可以執行 C: 磁碟機上的每個批次檔案 (*.bat),以檔案名稱 Myinput.txt 作為第一個引數。

使用 forfiles,您可以執行下列任何一項動作:

使用 /d 按絕對或相對日期選取檔案。

使用變數,例如 @fsize (檔案大小) 及 @fdate (檔案日期),來建立檔案的保存樹狀目錄。

使用 @isdir 變數以從目錄中區分檔案。

藉由在命令列中包含特殊字元,及使用十六進位字碼 0xHH 包圍字元,來格式化輸出。

Forfiles 藉由執行工具 (設計用於僅處理單一檔案)上的 recurse subdirectories 旗標來運作。

Examples

若要列出 C: 磁碟機上的所有批次檔案,請輸入:

forfiles /p c:\ /s /m *.bat /c "cmd /c echo @file is a batch file"

若要列出 C: 磁碟機上的所有目錄,請輸入:

forfiles /p c:\ /s /m *.* /c "cmd /c if @isdir==true echo @file is a directory"

若要列出 C: 磁碟機上 100 天之前的所有檔案,請輸入:

forfiles /p c:\ /s /m *.* /dt-100 /c "cmd /c echo @file :date >= 100 days"

若要列出 C: 磁碟機上 1993 年 1 月 1 日之前的所有檔案,再為這些檔案顯示 "file is quite old!",請輸入:

forfiles /p c:\ /s /m *.* /dt-01011993 /c "cmd /c echo @file is quite old!"

若要列出 C: 磁碟機上所有檔案的所有副檔名(按欄位格式),請輸入:

forfiles /p c:\ /s /m *.* /c "cmd /c echo extension of @file is 0x09@ext0x09" With:

若要列出 C: 磁碟機上的所有批次檔案,請輸入:

forfiles /p c:\ /s /m *.bat /c "cmd /c echo @file is a batch file"

若要列出 C: 磁碟機上的所有目錄,請輸入:

forfiles /p c:\ /s /m *.* /c "cmd /c if @isdir==true echo @file is a directory"

若要列出 C: 磁碟機上 100 天之前的所有檔案,請輸入:

forfiles /p c:\ /s /m *.* /d t-100 /c "cmd /c echo @file :date >= 100 days"

若要列出 C: 磁碟機上 1993 年 1 月 1 日之前的所有檔案,再為這些檔案顯示 "file is quite old!",請輸入:

forfiles /p c:\ /s /m *.* /d t-01011993 /c "cmd /c echo @file is quite old!"

若要列出 C: 磁碟機上所有檔案的所有副檔名(按欄位格式),請輸入:

forfiles /p c:\ /s /m *.* /c "cmd /c echo extension of @file is 0x09@ext0x09"


#刪除超過7天,位於 c:\windows\Temp 路徑中檔名 sess開頭的檔案
forfiles /P c:\Windows\Temp /M sess_* /S /D -7 /C "cmd /c del /F @path"

2012-11-17

The procedures for obtaining diagnostic information for VMware vCenter Server

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1011641#method1

2012-10-13

MRBS -- LDAP

mrbs 1.4.8 on OB2D with "apt-get install php5-ldap"

check ldap log
/var/log/apache2/error.log

systemdefaults.inc.php

$auth["type"] = "ldap";
$ldap_host = "server.abc.com";
$ldap_port = 389;
$ldap_v3 = false;
$ldap_tls = false;
$ldap_base_dn = "c=uers,DC=abc,DC=com";
$ldap_user_attrib = "uid";
$ldap_dn_search_attrib = "sAMAccountName";
$ldap_dn_search_dn = "CN=user,cn=users,DC=abc,DC=com";
$ldap_dn_search_password = "xxxxxx";

$ldap_disable_referrals = TRUE;
$ldap_get_user_email = FALSE;
$ldap_email_attrib = "mail";
//$ldap_unbind_between_attempts = TRUE;
$ldap_debug = TRUE;

//$ldap_filter = "memberof=cn=MRBSUsers,ou=MRBS,ou=Groups,dc=ufv,dc=ca";
//$ldap_admin_group_dn = "cn=MRBSAdmins,ou=MRBS,ou=Groups,dc=ufv,dc=ca";
//$ldap_group_member_attrib = "memberof";


auth_ldap.inc



// Turn any non-array config items into arrays in $all_ldap_opts
+  if (!isset($count))
+  {
+    $count = 1;
+  }
foreach ($config_items as $item)
{
if (!isset($$item))

Windows How to Finding non present devices

1. Open Command shell
2. type "set devmgr_show_nonpresent_devices=1"
3. type "start devmgmt.msc"
4. Select "Show hidden devices"

2012-09-30

Ubuntu -- Learning

@How to configure network setting to use static IP address
sudo vi /etc/network/interfaces


 1 auto lo
 2 iface lo inet loopback
 3
 4 auto eth0
 5 iface eth0 inet static
 6 address 192.168.0.1 # 固定 IP 位址
 7 netmask 255.255.255.0   # 網路遮罩
 8 gateway 192.168.0.254 # 預設閘道

 sudo /etc/init.d/networking restart #重啓網路服務

@How to configure DNS server setting
sudo vim /etc/resolv.conf


 1# DNS of Google
 2#nameserver  8.8.4.4
 3#nameserver  8.8.8.8
 4
 5# DNS of HiNet
 6#nameserver  168.95.1.1
 7#nameserver  168.95.192.1

sudo /etc/init.d/networking restart #重啓網路服務

@How to install LAMP
sudo apt-get install tasksel
sudo  tasksel

#select LAMP to install
$sudo vi /var/www/info.php #to vi info.php

<?php
phpinfo();
?>
$sudo /etc/init.d/apache2 restart  #to restart Apache service
Visit http://192.168.0.1/info.php

@How to install phpmyadmin
sudo  apt-get  install  phpmyadmin

http://ip/phpmyadmin #to test


Linux -- 檔案系統樹狀標準


  • 根目錄 (/):為整個檔案系統樹狀結構的根,也就是整個檔案系統的根目錄。
  • /bin: 此目錄中存放著許多的 Binary 執行檔案,為一般及啟動時常常會使用到的檔案,例如 ls、cp、rm ...等指令。
  • /sbin:此目錄中存放著許多的 System Binary 執行檔案,為系統管理時常常會使用到的檔案,例如 shutdown、fsck、quotacheck...等指令。
  • /etc:此為 Linux 系統中相當重要得目錄,大部份的設定檔都存放於此,例如檔案系統掛載設定檔 /etc/fstab、IPTables 防火牆設定檔 /etc/sysconfig/iptables...等。
  • /lib:存放 Linux 系統中各種共用的 Library 函式庫檔案,類似於 Windows 作業系統的 DLL 動態連結函式庫一樣的功能。
  • /dev:Linux 系統是以 Everything is Files 的觀念來進行管理 Device 硬體裝置,因此硬體設備及週邊設備也不例外,此目錄中存放著所偵測到的相關硬體檔案,例如 光碟機為 /dev/cdrom、SCSI 硬碟為 /dev/sda...等,為相容舊版系統而存在。
  • /sys:存放 System-Device 相關資訊 (由 RHEL 4 開始才有此資料夾),如 PnP...等,會將偵測到的 Device 資訊回寫至 /dev 對應的檔案內以相容舊版,所以舉例來說當主機插入 USB 隨身碟時會同時建立 /sys/block/sdb 以及回寫至 /dev/sdb 內。
  • /selinux:存放 Linux 增強安全性機制 SELinux (Security Enhanced Linux) 相關檔案。
  • /var 具備 Variable 也就是變動特性的檔案將存放於此,例如 系統的各式日誌檔案 /var/log、使用者電子信箱 /var/mail、正在執行的執行序 /var/run/*.pid ...等。
  • /srv:存放相關的 Server-data。(由 RHEL 4 開始才有此資料夾)
  • /usr:Linux 系統中大部份的 安裝套件及相關應用程序 都存放於此,例如其它網路服務的執行程序 /usr/sbin、核心原始碼檔案 /usr/src...等,類似於 Windows 作業系統的Program Files 資料夾。
  • /opt:Optional 通常非預設安裝的套件會安裝於此,例如 Oracle 資料庫...等。
  • /lost+found: 在每個獨立的掛載點內都會有此資料夾,當 Linux 系統不正常關機時相關資料便會暫存於此。
  • /mnt: 用於 臨時掛載的目錄,通常會手動執行將外接設備掛載於此。(Kernel 2.4.x 使用)
  • /media: 若 RunLevel 為 5 也就是進入圖形介面時 (由 RHEL 4 開始才有此資料夾),若主機有插入 USB 或其它外接設備時則會自動掛載於此目錄上 (不需手動掛載)。(Kernel 2.6.x 使用)
  • /misc、/net: 用於 autofs 自動掛載時所使用的資料夾,例如 Linux 主機成為 LDAP、NIS Client 時便會將相關資料夾自動掛載於此,類似於 Windwos 作業系統中網路芳鄰的概念。
  • /tmp: 暫存資料夾,存放暫時性的資料夾及檔案,通常 Linux 系統重新啟動或關機以及排程會自動清空此資料夾內容。
  • /proc: Linux 系統中目前所執行的 執行序 Process 即存放於此資料夾,當該執行序停止執行則位於此資料夾中的 Process ID 或檔案將消失 (事實上此資料夾就是 Memory 中的暫存資料),至於有些檔案的大小為何是 0? 例如 meminfo、cpuinfo 則只是為了要達成 Everything is Files 的觀念而以,但仍可查看及檔案內容。
  • /boot: 存放 Linux 系統開機時相關引導檔案,例如 Boot Loader 設定檔 /boot/grub/grub.conf、初始化映像檔 .img...等。
  • /home: 所有 一般使用者帳號的家目錄,例如 使用者帳號 weithenn 的家目錄為 /home/weithenn。
  • /root: Linux 系統超級管理者的家目錄。