Quantcast
Channel: PowerShell App Deployment Toolkit
Viewing all 2341 articles
Browse latest View live

New Post: VPN session detection logic


New Post: Supersedence Behavior (SCCM2012r2)

$
0
0
PowerSheller wrote:
Otherwise I think we need Cameron King from Microsoft to help out

Let me see if I can reach him somehow ...

New Post: Powershell Application Detection

$
0
0
Awesome tool, now that I have found this I need to read up on powershell! Being that I am not that well versed with Powershell scripting I am hoping someone tell me where i am going wrong.

I am trying to deploy an upgraded Citrix Receiver in our environment. I will be doing this via an SCCM Package. I am trying to query a specific key in the registry to determine the Receiver version installed HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\PluginPackages\XenAppSuite\PN_Agent\Version

If version is already value defined I would want this package not to even run for the user. If its not then proceed with killing processes and then install app.

Below is the script so far but it fails as I am trying to get-itemproperty.
# Determine if Citrix Receiver 3 is installed if so quit script
      $ReceiverVersion Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Citrix\PluginPackages\XenAppSuite\PN_Agent' -Name Version
            If ($ReceiverVersion -eq "13.1.300.8") {
            $Receiver3Installed = $true
            Break
    }
}

    # If Receiver is not up to date Show Welcome screen and kill Receiver processes
