Quantcast
Channel: psappdeploytoolkit Discussions Rss Feed
Viewing all 1769 articles
Browse latest View live

New Post: Set-PinnedApplication -Action "PintoTaskBar" for all users

$
0
0
I wasn't aware of the Active Setup option when I did my deployment. Instead, I wrote some code in the Post-Install section to parse the User profiles, check for pinned Taskbar items from 2010, create a new reg key to keep track, then add a new entry in each user's RunOnce to execute a script on their next login. I know it likely isn't the cleanest method, but it has worked consistently for me.

Post install code:
        # Find all all Office 2010 Links and remove them
        Write-Log "Finding all old TaskBar Links, writing a registry entry to keep track, and removing the old files"

        Copy-File $dirSupportFiles\ReplaceOldLinks.ps1 -Destination "C:\users\Public"

        $users = Get-UserProfiles | Where-Object{$_.SID -ine "S-1-5-21-Default-User"} 
        
        [scriptblock]$HKCURegistrySettings = {
            Set-RegistryKey -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce' -Name 'ReplaceOldOfficeLinks' -Value 'powershell.exe -noninteractive -noprofile -executionpolicy bypass -file "c:\users\public\ReplaceOldLinks.ps1" -windowstyle Hidden'  -Type String -SID $UserProfile.SID
        }
        Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings -UserProfiles $users

        foreach ($u in $users)
        {
            $links = Get-ChildItem -Path "$($u.ProfilePath)\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\" -Filter "*2010.lnk" -ErrorAction SilentlyContinue
            $regBase = "Registry::HKEY_USERS\$($u.SID)\Software\Microsoft\Office\15.0\Links"

            foreach($l in $links){
                switch -wildcard ($l.Name) 
                    { 
                        "*Outlook*" {Set-RegistryKey -Key "$regBase\Outlook"} 
                        "*Access*" {Set-RegistryKey -Key "$regBase\Access"} 
                        "*Excel*" {Set-RegistryKey -Key "$regBase\Excel"} 
                        "*InfoPath*" {Set-RegistryKey -Key "$regBase\InfoPath"} 
                        "*OneNote*" {Set-RegistryKey -Key "$regBase\OneNote"} 
                        "*PowerPoint*" {Set-RegistryKey -Key "$regBase\PowerPoint"} 
                        "*Project*" {Set-RegistryKey -Key "$regBase\Project"} 
                        "*Publisher*" {Set-RegistryKey -Key "$regBase\Publisher"} 
                        "*Word*" {Set-RegistryKey -Key "$regBase\Word"} 
                    }
            }
            $links | Remove-Item -Force -ErrorAction SilentlyContinue
        }
ReplaceOldOfficeLinks.ps1
$oldlinks = (Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Office\15.0\Links).PSChildName

$linkbase = "$($env:ALLUSERSPROFILE)\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013"

foreach($link in $oldlinks){

Switch -wildcard ($link)
{
    "*Access*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\Access 2013.lnk" -ErrorAction SilentlyContinue }
    "*Excel*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\Excel 2013.lnk" -ErrorAction SilentlyContinue }
    "*InfoPath*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\InfoPath Designer 2013.lnk" -ErrorAction SilentlyContinue }
    "*OneNote*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\OneNote 2013.lnk" -ErrorAction SilentlyContinue }
    "*Outlook*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\Outlook 2013.lnk" -ErrorAction SilentlyContinue }
    "*PowerPoint*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\PowerPoint 2013.lnk" -ErrorAction SilentlyContinue }
    "*Publisher*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\Publisher 2013.lnk" -ErrorAction SilentlyContinue }
    "*Project*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\Project 2013.lnk" -ErrorAction SilentlyContinue }
    "*Word*"{ Set-PinnedApplication -Action PinToTaskbar -FilePath "$linkbase\Word 2013.lnk" -ErrorAction SilentlyContinue }
 }
}

