Jim

Jim

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 54 total)
  • Author
    Posts
  • Jim
    Participant
    Post count: 54
    in reply to: Dynamic Uninstall #2343

    The get-installedapplication does support partial display names. It supports name, exact and even wildcard. You could submit a feature request to have QuietUninstall added to the list of values it finds or even just add it yourself- QuietUninstallString = $regKeyApp.QuietUninstallString. I think I’m going to do that. Thanks for the idea. My way above got the default uninstall parameters, I just manually added the /quiet /norestart since I wasn’t pulling the QuietUninstall key and didn’t have all the parameters. But it did have the /uninstall. So it looks like both of our methods get the job done, just in different ways.

  • Jim
    Participant
    Post count: 54

    Are you using $dirWSSource for anything else? Why not just put c:\sccmsupport in the XML file?

    <Toolkit_LogPath>c:\sccmsupport\</Toolkit_LogPath>
    <MSI_LogPath>c:\sccmsupport</MSI_LogPath>

  • Jim
    Participant
    Post count: 54
    in reply to: Dynamic Uninstall #2329

    Matt,

    I’ve seen other people on here post similar scripts to uninstall software. Out of curiosity, why not use the get-installedapplication function to get the uninstall string? That way you let the function figure out if it’s 64-bit or not…

    Something like this:

    $VC2013 = ((Get-InstalledApplication -Name 'Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501').UninstallString -split '" ').Trim('"')
    If ($VC2013) {
    $VC2013Uninst = $VC2013[0]
    $VC2013Params = $VC2013[1]
    Execute-Process -Path $VC2013Uninst -Parameters "$VC2013Params /quiet /norestart"
    }

    Or my post here, “http://psappdeploytoolkit.com/forums/topic/execute-process-odd-behavior/#post-2248”.

  • Jim
    Participant
    Post count: 54

    What about something like this?

    $p = (get-process -Name notepad).Id
    $WTitle = (Get-WindowTitle -GetAllWindowTitles | Where-Object {$_.ParentProcessId -eq $p}).WindowTitle
    Send-Keys -WindowTitle $WTitle -Keys '{ENTER}'

  • Jim
    Participant
    Post count: 54

    Hmmm… Interesting… It does work! But it’s still loading/unloading the ntuser.dat for each user unnecessarily. I think I like my way better for copying/deleting files/folders… But I learned something… Thanks.

  • Jim
    Participant
    Post count: 54

    Have you actually tried using that function with anything other than registry values? I looked at that function in the AppDeployToolkitMain.ps1 file and it only references registry info- reg.exe, ntuser.dat files, HKEY_Users etc. I tried using that function to copy a file today and I couldn’t get it to work… To copy or remove files or folders, you’d probably need to do something like this:

    [string[]]$ProfilePaths = Get-UserProfiles | Select-Object -ExpandProperty 'ProfilePath'
    foreach ($ProfilePath in $ProfilePaths) {
    Copy-File -Path "$dirFiles\discovery925_ug_en.pdf" -Destination "$ProfilePath\Desktop"
    }

  • Jim
    Participant
    Post count: 54
  • Jim
    Participant
    Post count: 54
    in reply to: Can't copy folders #2290

    Here’s what I did. The folder name is ‘Home Care Access’ and gets copied to the Public Desktop:

    Copy-File -Path "$dirFiles\Desktop Folders\Home Care Access" -Destination $envCommonDesktop -Recurse

  • Jim
    Participant
    Post count: 54

    It looks like Exit Code 2 means it can’t find the MSU file. Did you escape the inner double quotes in the parameter section with backticks? The forum seems to remove them, although I’ve seen some people make it work, I haven’t figured it out yet… In the code below, just replace BT with the actual backtick `.

    Execute-Process -Path 'wusa.exe' -Parameters "BT"$dirFiles\WindowsTH-RSAT_WS2016-x64Q.msuBT" /quiet /norestart" -WindowStyle Hidden -CreateNoWindow

  • Jim
    Participant
    Post count: 54

    In a previous post I asked if you were trying to remove values and you said, “I am trying to create new 4 values (1607)”. That’s where I got the 1607 from…

    I think the problem is you have (one) double-quote for your value: -Value ”. What you should have is (2) single-quotes: -Value ”.

    Or maybe you had single quotes and the site changed them to double? If that’s the case, then I’m not sure what the issue is.

  • Jim
    Participant
    Post count: 54

    Your code:

    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723’ -Name ‘NoOpenWith’ -Value -Type String -SID $UserProfile.SID

    Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings`

    My code:

    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723’ -Name ‘NoOpenWith’ -Value '1607' -Type String -SID $UserProfile.SID

    Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings

  • Jim
    Participant
    Post count: 54

    If you want to do it your way, remove the [String] at the beginning of your Get-RegistryKey variable declarations… But my way lets PSADT do the work of finding the correct uninstall string… Also, you may need to add a -eq $True to the StartsWith line like this:

    If ($7ZIP) {
    If ($7ZIP.StartsWith("MsiExec.exe") -eq $True) {
    Remove-MSIApplications -Name '7-zip'
    }
    Else {
    Execute-Process -Path $7ZIP -Parameters '/S'
    }
    }

    I’ve had to do that in the past when the StartsWith was a number. It seems to work here without it, but you should test it both ways.

  • Jim
    Participant
    Post count: 54

    Once I changed the value from the single double quote to ‘1607’ and removed the single quote at the end of the last line it worked fine. It set the values for all existing users including default user.

  • Jim
    Participant
    Post count: 54

    I’d just use WUSA to install it:

    Execute-Process -Path 'wusa.exe' -Parameters ""$dirFiles\WindowsTH-RSAT_WS2016-x64.msu" /quiet /norestart" -WindowStyle Hidden -CreateNoWindow

    To uninstall, just add the /uninstall switch:

    Execute-Process -Path 'wusa.exe' -Parameters "/uninstall "$dirFiles\WindowsTH-RSAT_WS2016-x64.msu" /quiet /norestart" -WindowStyle Hidden -CreateNoWindow

    If you’re using SCCM to deploy this, make sure you use the sysnative variable for 64-bit PCs…

  • Jim
    Participant
    Post count: 54

    Did you change the name of the process to setup or whatever window you are sending keys to?

Viewing 15 posts - 16 through 30 (of 54 total)