Jim

Jim

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 45 total)
  • Author
    Posts
  • Jim
    Participant
    Post count: 45

    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: 45

    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: 45

    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: 45

    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: 45

    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: 45

    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: 45

    You’re not setting any values? Are you trying to remove the existing values?

  • Jim
    Participant
    Post count: 45

    How about something like this?

    $7ZIP = (Get-InstalledApplication -Name '7-zip').UninstallString

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

  • Jim
    Participant
    Post count: 45

    Ok, I think I figured out how to post code… One more try. 🙂

    Execute-Process -FilePath "$env:WinDir\System32\WindowsPowerShell\v1.0\powershell.exe" -Parameters "-File <code>"$DirFiles\Install-VisualCRedistributables.ps1” -Xml "$DirFiles\VisualCRedistributablesAll.xml” -Install” -WindowStyle ‘Hidden’

    Why don’t you just put the code from the Install-VisualCRedistributables.ps1 script directly in the Deploy-Application script?

    Edit: It remove the backticks… 🙁 Well at least I’m getting closer… 🙂

  • Jim
    Participant
    Post count: 45

    I would just do something like this:

    $ABC = Get-ChildItem -Path "<path-to-folder>\ABC*" | Where-Object {$_.PSIsContainer}
    foreach ($_ in $ABC) {
    Remove-Folder -Path $_.FullName
    }

    I have yet to be successful posting code on here, hopefully this works…

  • Jim
    Participant
    Post count: 45

    How did you post that code? I’ve tried several things and I can’t get it to work. 🙁

  • Jim
    Participant
    Post count: 45

    What you need to do is escape the quotes in the parameters with the backtick character, under the tilde symbol. Just put a backtick before each of the quotes in the parameters except the beginning and ending quotes. I can never get code to post correctly here, so this probably won’t work, but I’ll give it another try:

    <p>"-File "$DirFiles\Install-VisualCRedistributables.ps1" -Xml "$DirFiles\VisualCRedistributablesAll.xml" -Install" </p>

  • Jim
    Participant
    Post count: 45

    Are you using the Zero-Config MSI Install because I don’t see any lines where you actually install anything? What does the log file say? Is there an MSI log?

  • Jim
    Participant
    Post count: 45

    Why not just use the Show-InstallationWelcome function?

    Show-InstallationWelcome -CloseApps 'iexplore' -Silent -BlockExecution

    Just be careful with the blockexecution switch. If the script bombs out for any reason, the user won’t be able to launch the apps until the script is re-run and completes successfully.

  • Jim
    Participant
    Post count: 45

    Not sure what you are asking. Thought you said they were autologous. Thought you just needed to close some open apps.

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