B
B
Berkutman2019-08-24 14:41:14
PowerShell
Berkutman, 2019-08-24 14:41:14

Variable as powershell parameter?

There is a VS.ps1 script

Connect-VIServer -Server $ip -User $user -Password $passwd

You must pass the values ​​for the variables through the command line
.\VS.ps1 -ip 0.0.0.0 -user username -passwd password

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey c0re, 2019-08-24
@Berkutman

see Passing parameters in PowerShell
like this:

Param (
[string]$ip,
[string]$user,
[string]$passwd,
)

Connect-VIServer -Server $ip -User $user -Password $passwd

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question