question

ErikGroen-6374 avatar image
0 Votes"
ErikGroen-6374 asked RichMatheisen-8856 answered

Create folder with WMI with alternate credentials

Goodday,

I have a powershell script to create a folder on a remote computer with WMI. But i need to run this with alternate credentials. Normally we would just ad -credential $cred to the command but i don't know where to put it in this case.

$computer = "COMPUTERNAME" //add the computername where the folder needs to bee created
$pathname = "PATHNAME''//Add the path and foldername to be added
$p = [WMIClass]"\\$computer\root\cimv2:Win32_Process" //Start local proces with help of WMI
$p.Create("cmd.exe /c md $pathname") // run CMD to execute the action



windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.