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

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

$
0
0
dersonc wrote:
My company has been using serviceui.exe to allow user interaction on installations. In this case we always have to check the option to run the process as 32 bit. This is what we found so far:
  • We were able to successfully view the process under the user session in all cases only on Windows 7 64 bits.
  • If using Windows 7 32 bits serviceui.exe always fails with exit code -1 on the AppEnforce.log.
    Anderson Cassimiro
We are having the exact same problem with 32bit Machines. But only if we run the Deployment as an Application. It works fine when using a Package.
Not sure why this is happening.

New Post: Application blocking won't go away.

$
0
0
I'm up to 5 computers (out of 1500 so far) that have this issue and I haven't found a way to resolve it yet. Anybody have any insight in to where this application block setting can be altered manually on a PC?

New Post: Application blocking won't go away.

$
0
0
amigo,

not sure if this will lead you in the right track or not but i was looking around appdeploytoolkit.ps1 and came across the following. Can you check the scheduled task of the PC's and see if the settings are stored there? Hope it helps...

Function UnBlock-AppExecution
# Remove the scheduled task if it exists
    $schTaskBlockedAppsName = "$installName" + "_BlockedApps"
    If (Get-ScheduledTask -ContinueOnError $true | Select TaskName | Where { $_.TaskName -eq "\$schTaskBlockedAppsName" } ) {
        Write-Log "Deleting Scheduled Task [$schTaskBlockedAppsName] ..."
        Execute-Process -FilePath $exeSchTasks -Arguments "/Delete /TN $schTaskBlockedAppsName /F"
    }
}

New Post: Application blocking won't go away.

$
0
0
Locate the blocked executables in this registry key (hint: search for powershell.exe):

"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options"

Delete the Debugger value that launches the PSAppDeployToolkit.

Sean

New Post: Launch browser after install

$
0
0
Hi,

Make sure to use the -NoWait parameter so the script can launch IE and then return the exit code back to SCCM.

Sean

New Post: Deployment Script: Oracle Java Runtime 1.7.0.45

$
0
0
This one suppresses autoupdate, hide tray icons, silent install and other cool stuff. Java Update 765


<#
.SYNOPSIS
This script performs the installation or uninstallation of an application(s).  
.DESCRIPTION
The script is provided as a template to perform an install or uninstall of an application(s). 
The script either performs an "Install" deployment type or an "Uninstall" deployment type.
The install deployment type is broken down in to 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
To access the help section,
.EXAMPLE
Deploy-Application.ps1
.EXAMPLE
Deploy-Application.ps1 -DeploymentType "Silent"
.EXAMPLE
Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer
.EXAMPLE
Deploy-Application.ps1 -Uninstall 
.PARAMETER DeploymentType
The type of deployment to perform. [Default is "Install"]
.PARAMETER DeployMode
Specifies whether the installation should be run in Interactive, Silent or NonInteractive mode.
Interactive = Default mode
Silent = No dialogs
NonInteractive = Very silent, i.e. no blocking apps. Noninteractive mode is automatically set if an SCCM task sequence or session 0 is detected.
.PARAMETER AllowRebootPassThru
Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. 
If 3010 is passed back to SCCM a reboot prompt will be triggered.
.NOTES
.LINK
Http://psappdeploytoolkit.codeplex.com
"#>
Param (
[ValidateSet("Install","Uninstall")] 
[string] $DeploymentType = "Install",
[ValidateSet("Interactive","Silent","NonInteractive")]
[string] $DeployMode = "Interactive",
[switch] $AllowRebootPassThru = $false
)

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

* VARIABLE DECLARATION