function Set-PinnedApplication 
{ 
<#  
.SYNOPSIS  
This function are used to pin and unpin programs from the taskbar and Start-menu in Windows 7 and Windows Server 2008 R2 
.DESCRIPTION  
The function have to parameteres which are mandatory: 
Action: PinToTaskbar, PinToStartMenu, UnPinFromTaskbar, UnPinFromStartMenu 
FilePath: The path to the program to perform the action on 
.EXAMPLE 
Set-PinnedApplication -Action PinToTaskbar -FilePath "C:\WINDOWS\system32\notepad.exe" 
.EXAMPLE 
Set-PinnedApplication -Action UnPinFromTaskbar -FilePath "C:\WINDOWS\system32\notepad.exe" 
.EXAMPLE 
Set-PinnedApplication -Action PinToStartMenu -FilePath "C:\WINDOWS\system32\notepad.exe" 
.EXAMPLE 
Set-PinnedApplication -Action UnPinFromStartMenu -FilePath "C:\WINDOWS\system32\notepad.exe" 
#>  
       [CmdletBinding()] 
       param( 
      [Parameter(Mandatory=$true)][string]$Action,  
      [Parameter(Mandatory=$true)][string]$FilePath 
       ) 
       if(-not (test-path $FilePath)) {  
           throw "FilePath does not exist."   
    } 
    
       function InvokeVerb { 
           param([string]$FilePath,$verb) 
        $verb = $verb.Replace("&","") 
        $path= split-path $FilePath 
        $shell=new-object -com "Shell.Application"  
        $folder=$shell.Namespace($path)    
        $item = $folder.Parsename((split-path $FilePath -leaf)) 
        $itemVerb = $item.Verbs() | ? {$_.Name.Replace("&","") -eq $verb} 
        if($itemVerb -eq $null){ 
            throw "Verb $verb not found."             
        } else { 
            $itemVerb.DoIt() 
        } 
            
       } 
    function GetVerb { 
        param([int]$verbId) 
        try { 
            $t = [type]"CosmosKey.Util.MuiHelper" 
        } catch { 
            $def = [Text.StringBuilder]"" 
            [void]$def.AppendLine('[DllImport("user32.dll")]') 
            [void]$def.AppendLine('public static extern int LoadString(IntPtr h,uint id, System.Text.StringBuilder sb,int maxBuffer);') 
            [void]$def.AppendLine('[DllImport("kernel32.dll")]') 
            [void]$def.AppendLine('public static extern IntPtr LoadLibrary(string s);') 
            add-type -MemberDefinition $def.ToString() -name MuiHelper -namespace CosmosKey.Util             
        } 
        if($global:CosmosKey_Utils_MuiHelper_Shell32 -eq $null){         
            $global:CosmosKey_Utils_MuiHelper_Shell32 = [CosmosKey.Util.MuiHelper]::LoadLibrary("shell32.dll") 
        } 
        $maxVerbLength=255 
        $verbBuilder = new-object Text.StringBuilder "",$maxVerbLength 
        [void][CosmosKey.Util.MuiHelper]::LoadString($CosmosKey_Utils_MuiHelper_Shell32,$verbId,$verbBuilder,$maxVerbLength) 
        return $verbBuilder.ToString() 
    } 
 
    $verbs = @{  
        "PintoStartMenu"=5381 
        "UnpinfromStartMenu"=5382 
        "PintoTaskbar"=5386 
        "UnpinfromTaskbar"=5387 
    } 
        
    if($verbs.$Action -eq $null){ 
           Throw "Action $action not supported`nSupported actions are:`n`tPintoStartMenu`n`tUnpinfromStartMenu`n`tPintoTaskbar`n`tUnpinfromTaskbar" 
    } 
    InvokeVerb -FilePath $FilePath -Verb $(GetVerb -VerbId $verbs.$action) 
} 

New Post: Need urgent help on a strange problem..

$
0
0
What version of the PSADT are you using?

New Post: Need urgent help on a strange problem..

$
0
0
g4m3c4ck wrote:
What version of the PSADT are you using?
I'm using the most recent version "PSAppDeployToolkit v3.5.0".

The thing is this is an damned old InstallShield engine it seems .. cause other InstallShield based applications I can install just fine with the commands above, that's why I'm so baffled why it would call just this specific installer with the addendum
"C:\APP_Path\Files\Setup.exe" -isw64 
before the correct command line.. is there eventually any way to enforce the command line to be used? I even tried already parsing the command line trough a
Execute-Process -FilePath "cmd" -Parameters "/c `"$dirFiles\setup.exe`"  /s /f1`"$dirFiles\setup.iss`" " -WindowStyle Hidden
but even then its the same behavior.. so something is really odd with that ages old InstallShield

Regards Sven//

New Post: Get your Complete vc++ install kit

$
0
0
Hi

