ndalmolin_13
asked on
Help executing a batch file on a remote PC using Powershell (PSRemote)
Good Morning Powershell Experts,
I have been asked to uninstall all old versions of Adobe Flash and install the newest version on several hundred PCs. I’ve read about doing this with a GPO or through SCCM (we use SCCM 2007), but I have not been successful with either of these options. The cleanest way I have found to do this is using the following script (named AdobeFlashInstall.cmd):
taskkill /f /t /im iexplore.exe
pushd "\\netapp3140a\sccmdata$\s ources\app s\AdobeFla shPlayer"
Uninstall_flash_player.exe -uninstall -force
Install_flash_player_11_ac tive_x.msi /QB!
Popd
What I would like to do is use Powershell to launch the AdobeFlashInstall.cmd script on the remote PCs.
To see how well this would work, I’m trying to initiate a remote launch of the AdobeFlashInstall.cmd script on one of my test machines. The Powershell command I’m using is as follows:
Invoke-command –ComputerName TestPC1 –ScriptBlock {Start-Process “\\Server1\SharedApps\Adob e\InstallA dobeFlash. cmd”} –credential mydomain\nick
When I run the command above, I’m prompted for my password, which I enter, and then I get the following error:
This command cannot be executed due to the error: Access is denied.
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorID : InvalidOperationException, Microsoft. Powershell .Commands. StartProce ssCommand
+ PSComputerName : TestPC1
I have verified PSRemoting is enabled and working on the test machine using the following command:
Invoke-command – ComputerName TestPC1 –ScriptBlock {Get-Process} –credential mydomain\nickd
The above command works.
I have verified that everyone has access to the share on the server. I have also added domain computers to have access on the share. I have tested this by accessing the share from my PC and one of my other test PCs without any issues. Any ideas on what I’m doing wrong?
As always, thanks in advance for your help.
Nick
I have been asked to uninstall all old versions of Adobe Flash and install the newest version on several hundred PCs. I’ve read about doing this with a GPO or through SCCM (we use SCCM 2007), but I have not been successful with either of these options. The cleanest way I have found to do this is using the following script (named AdobeFlashInstall.cmd):
taskkill /f /t /im iexplore.exe
pushd "\\netapp3140a\sccmdata$\s
Uninstall_flash_player.exe
Install_flash_player_11_ac
Popd
What I would like to do is use Powershell to launch the AdobeFlashInstall.cmd script on the remote PCs.
To see how well this would work, I’m trying to initiate a remote launch of the AdobeFlashInstall.cmd script on one of my test machines. The Powershell command I’m using is as follows:
Invoke-command –ComputerName TestPC1 –ScriptBlock {Start-Process “\\Server1\SharedApps\Adob
When I run the command above, I’m prompted for my password, which I enter, and then I get the following error:
This command cannot be executed due to the error: Access is denied.
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorID : InvalidOperationException,
+ PSComputerName : TestPC1
I have verified PSRemoting is enabled and working on the test machine using the following command:
Invoke-command – ComputerName TestPC1 –ScriptBlock {Get-Process} –credential mydomain\nickd
The above command works.
I have verified that everyone has access to the share on the server. I have also added domain computers to have access on the share. I have tested this by accessing the share from my PC and one of my other test PCs without any issues. Any ideas on what I’m doing wrong?
As always, thanks in advance for your help.
Nick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://ss64.com/nt/psexec.html