Hello,
I am a beginner with Powershell scripting and need some help from your side.
I am using this script to pull Exchange information from several forests:
izzy.org/…/Get-ExchangeVer.ps1
Everything is working as it should but now i would like to add a console menu to my script to be asked after or before adding the domain credentials, to which server in which domain i would like to connect:
I am creating specific variables for credentials and then using New-PSSession, connect to those domains and search after information.
$ExTest = Get-Credential "Domainistok"
$ps1=New-PSSession -Authentication basic -Credential $ExTest -ConnectionUri hallo-domain.local/powershell -ConfigurationName Microsoft.Exchange -SessionOption (New-PSSessionOption -SkipRevocationCheck)
I found a very useful script for creating a menu but need your help.
First button should mean – Search between all Servers – Should i create a txt file with all servers and then connect to that file? or what would you recommend?
After choosing all the servers i would like to get a prompt for what Exchange info's i request.
[int]$xMenuChoiceA = 0
while ( $xMenuChoiceA -lt 1 -or $xMenuChoiceA -gt 3 ){
Write-host "1. Select Server"
Write-host "2. What is your request?"
Write-host "3. Quit and exit"
[Int]$xMenuChoiceA = read-host "Please enter an option 1 to 3…" }
Switch( $xMenuChoiceA ){
1{<#run an action or call a function here #>}
2{<#run an action or call a function here #>}
3{<#run an action or call a function here #>}
default{<#run a default action or call a function here #>}
}
I appreciate your help,
Craznic Razvan