The following script was written for me. My problem is that when our remote deployment system executes the script, Powershell on the local machine will not run the script. It has no problem running .vbs though. Long story short, our remote deployment software copies this .zip file to all machines that are not connected to our domain. This script then is supposed to unzip the files into a specific location.

Without getting too much more complex, is there a way to convert this function into an easy .vbs or would there be a way to use a batch command to enable the powershell to execute this script on all workstations I need to?

Set oShell = CreateObject( "WScript.Shell" )
USRPROFILE = oshell.expandenvironmentstrings("%UserProfile%")
Appdata = USRProfile & "\AppData\"
sZipFile = "C:\ProgramData\CentraStage\Packages\377fa3f4-6b60-4ec5-94b9-fc1716d53ea9#\vidistar.zip"
sTargetFolder = appdata
Dim oShellApp:Set oShellApp = CreateObject("Shell.Application")
Dim oFSO:Set oFSO = CreateObject("Scripting.FileSystemObject")
    'Create the target folder if it isn't already there
If not oFSO.FolderExists(sTargetFolder) Then
    oFSO.CreateFolder sTargetFolder
    wscript.echo sTargetFolder & "  Folder Has Been Created "
end if
'Extract the files from the zip into the folder
oShellApp.NameSpace(sTargetFolder).CopyHere oShellApp.NameSpace(sZipFile).Items

closed as unclear what you're asking by Ƭᴇcʜιᴇ007, Nifle, Kevin Panko, mdpc, fixer1234 Feb 1 '15 at 0:24

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


That code sample looks like VBScript, not PowerShell. Try running it with cscript.

Or, if your remote deployment system knows how to run .vbs files, just change the extension from .ps1 to .vbs.

  • Also, on Vista or later, you probably don't want to drop the files into %userprofile%\appdata. Instead, appdtata\roaming or appdata\local would be more appropriate. – Celery Man Jan 29 '15 at 20:00

Here is a big time hint:

Get-Help Set-ExecutionPolicy


Get-Help about_execution_policies

The big question here is: are your target machines allowed to run unsigned scripts? PowerShell has different restrictions in place based on the session, and generally out of the box you will find that the policy is Restricted.

You can set the execution policy via Group Policy on domain-joined machines, and this is generally preferable.

Not the answer you're looking for? Browse other questions tagged or ask your own question.