Advertisement
rj07thomas

iSCSI target in PowerShell

Aug 23rd, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #Following 3 variable request IP address and port of target server.
  2. $targetPortalIP = read-host -Prompt "Please enter the IP address of the iSCSI storage"
  3. $chapUser = read-host -Prompt "Please enter the CHAP username"
  4. $chapSecret = read-host -Prompt "Please enter the CHAP secret"
  5.  
  6. #Just to make life easier; these list the available IQNs and prompts you to choose an
  7. #IQN to connect to.
  8. Write-Host "Here's a list of the iSCSI targets"
  9. Write-Host ""
  10. Get-iscsiTarget | fl
  11. Write-Host ""
  12. $targetIQN = read-host -Prompt "Please paste the IQN you want here"
  13. Write-Host ""
  14.  
  15. #Connects to the IQN using all the details above.
  16. connect-iscsitarget -NodeAddress $targetIQN -TargetPortalAddress $targetPortalIP -TargetPortalPortNumber 3260 -IsPersistent $true -AuthenticationType ONEWAYCHAP -IsMultiPathEnabled $true -ChapUsername $chapUser -ChapSecret $chapSecret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement