回答:
Win32_Share Createメソッドを使用します。例:
(Get-WmiObject -List -ComputerName . | Where-Object -FilterScript 
{$_.Name -eq "Win32_Share"}).InvokeMethod("Create",
   ("C:\FolderToShare","ShareName",0,100,"Share description"))
このメソッドのドキュメントは、MSDNにあります。
uint32 Create(
  [in]  string Path,
  [in]  string Name,
  [in]  uint32 Type,
  [in]  uint32 MaximumAllowed,
  [in]  string Description,
  [in]  string Password,
  [in]  Win32_SecurityDescriptor Access
);
パラメーター:
アクセス許可を設定する方法の詳細については、MSDNのこのページを参照してください:Win32_SecurityDescriptor Class。この記事は、WMIタスク:ファイルとフォルダーも出発点として適しています。
以下の関数は一例であり、必要に応じて変更できます。主な制限は、共有をホストするマシンで実行する必要がある(または、PSリモーティングを使用して最初にそのマシンに到達する)ことです。スクリプトを実行するアカウントには、共有を作成するための十分な権限も必要です。
書かれているようDirectoryInfoに、それは引数としてオブジェクトを期待しますが、文字列に適合させることは難しくありません。この例には、それぞれ異なる種類のアクセス権を持つ2つの異なるオブジェクト(1つのユーザーと1つのグループ)のフォルダーに対するアクセス許可が含まれているため、複雑なアクセス許可要件を組み合わせて照合する方法を確認できます。
# $folder is a DirectoryInfo object
Function Create-FileShare($folder)
{
    $name = $folder.Name
    $path = $folder.FullName
    $description = "$name"
    $domain = "example.com" #AD Domain name here (Optional/Not really used/Here for completeness)
    $Method = "Create"
    $sd = ([WMIClass] "Win32_SecurityDescriptor").CreateInstance()
    #AccessMasks:
    #2032127 = Full Control
    #1245631 = Change
    #1179817 = Read
    #Share with the user
    $ACE = ([WMIClass] "Win32_ACE").CreateInstance()
    $Trustee = ([WMIClass] "Win32_Trustee").CreateInstance()
    $Trustee.Name = $name
    $Trustee.Domain = $Null
    #original example assigned this, but I found it worked better if I left it empty
    #$Trustee.SID = ([wmi]"win32_userAccount.Domain='$domain',Name='$name'").sid    
    $ace.AccessMask = 1245631 
    $ace.AceFlags = 3 #Should almost always be three. Really. don't change it.
    $ace.AceType = 0 # 0 = allow, 1 = deny
    $ACE.Trustee = $Trustee 
    $sd.DACL += $ACE.psObject.baseobject 
    #Share with Domain Admins
    $ACE = ([WMIClass] "Win32_ACE").CreateInstance()
    $Trustee = ([WMIClass] "Win32_Trustee").CreateInstance()
    $Trustee.Name = "Domain Admins"
    $Trustee.Domain = $Null
    #$Trustee.SID = ([wmi]"win32_userAccount.Domain='$domain',Name='$name'").sid    
    $ace.AccessMask = 2032127
    $ace.AceFlags = 3
    $ace.AceType = 0
    $ACE.Trustee = $Trustee 
    $sd.DACL += $ACE.psObject.baseobject        
    $mc = [WmiClass]"Win32_Share"
    $InParams = $mc.psbase.GetMethodParameters($Method)
    $InParams.Access = $sd
    $InParams.Description = $description
    $InParams.MaximumAllowed = $Null
    $InParams.Name = $name
    $InParams.Password = $Null
    $InParams.Path = $path
    $InParams.Type = [uint32]0
    $R = $mc.PSBase.InvokeMethod($Method, $InParams, $Null)
    switch ($($R.ReturnValue))
     {
          0 {Write-Host "Share:$name Path:$path Result:Success"; break}
          2 {Write-Host "Share:$name Path:$path Result:Access Denied" -foregroundcolor red -backgroundcolor yellow;break}
          8 {Write-Host "Share:$name Path:$path Result:Unknown Failure" -foregroundcolor red -backgroundcolor yellow;break}
          9 {Write-Host "Share:$name Path:$path Result:Invalid Name" -foregroundcolor red -backgroundcolor yellow;break}
          10 {Write-Host "Share:$name Path:$path Result:Invalid Level" -foregroundcolor red -backgroundcolor yellow;break}
          21 {Write-Host "Share:$name Path:$path Result:Invalid Parameter" -foregroundcolor red -backgroundcolor yellow;break}
          22 {Write-Host "Share:$name Path:$path Result:Duplicate Share" -foregroundcolor red -backgroundcolor yellow;break}
          23 {Write-Host "Share:$name Path:$path Result:Reedirected Path" -foregroundcolor red -backgroundcolor yellow;break}
          24 {Write-Host "Share:$name Path:$path Result:Unknown Device or Directory" -foregroundcolor red -backgroundcolor yellow;break}
          25 {Write-Host "Share:$name Path:$path Result:Network Name Not Found" -foregroundcolor red -backgroundcolor yellow;break}
          default {Write-Host "Share:$name Path:$path Result:*** Unknown Error ***" -foregroundcolor red -backgroundcolor yellow;break}
     }
}
              Windows 7の場合、これを試してください。
net SHARE share=d:\share /GRANT:EVERYONE`,FULL /REMARK:"
上記はPowerShellでも動作します。注意前に、FULL