Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

powershell not mapping drive from bat file

$
0
0

Once again, this GREATLY dumbed down to simplify the error. I have a bat file that maps a local drive from a UNC share. Contents of my bat file (map.bat) are:

net use Z: "\\myserver\e$\apps\Data" /USER:mydomain\myuser mypass

The bat file works flawlessly, and I can then look at my Z: files from windows explorer. When I run the bat file from a powershell command, it says it completes successfully, yet I cannot see the Z: drive. Contents of my powershell are:

Invoke-Command-ComputerNamelocalhost-ScriptBlock{E:\Scripts\Setup\Company\Map.bat}

This makes no sense to me at all. If the bat works, why wouldn't the powershell?

mpleaf


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

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