Изменение настроек общих ресурсов

$shareName="'fso'"
$maxAllowed="5"
$description="Test share"
$wmiClass="Win32_share"

$objService=Get-WmiObject -Class $wmiClass -filter "name=$shareName"
$errRTN=$objService.setShareInfo($maxAllowed,$description)

"Set share info completed with a return code of $($errRTN.returnvalue)"

или

param($shareName="'fso'", $maxAllowed=5, $description="Test script")

$wmiClass="Win32_share"
$objService=Get-WmiObject -Class $wmiClass -filter "name=$shareName"
$errRTN=$objService.setShareInfo($maxAllowed,$description)

"Set share info completed with a return code of $($errRTN.returnvalue)"

Также интересно:

или

param($shareName="'fso'", $maxAllowed=5, $description="Test script")

Function funlookup($intIN)
{
 Switch($intIN)
 {
  0  { "Success" }
  2  { "Access denied" }
  8  { "Unknown failure" } 
  9  { "Invalid name" } 
  10 { "Invalid level" } 
  21 { "Invalid parameter" } 
  22 { "Duplicate share" } 
  23 { "Redirected path" } 
  24 { "Unknown device or directory" } 
  25 { "Net name not found" }
  DEFAULT { "$intIN is an Unknown value" }

 }
}

$wmiClass="Win32_share"
$objService=Get-WmiObject -Class $wmiClass -filter "name=$shareName"
$errRTN=$objService.setShareInfo($maxAllowed,$description)

#"Set share info completed with a return code of $($errRTN.returnvalue)"

funLookup($errRTN.returnValue)
0
Голосов пока нет

Оставить комментарий