若要创建网络共享,请使用 Win32_Share 的 Create 方法:
(Get-CimInstance -List |
Where-Object {$_.Name -eq 'Win32_Share'}).Create(
'C:\temp','TempShare',0,25,'test share of the temp folder'
)
还可以在 Windows 上的 PowerShell 中使用 net share 来创建共享:
net share tempshare=c:\temp /users:25 /remark:"test share of the temp folder"