Jump to content


  • 0
Dubs_sccm

Running Powershell

Question

Hello all

 

Running SCCM 1606

Hoping I can get a push in the right direction. I'm looking to uninstall a program on a few hundred PC's.  The package was deployed via SCCM , but the uninstall does not work so I dug up an PS script from online.

 

The following PS Script works just fine if it's ran locally on the clients. 

 

$appVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall  |
    Get-ItemProperty |
        Where-Object {$_.DisplayName -match "Some Application" } |
            Select-Object -Property DisplayName, UninstallString

ForEach ($ver in $appVer) {

    If ($ver.UninstallString) {

        $uninst = $ver.UninstallString
        & cmd /c $uninst /u 
    }

}
 

I have created a  package without any source files.

I have created a program with the following command line 

powershell.exe -ExecutionPolicy ByPass -File \\servername\Applications\application\Uninstall\ps\Uninstall.ps1

Runs with Administrative rights

Runs with UNC name

Whether or not a users is logged on.

 

I deploy to the collection that has this piece of software installed but it never runs on them. I have allowed PowerShell execution on the client settings. I can push other SW to these computers by they way.

Any help would be very much appreciated.

 

Edited by Dubs_sccm
left out some info

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

First what didn't work when you created the package the first time?

Secondly, your problem is you are trying to run a PowerShell script from a UNC path. The Computer account will NOT have access to that path. Therefore it will fail. Why don't you include the posh script within the package source?

Share this post


Link to post
Share on other sites

  • 0

The Package source folder is a UNC path that contains the posh script. 

pss3.png.06cea5f310c50a8ec090e18eafd526f4.pngThanks for the reply.

 

Then the program is the actual posh script. I have tried browsing the the scrips locally , when i deploy I don't get any computers getting this PS script.

,PSS.png.cf164087e5c912d98cef4a0f27a43580.png

This program also uninstalls by a simple uninstall.exe /u/ Hell it even uninstalls by creating a batch file and running it from a share on sccm server, but it's getting that batch or powershell to to clients os the biggest pain i am facing. So any advise to how I can get rid of this program would be wonderful.

Dont really care how brutal the method is as long as sccm can do it.

  •  
  •  
 

PSS.png

9 kb · Done

  •  
  •  

I then have a program 

pss2.png

Edited by Dubs_sccm

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.