# Learning and need help

**URL:** <https://forums.powershell.org/t/learning-and-need-help/8711>\
**Category:** PowerShell Help\
**Created:** [May 26, 2017, 1:28pm UTC](https://forums.powershell.org/t/learning-and-need-help/8711 "2017-05-26T13:28:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsawyer16](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@rsawyer16](https://forums.powershell.org/u/rsawyer16)\
**Post date:** [May 26, 2017, 1:28pm UTC](https://forums.powershell.org/t/learning-and-need-help/8711/1 "2017-05-26T13:28:17Z")

</div>

I am trying to learn powershell my book has a lab and i can not get my code to execute without an error.  
here is the error, I can’t figure out what i am doing wrong any help would be appreciated.  
Elseif : The term ‘Elseif’ 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 C:\Users\Administrator\Scripts\Get-Inventorya.ps1:39 char:1

- Elseif ( $menu\_choice -eq “X” )
- 

```auto
  + CategoryInfo : ObjectNotFound: (Elseif:String) [], CommandNotFoundException
  + FullyQualifiedErrorId : CommandNotFoundException 

```

##################################################################################################################################  
Here is the code I have  
#################################################################################################################################  
#Initialization

# This section contains variable declarations and assignments

# $menu\_choice = “” $menu = @” Inventory System Menu

```
	A - Installed Software Inventory
	B - Basic Hardware Inventory
			X - Exit

```

===================================================  
“@

#Main Body  
#This section contains the code that implements that main function of the script.#  
$menu  
$menu\_choice = Read-Host -Prompt “Choose a menu option”  
$sure = Read-Host -Prompt “Are you sure you want to exit? (Y)”  
if ($sure -eq “Y”)  
{  
Write-Host “This I can do.”  
Write-Host “Exiting…”  
}  
Else  
{  
Write-Host “Not Exiting :)”  
}  
ElseIf ( $menu\_choice -eq “X” )  
{  
$sure = Read-Host -prompt “are you sure you want to exit? (Y)”  
{  
Write-Host “This I can do.”  
Write-Host “Exiting…”  
}  
Else  
{  
Write-host “Not Exiting :)”  
}  
}

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [May 26, 2017, 1:35pm UTC](https://forums.powershell.org/t/learning-and-need-help/8711/2 "2017-05-26T13:35:43Z")

</div>

Are you not satisfied with the answers there?

[https://social.technet.microsoft.com/Forums/windows/en-US/ee4b93c6-37d4-490d-b745-68506dd98136/script-error?forum=winserverpowershell#fc295b8b-2dac-447a-9369-488aad8030e6](https://social.technet.microsoft.com/Forums/windows/en-US/ee4b93c6-37d4-490d-b745-68506dd98136/script-error?forum=winserverpowershell#fc295b8b-2dac-447a-9369-488aad8030e6)

---

<div class="post-metadata">

**Author:** ![rsawyer16](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@rsawyer16](https://forums.powershell.org/u/rsawyer16)\
**Post date:** [May 26, 2017, 1:46pm UTC](https://forums.powershell.org/t/learning-and-need-help/8711/3 "2017-05-26T13:46:13Z")

</div>

The last post did, I didn’t see it had to refresh.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:38pm UTC](https://forums.powershell.org/t/learning-and-need-help/8711/4 "2024-05-16T20:38:41Z")

</div>

Closed on May 16, 2024, 8:38pm UTC


