cannot integrate PowerShell managemet library for Hyper-V into PowerShell

Jul 14, 2009 at 11:27 AM

Hi all, I'm very desperate because I'm not able to integrate PowerShell management library for Hyper-V into PowerShell:

scenario-1:

  1. Installed Power Shell 1.0 >> in Power Shell command line i wrote "hyperv.ps1" >> get error message: The term 'hyperv.ps1' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.
  2. Wrote .\hyperv.ps1 (read this syntax somewhere on net...) >> I get error message: No functions were loaded - you need to invoke with . scriptname.
scenario-2:
  1. Installed Windows Power Shell 2.0 Community Technology Preview (CTP) >> in Power Shell command line i wrote "hyperv.ps1" >> get error message: The term 'hyperv.ps1' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.
  2. Wrote .\hyperv.ps1 >> I get error message: The hash literal was incomplete.
 
So, anyone has idea how to solve this issue? Because I'm in dead end. Maybe I do something in wrong way >> in this way please correct me.

 

Jul 15, 2009 at 2:19 AM

these 2 links should help. 


http://blogs.technet.com/softienerd/default.aspx
http://pshyperv.codeplex.com/Thread/View.aspx?ThreadId=35417

 

you can set the reg to unrestricted but set it back later..

 

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\powershell\1\ShellIds\Microsoft.powershell]
"ExecutionPolicy"="Unrestricted"

 
unzip the file.. say to z:\
the open powershell command
cd z:\
PS Z:\>
type   . .\hyperv.ps1    

 notice the dot+space+dot+slash.

 

 

 

snippets.. from the links..

try to call . .\hyperv.ps1 ftom the folder the zip was extraced to. notice the dot+space+dot+slash.

 

 

Powershell Tip #1
In Powershell, type $profile.

PS C:\Program Files\Microsoft\AxFuzzer> $profile
C:\Users\mengli\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

That points to where your profile is stored at.  This is a powershell script that executes upon the start up of any powershell prompt for the current user.  Go ahead and make the file.  In my case, I made a new file at the location by typing this:

new-item $profile -itemtype file -force

Now, open the file and you can put in things like this:
set-executionpolicy unrestricted
. \\meng\shared\powershell\hyperv.ps1
set-executionpolicy remotesigned

Every new powershell prompt that you