[Windows] How to count CIFS/SMB files in a folder or a directory ?

運用PowerShell來計算檔案及目錄數
**計算檔案數量**
Get-ChildItem \\CIFS-IP\Share-Volume -Recurse -File | Measure-Object | %{$_.Count}
**計算目錄數量**
Get-ChildItem  \\CIFS-IP\Share-Volume -Recurse -Directory | Measure-Object | %{$_.Count}
PS: 在 Restricted 可執行無需 bypass 或 unrestricted
運用命令提示列 (cmd.exe)
dir *.* /w /s
count-file2.jpg

Windows Server 2008 設定 共用磁碟 安全性(Security) 或 擁有者(Owner) 會發生"無法列舉容器中的物件。拒絕存取。"

客戶反應他們NetApp 移轉到另一台同型號,請我們initialize 另一台FAS-series也設定好cifs shares ,
測試目錄設定安全性(Security) 或變更擁有者(Take owner) 會發生錯誤訊息 " 無法列舉容器中的物件。拒絕存取 "

(前提:該使用者非Domain Admins Groups member)
他們發現若是replication過去的volume分享出來無論是作變更安全性或是擁有者都很正常 !
若在另一台新機作變更安全性或是擁有者卻有錯誤訊息 " 無法列舉容器中的物件。拒絕存取 “但還是有套用成功只是都會有錯誤訊息。

最後查證後只要是NetApp 新建volume後cifs shares出來空的目錄就會如此,但若新建後放些檔案及目錄則為正常,原來是微軟 KB972299 Bug搞的鬼。

Microsoft原廠KB 972299說明可以忽略此一錯誤無patch ….Orz


Reference:

Microsoft KB972299

[NetApp] FAS25xx-series clean ADP configuration

因目前至今NetApp FAS25xx-series大多是配C-DOT 8.3.x,因此它出廠預設會是啟用ADP ( Advanced Drive Partitioning ) ,若總數硬碟落在48顆左右則建議用ADP,OK..今日重點在於拿掉ADP 下作成的 Root-data partitioning (shared disks) .

workaround#1

step01.
enter LOADER>

step02.
LOADER> set-defaults
LOADER> saveenv

step03.
LOADER> boot_ontap

step04.
Ctrl+C , choice “5″ enter mainteance mode

step05.
*> aggr status // check current have root aggregate , if yes > offline / destroy it
*> aggr offline {aggregate-name}
*> aggr destroy {aggregate-name}

step06.
*> disk show // check ownership
*> disk remove_ownership  // each node type this command , remove disk ownership
*> disk assign all // temporary assign one node , then it doing unpartitiion action

step07.
*> disk unpartition {disk} , choice “no"  // be one by one

step08.
Finial , each re-assign disk , do option “4″ initialize

*************************************************************************************************

workaround#2

step01.
enter LOADER/CFE

step02.

LOADER> set-defaults
LOADER> setenv bootarg.init.boot_clustered true
LOADER> setenv bootarg.factory_init_completed true
LOADER> setenv bootarg.init.clearvarfsnvram true

LOADER> saveenv

step03.

When the nodes are booting, press CTRL+C to enter the Boot menu.
*******************************
* *
* Press Ctrl-C for Boot Menu. *
* *
*******************************

Boot Menu will be available.

step04.

At the Boot menu, type wipeconfig on each node.
Please choose one of the following:
(1) Normal Boot.
(2) Boot without /etc/rc.
(3) Change password.
(4) Clean configuration and initialize all disks.
(5) Maintenance mode boot.
(6) Update flash from backup config.
(7) Install new software first.
(8) Reboot node.

Selection (1-8)? wipeconfig 

step05.

After running the wipeconfig command, select option (4)
Please choose one of the following:
(1) Normal Boot.
(2) Boot without /etc/rc.
(3) Change password.
(4) Clean configuration and initialize all disks.
(5) Maintenance mode boot.
(6) Update flash from backup config.
(7) Install new software first.
(8) Reboot node.

Selection (1-8)?  4

step06.

Answer yes to zero/erase all disks
Zero disks, reset config and install a new file system?: yes
This will erase all the data on the disks, are you sure?: yes

Rebooting to finish wipeconfig request

done.


Reference:

1. https://www.linkedin.com/pulse/clean-disk-ownership-netapp-cdot-83x-adp-john-an-vmware

2. KB Doc ID 1014631