Send-MailMessage is not a toolkit function. It must be a private function you use. You should post it to the Toolkit Extensions forumif you meant to share it with the user above.
↧
New Post: Email with .log file...
↧
New Post: Custom Toolkit Parameter
I included some detection logic in a deployment script to check for the existence of the installed product before making an attempt to install/uninstall the application. I placed the conditional logic into a function and placed the function in the "AppDeployToolkitExtensions.ps1". The detection logic works flawlessly when the function is called from my "Deploy-Application.ps1." My question is quite simple I would like to create a custom command line parameter that calls the custom Toolkit function if the parameter is used in the command line. For example; it is assumed that the following forces the uninstall to execute Silently (non-interactively) otherwise the default nature is to execute the install routine interactively.
Best Regards,
Yves
Deploy-Application.ps1 -DeploymentType "Uninstall" -DeployMode "Silent"
I would like to accomplish something similar Deploy-Application.ps1 -DeploymentType "Uninstall" -DeployMode "Silent" -CustomParam "Yes"
Where the default behavior of "-CustomParam" is set to "No" unless explicitly set to "Yes" at which point would call the custom function in the "AppDeployToolkitExtensions.ps1" to process conditional logic. Any suggestions on how to accomplish this would be greatly appreciated. Best Regards,
Yves
↧
↧
New Post: Regarding the SCCM limitation with Applications and "allow user to interact with program installation"
scotpower wrote:
(Apologies if this requires a new thread)There is a bug in 3.6.0: https://psappdeploytoolkit.codeplex.com/workitem/172
I am running into a problem solely with the Show-InstallationPrompt dialogs displaying under session 0, and only with PowerShell 3.0 or 4.0. The Show-InstallationPrompt dialogs, when run under session 0 (via ConfigMgr 12 or pesexec) with PowerShell 3.0 or 4.0 on Win7x64 either fail for display, or sometimes will display up to 10 minutes later. All other dialogs are presented as expected.
Has anyone expierned this problem, and if so, have any idea what may going on here.
↧
New Post: Custom Toolkit Parameter
Hi Yves,
in Deploy-Application.ps1 add following:
As a suggestion, maybe implemented as a boolean instead, just like the variable $AllowRebootPassThru.
This way it switches to $true if the parameter is specified even without a value, otherwise it is $false.
in Deploy-Application.ps1 add following:
Param (
[Parameter(Mandatory=$false)]
[ValidateSet('Yes','No')]
[string]$CustomParam = 'No',
You can now use the value of $CustomParam.As a suggestion, maybe implemented as a boolean instead, just like the variable $AllowRebootPassThru.
This way it switches to $true if the parameter is specified even without a value, otherwise it is $false.
↧
New Post: Email with .log file...
Oh ok, sorry about that. I believe it's just a basic PowerShell function though, Send-MailMessage, nothing private that I set up. I added it to the end of Deploy-Application.ps1
↧
↧
New Post: BlockExecution silently?
I have tried using Block-AppExecution -ProcessName 'javaw,iexplore,chrome,firefox,safari' after Show-InstallationWelcome, no luck, I get the Close App promt.
I have also tried using it in pre installation task but it doesnt work at all, no block.
I have also tried using it in pre installation task but it doesnt work at all, no block.
↧
New Post: Function Get-Installed Application
working on something similar and need to perform a install based on the results.
here is what is not working for me..
$IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
If($IsAppInst -eq "4.0.5"){prompt users}
else{perform install step}
when I run the script I get.. (Testing with version 3.5.0 PSAPPDT)
[dotPDNLLC_paint.net_4.0.5] setup started.
[03-19-2015 12:43:20.411] [Initialization] [PSAppDeployToolkitExt] :: Script [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitExtensions.ps1] dot-source invoked by [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMa
in.ps1]
[03-19-2015 12:43:20.415] [Initialization] :: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)
[03-19-2015 12:43:20.420] [Initialization] [Show-DialogBox] :: Display Dialog Box with message: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain
.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)...
[03-19-2015 12:43:24.942] [Initialization] [Show-DialogBox] :: Dialog Box Response: OK
if I simply highlight and run the code I get this:
PS C:\WINDOWS\system32> $IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
$IsAppInst
[03-19-2015 12:46:30.828] [Initialization] [Get-InstalledApplication] :: Get information for installed Application Name(s) [paint.net]...
[03-19-2015 12:46:30.915] [Initialization] [Get-InstalledApplication] :: Found installed application [paint.net] version [4.0.5] matching application name [paint.net]
4.0.5
thanks in advance
here is what is not working for me..
$IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
If($IsAppInst -eq "4.0.5"){prompt users}
else{perform install step}
when I run the script I get.. (Testing with version 3.5.0 PSAPPDT)
[dotPDNLLC_paint.net_4.0.5] setup started.
[03-19-2015 12:43:20.411] [Initialization] [PSAppDeployToolkitExt] :: Script [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitExtensions.ps1] dot-source invoked by [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMa
in.ps1]
[03-19-2015 12:43:20.415] [Initialization] :: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)
[03-19-2015 12:43:20.420] [Initialization] [Show-DialogBox] :: Display Dialog Box with message: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain
.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)...
[03-19-2015 12:43:24.942] [Initialization] [Show-DialogBox] :: Dialog Box Response: OK
if I simply highlight and run the code I get this:
PS C:\WINDOWS\system32> $IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
$IsAppInst
[03-19-2015 12:46:30.828] [Initialization] [Get-InstalledApplication] :: Get information for installed Application Name(s) [paint.net]...
[03-19-2015 12:46:30.915] [Initialization] [Get-InstalledApplication] :: Found installed application [paint.net] version [4.0.5] matching application name [paint.net]
4.0.5
thanks in advance
↧
New Post: Function Get-Installed Application
ok so I think I got it working. Strange thing is that when I run it via ise it fails. If I select the section of code I want and run it only it works and it works fine when initiated via cm12 software center. Here is the updated code I tried for this.
check to see if its installed already
If((Get-InstalledApplication 'paint.net' | Select "DisplayVersion" -ExpandProperty "DisplayVersion")-eq "4.0.5"){$MsgText = "I have detected that you already have $InstallTitle
Nothing more to do, exiting the install."
$UserPrompt = Show-InstallationPrompt -message "$MsgText" -ButtonRightText "OK" -Icon "Information" -MinimizeWindows $True -timeout 900
Exit-Script -ExitCode 0
}
Else{# Install it
Show-InstallationProgress -StatusMessage "Installing $InstallTitle
Please wait..."
If ($is64bit -eq $true){Execute-MSI -Action Install -Path $DirFiles\PaintDotNet_x64.msi -Parameters " /quiet /norestart"}
Else{Execute-MSI -Action Install -Path $DirFiles\PaintDotNet_x86.msi -Parameters " /quiet /norestart"}
}
↧
New Post: InstallationUI_Timeout not timing out
Thanks for reporting this, the fix has been committed to the latest source code.
We should have a point release out by the end of next week including this fix.
Sean
We should have a point release out by the end of next week including this fix.
Sean
↧
↧
New Post: Get-InstalledApplication Fails because white space is stripped
I encountered an annoying anomaly working on a script to upgrade VLC from v2.1.5 to v2.2.0 with (detection) logic to exit with a message indicating the product is installed on machines where v2.2.0 exists.
I started out with the following condition
Oh wait there's more! I noticed something odd which would later underscore a much larger problem than I had originally assumed. Take note of the $appName variable
Initially I missed this and it wasn't until I employed a completely different detection method (that yielded similar results) that it became apparent that I would not achieve any measurable success until the white space stripping was remedied. For example,
Even with this
As always I appreciate the assistance.
Best Regards,
Yves
I started out with the following condition
if (Get-InstalledApplication -Name "VLC media player") {
Show-InstallationPrompt -Message "An installation of $appName $appVersion exists." -ButtonRightText 'OK' -Icon Information -NoWait; Write-Log "ErrorCode Return value is: 1638, proceeding."; Exit-Script -ExitCode 1638
} else {
#VLC Media Player installation routine assuming existing installation not detected
}
The installation halts immediately as it should because a product named "VLC media player" is detected (albeit a false positive of sorts). The version number is what actually makes each subsequent product release unique from the previous release, the product name (in this case VLC Media Player) does not change. [03-20-2015 00:45:29.618] [Pre-Installation] [Get-InstalledApplication] :: Get information for installed Application Name(s) [VLC media player]...The log entries below suggest that the Get-InstalledApplication function is aware of exactly which version installed; clearly v2.1.5 was detected.
[03-20-2015 00:45:30.455] [Pre-Installation] [Get-InstalledApplication] :: Found installed application [VLC media player] version [2.1.5] matching application name [VLC media player]The installation should have been allowed to continue (as I understand it) because the condition was not met in that version being targeted (in this case v2.2.0) does not exist. However I understand that "VLC media player" is not unique which is why (I presume) the condition was erroneously achieved (as seen in the remaining log entries).
[03-20-2015 00:45:30.906] [Pre-Installation] [Show-InstallationPrompt] :: Displaying custom installation prompt with the non-default parameters: [-NoWait:$true -ButtonRightText "OK" -Icon "Information" -Message "An installation of VLCMediaPlayer 2.2.0 exists."]...Is there a way to specify the version in the condition to mitigate potential failures (false positives) due to non-unique name? For example, perhaps something like the following:
03-20-2015 00:45:30.965] [Pre-Installation] :: ErrorCode Return value is: 1638, proceeding.
[03-20-2015 00:45:31.024] [Pre-Installation] [Exit-Script] :: VLCMediaPlayer_2.2.0_EN_01 Installation completed with exit code [1638].
if (Get-InstalledApplication -Name "VLC media player") -and (Get-InstalledApplication -Version "2.2.0") {
#Condition met, exit
}eles{
#Condition not met proceed with installation
}
According to the log the "Get-InstalledApplication" function has the ability to determine the current version of the installed app, is there some way to capture it in the logic to solidify the detection method?Oh wait there's more! I noticed something odd which would later underscore a much larger problem than I had originally assumed. Take note of the $appName variable
##*===============================================
##* VARIABLE DECLARATION
##*===============================================
## Variables: Application
[string]$appVendor = ''
[string]$appName = 'VLC Media Player'
[string]$appVersion = '2.2.0'
[string]$appArch = ''
[string]$appLang = 'EN'
[string]$appRevision = '01'
[string]$appScriptVersion = '1.0.1503.16'
[string]$appScriptDate = '2015.03.16'
[string]$appScriptAuthor = 'alexayr'
[03-20-2015 00:45:30.906] [Pre-Installation] [Show-InstallationPrompt] :: Displaying custom installation prompt with the non-default parameters: [-NoWait:$true -ButtonRightText "OK" -Icon "Information" -Message "An installation of VLCMediaPlayer 2.2.0 exists."]...The log returns "VLCMediaPlayer", something is stripping the white space from the DisplayName.
Initially I missed this and it wasn't until I employed a completely different detection method (that yielded similar results) that it became apparent that I would not achieve any measurable success until the white space stripping was remedied. For example,
Even with this
if ($is64Bit -eq $true) {
$DisplayName = (Get-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\VLC media player' -ErrorAction SilentlyContinue).DisplayName
$DisplayVersion = (Get-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\VLC media player' -ErrorAction SilentlyContinue).DisplayVersion
} else {
$DisplayName = (Get-ItemProperty -Path 'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\VLC media player' -ErrorAction SilentlyContinue).DisplayName
$DisplayVersion = (Get-ItemProperty -Path 'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\VLC media player' -ErrorAction SilentlyContinue).DisplayVersion
}
and this$name = "VLC media player"
$Version = "2.2.0"
This condition would still would fail to detect "VLC media player" becuase the white space is being stripped.if ((Get-InstalledApplication -Name $Name) -and ($DisplayVersion -eq $Version)) {
Show-InstallationPrompt -Message "An installation of $appName $appVersion exists." -ButtonRightText 'OK' -Icon Information -NoWait; Write-Log "ErrorCode Return value is: 1638, proceeding."; Exit-Script -ExitCode 1638
} else {
Write-Log -Message "$appName $appVersion not installed, proceeding."
}
so in essence "VLC media player" = "VLCmediaplayer" = False.As always I appreciate the assistance.
Best Regards,
Yves
↧
New Post: additional functions or parameters for Remove-MSIApplications??
I have committed below updated to the under the beta under "Source Code" tab of this site:
Added following parameters to Remove-MSIApplications to match those in Execute-MSI: -Parameters, -AddParameters, -LoggingOptions, -LogName.
This update will be included in the next release of the toolkit.
Added following parameters to Remove-MSIApplications to match those in Execute-MSI: -Parameters, -AddParameters, -LoggingOptions, -LogName.
This update will be included in the next release of the toolkit.
↧
New Post: Set-ActiveSetup Not Working
I believe the Set-ActiveSetup function is not working properly. I have tested multiple ways and cant seem to have it properly create the registry entries. I am testing on a x64 system and have validated that the entries are not showing up in either standard registry paths, mentioned in the deployment guide, or the SysWOW64 registry paths?
I have written them from scratch according to the guide and also copied and pasted directly from the examples and in all cases they were not created. I am using the 3.6.0 version of the code, fresh download with no changes.
Here are some examples of what I have tried:
I have written them from scratch according to the guide and also copied and pasted directly from the examples and in all cases they were not created. I am using the 3.6.0 version of the code, fresh download with no changes.
Here are some examples of what I have tried:
Set-ActiveSetup -StubExePath 'regedit.exe' -Arguments '/S "%SystemDrive%\Program Files (x86)\DataLink Viewer 11\DesChampsLive_DataLink_Viewer.reg"' -Description 'Setup Personalized Settings for DataLink Viewer' -Key 'DataLinkViewer_ODBC_UserSetup' ContinueOnError
Set-ActiveSetup -StubExePath 'regedit.exe /S "%SystemDrive%\Program Files (x86)\DataLink Viewer 11\DesChampsLive_DataLink_Viewer.reg"' -Description 'Setup Personalized Settings for DataLink Viewer' -Key 'DataLinkViewer_ODBC_UserSetup' ContinueOnError
Just wanted to make sure someone is aware of the potential issue.↧
New Post: Set-ActiveSetup Not Working
Does the active set up registry entry get created under this path?: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\
If so, then Set-ActiveSetup is working correctly and the problem is with the way you are importing registry entries with regedit.exe. Active setup entries are only execute against a user account when they first log into their system. Therefore, active setup only has standard user rights. Please make sure that the registry setting you are importing are all HKEY_CURRENT_USER registry keys or the command will fail. Also, some companies restrict the ability of standard users being able to execute regedit.exe so your command would also fail in this scenario. That is why reg.exe is usually a better option for importing/creating registry keys.
Also, you can take a look at the Invoke-HKCURegistrySettingsForAllUsers function for another method of importing HKEY_CURRENT_USER settings for all users.
If so, then Set-ActiveSetup is working correctly and the problem is with the way you are importing registry entries with regedit.exe. Active setup entries are only execute against a user account when they first log into their system. Therefore, active setup only has standard user rights. Please make sure that the registry setting you are importing are all HKEY_CURRENT_USER registry keys or the command will fail. Also, some companies restrict the ability of standard users being able to execute regedit.exe so your command would also fail in this scenario. That is why reg.exe is usually a better option for importing/creating registry keys.
Also, you can take a look at the Invoke-HKCURegistrySettingsForAllUsers function for another method of importing HKEY_CURRENT_USER settings for all users.
↧
↧
New Post: Set-ActiveSetup Not Working
Hi,
No it does not get created in that path either. I have been using Active Setup for some time now with this tool, and coding it directly as needed in my CMD or VBS deployment files. Thanks for the tip on the REG vs REGEDIT but at this point REGEDIT does work in my environment quite nicely.
Set-ActiveSetup does NOT appear to be working in any of my tests, does it work for you?. I had been using version 3.5.0 for some time and had a work around for creating this key. It does work nicely but the Set-ActiveSetup function will be much easier to manage going foward.
Here is what I have been using all along as a work around. No issues are found with this method:
No it does not get created in that path either. I have been using Active Setup for some time now with this tool, and coding it directly as needed in my CMD or VBS deployment files. Thanks for the tip on the REG vs REGEDIT but at this point REGEDIT does work in my environment quite nicely.
Set-ActiveSetup does NOT appear to be working in any of my tests, does it work for you?. I had been using version 3.5.0 for some time and had a work around for creating this key. It does work nicely but the Set-ActiveSetup function will be much easier to manage going foward.
Here is what I have been using all along as a work around. No issues are found with this method:
Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\DataLinkViewer_ODBC_UserSetup' -Name 'Version' -Value '1' -Type String
Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\DataLinkViewer_ODBC_UserSetup' -Name 'StubPath' -Value 'regedit.exe /S "%SystemDrive%\Program Files (x86)\DataLink Viewer 11\DesChampsLive_DataLink_Viewer.reg"' -Type ExpandString
↧
New Post: Get-InstalledApplication Fails because white space is stripped
I think you're using the the Get-InstalledApplication function incorrectly. When you make a call to this function, it returns the following properties for every application that it found: ProductCode, DisplayName, DisplayVersion, UninstallString, InstallSource, InstallLocation, InstallDate, Publisher, Is64BitApplication.
DisplayVersion is the property with the version number of the application that it found. So to use it properly in your code to do the detection, you would use it like thus:
DisplayVersion is the property with the version number of the application that it found. So to use it properly in your code to do the detection, you would use it like thus:
$VLCInstall = Get-InstalledApplication -Name "VLC media player"
If ($VLCInstall -and (VLCInstall.DisplayVersion -eq '2.2.0')) {
# Contdition met, exit
}
Else {
# Condition not met, proceed with install
}
You can search in the toolkit to see where we are removing white spaces from the $appName variable. It is done to avoid various issues in the script when we use it to build other variables and file names. I would suggest not using this variable to control your logic or how you log if you don't want the white space to be stripped.↧
New Post: Set-ActiveSetup Not Working
Can I see your log file for the install so I can examine the log entries from when this functions is executed?
↧
New Post: Set-ActiveSetup Not Working
Also, I notice that your Set-ActiveSetup command has "ContinueOnError" in it. It should actually be "-ContinueOnError $true" or "-ContinueOnError $false".
↧
↧
New Post: Get-InstalledApplication Fails because white space is stripped
Thank you for the expert advise.
Best Regards,
Yves
Best Regards,
Yves
↧
New Post: Custom Toolkit Parameter
Thank you for the expert advice!
Best Regards,
Yves
Best Regards,
Yves
↧
New Post: Set-ActiveSetup Not Working
Thanks! I did update the testing code to include -ContinueOnError $true but the function still did not work. I have been using ContinueOnError in a few other scripts and it seemed to work well but I will use it the way you suggested going forward.
FYI, I have tested on 3 other machines and all have failed as well. Use the PM that I sent you for a link to the log file. It was executed with the following code:
FYI, I have tested on 3 other machines and all have failed as well. Use the PM that I sent you for a link to the log file. It was executed with the following code:
Set-ActiveSetup -StubExePath 'regedit.exe /S "%SystemDrive%\Program Files (x86)\DataLink Viewer 11\DesChampsLive_DataLink_Viewer.reg"' -Description 'VA Database ODBC Setup' -Key 'DataLinkViewer_ODBC_UserSetup' -ContinueOnError $true
↧