Monday, January 19, 2009

network share and networked drive

[] to create a network share

PS> (Get-WmiObject -List -ComputerName . | Where-Object -FilterScript {$_.Name -eq "Win32_Share"}).Create("C:\temp","TempShare",0,25,"test share of the temp folder")

[] to remove a network share

PS> (Get-WmiObject -Class Win32_Share -ComputerName . -Filter "Name='TempShare'").Delete()

[] to create a new networked drive that maps the share \\FPS01\users to local drive B:

PS> (New-Object -ComObject WScript.Network).MapNetworkDrive("B:", "\\FPS01\users")

No comments:

Post a Comment