Try {

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

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

Variables: Application

$appVendor = "Oracle"
$appName = "Java Runtime Environment"
$appVersion = "1.7.0_65"
$appArch = "x86"
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.0"
$appScriptDate = "07/28/2014"
$appScriptAuthor = "Whatever"

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

Variables: Script - Do not modify this section

$deployAppScriptFriendlyName = "Java Update 7u65"
$deployAppScriptVersion = "1/0"
$deployAppScriptDate = "07/28/2014"
$deployAppScriptParameters = $psBoundParameters

Variables: Environment

$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition

Dot source the App Deploy Toolkit Functions

."$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"

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

* END VARIABLE DECLARATION

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

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

* PRE-INSTALLATION

If ($deploymentType -ne "uninstall") { $installPhase = "Pre-Installation"

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

# Show Welcome Message, close web browsers if required, and verify there is enough disk space to complete the install
Show-InstallationWelcome -CloseApps "iexplore,chrome,firefox" -CheckDiskSpace -PersistPrompt

# Show Progress Message (with the default message)
Show-InstallationProgress "Do not open any browsers doing so will probably make this installation fail. Call Jose @ x4524 if you have any problems with the java installation."
Show-BalloonTip "Please do not open any browsers during the installation!" -BalloonTipTitle "Updating Java"
# Uninstall any previous JRE version
Remove-MSIApplications "Java(TM) 6 Update"
Remove-MSIApplications "Java 7 Update"

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

* INSTALLATION

$installPhase = "Installation"

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

Show-InstallationProgress "We appreciate your time. Remember do not open any browsers. "
# Perform installation tasks here

Execute-MSI -Action Install -Path "jre1.7.0_65.msi" -Parameters "SPONSORS=0 ALLUSERS=1 JAVAUPDATE=0 AUTOUPDATECHECK=0 REBOOT=REALLYSUPPRESS WEBSTARTICON=0 SYSTRAY=0   /qn" 

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

* POST-INSTALLATION

$installPhase = "Post-Installation"

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

# Disable Java Expiration warning (JRE 7u30+)
Add-Content "$envUserProfile\AppData\LocalLow\Sun\Java\Deployment\deployment.properties" "deployment.expiration.check.enabled=false" -ErrorAction SilentlyContinue

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

* UNINSTALLATION

} ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"

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

# Show Welcome Message, close web browsers if required with a 60 second countdown before automatically closing
Show-InstallationWelcome -CloseApps "iexplore,chrome,firefox" -CloseAppsCountdown "60"

# Show Progress Message (with the default message)
Show-InstallationProgress
Show-BalloonTip "Thank you for your patience" -BalloonTipTitle "Installation Completed"
# Perform uninstallation tasks here
Execute-MSI -Action Uninstall -Path "jre1.7.0_65.msi"

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

* END SCRIPT BODY

} } Catch {$exceptionMessage = "$($_.Exception.Message) ($($_.ScriptStackTrace))"; Write-Log "$exceptionMessage"; Show-DialogBox -Text $exceptionMessage -Icon "Stop"; Exit-Script -ExitCode 1} # Catch any errors in this script
Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final clean-up operations

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

New Post: Application blocking won't go away.

$
0
0
You can do this with PowerShell by running the following from an Administrative PowerShell prompt
Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options" -Recurse |
ForEach-Object { Get-ItemProperty $_.pspath } |
Where-Object {$_.Debugger -like "*ShowBlockedAppDialog*"} |
Remove-ItemProperty -Name Debugger
Dan

New Post: write-log and exit-script are not recognized as the name of a cmdlet

$
0
0
Hi,

Just found this tool and looks like it will be very useful. Having downloaded the toolkit and extracted the zip file I can successfully run the Deploy-Application.ps1 script under the toolkit folder but if I try to run the Deploy-Application.ps1 scripts contained within either the Adobe or Microsoft examples I get the following errors:

