Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Using LanManServer with Powershell

$
0
0

Hi,

I have the following code on a vbscript that creates shares on a filer:

strMyDate = (RIGHT("0" &Day(Date),2) & "." & RIGHT("0" &Month(Date),2) & "." & Year(Date))
Set objDestHost = GetObject("WinNT://" & strDestServer & "/LanManServer")
 
 strUserID = "_" & strUserName & "$"
 objUserMigLog.WriteLine "Action,Create share using name: " & strUserID
 strNewPath = strDestPath & "\" & strUserName
 objUserMigLog.WriteLine "Action,Create share using path: " & strNewPath
 strNewShare = "\\" & strDestServer & "\" & strUserID

 Set objNewShare = objDestHost.Create("fileshare", strUserID)  
 objNewShare.Path = strNewPath
 objNewShare.Description = strUserName & " home share - created " & strMyDate
 objNewShare.SetInfo
 objUserMigLog.WriteLine "Action, Created share: " & strNewShare & " on server: " & strDestServer

I would like to do something similar with powershell but have not found a solution to date.  The problem that arises is that I can not use WMI in order to create the share or any other method available to powershell.  Any suggestions?

Thanks!



Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>