Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

How to Reuse the input collected from READ-HOST within a script

$
0
0

I am trying to reuse the input I collect with the READ-HOST (line 1) later on in my script but it does not seem to be working.  Referring to the variable works on the first command (line 15) in the script but not the second command (line 20).  I am new to PowerShell and wondering what I'm doing wrong.

1 $vserver=Read-Host "Enter the Name for the New! Vserver"
2 Write-Host ""
3 $rootvolname=Read-Host "Enter the Root Volume Name for the New! Vserver"
4 Write-Host ""
5 $rootvolaggr=Read-Host "Enter the Root Volume Aggregate"
6 Write-Host ""
7 $volsecuritystyle=Read-Host "Enter the Root Volume Security Style"
8 Write-Host ""
9 $vserverlang=Read-Host "Enter the Language for the New! Vserver (this will apply to all volumes assigned to the Vserver)"
10 Write-Host ""
11 $nameserverswitch=Read-Host "Enter Name Server Switch (nis, file, ldap) for the New! Vserver"
12 Write-Host ""
13 $namemapping=Read-Host "Enter the Name Mapping (file, ldap) for the New! Vserver"
14 Write-Host ""
15 New-NcVserver -Name $vserver -RootVolume $rootvolname -RootVolumeAggregate $rootvolaggr -RootVolumeSecurityStyle $volsecuritystyle -Language $vserverlang -NameServerSwitch $nameserverswitch -NameMappingSwitch $namemapping
16
17 #CONFIGURE ALLOWED PROTOCOLS ON VSERVER
18
19 $allowedprotocols=Read-Host "Enter the Allowed Protocols for the Vserver (CIFS,FCP,iSCS,NFS)"
20 Set-NcVserver -Name $vserver -AllowedProtocols $allowedprotocols

William


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>