Write-Log : The term 'Write-Log' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\green_d\Downloads\PSAppDeployToolkit_v3.1.4\Examples\Office2013\Deploy-Application.ps1:244 char:86
  • ... tackTrace)`)"; Write-Log "$exceptionMessage"; Show-DialogBox -Text $exceptionMes ...
  • ~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Write-Log:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
Exit-Script : The term 'Exit-Script' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\green_d\Downloads\PSAppDeployToolkit_v3.1.4\Examples\Office2013\Deploy-Application.ps1:245 char:1
  • Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform fin ...
  • ~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Exit-Script:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
I've not modified anything at this point just extracted the files from the downloaded zip file.....am I missing something here?

Thanks,

Dan.

New Post: Unable to find "AppDeploymentkit" Folder

$
0
0
I got the same error.
Keep an empty folder "AppDeployToolkit" in the package source directory.
That solved the problem for myself.

-AppDeployToolkit
-Files
-SupportFiles

New Post: Application blocking won't go away.

$
0
0
Thanks gents, that totally worked and I've built it in as a check at the end of my job!

New Post: write-log and exit-script are not recognized as the name of a cmdlet

$
0
0
Ignore me, got it sorted. Realised I needed AppDeployToolkit folder in the same location as the Deploy-Application.ps1 script.

New Post: Show-InstallationWelcome Guidance

$
0
0
Hello Everyone,

I figured I would post on these forums to gather others input/suggestions for a current deployment project I have been tasked with, deploying an updated Citrix Receiver. Thanks to this toolkit and others similar post, I have been able to script out the necessary logic to complete that task.

However, prior to deploying this to our Production environment I need to address the following items -

I would like to know, is it possible, while using the Show-InstallationWelcome -Closeapps function to only display the Close Programs and Defer options?

Reason being, while using the syntax below
Show-InstallationWelcome -CloseApps "concentr,pnamain,receiver,wfcrun32,wfica32" -AllowDefer -DeferTimes 10
Users are getting prompted to end processes that they unfortunately dont have any access/rights to do so. The toolkit is doing its job as expected but to avoid confusion for the users, I would like to remove the Continue option altogether if possible. Or perhaps I need to script things out differently?

Ultimately for this particular deployment I MUST notify the customer about the Receiver installation, if they decide to proceed I must close out those processes defined and alternatively give them the capability to defer the install. Another post I found for the Citrix Receiver, they were fortunate enough to be able to use the /Silent switch. Citrix Receiver upgrade

I realize I could simply just ask the users to click on Close programs and be done with it but figured it would not hurt to ask.... Any input/suggestions are greatly appreciated!

New Post: Customizing Deployment for Every 1 Hr

$
0
0
Hi ,

Can we deploy the application using Defer times and Defer Deadline and making to Run Notification Prompt for every 1 hr.
We need to provide notification for user for every 1 hr to remain about Installation.
I can run the application only with Defer Time and Defer deadline. but the prompt doesn't appear for every one hour. Please let me know if i'm missing any thing.

I did notice persistent prompt and Defer Deadline cannot run together. Any ideas or Advise.

New Post: Get-MsiExitCodeMessage: Get message for MSI exit code by reading it from msimsg.dll

$
0
0
This function uses Write-Log and Write-ErrorStack functions posted in another thread in Toolkit Extensions.

You can use this function in the Execute-Process function in the following manner to automatically translate all MSI exit codes:
Else
{
    Write-Log -Message "Execution failed with exit code [$returnCode]" -Component ${CmdletName} -Severity 3
    If ($FilePath -match 'msiexec')
    {
        Get-MsiExitCodeMessage -MsiErrorCode $returnCode
    }
}
Function Get-MsiExitCodeMessage
{
<#
    .SYNOPSIS
        Get message for MSI error code
    .DESCRIPTION
        Get message for MSI error code by reading it from msimsg.dll
    .PARAMETER MsiErrorCode
        MSI error code
    .EXAMPLE
        Get-MsiExitCodeMessage -MsiErrorCode 1618
    .LINK
        http://msdn.microsoft.com/en-us/library/aa368542(v=vs.85).aspx
#>
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$true)]
        [ValidateNotNullorEmpty()]
        [uint32]$MsiErrorCode
    )
    
    Begin
    {
        ${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
        
        $MsiErrorCodeMsgSource = @"
        /// Get error message from msimsg.dll resource dll
        using System;
        using System.Text;
        using System.Runtime.InteropServices;
        public class MsiErrorCode
        {
            public static string GetMessageFromMsiErrCode(uint errCode) 
            {
                string libPath = "msimsg.dll";
                IntPtr hModuleInstance = LoadLibraryEx(libPath, IntPtr.Zero, LoadLibraryFlags.LOAD_LIBRARY_AS_DATAFILE);
                
                StringBuilder sb = new StringBuilder(255);
                LoadString(hModuleInstance, errCode, sb, sb.Capacity + 1);
                
                return sb.ToString();
            }
            
            [DllImport("kernel32.dll")]
            static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, LoadLibraryFlags dwFlags);
            
            enum LoadLibraryFlags : uint
            {
                DONT_RESOLVE_DLL_REFERENCES         = 0x00000001,
                LOAD_IGNORE_CODE_AUTHZ_LEVEL        = 0x00000010,
                LOAD_LIBRARY_AS_DATAFILE            = 0x00000002,
                LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE  = 0x00000040,
                LOAD_LIBRARY_AS_IMAGE_RESOURCE      = 0x00000020,
                LOAD_WITH_ALTERED_SEARCH_PATH       = 0x00000008
            }
            
            [DllImport("user32.dll", CharSet = CharSet.Auto)]
            static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax);
        }
"@

        If (-not ([System.Management.Automation.PSTypeName]'MsiErrorCode').Type)
        {
            Add-Type -TypeDefinition $MsiErrorCodeMsgSource -Language CSharp
        }
    }
    Process
    {
        Try
        {
            Write-Log -Message "Get message for MSI error code [$MsiErrorCode]" -Component ${CmdletName} -Severity 1
            [string]$MsiErrorCodeMsg = [MsiErrorCode]::GetMessageFromMsiErrCode($MsiErrorCode)
            Write-Output $MsiErrorCodeMsg
        }
        Catch
        {
            Write-Log -Message "Failed to get message for MSI error code `n$(Write-ErrorStack)" -Component ${CmdletName} -Severity 3
            Continue
        }
    }
    End
    {
        
    }
}

