Why does PSCX have to be in WinSys... folder?

Topics: Developer Forum, Project Management Forum, User Forum
Mar 10, 2011 at 4:05 PM

Hi,

In using this extension, I found it would only load successfully if I put it under the "C:\Windows\system32\windowspowershell\v1.0\Modules\" folder. If I put it in my own powershell extensions folder or any other folder for that matter, and add that to the PSModulePath, it will not Import without errors. Why is this?

That is very problematic because when we use it for a build or even for deployment, we must restore the machine to its "pristine" (for builds) state or original state (or installs). This means we need to know whether it was installed before we install it so we can uninstall it. If it were allowed to be any folder, then we would just include it with our "view" folder and add it to the module path or just install it as a component if we were deploying it.

Can anyone tell me why there is a dependency on the location of it or there are semi-absolute paths (something like %Windir% relative would be semi-absolute)?

 

Thanks,

Jim

Coordinator
Mar 10, 2011 at 4:18 PM

It shouldn't require being installed under system32.  I xcopy it under my profile dir on multiple machines without any problem.   What are the errors you are seeing when you xcopy it to a profile dir?  Also, are you sure you are unblocking the PSCX zip file before extracting it?  If not, each file will appear to be from the internet zone and that will cause errors.

Mar 10, 2011 at 4:23 PM

Well, perhaps that may be my problem, Keith. I really don't know what it means to unblock files. Is that a powershell concept? Can I unblock them and then zip them up for dynamic installation on builds?

I believe I am having a little trouble understanding the concept of blocking...

 

Jim

Developer
Mar 10, 2011 at 4:27 PM
Nope, unblocking is a Windows-level concept. If you download a zip
from the internet, right click it and view the properties. Near the
buttons on the bottom, you'll see another button: "Unblock." Click
this, then unzip the module again. This is the same mechanism as when
you download an EXE file from the internet and there's a checkbox on
the open/run dialog that says "[ ] always ask for this file?" (or
something like that.)

-Oisin

On Thu, Mar 10, 2011 at 11:23 AM, rittjc <notifications@codeplex.com> wrote:
> From: rittjc
>
> Well, perhaps that may be my problem, Keith. I really don't know what it
> means to unblock files. Is that a powershell concept? Can I unblock them and
> then zip them up for dynamic installation on builds?
>
> I believe I am having a little trouble understanding the concept of
> blocking...
>
>
>
> Jim
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com



--

---
404 signature missing
Mar 10, 2011 at 5:39 PM

Thanks Oisin,

Ok, then, that answers what blocking is, But, now, what I don’t understand is the “potential” issue with blocking. It couldn’t be blocked if I managed to use them in the Windows\System32\windowspowershell\...Modules folder as that would by definition mean they were not blocked right? And if they work in the WinSys… folder then they should work equally well in a local folder. Is that not correct? If it were blocked, I couldn't use them no matter where I deployed them...is that right?

 

Also, are you saying I do not need to unzip them, that simply locating the zip file in the modules folder, PowerShell will load it from the zip file as well?

Jim

 

Coordinator
Mar 10, 2011 at 5:48 PM

My *guess* is that if you got them into the system32 folder, which you had to be admin to do, the internet zone blocking doesn't come into play.  Follow these instructions and see if it results in PSCX working from your profile dir:

NOTES ABOUT XCOPY DEPLOYMENT

Files downloaded from the web are usually blocked on Windows including the Pscx-2.0.zip file. If you do not unblock the ZIP file first then each of the files extracted from the ZIP will also be blocked. This will cause numerous errors when you import Pscx like this:

Import-Module : The following error occurred while loading the extended type data file:
Microsoft.PowerShell, 
C:\Users\Keith\Documents\WindowsPowerShell\Modules\Pscx\TypeData\Pscx.FeedStore.Type.ps1xml : 
File skipped because of the following validation exception:  File 
C:\Users\Keith\Documents\WindowsPowerShell\Modules\Pscx\TypeData\Pscx.FeedStore.Type.ps1xml 
cannot be loaded.  The file 
C:\Users\Keith\Documents\WindowsPowerShell\Modules\Pscx\TypeData\Pscx.FeedStore.Type.ps1xml 
is not digitally signed. The script will not execute on the system. 
Please see "get-help about_signing" for more details...


To avoid these errors follow the unblocking directions below.

UNBLOCKING THE PSCX-2.0.ZIP FILE:

1. Locate the Pscx-2.0.zip file in Windows Explorer.
2. Right-click on the file and select "Properties".
3. On the General tab of the Properties dialog, locate the "Unblock" button in
the lower right-hand corner and press it.

COPYING THE PSCX MODULE INTO YOUR MODULE DIR

Once you have unblocked the Pscx-2.0.0.1.zip file, extract it to the 'My Documents\WindowsPowerShell\Modules' folder in your USERPROFILE directory. If this folder doesn't exist then you will need to create it. If you want Pscx to be available to all users, then extract the files to $PSHome\Modules directory instead.  


Mar 10, 2011 at 6:02 PM