If ($Receiver3Installed -eq $false) {
    Show-InstallationWelcome -CloseApps "Receiver,pamain" -AllowDefer -DeferTimes 3

New Post: Lenovo Battery Recall 2014

$
0
0
In March 2014, Lenovo issued a recall for certain batteries shipped with specific models of their ThinkPad line of laptops (or purchased afterwards as accessories). You can read about the recall here: http://support.lenovo.com/en_CA/detail.page?DocID=HF004122

They provide an enterprise tool which can be silently deployed to affected machines, but the enterprise tool only creates a .csv file for each machine which an admin needs to gather up and email to a Lenovo rep to have them check whether the battery in the machine is affected. For various reasons, that didn't sound like a good solution to me, so I thought this might be a good first project to try out the toolkit.

Here's the script:

https://gist.github.com/rgsteele/f08f817d955440bb98c4

Save LenovoBattery.exe (download link) to the Files folder. You'll want to deploy as a Package rather than as an Application. Enable the "Allow the user to run the program independently of assignments" option so the user can run the tool again through the Software Center if they have an additional battery to test.

I posted a WQL query in this thread on the Lenovo forums which should find all of the standard machines which may be affected. (Special bid machines may have a different model number and thus would not be found by this query.) Use this to create the device collection you deploy the Package to.

Here's how it works: first the script verifies that the client can connect to https://lenovobattery2014.orderz.com (which is the site the tool uses to verify whether the battery is eligible for recall). If the site cannot be reached, the script terminates with errorcode 1. Otherwise, the script displays a dialog to the user explaining what they will see when the tool runs. When the user clicks OK, the script runs LenovoBattery.exe with the /silent switch, which installs the tool and runs it.

The tool itself will either display a dialog saying that the battery is not affected or launch a browser window, which will either display "The battery is not eligible for replacement" or "The battery is eligible for replacement", in which case the user needs to click "Continue" and fill in their details to arrange to be shipped a replacement battery.

As soon as the tool finishes running, the script performs a silent uninstall of the tool since it is no longer needed. A final dialog is displayed to the user.

You should customize the messages displayed before and after the tool is run by editing the $message and $message2 here-strings.

A couple issues I encountered: I tried using Show-InstallationPrompt to display the messages to the user but the text was cut off, which I why I ended up using Show-DialogBox instead. I was also going to use Test-NetworkConnection rather than specifically validating that the site was available, but I found that function falsely reported "no connection" on my test machine which did in fact have a connection available. I'll file a bug for that when I'm able to further investigate why it didn't work.

Anyway, hope this is useful to someone. It was a good project for my first PSAppDeployToolkit deployment! Feedback is welcome.

New Post: Toolkit keeps returning exit code 0 instead of 3010.

$
0
0
After an installation I try to return a 3010 code back to ConfigMgr to restart the machine.
I use the Exit-Script function as following:
Exit-Script -ExitCode "3010"
I am aware that the $AllowRebootPassThru variable needs to be TRUE to avoid the suppression of this exit code. However PSAppDeploy Toolkit keeps returning return code 0 when I call the script with -AllowRebootPassThru.
When I replace 3010 with any other code it gets returned correct.

Do I need to configure something else to return a 3010 code?

New Post: Toolkit keeps returning exit code 0 instead of 3010.

$
0
0
Looked at the AppDeployToolkitMain.ps1 and found the reason.
If ($msiRebootDetected -eq $true -and $AllowRebootPassThru -eq $true) {
The MSI does not return a restart code and therefore the $msiRebootDetected variable is set to false. It works when I manually set it to true.
The documentation is not very clear on this behavior. It only mentions that
If $AllowRebootPassThru is set to False, it will suppress any "3010" exit codes detected during the installation and instead pass the "0" exit code.

New Post: Powershell Application Detection

$
0
0
I'm not well versed either, but I've been using something similar for detection methods that works for me.
# Determine if Citrix Receiver 3 is installed if so quit script
      $ReceiverVersion Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Citrix\PluginPackages\XenAppSuite\PN_Agent' -ErrorAction SilentlyContinue | Get-ItemProperty | Select "Version" -ExpandProperty "Version"
            If ($ReceiverVersion -ge "13.1.300.8") {
            $Receiver3Installed = $true
            Break
    }
}
I typically use -ge rather than -eq for certain apps just because at times others may have a higher version that they're using than the version approved or mandated by the company. This avoids uninstall/reinstall of their version because it fails version detection.

New Post: Deleting from Reg based on Search

$
0
0
We’re currently upgrading to a new Wireless system and with that we’re pushing out the SSID through a GPO. However, we would like to remove the existing SSID/Profile from the system, which isn’t an issue with simply using “netsh wlan delete profile name”. The problem we’re having is removing these profiles from our user’s “Lenovo Access Connections” which is managing most (if not all) user’s various network profiles. If it’s deleted with the netsh, the user can simply open up Access Connections and it will recreate that profile within Windows.
We cannot simply delete the profiles since each user can name our company network with whatever nickname they want within the program. That being said, I’ve found where these profiles are stored within the registry.

Lenovo Access Connections
HKLM\SOFTWARE\Wow6432Node\Lenovo\Access Connections\Locations

This is where the problem lies, I cannot figure a means to search within the \Locations folder for our SSID, then delete it’s main key. It is currently laid out like this:
\Locations\(Custom Profile Name)\AdptList\Adpt00\
Within the Adpt00 Key there is a Reg_SZ with the name of m_szSsid with it’s value = Our Network’s SSID. So, basically I’m looking to search ALL of \Locations and if any of the m_szSsid within the Adpt00 Key for each of the varying Profiles exists… delete the entire Profile from \Locations, and yes some of our user’s have multiple Profile’s setup for the same Network SSID for a reason unknown to me. Is this even a possibility?

New Post: Deployment Script: Adobe Flash player 11.9.900.152

$
0
0
Hello

Since sintaxasn is very busy I am sure with more important things I thought I would try and resolve my own problem. In my environment we have a mix of Windows 7 and Windows 8 with various browsers and versions. I would like to deliver both Flash ActiveX and Plugin at once to as many as possible . I figured I would check if Firefox was installed and then only update the Flash Plugin on those machines. And Windows 8 / 8.1 does not allow Flash ActiveX updates outside of Windows Updates so I wanted to skip those machines. Below is what I have so far. It appears to work but I'm sure it could be improved. Any ideas would be appreciated. :)

*===============================================

* INSTALLATION

$installPhase = "Installation"

*===============================================

# Get the OS version
$osVersion = [version]$($envOS.version)

# Check If Firefox Is Installed
If(Get-InstalledApplication -Name "Mozilla Firefox" -eq $true) {
Show-InstallationProgress "Installing Flash Player 14 Plugin (14.0.0.145). Please wait..."
Execute-MSI -Action Install -Path "install_flash_player_14_plugin.msi"
}

# Check If OS Is Windows 8 or greater    
If ($osVersion -lt "6.2") {
Show-InstallationProgress "Installing Flash Player 14 ActiveX (14.0.0.145). Please wait..."
Execute-MSI -Action Install -Path "install_flash_player_14_active_x.msi"
}
It would be nice if there was a way to only prompt a close of Internet Explorer on Windows 7, Vista ( OS versions less than 6.2 ) when installing Flash.

THANKS!

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

$
0
0
Going through this thread, I'm having a hard time figuring out what problem people are noticing with ServiceUI.exe. Can someone explicitly describe the problem? I would like to help in solving this if possible.

Also, looking at the Deploy-Application.wse file, we can pass actual exit codes to the parent process using this code
Document Type: WSE
item: Global
  Version=9.02
  Flags=00000100
  Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  Copy Default=1
  Japanese Font Name=MS Gothic
  Japanese Font Size=9
  Start Gradient=0 0 255
  End Gradient=0 0 0
  Windows Flags=00000100000000000010110000001010
  Message Font=MS Sans Serif
  Font Size=8
  Pages Modified=00001000011000000000000000000000
  Extra Pages=00000000000000000000000000010000
  Disk Label=Default
  Disk Filename=SETUP
  Patch Flags=0000000000000001
  Patch Threshold=85
  Patch Memory=4000
  MIF PDF Version=1.0
  MIF SMS Version=2.0
  FTP Cluster Size=20
  Per-User Version ID=1
  Dialogs Version=7
  Crystal Format=10111100101100000010001001001001
  Variable Name1=_INIT_WINDOW_
  Variable Default1=HIDE
  Variable Flags1=00001000
  Variable Name2=_SYS_
  Variable Default2=C:\Windows\system32
  Variable Flags2=00001000
  Variable Name3=_WIN_
  Variable Default3=C:\Windows
  Variable Flags3=00001000
  Variable Name4=_WISE_
  Variable Default4=C:\Program Files\Altiris\Wise Package Studio\WiseScript Editor
  Variable Flags4=00001000
  Requested Execution Level=asInvoker
end
item: Remark
  Text=Call "kernel32.dll" and pass it %#PROCEXITCODE#%. "Kernel32.dll" then terminates current process and passes %#PROCEXITCODE#% to parent process
end
item: Set Variable
  Variable=#PROCEXITCODE#
  Value=%PROCEXITCODE%
end
item: Call DLL Function
  Pathname=%SYS32%\kernel32.dll
  Function Name=ExitProcess
  Argument List=20#PROCEXITCODE#
  Return Variable=2
  Flags=00100000
end
Also, as Wise only compiles 32-bit exes, we can disable WOW64 file redirection so that we can directly access 64-bit files/directories from a 32-bit process using this code:
Document Type: WSE
item: Global
  Version=9.02
  Flags=00000100
  Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  Copy Default=1
  Japanese Font Name=MS Gothic
  Japanese Font Size=9
  Start Gradient=0 0 255
  End Gradient=0 0 0
  Windows Flags=00000100000000000010110000001010
  Message Font=MS Sans Serif
  Font Size=8
  Pages Modified=00001000011000000000000000000000
  Extra Pages=00000000000000000000000000010000
  Disk Label=Default
  Disk Filename=SETUP
  Patch Flags=0000000000000001
  Patch Threshold=85
  Patch Memory=4000
  MIF PDF Version=1.0
  MIF SMS Version=2.0
  FTP Cluster Size=20
  Per-User Version ID=1
  Dialogs Version=7
  Crystal Format=10111100101100000010001001001001
  Variable Name1=_INIT_WINDOW_
  Variable Default1=HIDE
  Variable Flags1=00001000
  Variable Name2=_SYS_
  Variable Default2=C:\Windows\system32
  Variable Flags2=00001000
  Variable Name3=_WIN_
  Variable Default3=C:\Windows
  Variable Flags3=00001000
  Variable Name4=_WISE_
  Variable Default4=C:\Program Files\Altiris\Wise Package Studio\WiseScript Editor
  Variable Flags4=00001000
  Requested Execution Level=asInvoker
end
item: Remark
  Text=If you need to disable WOW64 file redirection so that you can access 64-Bit OS components and directories on 64-bit systems, use the following code
end
item: If/While Statement
  Variable=ENV_64BITOS
  Value=1
end
item: Remark
  Text=Disable WOW64 File Redirection
end
item: Call DLL Function
  Pathname=%SYS32%\kernel32.dll
  Function Name=Wow64DisableWow64FsRedirection
  Argument List=70OLD64FSVALUE
  Return Variable=2ERRCODE64FS
  Flags=01100000
end
item: End Block
end
item: Remark
  Text=Execute/Access 64-bit or 32-bit OS components and directories here.
end
item: Remark
end
item: If/While Statement
  Variable=ENV_64BITOS
  Value=1
end
item: Remark
  Text=Enable WOW64 File Redirection
end
item: Call DLL Function
  Pathname=%WIN%\SysWow64\kernel32.dll
  Function Name=Wow64RevertWow64FsRedirection
  Argument List=21%OLD64FSVALUE%
  Return Variable=2ERRCODE64FS
  Flags=00100000
end
item: End Block
end

New Post: NoCountdown Reposition for Restart prompt with Countdown

$
0
0
Is there a way to get a regular countdown, with the restart later button enabled, to re-position itself front and center like the NoCountdown installation restart prompt will?

I'd like to allow the user to at least partially dismiss the countdown as long as it could come back to foreground to remind them it was counting down every half hour or so.

New Post: NoCountdown Reposition for Restart prompt with Countdown

$
0
0
It sounds like what you're looking for is a combination of the two options currently available. This would be a feature request as it's not currently available.

New Post: Deleting from Reg based on Search

$
0
0
Yes, it sounds possible. You would need to enumerate all the profiles under the Locations key in a foreach loop, getting the PSPath of each of those Custom Profile keys and drilling down in to the Adpt00 key to look for the m_szSsid.

New Post: Powershell Application Detection

$
0
0
Sample Citrix Receiver script:

https://psappdeploytoolkit.codeplex.com/discussions/470880

Here's the code you need - important bit is the [version] type cast:
[version]$CitrixVersion = Get-InstalledApplication "Citrix Receiver" | select "DisplayVersion" -expand "DisplayVersion" 

If ($CitrixVersion -lt [version]"13.1.300.8" -or $CitrixVersion -eq $null) {
     Execute-Process -FilePath "CitrixReceiver.exe" -Arguments "/noreboot /silent"    
} 

New Post: Allowing applications to automatically close while using the defer option

$
0
0
Hi,

I understand your request, the challenge is we get a lot of requests for to cater for different nuances and we need to evaluate the level of effort/complexity involved versus the value they provide and what is in the interest of the toolkit.

The reason we have a deferral is to allow a user the opportunity to postpone an installation. The countdown to close applications is seen as a last resort to force close applications. To us it made more sense only to show the countdown timer if no deferrals are remaining, otherwise you are saying - "here you have a chance to defer this but if you don't respond within the allotted time we're going to kill your applications" (pretty harsh - I wouldn't like to return to my computer only to find my applications were closed without warning!), as opposed to "you've already deferred this installation X number of times, now I'm afraid we must insist on installing this time and if you don't close your applications within the allotted time we will do it automatically"

Sean

New Post: Powershell Application Detection

$
0
0
Why not use the built in Get-InstalledApplication? Since you are looking for a specific version of Citrix, you can just snag that product code or target a specific Citrix plugin (looks like you want to check PNA) and do something like
$appVersion = Get-InstalledApplication -Name "Citrix Receiver(PNA)" | % {$_.DisplayVersion} 
If ($appVersion -le '13.1.300.8') {
Write-Host "it's less than or equal to"
}
Else {
Write-Host "it's greater than"
}
You can use -eq or -ge and modify accordingly. That's usually what I use if I'm looking for something specific like that.

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

$
0
0
The truth is we don't understand why ServiceUI is failing, but when it does fail invariably the error message is this:

[Initialization] ServiceUI: API [CreateProcessAsUser] Error: [5]

The issue appears to be related to cross-architecture processes. When we launch ServiceUI from ccmexec to launch the toolkit it seems to work, but when we launch ServiceUI from within the toolkit it fails - the ideal is that we build it in to the toolkit and the toolkit re-launches itself using ServiceUI provided the following criteria are met:
  • running in system context
  • user is logged on
  • task sequence is not running
There is some further background and test results in this thread that help explain what happens in each scenario:

https://psappdeploytoolkit.codeplex.com/discussions/546142

New Post: Toolkit keeps returning exit code 0 instead of 3010.

New Post: COPY-FILE questions

$
0
0
I am attempting to copy a series of files and folders from the $dirFiles to $envProgramData\appdir (where appdir is the actual name of the destination directory created by the installer) and I can't seem to figure out the appropriate syntax. The Execute-MSI installed the application correctly and New-Shortcut worked to create the desktop shortcut but for the life of me I cannot figure out how to copy all of the required files and folders to the destination. One of the files also needs to overwrite a file that was created by the installer. If someone could provide some syntax suggestions. I tried several of the commands associated with Copy-Item such as force but that doesn't seem to work and threw an error. Oh and I did try a Execute-Process command that was something like this and it just stopped the install dead in its tracks with an error but there was no code to reference:

Execute-Process -FilePath "$envWinDir\system32\cmd.exe" -Arguments "/c xcopy $dirFile\Data*.* $envProgramData\appdir\ /e /s"

New Post: NoCountdown Reposition for Restart prompt with Countdown

$
0
0
Ok, is the project currently taking feature requests? If it is, what's the preferred method of submission?
Viewing all 2341 articles
Browse latest View live


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