New Post: Test-MsiExecMutex: Wait, up to a timeout, for the MSI installer service to become free by checking to see if the MSI mutex, "Global\\_MSIExecute", is available

$
0
0
This function uses Write-Log and Write-ErrorStack functions posted in another thread in Toolkit Extensions.

You can add the following code in the Execute-Process function right before starting the process to use this function:
# If MSI install, check to see if the MSI installer service is available or if another MSI install is already underway
If ($FilePath -match 'msiexec')
{
    $MsiExecAvailable = Test-MsiExecMutex -MsiExecWaitTime $(New-TimeSpan -Minutes 10)
    If (-not $MsiExecAvailable)
    {
        Write-Log -Message "Another MSI installation is already in progress. Wait for the installation to complete before trying this installation again." -Component ${CmdletName} -Severity 3
        Exit-Script -ExitCode 1618
    }
}
Function Test-MsiExecMutex
{
<#
    .SYNOPSIS
        Wait, up to a timeout, for the MSI installer service to become free.
    .DESCRIPTION
        The _MSIExecute mutex is used by the MSI installer service to serialize installations
        and prevent multiple MSI based installations happening at the same time.
        Wait, up to a timeout (default is 10 minutes), for the MSI installer service to become free
        by checking to see if the MSI mutex, "Global\\_MSIExecute", is available.
    .PARAMETER MsiExecWaitTime
        The length of time to wait for the MSI installer service to become available.
        This variable must be specified as a [timespan] variable type using the [New-TimeSpan] cmdlet.
        Example of specifying a [timespan] variable type: New-TimeSpan -Minutes 5
    .OUTPUTS
        Returns true for a successful wait, when the installer service has become free.
        Returns false when waiting for the installer service to become free has exceeded the timeout.
    .EXAMPLE
        Test-MsiExecMutex
    .EXAMPLE
        Test-MsiExecMutex -MsiExecWaitTime $(New-TimeSpan -Minutes 5)
    .EXAMPLE
        Test-MsiExecMutex -MsiExecWaitTime $(New-TimeSpan -Seconds 60)
    .LINK
        http://msdn.microsoft.com/en-us/library/aa372909(VS.85).aspx
#>
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$false)]
        [ValidateNotNullOrEmpty()]
        [timespan]$MsiExecWaitTime = $(New-TimeSpan -Minutes 10)
    )
    
    Begin
    {
        ${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
        $PSParameters = New-Object -TypeName PSObject -Property $PSBoundParameters
        
        Write-Log -Message "Function Start" -Component ${CmdletName} -Severity 1
        If (-not [string]::IsNullOrEmpty($PSParameters))
        {
            Write-Log -Message "Function invoked with bound parameters [$PSParameters]" -Component ${CmdletName} -Severity 1
        }
        Else
        {
            Write-Log -Message "Function invoked without any bound parameters" -Component ${CmdletName} -Severity 1
        }
        
        $IsMsiExecFreeSource = @"
        using System;
        using System.Threading;
        public class MsiExec
        {
            public static bool IsMsiExecFree(TimeSpan maxWaitTime)
            {
                /// <summary>
                /// Wait (up to a timeout) for the MSI installer service to become free.
                /// </summary>
                /// <returns>
                /// Returns true for a successful wait, when the installer service has become free.
                /// Returns false when waiting for the installer service has exceeded the timeout.
                /// </returns>
                
                // The _MSIExecute mutex is used by the MSI installer service to serialize installations
                // and prevent multiple MSI based installations happening at the same time.
                // For more info: http://msdn.microsoft.com/en-us/library/aa372909(VS.85).aspx
                const string installerServiceMutexName = "Global\\_MSIExecute";
                Mutex MSIExecuteMutex = null;
                var isMsiExecFree = false;
                
                try
                {
                    MSIExecuteMutex = Mutex.OpenExisting(installerServiceMutexName,
                                    System.Security.AccessControl.MutexRights.Synchronize);
                    isMsiExecFree = MSIExecuteMutex.WaitOne(maxWaitTime, false);
                }
                catch (WaitHandleCannotBeOpenedException)
                {
                    // Mutex doesn't exist, do nothing
                    isMsiExecFree = true;
                }
                catch (ObjectDisposedException)
                {
                    // Mutex was disposed between opening it and attempting to wait on it, do nothing
                    isMsiExecFree = true;
                }
                finally
                {
                    if (MSIExecuteMutex != null && isMsiExecFree)
                    MSIExecuteMutex.ReleaseMutex();
                }
                
                return isMsiExecFree;
            }
        }
"@
        
        If (-not ([System.Management.Automation.PSTypeName]'MsiExec').Type)
        {
            Add-Type -TypeDefinition $IsMsiExecFreeSource -Language CSharp
        }
    }
    Process
    {
        Try
        {
            If ($MsiExecWaitTime.TotalMinutes -gt 0)
            {
                [string]$WaitLogMsg = "$($MsiExecWaitTime.TotalMinutes) minutes"
            }
            Else
            {
                [string]$WaitLogMsg = "$($MsiExecWaitTime.TotalSeconds) seconds"
            }
            Write-Log -Message "Check to see if the MSI installer service is available. Wait up to [$WaitLogMsg] for the installer service to become available." -Component ${CmdletName} -Severity 1
            [boolean]$IsMsiExecInstallFree = [MsiExec]::IsMsiExecFree($MsiExecWaitTime)
            
            If ($IsMsiExecInstallFree)
            {
                Write-Log -Message "The MSI installer service is available to start a new installation." -Component ${CmdletName} -Severity 1
            }
            Else
            {
                Write-Log -Message "The MSI installer service is not available because another installation is already in progress." -Component ${CmdletName} -Severity 1
            }
            Return $IsMsiExecInstallFree
        }
        Catch
        {
            Write-Log -Message "There was an error while attempting to check if the MSI installer service is available `n$(Write-ErrorStack)" -Component ${CmdletName} -Severity 3
        }
    }
    End
    {
        Write-Log -Message "Function End" -Component ${CmdletName} -Severity 1
    }
}

