Skype Uninstallation

Hi,
I am trying to uninstall Skype using powershell script and the action gets completed but Skype does not get uninstalled.

Here is the script :
folder delete "c:\tempSKYPE"
if {not exist folder “c:\tempSKYPE”}
folder create "c:\tempSKYPE"
move __download c:\tempSKYPE\test4
delete __createfile
delete install.bat
createfile until __END
cd "c:\tempSKYPE\test4"
powershell.exe -noprofile -executionpolicy bypass -file “c:\tempSKYPE\test4\Skype.ps1”
__END
copy __createfile install.bat
waithidden install.bat

And the script works outside of BigFix?

Wait, you said VB script but your call command is for a PowerShell script??

What are you trying to move here?

> move __download c:\tempSKYPE\test4

Yes,sorry it is powershell script and I am trying to move ps1 file to local machine and then trying to run it.And script works manually.

You are not actually moving it.
You left out the file name to move and the full path to the file.

move __download\Skype.ps1 c:\tempSKYPE\test4\Skype.ps1

Skype.ps1 getting move to tempSkype folder when I use my script.The only problem is script run but its not get executed.

What does your prefetch look like?

You are not actually moving anything with this line.

image

You have to add the name you put in your prefetch for the file.

1 Like

Here is the complete script.

prefetch 5d05386109ab4dc235a42b0ac4e8baf187fbea64 sha1:5d05386109ab4dc235a42b0ac4e8baf187fbea64 size:118 http://EDCTEM.tsys.tss.net:52311/Uploads/5d05386109ab4dc235a42b0ac4e8baf187fbea64/SkypeUninstall.tmp sha256:bff5e853d5b3f30bc3f9727445c097ef52a9acd2174f9922e2459504333823d7
extract 5d05386109ab4dc235a42b0ac4e8baf187fbea64

folder delete "c:\tempSKYPE"
if {not exist folder “c:\tempSKYPE”}
folder create "c:\tempSKYPE"
move __download c:\tempSKYPE\test4
delete __createfile
delete install.bat
createfile until __END
cd "c:\tempSKYPE\test4"
powershell.exe -noprofile -executionpolicy bypass -file “c:\tempSKYPE\test4\Skype.ps1”
__END
copy __createfile install.bat
waithidden install.bat

D.Dean has it correct, you’re not moving the correct file(s) from the __Download folder.

After you extract

extract 5d05386109ab4dc235a42b0ac4e8baf187fbea64

What file(s) are you expecting? Change your ‘move __download’ statement to match it.

I am copying the folder name “Skype Uninstall” which contains Skype.ps1 to c:\tempSKYPE\test4 and trying to run Skype.ps1 file.

Are you, though? You need to step through and debug your process.

Take an action that only does the download and extract. Then check the directory listing to see what’s actually in the __Download folder. Report back.

Skype.ps1 copied to c:\tempSKYPE\test4 folder.

Check Tip: Running Commands and Saving Output (Windows) for how to save the command output, and see what it says.

Also try disabling wow64 redirection

You could also drop the prefetch and use the createfile until command to build your script in the action and then save it to your file.

createfile until _end_of_script
All my Poweshell Script lines here.
Another line
Another line
another line
_end_of_script

move __createfile "c:\tempSKYPE\test4\Skype.ps1"

waithidden powershell -ExecutionPolicy Bypass -File "c:\tempSKYPE\test4\Skype.ps1"

I have tried the below script and it completed with exit code 0. But skype doesn’t get uninstalled.

delete createfile
createfile until END
Get-AppxPackage -allusers Microsoft.SkypeApp | Remove-AppxPackage | out-file "C:\temp\skype.txt"
END
delete myskype.ps1
move __createfile myskype.ps1
waithidden {(value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) as string} -ExecutionPolicy Bypass -File myskype.ps1

The output might be helpful. Check my earlier post.

BigFix actions, on Tasks, will report as “Completed” as long as BigFix was able to execute the command. It does not always return the error from the script or whatever you are executing.

I didn’t realize your PowerShell script had one line. You don’t even need to use a script or the create file, you can just run the command. As @JasonWalker stated, you may want to use a script and dump some error codes to see what is happening but you should be able to get that from the one line action script you can run to perform your task.

I am a novice at PS but I believe this will work

run cmd /k powershell.exe -ExecutionPolicy Bypass -NoLogo Get-AppxPackage -allusers Microsoft.SkypeApp | Remove-AppxPackage | out-file "C:\temp\skype.txt"

OR

waithidden cmd /k powershell.exe -ExecutionPolicy Bypass -NoLogo Get-AppxPackage -allusers Microsoft.SkypeApp | Remove-AppxPackage | out-file "C:\temp\skype.txt"Preformatted text`

1 Like

I have tried both commands.

1.run cmd /k powershell.exe -ExecutionPolicy Bypass -NoLogo Get-AppxPackage -allusers Microsoft.SkypeApp | Remove-AppxPackage | out-file “C:\temp\skype.txt”

Result : Completed with 0 exit code.But Skype is not uninstalled.

2.waithidden cmd /k powershell.exe -ExecutionPolicy Bypass -NoLogo Get-AppxPackage -allusers Microsoft.SkypeApp | Remove-AppxPackage | out-file “C:\temp\skype.txt”

Result : Action in running state for more than 12 hours. No result.

Hi @rupkumar

Can you share the Relevance statement you are using for identify if Skype is Install?

CMD /k will “keep CMD open” after running the command. It does not allow the CMD window to exit after running - good for debugging interactively but you’ll need CMD /C when running in BigFix, so the CMD window will “close” after the command executes.

Both versions should still write the output file, you need to check what is in the output.