skeeter
 New Member Posts:11

 |
| 10 Jun 2010 09:34 AM |
|
Hello All, I am trying to run a powershell script on a remote computer, and the purpose of the script is to edit a txt file then open notepad and display the edited information on the remote computer. I have accomplished everything except opening notepad on the remote computer. I can start notepad as a process but not to physically see notepad open on the remote computer. Here is my code if anyone has any ideas that would be great. I tried .visable and .show like one would in VB but that didn't work.
$computer= "tester" $session = New-PSSession -ComputerName $computer Enter-PSSession -session $session
Invoke-Command -Session $session { $saywhat = read-host "type what you want to say" Add-Content c:\test.txt "'me'$saywhat" Invoke-Item c:\test.txt Start-Process notepad.exe } exit-pssession
Thanks again for any help.
|
|
|
|
|
JBR
 New Member Posts:3

 |
| 26 Oct 2010 04:25 AM |
|
Hi there.
I think you got the same problem as me.
Well, your notepad is starting, just not in the profile you want.
That means you can press Ctrl + Shift + Esc and see the Processes running, and there will be a notepad.exe, but in another "User Name".
I wanna know how I start the process in another profile aswell without knowing the other users credentials, but do have administrator rights on the machine. |
|
|
|
|
Joel "Jaykul" Bennett
 Basic Member Posts:112

 |
| 26 Oct 2010 07:09 PM |
|
The only way I can think of is to generate a scheduled task to start it. |
|
|
|
|
Shay Levy PowerShell MVP, Admin
 Veteran Member Posts:1362

 |
|
JBR
 New Member Posts:3

 |
| 28 Oct 2010 05:56 AM |
|
That was a great advice - but when I use it it starts a notepad, but the notepad is black all the way. You can't see the part where you write text but you can see it's a notepad. Any idea ? |
|
|
|
|
Shay Levy PowerShell MVP, Admin
 Veteran Member Posts:1362

 |
|
JBR
 New Member Posts:3

 |
| 28 Oct 2010 06:13 AM |
|
Oh ok, maybe it is because the machine I'm testing on is a Windows 7 and there is some probplems as you mentioned. |
|
|
|
|