powershell 獲取共享

Function FunWMI($strShare)

{

    Get-WmiObject win32_share -Filter "type=$strShare"

}

if(!$args)

{

    Write-Host "You must supply an argument.Try ArgsShare.ps1 ?"

}

else

{

    $strShare=$args

    switch($strShare)

    {

        "admin" {$strShare=2147483648 ; FunWMI($strShare)}

        "print" {$strShare=2147483649;FunWMI($strShare)}

        "file"{$strShare=0;FunWMI($strShare)}

        "ipc"{$strShare=2147483651;FunWMI($strShare)}

        "all"{Get-WmiObject -Class win32_share}

        Default{Write-Host "You must supply either :admin、print、file、ipc、or all`n Example:>ArgsShare.ps1 admin"}

    }

}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章