I finally got around to creating an installer for the various vc++ installers.
This is built for our environment so it's only geared for x64 machines.. it installs x86 libraries as well but it doesn't look at architecture of the client.

it's built with psappdeploy toolkit of course...

If you want it.. here it is:


https://dl.dropboxusercontent.com/u/4142619/vc.rar

New Post: Syntax

$
0
0
Hi,

New to this, so this could be a really easy answer. I'm looking at deploying AutoCAD using the deployment toolkit. I've tried to use this argument

Execute-Process Install -Path "$dirFiles\IMG\Setup.exe" -Parameters '/W /qb /I Img\setup.ini' -WindowStyle Normal

but am getting the error below
[12-23-2014 12:37:57.642] [Installation] [Execute-Process] :: Function failed, setting exit code to [999].

Error Record:

Message : Exception calling "Start" with "0" argument(s): "The directory name is invalid"
InnerException : System.ComponentModel.Win32Exception (0x80004005): The directory name is invalid
                at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
                at CallSite.Target(Closure , CallSite , Object )
FullyQualifiedErrorId : Win32Exception
ScriptStackTrace : at Execute-Process<Process>, C:\Users\John.R.Taylor\Desktop\AutoCAD 2015 x64\AppDeployToolkit\AppDeployToolkitMain.ps1: line 2263
                    at <ScriptBlock>, C:\Users\John.R.Taylor\Desktop\AutoCAD 2015 x64\Deploy-Application.ps1: line 119
PositionMessage : At C:\Users\John.R.Taylor\Desktop\AutoCAD 2015 x64\AppDeployToolkit\AppDeployToolkitMain.ps1:2263 char:5
              +                 [boolean]$processStarted = $process.Start()
              +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error Inner Exception(s):

Message : The directory name is invalid
InnerException :

Just wondering if someone can point me in the correct direction?

New Post: Need urgent help on a strange problem..

$
0
0
This is a package issue. Not a toolkit issue.

1- You are installing blind. Tack on something like /f2"C:\Setup.log" to get a log file.

2- Simplify and isolate. Try to install without the toolkit. If it doesn't work with
setup.exe  /s /f1"$dirFiles\setup.iss" /f2"C:\Setup.log"
The toolkit will not magically make it work.

3- Where did the setup.iss come from? Did you created it with XP and now you expect it to work on Win8 or Win7?
Installshield ISS files are a built-in way to "drive" the installation dialog boxes and are only able to handle only ONE scenario.
If the setup.exe does something on Win7 that it didn't do in XP, the ISS files will not work.

4-WTH is the -isw64 switch for? It's not documented anywhere. (it's mentioned here if you know Russian! http://blog.not-a-kernel-guy.com/2007/01/12/133 )

5-There are some package that are so badly done that you have no choice but to repackage.

New Post: Installing Updates

$
0
0
Yes, but it wouldn't line up with the sample I plagiarized from my internet search result :-)

New Post: Installing Updates

$
0
0
I am now packaging IE11 for deployment and I plan to use the install-updates (as mentioned above) for the IE11 prereqs.

New Post: Regarding the SCCM limitation with Applications and "allow user to interact with program installation"

$
0
0
I've tested out the latest beta, and it works, provided that the logged on user is an admin on the machine.
However, most users I'm using PSAppDeploy on are NOT local admins, so the deployment fails to run properly. Am I missing something? How do I properly deploy this latest version using SCCM? I'm currently using:

Install: Deploy-Application.EXE

Uninstall: Deploy-Application.exe Uninstall

Install for System
Whether or not a user is logged on
Normal

New Post: Show-InstallationWelcome when uninstalling ?

$
0
0
johann787

I ran into the same issue.. when uninstalling it show the wrong info.

How did you work around it. Could you post the needed changes.

Did not understand "PowerSheller" input on the solution.

New Post: Syntax

$
0
0
Is the application source and setup.exe located in the C:\Users\John.R.Taylor\Desktop\AutoCAD 2015 x64\Files\IMG directory?

Might be simpler to place the root of the installation source in the "Files" directory.

New Post: Regarding the SCCM limitation with Applications and "allow user to interact with program installation"

$
0
0
After further testing with v3.6.0, I think I've got everything working to properly display UI to the current logged on user of a machine.

In SCCM, I have the following set:

Install: Install.bat

Uninstall: Uninstall.bat

Install for System
Whether or not a user is logged on
Normal

