Wired error of get-credential for non-privilege user
- From: "TonyDeSweet" <shenzhonghao@xxxxxxxxx>
- Date: 27 Jan 2006 08:36:41 -0800
Not sure if it is right place, but I discovered this while using monad.
System: Windows XP Home, .NET Framework SDK 2.0, Monad beta3
If login as a member of Administrators group, MSH.exe runs perfectly.
I am writing "su.msh" script (go to http://mshforfun.blogspot.com/
for detail)
There is a non-privilege user "testac" who belong to Users and
Everyone group. When login as "testac", msh.exe launched OK. If
you login as a member of Administrators group and try to launch msh.exe
(within a msh window of course) using RUNAS.exe (runas /profile
/User:testac msh.exe), msh.exe launched OK.
Problem really come out when you using get-credential cmdlet and pass
Username and Password to Process.Start() method.
$SuAccount = get-credential
$StartInfo = new-object System.Diagnostics.ProcessStartInfo
$StartInfo.FileName = "msh.exe"
$StartInfo.Arguments = "-nologo -noprofile"
$StartInfo.UserName = $SuAccount.UserName
$StartInfo.Password = $SuAccount.Password
$StartInfo.LoadUserProfile = $true
$StartInfo.UseShellExecute = $false
$StartInfo.WorkingDirectory = (get-location).Path
[System.Diagnostics.Process]::Start($StartInfo)
First time you run script:
Cmdlet get-credential at command pipeline position 1
Supply values for the following parameters:
Credential
Exception calling "Start" with "1" argument(s): "Logon failure: unknown
user name or bad password"
At D:\msh\su.msh:11 char:36
+ [System.Diagnostics.Process]::Start( <<<< $StartInfo)
Second time you run script:
No error, works like runas
Third time you run script:
Cmdlet get-credential at command pipeline position 1
Supply values for the following parameters:
Credential
Exception calling "Start" with "1" argument(s): "Logon failure: unknown
user name or bad password"
At D:\msh\su.msh:11 char:36
+ [System.Diagnostics.Process]::Start( <<<< $StartInfo)
Fourth time you run script:
No error, works like runas
Fifth time you run script:
Cmdlet get-credential at command pipeline position 1
Supply values for the following parameters:
Credential
Exception calling "Start" with "1" argument(s): "Logon failure: unknown
user name or bad password"
At D:\msh\su.msh:11 char:36
+ [System.Diagnostics.Process]::Start( <<<< $StartInfo)
So you see patterns here? I don't have detailed trace information,
but I am pretty sure there is something wrong with get-credential
cmdlet (or maybe it is Process.Start() method). Or it is simply a bug?
Tony
http://mshforfun.blogspot.com/
.
- Follow-Ups:
- Re: Wired error of get-credential for non-privilege user
- From: /\\/\\o\\/\\/ [MVP]
- Re: Wired error of get-credential for non-privilege user
- Prev by Date: Re: Scripting directory/file security in IIS Manager?
- Next by Date: Re: Interactive Windows form modification, is it possible with MSH
- Previous by thread: Re: How can I change "Allow this number of users" value for user share
- Next by thread: Re: Wired error of get-credential for non-privilege user
- Index(es):
Relevant Pages
|