How can I use WASP permanently without re-installing?

3.6k Views Asked by At

I'm writing powershell queries using WASP.

But every time I want to use WASP I have to do :

c:\Windows\System32\WindowsPowerShell\v1.0>powershell.exe Install.ps1 -Force

Then I get this result :

enter image description here

And as they say : I run this in Powershell_ise.exe :

Add-PSSnapin WASP

Now - I can write queries using WASP.

Question

The next time I start Powershell_ise.exe and try to invoke the script :

I get this error :

enter image description here

  • I don't want to install it every time in order to use WASP. What can I do in order for Powershell_ise.exe to recognize WASP automatically ?

NB

Maybe the answer is in the last console result line : You can also add that line to your Profile script to load it automatically.

But I didn't find how to do it.

2

There are 2 best solutions below

0
On BEST ANSWER

You should use import-module in your profile and you can look at your profile file using $profile var :

$profile.AllUsersAllHosts
C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1

$profile.AllUsersCurrentHost
C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShellISE_profile.ps1

$profile.CurrentUserAllHosts
C:\Users\JPB\Documents\WindowsPowerShell\profile.ps1

$profile.CurrentUserCurrentHost
C:\Users\JPB\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
0
On

Ok found it :

This article says it all : http://blogs.technet.com/b/heyscriptingguy/archive/2013/01/04/understanding-and-using-powershell-profiles.aspx

When running this : $PROFILE | Format-List * -Force

we get : PS C:\Users\royin> $PROFILE | Format-List * -Force

AllUsersAllHosts       : C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
AllUsersCurrentHost    : C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShellISE_profile.ps1
CurrentUserAllHosts    : C:\Users\royin\Documents\WindowsPowerShell\profile.ps1
CurrentUserCurrentHost : C:\Users\royin\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
Length                 : 78

so just add a file named profile.ps1 to the library ^ (choose)

And write Add-PSSnapin WASP inside that file.