- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2017 04:59 AM
Hi All,
I am facing the problem here with my powershell probe, whenever i try and run my powershell probe against a remote server to
discover the process, the powershell script executes on my host machine that is where the mid server is installed and not on the remote
machine
Ex. I am testing the probe with ip x.x.x.x with midserver MIDSERVER1, then the powershell runs on the host machine where the midserver is
installed and not on the remote machine x.x.x.x
Kindly let me know if i am missing anything.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2017 03:13 AM
Hi all,
I was able to achieve this by opening a remote session from the mid server to the target machine, below is the code that i used to connect
$fqdn= Resolve-DnsName $computer | Select NameHost -expandproperty NameHost
$s = New-PSSession -ComputerName $fqdn -Credential $cred
$cmd={<-----Powershell script used to get the details of applications from the Target machine------>}
Invoke-Command -Session $s -ScriptBlock $cmd
Remove-PSSession $s
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2017 09:25 AM
Hi Rajesh,
Thanks for the response, yes the wmi port is open and i was able to execute the above command, but the problem is i want to run a 20 line powershell in the target machine. Is there a way to achieve it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2017 11:04 AM
My guess is you should be able to run a 20 line powershell in the target machine. But it depends on what you are trying to achieve on the remote machine.
Could you please let me know what is the specific purpose? Looks like we both work for same company. Why don't you initiate a thread?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2017 03:13 AM
Hi all,
I was able to achieve this by opening a remote session from the mid server to the target machine, below is the code that i used to connect
$fqdn= Resolve-DnsName $computer | Select NameHost -expandproperty NameHost
$s = New-PSSession -ComputerName $fqdn -Credential $cred
$cmd={<-----Powershell script used to get the details of applications from the Target machine------>}
Invoke-Command -Session $s -ScriptBlock $cmd
Remove-PSSession $s
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2017 08:56 AM
I thought of suggesting the same Dinesh. You can always create a new session on a remote machine and bind it with required credentials and invoke all of your commands within that session.
Great job!
Rajesh