VMware Cloud Community
22Tango
Contributor
Contributor
Jump to solution

my first script

I type the vSphere PowerCLI commands in notepad and save them like : file.ps1

If I want to execute the script, I go to the directory and try to execute it by .file but i always get errors

do I have to put some additional info in de file.ps1?

Do I have to use another extension?

The script is executed in PowerShell v1.0, vSpherePowerCLI 4;x is installed

running a normal command is no problem, but a script won't go! ;-(

please help

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

What errors are you getting ?

Is your execution policy set corectly ?

Do a

Get-ExecutionPolicy

from the PowerCLI prompt.

If it says "Restricted", do a

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

for example

PS: I moved the thread to the PowerCLI Community


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
a_p_
Leadership
Leadership
Jump to solution

Welcome to the Community,

try to execute the script like

.\myscript.ps1

André

PS: In your case, it's .\file.ps1

0 Kudos
LucD
Leadership
Leadership
Jump to solution

What errors are you getting ?

Is your execution policy set corectly ?

Do a

Get-ExecutionPolicy

from the PowerCLI prompt.

If it says "Restricted", do a

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

for example

PS: I moved the thread to the PowerCLI Community


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
22Tango
Contributor
Contributor
Jump to solution

thank you it was helpfull

0 Kudos