I have made a script that I would distribute to my college's. It's a Powershell script using CSOM to connect to a SharePoint-Online environment. What I would like is to create an input box where my college's can enter their credentials. Because now I have put my userid en password in the code itself. How can I change the CSOM code to create an inputbox? I know that the command: “$credential = get-credential” generates a inputbox too. How can I change the code below that a user can logon through an inputbox.
$SiteUrl = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$UserName="xxxxxxxxxxxxxxxxxxxxxx"
$Password ="xxxxxxxxxxxxxxxxxxxxx"
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Context.Credentials = $credentials
Gr, P