Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, July 13, 2020 2:40 PM
Hi there,
This is kind of a 2 part question, so I'll start with the first one. Is there a way to convert this Batch command to Powershell?
set /P "ClientNo=Enter Client Number:"
echo C:\Data\Hosted\Company%ClientNo%\Profiles\
igrant.exe -r -f -usepriv mydomain\Admin:Full C:\Data\Hosted\Company%ClientNo%\Profiles\
pause
Thank you
All replies (4)
Monday, July 13, 2020 3:20 PM | 2 votes
Start by learning Powershell. Here is a good reference.
https://www.sapien.com/books_training/Windows-PowerShell-4
Your simple bat file consists of:
- Prompt user for input, assign to variable.
- Write output to console
- Run a proram that uses a variable as an argument
- Prompt user to hit enter.
Use Get-Help to see documentation on commands.
Get-Help Read-Host
Get-Help Write-Host
Get-Help about_variables
$ClientNo = Read-Host "Enter Client Number:"
Write-Host "C:\Data\Hosted\Company$ClientNo\Profiles\"
igrant.exe -r -f -usepriv mydomain\Admin:Full C:\Data\Hosted\Company$ClientNo\Profiles\
read-host "Press enter to continue."
Monday, July 13, 2020 6:41 PM
Answer to part 1: yes.
Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)
Monday, July 13, 2020 7:47 PM
I like this. It is like a symphony in two movements that has only one. By implication then part 2 is in a superposition of states.
\(ツ)_/
Monday, July 13, 2020 10:33 PM
With apologies to yg001... there is a definite trend on these forums and I'm certain that the part 2 question will be: "I'm running this as a scheduled task and it doesn't work, what's wrong?".