![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Powershell Execute process I want to execute a command at remote DMZ server with below line. But it is not authenticating the password and giving access denied error even though password is correct & able to access remote share with same password. $ProcessClass = get-wmiobject -query "SELECT * FROM Meta_Class WHERE __Class = 'Win32_Process'" -namespace "root\cimv2" -credential $(Get- Credential) -computername $computer $results = $ProcessClass.Create( $commandline ) ::::::::::Error ::::::::: Exception retrieving member "Create": "Access is denied. (Exception from HRESUL T: 0x80070005 (E_ACCESSDENIED))" At C:\ExeCmd.ps1:72 char:11 + $results = <<<< $ProcessClass.Create($commandline) Any idea how to pass the credential safely? |
| | #2 (permalink) | ||||||||||||
| Guest | RE: Powershell Execute process This has come up before if I remember correctly. You need to do the get-credential as a seperate prior step $cred = get-credential get-wmiobject ........... -credentials $cred .......... -- Richard Siddaway All scripts are supplied "as is" and with no warranty PowerShell MVP Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Amit Tank" wrote:
| ||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: Powershell Execute process I tried that and checked again but same error. It takes credential correctly when we give below $ProcessClass = get-wmiobject -class "Win32_Process" -namespace "root \cimv2" -credential $(Get-Credential) -computername $computer But this code doesn't allow to run create( ) method to execute command at remote machine like below. $results = $ProcessClass.Create( $commandline ) On Apr 16, 3:37*am, RichS [MVP] <RichS...@xxxxxx> wrote:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: Powershell Execute process I tried other two methods also and let me explain in detail. I want to execute a process on a server which is in DMZ & workgroup from my domain. It works if, - If I keep the same password of my domain ID and user ID of that server then it works. - I can access the \\ServerName\C$ with my user ID of DMZ server from domain. - If I run these scripts against a server which is in same domain then it works. It doesn't work - If passwords are different for my domain ID and user ID of remote DMZ server and if I pass the password through PowerShell. ## 1 ## $co = new-object management.connectionoptions $co.Username = "ServerName\UserID" $co.SecurePassword = (read-host -assecurestring) $scope = new-object management.managementscope "\\ServerName\root \cimv2",$co $scope.Connect() $mp = new-object management.managementpath "win32_process" $ogo = new-object management.objectgetoptions $proc = new-object management.managementclass $scope,$mp,$ogo $proc.Create("notepad.exe") ## 2 ## $comp = "ServerName" $cre = get-credential ServerName\UserID $win32ProcessClass = Get-WmiObject -List -Namespace 'root\cimv2' - credential $cre -computername $comp | Where-Object { $_.Name -eq 'Win32_Process' } $win32ProcessClass.Create("notepad.exe") Any help is really appreciated. Amit On Apr 16, 3:51*am, Amit Tank <amitmt...@xxxxxx> wrote:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #5 (permalink) | ||||||||||||
| Guest | Re: Powershell Execute process I'm sorry, what are you identifying here:
I understand there are some small cross-domain authentation issues with get-wmiobject in v1. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com | ||||||||||||
| | #6 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest | Re: Powershell Execute process Thanks for the information Macro. ![]() Is it corrected in v2? if you come across. Or any alternate way to execute process. On Apr 16, 4:40*pm, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote:
| ||||||||||||||||||||||||||||||||||||
| | #7 (permalink) | ||||||||||||
| Guest | Re: Powershell Execute process Amit Tank wrote:
non-production use and available now). You can also use winrm to execute remote commands. I'm not sure how far you are willing to go to try to make this work. -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com | ||||||||||||
| | #8 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest | Re: Powershell Execute process I think winrm configuration is not advisable for Edge server because it directly contact to internet. Am I right ? On Apr 16, 7:27*pm, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote:
| ||||||||||||||||||||||||||||||||||||
| | #9 (permalink) | ||||||||||||
| Guest | Re: Powershell Execute process Amit Tank wrote:
edit that list. Furthermore, you can use the Windows Firewall client in certain conditions. Marco | ||||||||||||