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

New Post: Deployment Script: IE11 needs one reboot (x86 and X64) updated for 3.5.0

$
0
0
<---name change
dism lets you inject it without any reboots...

New Post: Forcing a reboot in sccm

$
0
0
update if you call a shutdown.exe in a TS.... it will lose it's way

New Post: Defer showing as failed in sccm

$
0
0
Ok so the app is returning an exit code of 5000 in sccm but I am still getting a failed when someone hits defer instead of retry....any thoughts here?I am at a lost after working on this...

New Post: Check for pending reboot

$
0
0
Here's an updated version.
I currently only use it for inventory/info purposes.
In the header in .EXAMPLE, I added 2 ways you could use it to act on the Pending Reboot status of the machine.
The key property to test is .RebootPending
The rest is for info purposes.
Function Get-PendingReboot {
<#
.SYNOPSIS
    Gets the pending reboot status on a local computer. Return 
    
.DESCRIPTION
    Queries the registry and WMI to determine if the system waiting for a reboot, from:
        CBServicing   = Component Based Servicing (Windows 2008)
        WindowsUpdate = Windows Update / Auto Update (Windows 2003 / 2008)
        CCMClientSDK  = SCCM 2012 Clients only (DetermineIfRebootPending method) otherwise $null value
        PendFileRename = PendingFileRenameOperations (Windows 2003 / 2008)
    
    Returns hash table similar to this:
    
    Computer       : MYCOMPUTERNAME
    LastBootUpTime : 01/12/2014 11:53:04 AM
    CBServicing    : False
    WindowsUpdate  : False
    CCMClientSDK   : False
    PendFileRename : False
    PendFileRenVal : 
    RebootPending  : False
    ErrorMsg       : 

    NOTES: 
    ErrorMsg only contains something if an error occurred

.EXAMPLE
    Get-PendingReboot
    
.EXAMPLE
    $PRB=Get-PendingReboot
    $PRB.RebootPending
    
.EXAMPLE
    #CAVEAT: Not fully tested but should work
    If ( ${Get-PendingReboot}.RebootPending ) { echo "need to reboot" } Else { echo "no reboots pending" }
        
.NOTES
    Based On: http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542
#>
    [CmdletBinding()]
    Begin {
        ## Get the name of this function and write header
        [string]${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
        Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -CmdletBoundParameters $PSBoundParameters -Header
        
        [String]$ComputerName="$envComputerName"
        $CBSRebootPend=$null
        $WUAURebootReq=$null
        $SCCM=$null
        $PendFileRename=$null
        $RegValuePFRO=$null
        $Pending=$null
        $LastBootUpTime=$null
        $PendRebootErrorMsg=$null
    }
    
    Process {
        Try {
            # Setting pending values to false to cut down on the number of else statements
            $PendFileRename,$Pending,$SCCM = $false,$false,$false
            
            # Setting CBSRebootPend to null since not all versions of Windows has this value
            $CBSRebootPend = $null
            
            Try {
                # Querying WMI for build version
                $WMI_OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $ComputerName
                $LastBootUpTime=$WMI_OS.ConvertToDateTime($WMI_OS.LastBootUpTime)
            } catch {
                [datetime]$LastBootUpTime=0 # returns January-01-01 12:00:00 AM
                $PendRebootErrorMsg="WMI: $($_.Exception.Message)"
            }
            
            # If Vista/2008 & Above query the CBS Reg Key
            If ($WMI_OS.BuildNumber -ge 6001) {
                If (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") {
                $CBSRebootPend=$true } else { $CBSRebootPend=$false }
            }   
            
            # Query WUAU from the registry
            If (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
            $WUAURebootReq=$true } else { $WUAURebootReq=$false }
            
            # Query PendingFileRenameOperations from the registry
            $key="HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\"
            $Value="PendingFileRenameOperations"
            If (Test-Path "$key\$Value" -ErrorAction SilentlyContinue)  {
                $RegValuePFRO=Get-ItemProperty -Path $key | Select $Value -ExpandProperty $Value -ErrorAction SilentlyContinue
            } else { $RegValuePFRO=$null }

            # If PendingFileRenameOperations has a value set $RegValuePFRO variable to $true
            If ($RegValuePFRO) {
                $PendFileRename = $true
            } else {
    #           $RegValuePFRO="<empty>"
                $PendFileRename = $false                
            }

            # Determine SCCM 2012 Client Reboot Pending Status
            # To avoid nested 'if' statements and unneeded WMI calls to determine if the CCM_ClientUtilities class exist, setting EA = 0
            $CCMClientSDK = $null
            $CCMSplat = @{
                NameSpace='ROOT\ccm\ClientSDK'
                Class='CCM_ClientUtilities'
                Name='DetermineIfRebootPending'
                ComputerName=$ComputerName
                ErrorAction='SilentlyContinue'
            }
            $CCMClientSDK = Invoke-WmiMethod @CCMSplat
            If ($CCMClientSDK) {
                If ($CCMClientSDK.ReturnValue -ne 0) {
                    Write-Warning "Error: DetermineIfRebootPending returned error code $($CCMClientSDK.ReturnValue)"
                }

                If ($CCMClientSDK.IsHardRebootPending -or $CCMClientSDK.RebootPending) {
                    $SCCM = $true
                }
            }                        
                            
        } Catch {
            Write-Warning "$ComputerName`: $_"
            $PendRebootErrorMsg=$_
        }
        
        # If any of the variables are true, set $Pending variable to $true
        # If the variables are a mixture of false and Null, $Pending variable becomes $false
        If ($CBSRebootPend -or $WUAURebootReq -or $SCCM -or $PendFileRename) {
                $Pending = $true
        }
            
        # Creating Custom PSObject and Select-Object Splat
        $SelectSplat = @{
            Property=('Computer','LastBootUpTime','CBServicing','WindowsUpdate','CCMClientSDK','PendFileRename','PendFileRenVal','RebootPending','ErrorMsg')
        }
        New-Object -TypeName PSObject -Property @{
            Computer=$WMI_OS.CSName
            CBServicing=$CBSRebootPend
            WindowsUpdate=$WUAURebootReq
            CCMClientSDK=$SCCM
            PendFileRename=$PendFileRename
            PendFileRenVal=$RegValuePFRO
            RebootPending=$Pending
            LastBootUpTime=$LastBootUpTime
            ErrorMsg=$PendRebootErrorMsg
        } | Select-Object @SelectSplat
    }
    End {
        Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -Footer
    }           
} #Get-PendingReboot Function

New Post: Defer showing as failed in sccm

$
0
0
That return code is not acted upon by SCCM, other than to flag a 'failed' installation (which is technically correct). The toolkit script continues to run and takes care of the re-prompts at your specified interval, but SCCM is done from that point until the next detection cycle.
You dont want to return a SCCM Retry Code when a user defers and then have SCCM try to run the install again (10mins by default) because the toolkit script is still running and still 'managing' the install.

Or have I not understood your issue?

p.s. you can customise the InstallationDefer_ExitCode in the XML config, but dont unless you are sure you need to!

New Post: Anybody using AppDeployToolkit to deploy package with SCCM 2012 R2?

$
0
0
In fact deploying with system account should only impact USer settings like HKCU. Why not just use activesetup?

For hard package, why directly using repackage and not automation software like Winbatch or AutoIT?

New Post: Defer showing as failed in sccm

$
0
0
I guess my question is should I document for our users if they defer an installation from sccm that it will show as failed then? I think there will be a lot of confusion with this feature within SCCM.

New Post: Module failed to load: Illegal characters in path.

$
0
0
Hello all!

I'm totaly new to AppDeploymentToolkit. I tested my first Deployment successfully on about 10 Workstations but when i deployed it to my department (~100 Clients) some installed successfull and some came up with an error.

I launched it from PowerShell ISE to see whats going on and got this feedback from console:

AppDeployToolkitMain.ps1:576 char:23
  • If (-not (Test-Path <<<< -Path $LogFileDirectory -PathType Container)) {
Whats the matter on those Clients (Windows 7 SP1 32-bit)?

New Post: Module failed to load: Illegal characters in path.

$
0
0
Maybe i fixed it by myselfe, actually i did on one Client.

KB2506143 (Windows Management Framework 3.0) was missing. After installation, my script ran without any errors and the software was installed!

New Post: Multiple Parameters in the Execute-Process function?

$
0
0
Hi snruebes. Just another PADT fan here but I think I can help.

First of all, if you want to make registry changes maybe try using the Set-RegistryKey function, or the even cooler Invoke-HKCURegistrySettingsForAllUsers function.

Otherwise, this might work:

Execute-Process "regedit.exe" -Parameters "/s ^"C:\Users\FirstName Last Name\AppData\local\Temp\HKCU.reg^""

Replace the ^ with ` which is an escape character (doesn't display in the forum), that might do the trick.

New Post: Defer showing as failed in sccm

$
0
0
I think you're probably using the exe to deploy the toolkit. This is a bug that should be resolved in the next release of the toolkit. The proper exit code is not being passed onto SCCM. The updated exe under the source code tab of this site should already have this issue resolved.

Created Unassigned: Feature Request: Specify UI language in config XML (e.g. UILanguage) [139]

$
0
0
Hello PSAD maker,

I love your idea and how you implemented the toolkit so far, but I have a feature request.

As we are an internaltional company located in more then 90 countries worldwide we have a lot of employees around the world speaking different languages with computers with a lot of different keyboard layouts. However we decided to unify the environment and use only english as global standard. Therefore we want, that PSAD toolkit UI elements and dialogs are always displayed in english independed from which keyboard layout/ windows input method or IME a user is currently using. The best solution I can think of would be the ability to determine the UI language by a new toolkit parameter

e.g. -UILanguage 1033

whereas 1033 is the LCID in decimal for English (full table here: http://msdn.microsoft.com/de-de/goglobal/bb964664.aspx).

is it possible to implement this feature?

I would really love it!!!!

New Post: Feature Request: Ability to determine the UI language by a new toolkit parameter (e.g. UILanguage)

$
0
0
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.

New Post: Multiple Parameters in the Execute-Process function?

$
0
0
Hi ambrosis,

cool tip - this works like a charm! Thank you very much.

I know the HKCURegistrySettingsForAllUsers function - the reason why I decided to not use it in this case although it is of course much more elegant is the fact that I had to set 71 registry key values and to safe time I desided to use one line script code to togehther with an exported reg file instead of calling HKCURegistrySettingsForAllUser 71 times.

I love this tools and the community here!

Happy coding!
Sebastian

New Post: Check for pending reboot

$
0
0
It doesn't. That's why it's in the "Toolkit Extensions" section.
I'm just a user like you. Not a Developer of App Deploy Toolkit.

If you want it to be added, raise an "Issue" and ask the developers to add it.

Meanwhile, you can cut-n-paste it inside AppDeployToolkitExtensions.ps1

Denis

New Post: Script not started from SCCM 2012

$
0
0
I created a AppDeployPackage and runs it locally on a machine..that works fine.
When scheduled by SCCM 2012 I see it is started (execmgr.log), but I do not see anything happen. I do not get any AppDeployPackage logs at all.

Any ideas what goes wrong here.
I user version 3.5.0

maybe something goes wrong with the ExecutionPolicy of Powershell ? How could I verify that ?

New Post: Script not started from SCCM 2012

$
0
0
My mistake......I made a failure in the script.
It is working...sorry for this post.

Created Unassigned: Deploy-application.exe not working [141]

$
0
0
Hi,
Earlier Deploy-application.exe is working well. But for some reason its not working with my new app deployment. I didn't do any think weired. I did use the script as i'm using before.
Please advise.

New Post: Check for pending reboot

$
0
0
Hi,

I believe that code is really interesting and will done. But once you run that code then what should we do? Popup a restart message with a SCCM Fast retry? Just return an error and make the package fail? How the strategy will act on OSD?

New Post: Detect Active user / Locked Screen / Not Logged On user

$
0
0
Get-LoggedOnUser function returns a property called IsConsoleUser. If this property is true, then that is the user with control of the keyboard, mouse, and screen.

To check if the screen is locked, see below code. There may be some other method of checking as well but you may have to google that:
$UserNotificationStateSource = @'
using System;
using System.Runtime.InteropServices;
namespace QueryUser
{
    public class NotificationState
    {
        // http://msdn.microsoft.com/en-us/library/bb762533(v=vs.85).aspx
        public enum UserNotificationState
        {
            ScreenSaverOrLockedOrFastUserSwitching=1, FullScreenOrPresentationMode=2, RunningDirect3dFullScreen=3, PresentationMode=4, AcceptsNotifications=5, QuietTime=6, WindowsStoreAppRunning=7
        }
        // Only for Vista or above
        [DllImport("shell32.dll")]
        static extern int SHQueryUserNotificationState(out UserNotificationState pquns);
        public static UserNotificationState GetState()
        {
            UserNotificationState state;
            int returnVal = SHQueryUserNotificationState(out state);
            return state; 
        }
    }
}
'@
If (-not ([System.Management.Automation.PSTypeName]'QueryUser.NotificationState').Type) {
    Add-Type -TypeDefinition $UserNotificationStateSource -Language CSharp
}
Start-Sleep -Seconds 10
[QueryUser.NotificationState]::GetState()
Viewing all 2341 articles
Browse latest View live


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