Dave Susemiehl wrote:
>I have a long script for setting up client ou's share folders etc and we
>are
> moving to Windows 2008. I want to get the VBScript working before
> tackling
> the task of proting it to PowerShell and I have one peice that's not
> working
> I was hoping someone would have some insite into it. I need to be able to
> create a share on a Windows 2008 file server (64 Bit)
>
> Here's the code that works in our Windows 2003 environment (I added the
> Echo
> for testing). All the variables are defined earlier in the script (FS=0)
>
> Set objWMIService = GetObject("winmgmts:" &
> "{impersonationLevel=impersonate}!\\" & strServer & "\root\cimv2")
> Set objNewShare = objWMIService.Get("Win32_Share")
> MkShr = objNewShare.Create (strSharePath,strShareName,FS,,strShareDesc)
> wscript.echo MkShr
>
> The return code is an 8 (unknown error) when I try to run it.
>
> Any help would be greatly appreciated. and I'm not oppsed to doing
> somethign completely different (except Powershell I don't have the time
> right
> now to port the entire script to powershell right now). Does it work if you specify a value for maximum connections? For example:
MkShr = objNewShare.Create (strSharePath,strShareName,FS,25,strShareDesc)
I see the documentation says this parameter can be blank. I don't see any
documentation yet that mentions W2k8. In the past I've used LanmanServer and
the WinNT provider to create shares. For example:
strDomain = "MyDomain"
strComputer = "MyServer"
strShare = "MyShareName"
strFileSharePath = "c:\MyFolder"
strDescription = "Admin Files"
Set objComputer = GetObject("WinNT://" & strDomain & "/" & strComputer &
"/LanmanServer")
Set objShare = objComputer.Create("fileshare", strShare)
objShare.Path = strFileSharePath
objShare.Description = strDescription
objShare.MaxUserCount = -1
objShare.SetInfo
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--