New Post: Import-AuthenticodeCertificateFromFile: Import the signed certificate embedded in a file into the certificate store for all users on the local computer

$
0
0
This function uses Write-Log and Write-ErrorStack functions posted in another thread under Toolkit Extensions.
Function Import-AuthenticodeCertificateFromFile
{
<#
    .SYNOPSIS
        Import the signed certificate embedded in a file into the certificate store for all users on the local computer
    .DESCRIPTION
        Import the Authenticode certificate from a file into a certificate store for all users on the machine
    .PARAMETER FilePath
        Path to the file which contains the signed certificate
    .PARAMETER StoreName
        Name of the certificate store that the certificate should be added to. Default store is 'TrustedPublisher'.
    .EXAMPLE
        Import the certificate into the default 'TrustedPublisher' certificate store.
        Import-AuthenticodeCertificateFromFile -FilePath "F:\SCCM\ConfigurationManager.psd1"
    .EXAMPLE
        Import the certificate into the 'Root' certificate store.
        Import-AuthenticodeCertificateFromFile -FilePath "F:\SCCM\ConfigurationManager.psd1" -Store 'Root'
    .LINK
        http://msdn.microsoft.com/en-us/library/windows/hardware/ff537890(v=vs.85).aspx
        http://msdn.microsoft.com/en-us/library/ie/ms537361(v=vs.85).aspx
    .NOTES
        An authenticode certificate always gets added to the 'TrustedPublisher' certificate store. It may also
        need to be added to the 'Root' certificate store if the authenticode certificate does not have a
        trusted Certification Authority in the 'Root' certificate store.
#>
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$true)]
        [ValidateNotNullorEmpty()]
        $FilePath,
        [Parameter(Mandatory=$false)]
        [ValidateNotNullorEmpty()]
        [ValidateSet('TrustedPublisher','Root','AddressBook','AuthRoot','CertificateAuthority','Disallowed','My','TrustedPeople')]
        $StoreName = 'TrustedPublisher'
    )
    
    Begin
    {
        ${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
        $PSParameters = New-Object -TypeName PSObject -Property $PSBoundParameters
        
        Write-Log -Message "Function Start" -Component ${CmdletName} -Severity 1
        If (-not [string]::IsNullOrEmpty($PSParameters))
        {
            Write-Log -Message "Function invoked with bound parameters [$PSParameters]" -Component ${CmdletName} -Severity 1
        }
        Else
        {
            Write-Log -Message "Function invoked without any bound parameters" -Component ${CmdletName} -Severity 1
        }
    }
    Process
    {
        Try
        {
            Write-Log -Message "Get the Authenticode signing certificate from file [$FilePath]" -Component ${CmdletName} -Severity 1
            $Certificate = Get-AuthenticodeSignature -FilePath $FilePath -ErrorAction 'Stop'
            
            Write-Log -Message "Open a X.509 certificate store object for [LocalMachine\$StoreName]" -Component ${CmdletName} -Severity 1
            $Store = New-Object System.Security.Cryptography.X509Certificates.X509Store([System.Security.Cryptography.X509Certificates.StoreName]::$StoreName,'LocalMachine')
            $Store.Open("MaxAllowed")
            
            Write-Log -Message "Adding certificate to X.509 certificate store [$StoreName]" -Component ${CmdletName} -Severity 1
            $Store.Add($Certificate.SignerCertificate) | Out-Null
            $Store.Close()
        }
        Catch
        {
            Write-Log -Message "Failed to add certificate to X.509 certificate store `n$(Write-ErrorStack)" -Component ${CmdletName} -Severity 3
            Exit-Script -ExitCode 20
        }
    }
    End
    {
        Write-Log -Message "Function End" -Component ${CmdletName} -Severity 1
    }
}

