Hello everyone,
I have some users who need to have a VHD connected to a local mount point when they logon to a VM. It all works OK at the moment with a straightforward batch file, but I want to move it into PS to
a) stop a new console window appearing with the Diskpart output, and
b) capture the Diskpart output to a text file for each user (and add some more error checking etc later in the script)
At the moment it work as expected when a local admin logs on (ie no console, and output to file), but for a normal user it still opens a new console window for the Diskpart. It does create the DiskpartOutput.txt file, but it does not redirect the Diskpart output to the file. (NB Diskpart does run OK for normal users, as we have given all users access to run it)
Write-Host "`n Attaching VHDs..."Start-Process diskpart.exe -ArgumentList "/S \\networkshare\config\diskpart.txt" -RedirectStandardOutput $UserVhomeshare\DiskpartOutput.txt -wait -NoNewWindow
it also has to wait until the diskpart has finished before continuing with the script, as the VHD's contain SQL data which is needed by the next step which starts the SQL services...
Any ideas gratefully appreciated :-)
David.