Mar 12 2010 4:06PM GMT
Posted by: Richard Siddaway
PowerShell v2, Shares, WMI
Shares: Creating I
Posted by: Richard Siddaway
we’ve seen a few things we can do with shares – its time to look at creating them. A simple share craetion script will look like this
|
001
002 003 004 005 006 |
New-Item -Path c:\ -Name share1 -ItemType Directory
New-Item -Path c:\share1 -Name shareA -ItemType Directory New-Item -Path c:\share1 -Name shareB -ItemType Directory $s = [WmiClass]"Win32_Share" |
We create some folders in a hierarchy with New-Item and then create an instance of the Win32_Share class using the [WmiClass] type accelerator.
We can then call the create method. The parameters are:
- folder path
- share name
- share type – 0 = disk share
- maximum connections allowed – $null means unlimited
- description
This sets default permissions on the share
Technorati Tags: PowerShell,share




