Windows 10
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Windows 10
Hi, I'm having issues when running some GUIs on Windows 10. Whenever I use $global:cred = Get-Credential -Credential it will not pass the credentials on. Works great in Windows 7. Also If I use the RunAs user or Impersonate user (Script Packager) I get the working directory is invalid message when running the EXE. Any ideas. Thanks for any help in advance.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Windows 10
"Also If I use the RunAs user or Impersonate user (Script Packager) I get the working directory is invalid message when running the EXE"
Most likely you run the exe from a personal user folder that either does not exists or is not accessible for the other user.
Most likely you run the exe from a personal user folder that either does not exists or is not accessible for the other user.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Windows 10
Alexander, thanks for the tip. Yes it was in a personal folder. It seems to work now.
jvierra when I use $global:cred = Get-Credential -Credential it brings up the credential login box but when I use the credentials for example
Start-Process "C:\Program Files\Desktop\DesktopPowershellAPPS\RADIA 91 Console.exe" -Credential $cred it will not launch the RADIA 91 Console.exe
jvierra when I use $global:cred = Get-Credential -Credential it brings up the credential login box but when I use the credentials for example
Start-Process "C:\Program Files\Desktop\DesktopPowershellAPPS\RADIA 91 Console.exe" -Credential $cred it will not launch the RADIA 91 Console.exe
Re: Windows 10
This is normal behavior. To be prompted for creds on a command don't use the variable or use a null variable. If the variable is already set it will not prompt. You are setting that variable globally so it will override the prompt.v35678 wrote:Alexander, thanks for the tip. Yes it was in a personal folder. It seems to work now.
jvierra when I use $global:cred = Get-Credential -Credential it brings up the credential login box but when I use the credentials for example
Start-Process "C:\Program Files\Desktop\DesktopPowershellAPPS\RADIA 91 Console.exe" -Credential $cred it will not launch the RADIA 91 Console.exe
Re: Windows 10
Hi, I apologize if I’m misunderstanding or not explaining this right so here is exactly what is happening. We have a menu PowerShell gui that allows us to launch certain applications with elevated Administrative rights. The first button is the set credentials which brings up the PowerShell credential request login screen. The code is this:
The other buttons allow us to launch the apps with the credentials we just set. For example:
$buttonSetCredentials_Click={ #TODO: Place custom script here $global:cred = Get-Credential -Credential 'Dom1\' }We login using our Admin account.
The other buttons allow us to launch the apps with the credentials we just set. For example:
$buttonRadiaConsoleSC_Click={ #TODO: Place custom script here Start-Process "C:\Program Files\Desktop\DesktopPowershellAPPS\RADIA 91 Console.exe" -Credential $cred }
$buttonComputerSupportSC_Click={ #TODO: Place custom script here Start-Process "C:\Program Files\Desktop\DesktopPowershellAPPS\SDSA.exe" -Credential $cred }This works perfectly in Windows 7. In Windows 10 we can set the credentials but when we click on a button to launch the apps it doesn’t do anything. If we go to the folder of the apps and “run as a different user” in Windows 10 it works. We really need it to act the same way in windows 10 as it does in Windows 7. Please note I’m fairly new to powershell so if there is a different way to accomplish this that would be awesome.
Re: Windows 10
What does "it doesn’t do anything" mean? If there is an issue with the credentials you will get an error. Have you tried running this in the debugger to be sure your event is being called?
Re: Windows 10
The apps do not launch like in Windows 7. There isn't an issue with the credentials. I will try the debugger to see if anything gets flagged.jvierra wrote:What does "it doesn’t do anything" mean? If there is an issue with the credentials you will get an error. Have you tried running this in the debugger to be sure your event is being called?
Re: Windows 10
After your suggestion with the debugging, with Windows 10 I get start-process: this command cannot be run due to the error: The requested operation requires elevation.
Start-Process "C:\Program Files\Desktop\DesktopPowershellAPPS\RADIA 91 Console.exe" -Credential $cred
Start-Process "C:\Program Files\Desktop\DesktopPowershellAPPS\RADIA 91 Console.exe" -Credential $cred