Here are the command lines for each bat file:
Install: PSExec.exe -si -accepteula %cd%\ServiceUI.exe %cd%\Deploy-Application.exe
Uninstall: PSExec.exe -si -accepteula %cd%\ServiceUI.exe %cd%\Deploy-Application.exe Uninstall

I also have copies of both PSExec.exe and ServiceUI.exe (x86 version) at the root of the toolkit.

So far I've had success on both 64-bit and 32-bit machines. For some reason, running PSExec as SYSTEM, then running ServiceUI after, avoids the usual "Error Code 5" on 32-bit machines. The implementation may be a bit cumbersome, but it DOES WORK. If anyone else is interested, feel free to do the same.

New Post: Regarding the SCCM limitation with Applications and "allow user to interact with program installation"

$
0
0
Hummm, so you use PSExec because you had issues using ServiceUI on 32/64 Machines?
I use this the 32-bit ServiceUI to deploy Applications to 32 Bit AND 64 Bit Windows 7 / XP with no issues so far.
And this also works during a TS for me...

New Post: installTitle not working in StatusMessage?

$
0
0
Show-InstallationProgress -StatusMessage 'Uninstalling application [$installTitle]. Please Wait...'

above line should had shown me thi

Variables: Application

[string]$appVendor = 'Igor Pavlov'
[string]$appName = '7-Zip'
[string]$appVersion = '9.35 beta'
[string]$installTitle = "$appVendor $appName $appVersion"

but i getting the this:

'Uninstalling application [$installTitle]. Please Wait...'

What wrong with the string since it doesnt show this:

'Uninstalling application Igor Parlov 7-Zip 9.35 Beta. Please Wait...'

New Post: installTitle not working in StatusMessage?

$
0
0
I put '' around the [$installTitle] and got this error
Error Inner Exception(s):
-------------------------

Message        : Cannot convert value "Igor Pavlov 7-Zip 9.35 beta" to type "System.Int32". Error: "Input string was not in a correct format."
InnerException : System.FormatException: Input string was not in a correct format.
                    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberForma
                 tInfo info, Boolean parseDecimal)
                    at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
                    at System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo)
                    at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInf
                 o culture, Object value)
how to fix this Error?

New Post: installTitle not working in StatusMessage?

$
0
0
this is working fine?

Show-InstallationProgress -StatusMessage $installTitle

so how do i combine this with normal text?

New Post: installTitle not working in StatusMessage?

$
0
0
ok found out

this is working:

Show-InstallationProgress -StatusMessage "Uninstalling application $installTitle. Please Wait..."

New Post: Removing a KB with the tool

$
0
0
Has anyone tried using the tool to remove a kb? I know we can with a task sequence but to handle the reboot notice with a task sequence is rather non-standard for our deployments.

New Post: Update a config file from CSV

$
0
0
Got this code from a friend, if someone has a cleaner way of replacing values in a config file before deployment feel free to post it below. Using function updatefile and some code to pull config out of a CSV. I know you could do an ini instead of a csv. It's the updating the config after you have the value I wish was cleaner. Hope this helps someone with multiple locations.

Function UpdateFile
{
$file = Get-ChildItem $FILENAME
foreach ($str in $file) 
{
    $content = Get-Content -path $str
    $content | foreach {$_ -replace $OLDSTRING,$NEWSTRING} | Set-Content $str
} 
}

$site = $computername.substring(0,3)
$CSVfile = 'FacilityServers.csv'
$CSV=Import-Csv $CSVfile
[String]$Facility = $CSV | Where-Object {$_.'site' -eq $site} | select 'Facility'
$Facility = $Facility.Replace("@{Facility=","")
$Facility = $Facility.Replace("}","")

-----------------------------------------

$FILENAME = "main.conf"
$OLDSTRING = "XXXXXXXXXXXX"
$NEWSTRING = $GUIServer

-----------------------------------

CSV file contents
Site,GUIServer,Facility
ABC,ABCGUI01,ABC,

config file
[Global]
Replacenew=7za.exe,"XXXXXXXXXXXX\main\update\

New Post: Regarding the SCCM limitation with Applications and "allow user to interact with program installation"

$
0
0
Correct, I consistently receive failed deployments on 32-bit machines, all with Error code 5 from ServiceUI, similar to what others on this thread have posted as well. While we are working to transition to a complete 64-bit environment, the workaround with using PSExec in conjunctions with ServiceUI seems to do the trick.
Viewing all 1769 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>