![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Re: Connecting to a share that requires authentication What do you mean by "only recognizes"? As in, what particular error are you getting? I suspect that your problem is the omitted profile update value, which automatically gets populated (in between strDrivePath and strUser). If you tried a direct translation into PS you probably encountered the error Missing expression after ','. since PowerShell parses the array of values and sees there is nothing between the two commas. If you simply omitted the two commas, you would be trying to set the flag for updating the profile to the value of the user name instead of a true/false value, and PS was probably throwing a type mismatch error. Here's how you actually want to do this: explicitly include the bUpdateProfile boolean that goes between the UNC path and the username; like this: $net = New-Object -ComObject WScript.Network $net.MapNetworkDrive("X:\", "\\server\public", $false, "MyName", "MyPassword") That should work. "Michael Powe" <michael+gnus@xxxxxx> wrote in message news:u63plrypv.fsf@xxxxxx Quote: > Hello, > > I have a VBS script that connects to a remote share in order to copy > files from it. The share requires authentication, which is done in > VBS using this code: > > Set oNetwork = CreateObject("Wscript.Network") > oNetwork.MapNetworkDrive strDriveId, > strDrivePath,,strUser,strPass > > From googling, I see how to clone this process in PS, except that the > PS connection will not accept the user/password parameters for the > call to MapNetworkDrive. It only recognizes a mapping process using > the first two parameters. > > Is there a way, within PS itself, to connect to a remote share that > requires authentication? This cannot be interactive, the script is > intended to run automatically on a schedule. > > Thanks. > > mp > > -- > cat: $HOME/.signature: No such file or directory |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Connecting to a share that requires authentication >>>>> "Alex" == Alex K Angelopoulos <aka(at)mvps.org> writes: Alex> What do you mean by "only recognizes"? As in, what Alex> particular error are you getting? Alex> I suspect that your problem is the omitted profile update Alex> value, which automatically gets populated (in between Alex> strDrivePath and strUser). If you tried a direct translation Alex> into PS you probably encountered the error Missing Alex> expression after ','. since PowerShell parses the array of Alex> values and sees there is nothing between the two commas. If Alex> you simply omitted the two commas, you would be trying to Alex> set the flag for updating the profile to the value of the Alex> user name instead of a true/false value, and PS was probably Alex> throwing a type mismatch error. Yep, you are right. It was the missing value that was causing the problem. Your solution is correct. Thank you very much. mp -- cat: $HOME/.signature: No such file or directory |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Connecting to a share that requires authentication VBScript is usually pretty straightforward to translate, but the function calls can be a problem due to the weird VBScript syntax - and in particular, when you see a leading a comma or two commas doubled up in a demo, beware; there's some VBScript magic that they're not telling you about. ; ) "Michael Powe" <michael+gnus@xxxxxx> wrote in message news:u3akp3rc5.fsf@xxxxxx Quote: Quote: Quote: >>>>>> "Alex" == Alex K Angelopoulos <aka(at)mvps.org> writes: > Alex> What do you mean by "only recognizes"? As in, what > Alex> particular error are you getting? > > Alex> I suspect that your problem is the omitted profile update > Alex> value, which automatically gets populated (in between > Alex> strDrivePath and strUser). If you tried a direct translation > Alex> into PS you probably encountered the error Missing > Alex> expression after ','. since PowerShell parses the array of > Alex> values and sees there is nothing between the two commas. If > Alex> you simply omitted the two commas, you would be trying to > Alex> set the flag for updating the profile to the value of the > Alex> user name instead of a true/false value, and PS was probably > Alex> throwing a type mismatch error. > > Yep, you are right. It was the missing value that was causing the > problem. Your solution is correct. > > Thank you very much. > > mp > > -- > cat: $HOME/.signature: No such file or directory |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| My server requires authentication | Vista mail | |||
| how to send email if my SMTP server requires authentication | VB Script | |||
| Re: Connecting to a share that requires authentication | PowerShell | |||
| Mapped drive to 2003 DC always requires authentication after reboo | Vista account administration | |||
| My Server requires authentication | Vista mail | |||