header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

For Shay - Alternate Credentials
Last Post 19 Nov 2008 05:13 PM by Shay. 5 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
edm365f31User is Online
New Member
New Member
Posts:38
Avatar

--
18 Nov 2008 09:57 PM  
I am trying to run a script with Alt Cred and I came around your script but it give me an error

Exception setting "Password": "Cannot convert value "System.Security.SecureString" to type "System.Security.SecureString". Error: "Invalid cast from 'Sy stem.String' to 'System.Security.SecureString'."" At C:\powershell\Study\RenOpramon\renopra.ps1:20 char:5

$si = New-Object system.diagnostics.processStartInfo
$si.fileName = "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"
$si.arguments= "C:\Powershell\Study\RenOpramon\script.ps1"
#$si.UseShellExecute = $False
$si.userName = "Domain\User"
#$password = Read-Host "Enter password" -AsSecureString
$si.password. = "whatelse"
$proc = [System.Diagnostics.Process]::start($si)
ShayUser is Offline
Basic Member
Basic Member
Posts:269
Avatar

--
19 Nov 2008 08:02 AM  
Can you try this way

$si = New-Object system.diagnostics.processStartInfo
$si.fileName = "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"
$si.arguments= "C:\Powershell\Study\RenOpramon\renopra.ps1"
$si.UseShellExecute = $False
$si.userName = "susq\servicesot"
$password = Read-Host "Enter password" -AsSecureString
$si.password = $password
$proc = [System.Diagnostics.Process]::start($si)
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
edm365f31User is Online
New Member
New Member
Posts:38
Avatar

--
19 Nov 2008 02:47 PM  
Shay Tried that still giving me same error..not sure if there's a way to eliminate the method of system.security trying to convert or unconvert the string to secure string..just wondering???

Exception setting "Password": "Cannot convert value "System.Security.SecureString" to type "System.Security.SecureString". Error: "Invalid cast from 'Sys
em.String' to 'System.Security.SecureString'.""
At C:\powershell\Study\RenOpramon\script.ps1:20 char:5
+ $si. <<<< password="$password"
ShayUser is Offline
Basic Member
Basic Member
Posts:269
Avatar

--
19 Nov 2008 03:16 PM  
I need to test that in V1... . At the mean time, can you pass the user name without the domain prefix and see if it works?
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
edm365f31User is Online
New Member
New Member
Posts:38
Avatar

--
19 Nov 2008 04:17 PM  
Also separated Domain and Username by adding..
$si.Domain="Domain"
$si.userName="User"
still same thing but will try without domain...
is there also a Start-process in V1 don't see that in V2? Will do research on this..

thnx
ShayUser is Offline
Basic Member
Basic Member
Posts:269
Avatar

--
19 Nov 2008 05:13 PM  
Start-Process exists in PCSX, check it out here:

http://www.codeplex.com/PowerShellCX
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer