Member_2_7966113
asked on
Unable to Run Powershell Command
Hello Experts,
This is my first attempt at running Windows Powershell.
Each I run the powershell script setup-azure.psm I get the error shown in the image.
Can someone let me know what could be wrong?
Cheers
Carlton
This is my first attempt at running Windows Powershell.
Each I run the powershell script setup-azure.psm I get the error shown in the image.
Can someone let me know what could be wrong?
Cheers
Carlton
No image or attachement.
ASKER
For security reasons you always need to provide a path of running a .ps1 file. As you are in the correct folder already, just use
.\Setup-Azure.ps1
The file extension is not required but recommended to name here.
Note:
There is a known issue with PowerShell $env:PSModulePath that can occur when installing from WebPI. If your computer requires a restart due to system updates or other installations, it may cause updates $env:PSModulePath to not include the path where Azure PowerShell is installed. If this occurs, you may see a 'cmdlet not recognized' message when attempting to use Azure PowerShell cmdlets after the installation or upgrade. If this occurs, restarting the machine should fix the problem.
See: https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
There is a known issue with PowerShell $env:PSModulePath that can occur when installing from WebPI. If your computer requires a restart due to system updates or other installations, it may cause updates $env:PSModulePath to not include the path where Azure PowerShell is installed. If this occurs, you may see a 'cmdlet not recognized' message when attempting to use Azure PowerShell cmdlets after the installation or upgrade. If this occurs, restarting the machine should fix the problem.
See: https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
ASKER
a .psm1 s a module that will be called from a .ps1 (script) post a link to the page that you got this module from
Please note the dot backslash in my code line.
Just type "setup-a" and press the tab button to complete the command. It has to show exactly like this...
.\setup-azure.ps1
with the leading ".\"
.\setup-azure.ps1
with the leading ".\"
For that work you will have to install Windows Azure PowerShell module. Sign in to the Windows Azure Management Portal using the credentials for your Windows Azure account. Download and install the Windows Azure PowerShell Tools.
https://login.microsoftonline.com/common/oauth2/authorize?response_type=code+id_token&redirect_uri=https%3a%2f%2fmanage.windowsazure.com%2f&client_id=00000013-0000-0000-c000-000000000000&resource=https%3a%2f%2fmanagement.core.windows.net%2f&scope=user_impersonation+openid&nonce=4573ab5c-0d17-4d99-8f96-591a9512edb9&domain_hint=&site_id=500879&response_mode=form_post
https://login.microsoftonline.com/common/oauth2/authorize?response_type=code+id_token&redirect_uri=https%3a%2f%2fmanage.windowsazure.com%2f&client_id=00000013-0000-0000-c000-000000000000&resource=https%3a%2f%2fmanagement.core.windows.net%2f&scope=user_impersonation+openid&nonce=4573ab5c-0d17-4d99-8f96-591a9512edb9&domain_hint=&site_id=500879&response_mode=form_post
is D:\Modules in your psmodulepath?
Probably a better location is in c:\iusers\<username>\docum ents\Windo wsPowershe ll\Modules
Probably a better location is in c:\iusers\<username>\docum
Will you type "dir" so we can see the name of the files in the directory?
ASKER
Hi Nitenkumar,
I have logged into the portal with my Windows Azure account. Can you let me know where to go to get the Windows Azure PowerShell Tools.?
Cheers
I have logged into the portal with my Windows Azure account. Can you let me know where to go to get the Windows Azure PowerShell Tools.?
Cheers
This cannot be the result of tab completion, as you never get a wrong file or cmdlet that way.
The file name you showed now contains a dot isnstead of a dash!
The file name you showed now contains a dot isnstead of a dash!
ASKER
Hi Nitenkumar,
I think I have it. Installing it now. Will let you know how I get on
I think I have it. Installing it now. Will let you know how I get on
get-module -listavailable
import-module modulename
setup-azure
import-module modulename
setup-azure
ASKER
Hi,
So I have installed Windows Powershell ISE from Azure,
Please see below for dir and command outputs
pshell4.png
So I have installed Windows Powershell ISE from Azure,
Please see below for dir and command outputs
pshell4.png
Okay. I suppose you will need to type ".\setup-azure.psm1" for the command to run properly (or at least start.
ASKER
ASKER
ASKER
Ok, when I run the script without the quotes it appears to be fine, however the script then opens the Setup-Azure.psm1 file in notepad, see attached.
Setup-Azure.txt
Setup-Azure.txt
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
David
Thanks.
Please remember I'm a novice with this. Can you please let me know the command to the moody the module ?
Cheers
Thanks.
Please remember I'm a novice with this. Can you please let me know the command to the moody the module ?
Cheers
ASKER
I meant to say how to import the module
import-module -name modulename
ASKER
Can you let me know how to load the module ?
Cheers
Cheers
get-help import-module -examples
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Subsun,
Thank you. I will give that a try when I get to my desk.
Cheers
Thank you. I will give that a try when I get to my desk.
Cheers
ASKER
get-help about_signing
By default scripts are disabled in the execution policy.
set-executionpolicy -executionpolicy remotesigned
Powershell has a huge help index. Learn how to use it and you will be amazed at how many questions it will answer.
if you open powershell as an administrator you should periodically run the
update-help
command
ASKER
Hi David
We're nearly,
I get the following error after I run Setup-Azure
Which lab do you want to set up? Type a number from 1 - 11:
The lab you want to set up is: Lab 1
Is this is correct? Y/N?: The lab to set up is: Lab 1
Start-Transcript : A parameter cannot be found that matches parameter name 'IncludeInvocationHeader'.
At D:\modules\setup-azure\set up-Azure.p sm1:40 char:89
+ Start-Transcript -Path "D:\Logs\Setup-Azure-$labn umber.log" -IncludeInvocationHeader <<<< -Append -Force
+ CategoryInfo : InvalidArgument: (:) [Start-Transcript], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Mic rosoft.Pow erShell.Co mmands.Sta rtTranscri ptCommand
Lab 1. Introduction to Azure. Setup will remove any current Azure subscription and account details from the current Azure PowerShell session.
Now setting up Lab 1
Removing cached Azure subscriptions and accounts info...
The term 'Remove-SubsAndAccounts' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is co
rrect and try again.
At D:\modules\setup-azure\set up-Azure.p sm1:70 char:27
+ Remove-SubsAndAccounts <<<<
+ CategoryInfo : ObjectNotFound: (Remove-SubsAndAccounts:St ring) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Lab 1 setup is complete
Started at 12/10/2016 18:47:57
Ended at 12/10/2016 18:47:57
Total elapsed time is 0 minutes
Stop-Transcript : This host does not support transcription.
At D:\modules\setup-azure\set up-Azure.p sm1:91 char:20
+ Stop-Transcript <<<<
+ CategoryInfo : NotImplemented: (:) [Stop-Transcript], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.Pow erShell.Co mmands.Sto pTranscrip tCommand
__________________________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ _______
We're nearly,
I get the following error after I run Setup-Azure
Which lab do you want to set up? Type a number from 1 - 11:
The lab you want to set up is: Lab 1
Is this is correct? Y/N?: The lab to set up is: Lab 1
Start-Transcript : A parameter cannot be found that matches parameter name 'IncludeInvocationHeader'.
At D:\modules\setup-azure\set
+ Start-Transcript -Path "D:\Logs\Setup-Azure-$labn
+ CategoryInfo : InvalidArgument: (:) [Start-Transcript], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Mic
Lab 1. Introduction to Azure. Setup will remove any current Azure subscription and account details from the current Azure PowerShell session.
Now setting up Lab 1
Removing cached Azure subscriptions and accounts info...
The term 'Remove-SubsAndAccounts' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is co
rrect and try again.
At D:\modules\setup-azure\set
+ Remove-SubsAndAccounts <<<<
+ CategoryInfo : ObjectNotFound: (Remove-SubsAndAccounts:St
+ FullyQualifiedErrorId : CommandNotFoundException
Lab 1 setup is complete
Started at 12/10/2016 18:47:57
Ended at 12/10/2016 18:47:57
Total elapsed time is 0 minutes
Stop-Transcript : This host does not support transcription.
At D:\modules\setup-azure\set
+ Stop-Transcript <<<<
+ CategoryInfo : NotImplemented: (:) [Stop-Transcript], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.Pow
__________________________
where did you get this module? So the experts can follow along with you
ASKER
David,
I got it from Microsoft Azure Training Lab.
Thanks
I got it from Microsoft Azure Training Lab.
Thanks
ASKER
Would you happen to know if there is a script that will enable me to load a bunch of modules in one shot?
Cheers
Cheers
ASKER
Hello Experts
Just so you know, we have got past my original problem with running Setup-Azure.
If you could help me figure out why I can't get past the first base when I run the script:
Which lab do you want to set up? Type a number from 1 - 11:
The lab you want to set up is: Lab 2
Is this is correct? Y/N?: The lab to set up is: Lab 2
Start-Transcript : A parameter cannot be found that matches parameter name 'IncludeInvocationHeader'.
At D:\modules\setup-azure\set up-Azure.p sm1:40 char:89
+ Start-Transcript -Path "D:\Logs\Setup-Azure-$labn umber.log" -IncludeInvocationHeader <<<< -Append -Force
+ CategoryInfo : InvalidArgument: (:) [Start-Transcript], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Mic rosoft.Pow erShell.Co mmands.Sta rtTranscri ptCommand
Lab 2. Creating Virtual Networks and Connecting Virtual Networks. Setup will remove any current Azure subscription and account details from the current Azure PowerShell session.
Now setting up Lab 2
The term 'Add-AzureAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At D:\modules\setup-azure\set up-Azure.p sm1:56 char:29
+ 2 { Add-AzureAccount <<<< | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Add-AzureAccount:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Get-AzureSubscription' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is cor
rect and try again.
At D:\Modules\Show-Subscripti on\Show-Su bscription .psm1:6 char:34
+ $subs = Get-AzureSubscription <<<<
+ CategoryInfo : ObjectNotFound: (Get-AzureSubscription:Str ing) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Cannot index into a null array.
At D:\Modules\Show-Subscripti on\Show-Su bscription .psm1:47 char:53
+ Write-Host "Using the subscription: " $subs[ <<<< 0].SubscriptionName " Id: " $subs[0].SubscriptionId " (Service Management)"
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
The term 'Select-AzureSubscription' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At D:\Modules\Show-Subscripti on\Show-Su bscription .psm1:48 char:33
+ Select-AzureSubscription <<<< -SubscriptionName $subs[0].SubscriptionName -Current
+ CategoryInfo : ObjectNotFound: (Select-AzureSubscription: String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Choose-Location' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct a
nd try again.
At D:\modules\setup-azure\set up-Azure.p sm1:56 char:76
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location <<<< ; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Choose-Location:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-Names' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At D:\modules\setup-azure\set up-Azure.p sm1:56 char:90
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names <<<< $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-Names:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-Storage' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct an
d try again.
At D:\modules\setup-azure\set up-Azure.p sm1:56 char:117
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage <<<< $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-Storage:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-VirtualNetwork' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is cor
rect and try again.
At D:\modules\setup-azure\set up-Azure.p sm1:56 char:161
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork <<<< $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-VirtualNetwork:Str ing) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-VM' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At D:\modules\setup-azure\set up-Azure.p sm1:56 char:183
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM <<<< "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-VM:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Removing cached Azure subscriptions and accounts info...
The term 'Remove-SubsAndAccounts' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is co
rrect and try again.
At D:\modules\setup-azure\set up-Azure.p sm1:70 char:27
+ Remove-SubsAndAccounts <<<<
+ CategoryInfo : ObjectNotFound: (Remove-SubsAndAccounts:St ring) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Lab 2 setup is complete
Started at 12/10/2016 19:20:33
Ended at 12/10/2016 19:20:33
Total elapsed time is 0 minutes
Stop-Transcript : This host does not support transcription.
At D:\modules\setup-azure\set up-Azure.p sm1:91 char:20
+ Stop-Transcript <<<<
+ CategoryInfo : NotImplemented: (:) [Stop-Transcript], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.Pow erShell.Co mmands.Sto pTranscrip tCommand
__________________________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ _______
Just so you know, we have got past my original problem with running Setup-Azure.
If you could help me figure out why I can't get past the first base when I run the script:
Which lab do you want to set up? Type a number from 1 - 11:
The lab you want to set up is: Lab 2
Is this is correct? Y/N?: The lab to set up is: Lab 2
Start-Transcript : A parameter cannot be found that matches parameter name 'IncludeInvocationHeader'.
At D:\modules\setup-azure\set
+ Start-Transcript -Path "D:\Logs\Setup-Azure-$labn
+ CategoryInfo : InvalidArgument: (:) [Start-Transcript], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Mic
Lab 2. Creating Virtual Networks and Connecting Virtual Networks. Setup will remove any current Azure subscription and account details from the current Azure PowerShell session.
Now setting up Lab 2
The term 'Add-AzureAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At D:\modules\setup-azure\set
+ 2 { Add-AzureAccount <<<< | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Add-AzureAccount:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Get-AzureSubscription' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is cor
rect and try again.
At D:\Modules\Show-Subscripti
+ $subs = Get-AzureSubscription <<<<
+ CategoryInfo : ObjectNotFound: (Get-AzureSubscription:Str
+ FullyQualifiedErrorId : CommandNotFoundException
Cannot index into a null array.
At D:\Modules\Show-Subscripti
+ Write-Host "Using the subscription: " $subs[ <<<< 0].SubscriptionName " Id: " $subs[0].SubscriptionId " (Service Management)"
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
The term 'Select-AzureSubscription'
correct and try again.
At D:\Modules\Show-Subscripti
+ Select-AzureSubscription <<<< -SubscriptionName $subs[0].SubscriptionName -Current
+ CategoryInfo : ObjectNotFound: (Select-AzureSubscription:
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Choose-Location' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct a
nd try again.
At D:\modules\setup-azure\set
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location <<<< ; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Choose-Location:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-Names' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At D:\modules\setup-azure\set
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names <<<< $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-Names:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-Storage' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct an
d try again.
At D:\modules\setup-azure\set
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage <<<< $storeName $location; Create-VirtualNetwork $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-Storage:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-VirtualNetwork' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is cor
rect and try again.
At D:\modules\setup-azure\set
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork <<<< $labnumber; Create-VM "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-VirtualNetwork:Str
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Create-VM' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At D:\modules\setup-azure\set
+ 2 { Add-AzureAccount | Out-Null; Show-Subscription; Choose-Location; Create-Names $labnumber; Create-Storage $storeName $location; Create-VirtualNetwork $labnumber; Create-VM <<<< "ClassicSrv1" $
svcName "Server" $location $labnumber 1 "ADATUM-BRANCH-VNET"}
+ CategoryInfo : ObjectNotFound: (Create-VM:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Removing cached Azure subscriptions and accounts info...
The term 'Remove-SubsAndAccounts' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is co
rrect and try again.
At D:\modules\setup-azure\set
+ Remove-SubsAndAccounts <<<<
+ CategoryInfo : ObjectNotFound: (Remove-SubsAndAccounts:St
+ FullyQualifiedErrorId : CommandNotFoundException
Lab 2 setup is complete
Started at 12/10/2016 19:20:33
Ended at 12/10/2016 19:20:33
Total elapsed time is 0 minutes
Stop-Transcript : This host does not support transcription.
At D:\modules\setup-azure\set
+ Stop-Transcript <<<<
+ CategoryInfo : NotImplemented: (:) [Stop-Transcript], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.Pow
__________________________
I import all modules in my powershell profiles. Drawback is that it takes about 2.5 minutes to load initially
in my powershell profiles I use these
documents\windowsposwershe ll\Microso ft.PowerSh ellISE_pro file.ps1
documents\windowsposwershe ll\Microso ft.PowerSh ell_profil e.ps1
write-output('Enumerating Modules')
$modules = get-module -listavailable
Write-Output ('There are ' + {0} + ' Available' -f $modules.count)
Write-Output ('Hang on While I import modules')
Write-Output ('Importing ' + {0} +' Modules' -f $modules.Count)
if ([System.Windows.Input.Keyboard]::IsKeyDown('Ctrl') -eq $false)
{
$counter = 0
foreach ($module in $modules)
{
$counter ++
$total = $modules.Count
$activity = 'Importing Module: ' + $module.name
Write-Progress -Activity $activity `
-status "Module: $counter of $total" `
-percentComplete ($counter / $modules.count*100)
import-module -name $module.Name -erroraction SilentlyContinue -WarningAction SilentlyContinue
}
Write-Progress -Activity 'Done' -Completed
}
in my powershell profiles I use these
documents\windowsposwershe
documents\windowsposwershe
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you sooooooooooooooo much guys ... Luv EE
Don't know who to assign points to? :-(
Don't know who to assign points to? :-(
ASKER
Thanks guys