Ok Keith,

I don’t think that is the problem for. First I am an admin on all my machines both at work and home. Second at work, we are standardized on XP-SP3 (for now) and I believe blocking is a Win 7/Vista feature, which would only be relevant at home. That is if I understand it correctly.

If that is correct, then, I am making an assumption here that might be the real issue. I am “assuming” that the directory in which these modules exist has the “option” of being in any arbitrary folder “as long as” that folder’s path is in the PSModules environment variable prepended by a semicolon, just as you add to the PATH variable for applications globally defined.

If that too, is a valid assumption, and that it is not an issue for XP-3, then the only thing that could have failed was either in my specification of the folder in the PSModules folder. Does that sum it up?

Thanks!

Jim


From: r_keith_hill [email removed]
Sent: Thursday, March 10, 2011 12:49 PM
To: Rittenhouse, Jim
Subject: Re: Why does PSCX have to be in WinSys... folder? [Pscx:249190]

From: r_keith_hill

My *guess* is that if you got them into the system32 folder, which you had to be admin to do, the internet zone blocking doesn't come into play. Follow these instructions and see if it results in PSCX working from your profile dir:

NOTES ABOUT XCOPY DEPLOYMENT

Files downloaded from the web are usually blocked on Windows including the Pscx-2.0.zip file. If you do not unblock the ZIP file first then each of the files extracted from the ZIP will also be blocked. This will cause numerous errors when you import Pscx like this:

Import-Module : The following error occurred while loading the extended type data file:
Microsoft.PowerShell, 
C:\Users\Keith\Documents\WindowsPowerShell\Modules\Pscx\TypeData\Pscx.FeedStore.Type.ps1xml : 
File skipped because of the following validation exception:  File 
C:\Users\Keith\Documents\WindowsPowerShell\Modules\Pscx\TypeData\Pscx.FeedStore.Type.ps1xml 
cannot be loaded.  The file 
C:\Users\Keith\Documents\WindowsPowerShell\Modules\Pscx\TypeData\Pscx.FeedStore.Type.ps1xml 
is not digitally signed. The script will not execute on the system. 
Please see "get-help about_signing" for more details...


To avoid these errors follow the unblocking directions below.

UNBLOCKING THE PSCX-2.0.ZIP FILE:

1. Locate the Pscx-2.0.zip file in Windows Explorer.
2. Right-click on the file and select "Properties".
3. On the General tab of the Properties dialog, locate the "Unblock" button in
the lower right-hand corner and press it.

COPYING THE PSCX MODULE INTO YOUR MODULE DIR

Once you have unblocked the Pscx-2.0.0.1.zip file, extract it to the 'My Documents\WindowsPowerShell\Modules' folder in your USERPROFILE directory. If this folder doesn't exist then you will need to create it. If you want Pscx to be available to all users, then extract the files to $PSHome\Modules directory instead.



Coordinator
Mar 10, 2011 at 6:16 PM
Edited Mar 10, 2011 at 6:28 PM

Blocking is also enforced on XP SP3 - even if you are running as admim.  Well, unless you've tweaked the Internet zone security settings in Internet Explorer IIRC.

Mar 10, 2011 at 6:26 PM

I’ll take your word for that Keith. I have never seen a selection, menu, button, tab page or term described on properties. It is alien to me but that doesn’t mean anything. I could have missed something even more fundamental.

 

I am assuming there is no issue with the PSModulePath as Windows does not mention restrictions. I will play around with it is and see if it was just something stupid I was doing and avoided it by moving it to the winsys32 sub path.

 

 

Thanks!

 

Jim

Mar 10, 2011 at 6:56 PM

Fellas,

Below is the exact error WAS get:ting...I was right, I was doing something stupid. The problem is that the root path is pscx\pscx\<contents>. When I originally unzipped it, I saw the top folder as redundant and copied starting at the second pscx subfolder. That is why it gave the error on import you see below. The first pscx is redundant but you must register the "parent" folder with PSModulePath environment variable and the the Import-Module pscx is referring to a folder UNDERNEATH a path registered in the PSModulePath environment variable. Sorry for wasting your time! Thanks for the help getting me to this point.

Jim

 

Import-Module : The specified module 'pscx' was not loaded because no vali
d module file was found in any module directory.
At C:\source\SimApp\PLCSIM___GLOBCMA\GLOBCMA\Tools\PSScript.\setViewVars.p
s1:38 char:14
+ Import-Module <<<<  pscx
    + CategoryInfo          : ResourceUnavailable: (pscx:String) [Import-
   Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell
   .Commands.ImportModuleCommand

Coordinator
Mar 10, 2011 at 7:40 PM

When you unzip you should extract to (XP) "C:\Documents and Settings\<username>\My Documents\WindowsPowerShell\Modules" such that you wind up with "C:\Documents and Settings\<username>\My Documents\WindowsPowerShell\Modules\Pscx".  Also can you start a PowerShell with noprofile and try importing PSCX from that PowerShell instance:

PowerShell.exe -noprofile
Import-Module PSCX