I am trying to create a script which will create a directory in the C:\Program Files folder.
I am able to run the line to create it fine when I run in via an elevated powershell prompt manually - however when I run it via a script (elevated still) it simply creates a "file" object with the name I want instead of a folder.
Here is the code I am using to write the folder:
New-Item -ItemType Directory -Force -Path "C:\Program Files\Info"
I have also tried simply copying a folder into the Program Files location, with the same results.
Is there anyway I can script this so it will work?
I have found an old vbscript which does work to create the folder, so there must be a way to accomplish this in Powershell!?
Thanks for your time
-ItemType->-Type-ItemTypeworks in POSH 5.x.x.x not sure about older versions