Ok this is a fun one I could really use some help on.
We are trying to get SCCM to re-partition empty disks for bare metal installs. However there is a problem, you must pipe in a text file toDISKPART to make it work. Well there is no NTFS file system to put the file on.
So our solution is to run a http get of the text file to the ram drive (x:).
Our only problem is that we can only run one liners from the command shell not the powershell.
So this is what we got so far:
powershell.exe -command "($DL = New-Object System.Net.WebClient).DownloadFile(\"http://www.microsoft.com/favicon.ico\",
\"c:\wipe.ico\")"
Note: URL and files changed so you can run command.
Notice we are escaping the double quotes but we have one last problem, its not taking both DownloadFile parameters. I get the following error:
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At line:1 char:2
+ ($DL = New-Object System.Net.WebClient).DownloadFile("http://www.microsoft.com/f ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Can anyone help figure out this last bit? I tried escaping the comma using ^ but that didnt do it. I think anything within the outer quotes is good to go yet its not working.
Remember I can only call a single line powershell.exe -command <Blah>
Please help! :D