New Post: Import-PSModule: Import PowerShell Modules

$
0
0
This function uses Write-Log and Write-ErrorStack functions posted in separate threads under Toolkit Extensions.
Function Import-PSModule
{
    [CmdletBinding()]
    Param
    (
        [string]$Name
    )
    
    Begin
    {
        ${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
        $PSParameters = New-Object -TypeName PSObject -Property $PSBoundParameters
        
        Write-Log -Message "Function Start" -Component ${CmdletName} -Severity 1
        If (-not [string]::IsNullOrEmpty($PSParameters))
        {
            Write-Log -Message "Function invoked with bound parameters [$PSParameters]" -Component ${CmdletName} -Severity 1
        }
        Else
        {
            Write-Log -Message "Function invoked without any bound parameters" -Component ${CmdletName} -Severity 1
        }
    }
    Process
    {
        If (-not (Get-Module -Name $Name))
        {
            If (Get-Module -ListAvailable | Where-Object { $_.Name -eq $Name })
            {
                Try
                {
                    Write-Log -Message "Load PowerShell Module [$Name]" -Component ${CmdletName} -Severity 1
                    Import-Module -Name $Name -DisableNameChecking -ErrorAction 'Stop'
                    Return $true
                }
                Catch
                {
                    Write-Log -Message "Failed to load PowerShell module [$Name] `n$(Write-ErrorStack)" -Component ${CmdletName} -Severity 3
                    Return $false
                }
            } # end if module available then import
            Else
            {
                Write-Log -Message "PowerShell module [$Name] is not available for import. Failed to load PowerShell module [$Name]" -Component ${CmdletName} -Severity 3
                Return $false
            } # module not available
        } # end if module not available
        Else
        {
            Write-Log -Message "PowerShell Module [$Name] already loaded" -Component ${CmdletName} -Severity 1
            Return $true
        } # module already loaded
    }
    End
    {
        Write-Log -Message "Function End" -Component ${CmdletName} -Severity 1
    }
} # end function Import-PSModule

New Post: additional logfile

$
0
0
Hi,

is it possible to write in a "history.log" to have an overview of all installations from the toolkit?

such information like date, time, userid, app Name.

thanks

New Post: Show-InstallationWelcome Guidance

$
0
0
Please disregard -

I got things sorted out, thank you for creating such a powerful and versatile toolkit! It has really allowed me to strengthen my PowerShell skills and ultimately accomplish task that I otherwise believed were nearly impossible!

Great job guys and is there a way I can donate to this site?

New Post: Bug in Get-UniversalDate

$
0
0
Hello

I am starting to use this great deployment toolkit and I am hoping that you will get the integration with ServiceUI (or similar) to work.

Now to the problem.
I am using this toolkit in a company based in Denmark and beside Denmark we also have factories in other countries. One of these other locations is in Hungary.
We are using an English Windows 8.1 installation on all of our computers with locale set to their respective countries and we are managing them with SCCM 2012 R2.

I am using the Beta version 4.0 but it seems to me that the problem is the same in the stable version as well.

The problem I experienced was that when I am running an installation in Hungary with the option to defer using the following command (omitted):
Show-InstallationWelcome -CloseApps "iexp.......... -DeferTimes 3  -DeferDays 3 
The issue is that in Hungary they spell the month August like this: augusztus
The name includes a "z" and this gives an error with the toolkit because it removes the "Z" from the date this results in the following error:
[31-07-2014 14:40:18] [Pre-Installation] The date/time specified [2014. augustus 3. 14:40:18] is not specified in a format recognised by the current culture [hu-HU] (at Get-UniversalDate, C:\Windows\ccmcache\1d\AppDeployToolkit\AppDeployToolkitMain.ps1: line 2263
at Show-InstallationWelcome, C:\Windows\ccmcache\1d\AppDeployToolkit\AppDeployToolkitMain.ps1: line 2488
at <ScriptBlock>, C:\Windows\ccmcache\1d\Deploy-Application.ps1: line 86)
[31-07-2014 14:40:18] [Pre-Installation] Displaying Dialog Box with message: [The date/time specified [2014. augustus 3. 14:40:18] is not specified in a format recognised by the current culture [hu-HU] (at Get-UniversalDate, C:\Windows\ccmcache\1d\AppDeployToolkit\AppDeployToolkitMain.ps1: line 2263
at Show-InstallationWelcome, C:\Windows\ccmcache\1d\AppDeployToolkit\AppDeployToolkitMain.ps1: line 2488
at <ScriptBlock>, C:\Windows\ccmcache\1d\Deploy-Application.ps1: line 86)]...
My suggestion to fix this is to change the line number 2255 in the AppDeployMain.ps1 to the following:
If ($dateTime -match "Z$") { $dateTime = $dateTime -replace "Z$","" }
The only thing changed in the above line is the addition of a $ sign after the "Z" (regex for only match in the end of the string)

I haven't tested this in real life but it seems to work as expected on my own test environment.

Once again thanks for the great tool and keep up the good work.

Best Regards,
Christian
Viewing all 1769 articles
Browse latest View live


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