Open asparrowhawk opened 6 years ago
PowerShell 2 issue with WIndows 7. I will look into it, thank you for reporting this!
For your information the source ISO for the Windows 7 Machine was en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso.
I already have an idea what's going wrong. It sounds suspiciously like the -in operator has been used. I am at my customer at the moment, but a fix will be coming this evening.
We transfer a script block to the remote machine, which means that -in will fail on a plain Win7/2008R2 machine and we need to use -contains instead.
Hi @asparrowhawk , please do an Install-Module AutomatedLab.Common -Force
and update AutomatedLab.Common to the latest version (1.1.100).
It really was -notin, as well as the type accelerator pscredential which was also incompatible. After that, install-LabSoftwarePackage works again with PowerShell 2.
Sorry for the slow response. Many thanks for looking at this issue so promptly.
I have updated the AutomatedLab.Common to the latest version but I am seeing a new issue:
PS D:\> Install-LabSoftwarePackage -ComputerName OMS -Path $labSources\SoftwarePackages\OemMgmtSetup.msi -CommandLine '/
qn' -Verbose
VERBOSE: Install-LabSoftwarePackage Entering...
(ComputerName=OMS,Path=D:\LabSources\SoftwarePackages\OemMgmtSetup.msi,CommandLine=/qn,Verbose=True)
VERBOSE: Get-LabVM Entering... (ComputerName=OMS)
15:11:30|00:09:51|00:00:00.000| Installing software package 'D:\LabSources\SoftwarePackages\OemMgmtSetup.msi' on machine
s 'OMS'
VERBOSE: Get-LabVM Entering... (ComputerName=OMS,IncludeLinux=True)
VERBOSE: Get-LabVMStatus...leaving...(Time elapsed: 00:00:00:063)
VERBOSE: Starting background job for 'Installation of 'C:\OemMgmtSetup.msi''
15:11:30|00:09:51|00:00:00.120| - Copying files and initiating setup on 'OMS' and waiting for completionVERBOSE: Invoke-
LabCommand Entering...
(ComputerName=OMS,DependencyFolderPath=D:\LabSources\SoftwarePackages\OemMgmtSetup.msi,DoNotUseCredSsp=<null>,PassThru=
True,ScriptBlock=
Install-SoftwarePackage @installParams
,NoDisplay=True,AsJob=True,ActivityName=Installation of
'C:\OemMgmtSetup.msi',Variable=System.Management.Automation.PSVariable[](1),Function=System.Management.Automation.Funct
ionInfo[](1))
VERBOSE: Executing lab command activity 'Installation of 'C:\OemMgmtSetup.msi'' on machines 'OMS'
VERBOSE: Get-LabVM Entering... (IncludeLinux=True)
VERBOSE: Get-LabVM Entering... (ComputerName=OMS,IncludeLinux=True)
VERBOSE: Get-LabVM Entering... (ComputerName=OMS,IncludeLinux=True)
VERBOSE: Get-LabVMStatus...leaving...(Time elapsed: 00:00:00:028)
VERBOSE: Creating session to computer(s) 'OMS'
VERBOSE: New-LabPSSession Entering...
(ComputerName=OMS,DoNotUseCredSsp=<null>,UseLocalCredential=<null>,Credential=<null>)
VERBOSE: Get-LabVM Entering... (ComputerName=OMS,IncludeLinux=True)
VERBOSE: Connecting to machine 'OMS' using the DNS name 'OMS'
VERBOSE: Creating a new PSSession to machine 'OMS:5985' (UserName='OMS\Administrator', Password='Somepass1',
DoNotUseCredSsp='False')
VERBOSE: Get-LabVM Entering... (ComputerName=OMS)
VERBOSE: Session OMS_c28b8ade-76de-4b4d-b87c-52216df1bc89 is available and will be reused
VERBOSE: New-LabPSSession...leaving - return value is 'Session IDs: 2'...(Time elapsed: 00:00:00:014)
VERBOSE: Adding functions 'Install-SoftwarePackage' to session
VERBOSE: Adding variables 'System.Management.Automation.LocalVariable' to session
VERBOSE: Invoke-LWCommand Entering...
(AsJob=True,DependencyFolderPath=D:\LabSources\SoftwarePackages\OemMgmtSetup.msi,ComputerName=OMS,Retries=3,PassThru=Tr
ue,ScriptBlock=
Install-SoftwarePackage @installParams
,Verbose=True,Session=System.Management.Automation.Runspaces.PSSession[](1),RetryIntervalInSeconds=10,ActivityName=Inst
allation of 'C:\OemMgmtSetup.msi')
VERBOSE: Starting Activity 'Installation of 'C:\OemMgmtSetup.msi''
VERBOSE: Copying files from 'D:\LabSources\SoftwarePackages\OemMgmtSetup.msi' to OMS...
VERBOSE: Finished Installation Activity 'Installation of 'C:\OemMgmtSetup.msi''
VERBOSE: Invoke-LWCommand...leaving...(Time elapsed: 00:00:02:453)
VERBOSE: Invoke-LabCommand...leaving...(Time elapsed: 00:00:02:463)
VERBOSE: Waiting on job ID '54' with name 'Installation of 'C:\OemMgmtSetup.msi''
..
Write-Error : Fatal error during installation
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.1.0.115\AutomatedLabWorker.psm1:895 char:17
+ Write-Error -ErrorRecord $jobError
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Write-Error], Win32Exception
+ FullyQualifiedErrorId : Fatal error during installation
VERBOSE: Job ID '' with name '' finished
15:11:39|00:10:01|00:00:09.403| - Installation done
VERBOSE: Install-LabSoftwarePackage...leaving...(Time elapsed: 00:00:06:125)
PS D:\>
I suspect this due to the MSI failing with the message that Application requires the .NET Framework 4.6.1 to be installed. Although it is recorded in the PowerShell output that there was a Fatal error during installation, it would be good to see the exit code of the process. Also the message VERBOSE: Job ID '' with name '' finished would be better if it included the correct Job ID and name.
Many thanks again for the fix.
Sorry that it hit you again.
Is the file you share the file "OemMgmtSetup.msi" or a download link. Reproducing the issue is the easiest way to troubleshoot.
Attached is an MSI file, while not same one used before, exhibits the same issue:
PS D:\> Install-LabSoftwarePackage -ComputerName Client -Path $labSources\SoftwarePackages\SetupWpfInstaller.msi -CommandLine '/qn' -Verbose
VERBOSE: Install-LabSoftwarePackage Entering...
(ComputerName=Client,Path=D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi,CommandLine=/qn,Verbose=True)
VERBOSE: Get-LabVM Entering... (ComputerName=Client)
15:50:54|00:12:03|00:00:00.000| Installing software package 'D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi' on machines 'Client'
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Get-LabVMStatus...leaving...(Time elapsed: 00:00:00:043)
VERBOSE: Starting background job for 'Installation of 'C:\SetupWpfInstaller.msi''
15:50:54|00:12:03|00:00:00.112| - Copying files and initiating setup on 'Client' and waiting for completionVERBOSE: Invoke-LabCommand Entering...
(ComputerName=Client,DependencyFolderPath=D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi,DoNotUseCredSsp=<null>,P
assThru=True,ScriptBlock=
Install-SoftwarePackage @installParams
,NoDisplay=True,AsJob=True,ActivityName=Installation of
'C:\SetupWpfInstaller.msi',Variable=System.Management.Automation.PSVariable[](1),Function=System.Management.Automation.
FunctionInfo[](1))
VERBOSE: Executing lab command activity 'Installation of 'C:\SetupWpfInstaller.msi'' on machines 'Client'
VERBOSE: Get-LabVM Entering... (IncludeLinux=True)
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Get-LabVMStatus...leaving...(Time elapsed: 00:00:00:043)
VERBOSE: Creating session to computer(s) 'Client'
VERBOSE: New-LabPSSession Entering...
(ComputerName=Client,DoNotUseCredSsp=<null>,UseLocalCredential=<null>,Credential=<null>)
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Connecting to machine 'Client' using the DNS name 'Client'
VERBOSE: Creating a new PSSession to machine 'Client:5985' (UserName='Client\Administrator', Password='Somepass1',
DoNotUseCredSsp='False')
VERBOSE: Get-LabVM Entering... (ComputerName=Client)
VERBOSE: Session Client_5254a06f-a117-44c8-9b2f-267d13c082f7 is available and will be reused
VERBOSE: New-LabPSSession...leaving - return value is 'Session IDs: 6'...(Time elapsed: 00:00:00:033)
VERBOSE: Adding functions 'Install-SoftwarePackage' to session
VERBOSE: Adding variables 'System.Management.Automation.LocalVariable' to session
VERBOSE: Invoke-LWCommand Entering...
(AsJob=True,DependencyFolderPath=D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi,ComputerName=Client,Retries=3,Pas
sThru=True,ScriptBlock=
Install-SoftwarePackage @installParams
,Verbose=True,Session=System.Management.Automation.Runspaces.PSSession[](1),RetryIntervalInSeconds=10,ActivityName=Inst
allation of 'C:\SetupWpfInstaller.msi')
VERBOSE: Starting Activity 'Installation of 'C:\SetupWpfInstaller.msi''
VERBOSE: Copying files from 'D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi' to Client...
VERBOSE: Finished Installation Activity 'Installation of 'C:\SetupWpfInstaller.msi''
VERBOSE: Invoke-LWCommand...leaving...(Time elapsed: 00:00:00:131)
VERBOSE: Invoke-LabCommand...leaving...(Time elapsed: 00:00:00:163)
VERBOSE: Waiting on job ID '180' with name 'Installation of 'C:\SetupWpfInstaller.msi''
..
Write-Error : Fatal error during installation
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.1.0.115\AutomatedLabWorker.psm1:895 char:17
+ Write-Error -ErrorRecord $jobError
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Write-Error], Win32Exception
+ FullyQualifiedErrorId : Fatal error during installation
VERBOSE: Job ID '' with name '' finished
15:51:00|00:12:09|00:00:06.221| - Installation done
VERBOSE: Install-LabSoftwarePackage...leaving...(Time elapsed: 00:00:05:332)
PS D:\>
I have update the function and added a new exception class. This is how you get the error code if the code runs remotely:
Install-LabSoftwarePackage -Path C:\Users\randr\Downloads\SetupWpfInstaller.msi -CommandLine /qn -ComputerName Client7
$Error[0].Exception.SerializedRemoteException.ErrorCode
The verbose display issue is fixed in AL.
I updated to the latest version of AutomatedLab.Common:
Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 5.1.0.115 AutomatedLab {Add-LabAzureSubscription, Add-LabCertificate, Add-LabVMUs...
Script 1.1.103 AutomatedLab.Common {Add-AccountPrivilege, Add-CATemplateStandardPermission, A...
Script 0.0 AutomatedLab.init
Script 5.1.0.115 AutomatedLabDefinition {Add-LabAzureAppServicePlanDefinition, Add-LabAzureWebAppD...
Script 5.1.0.115 AutomatedLabNotifications Send-ALNotification
Script 5.1.0.115 AutomatedLabUnattended {Add-UnattendedNetworkAdapter, Add-UnattendedRenameNetwork...
Script 5.1.0.115 AutomatedLabWorker {Add-LWAzureLoadBalancedPort, Add-LWVMVHDX, Checkpoint-LWH...
Binary 1.0.0.0 CimCmdlets {Export-BinaryMiLog, Get-CimAssociatedInstance, Get-CimCla...
Script 5.1.0.115 HostsFile {Add-HostEntry, Clear-HostFile, Get-HostEntry, Remove-Host...
Binary 2.0.0.0 Hyper-V {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMFibreChanne...
Manifest 2.0.0.0 International {Get-WinAcceptLanguageFromLanguageListOptOut, Get-WinCultu...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, En...
Manifest 1.0.0.0 NetTCPIP {Find-NetRoute, Get-NetCompartment, Get-NetIPAddress, Get-...
Script 1.0.1.141 newtonsoft.json {ConvertFrom-JsonNewtonsoft, ConvertTo-JsonNewtonsoft}
Binary 1.0.0.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script 1.0.0.1 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
Script 5.1.0.115 PSFileTransfer {Copy-LabFileItem, Receive-Directory, Receive-File, Send-D...
Script 0.0 PsGet {Get-PsGetModuleHash, Get-PsGetModuleInfo, Install-Module,...
Script 5.1.0.115 PSLog {Get-CallerPreference, Start-Log, Stop-Log, Write-Debug...}
Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...
Binary 1.1.0.0 PSScheduledJob {Add-JobTrigger, Disable-JobTrigger, Disable-ScheduledJob,...
Manifest 2.0.0.0 PSWorkflow {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}
Manifest 2.0.0.0 Storage {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add...
I am seeing the following when trying to install the problem MSI:
Install-LabSoftwarePackage -ComputerName Client -Path $labSources\SoftwarePackages\SetupWpfInstaller.msi -CommandLine '/qn' -Verbose
VERBOSE: Install-LabSoftwarePackage Entering...
(ComputerName=Client,Path=D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi,CommandLine=/qn,Verbose=True)
VERBOSE: Get-LabVM Entering... (ComputerName=Client)
12:56:05|00:11:21|00:00:00.000| Installing software package 'D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi' on machines 'Client'
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Get-LabVMStatus...leaving...(Time elapsed: 00:00:00:052)
VERBOSE: Starting background job for 'Installation of 'C:\SetupWpfInstaller.msi''
12:56:05|00:11:21|00:00:00.097| - Copying files and initiating setup on 'Client' and waiting for completionVERBOSE: Invoke-LabCommand Entering...
(ComputerName=Client,DependencyFolderPath=D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi,DoNotUseCredSsp=<null>,P
assThru=True,ScriptBlock=
Install-SoftwarePackage @installParams
,NoDisplay=True,AsJob=True,ActivityName=Installation of
'C:\SetupWpfInstaller.msi',Variable=System.Management.Automation.PSVariable[](1),Function=System.Management.Automation.
FunctionInfo[](1))
VERBOSE: Executing lab command activity 'Installation of 'C:\SetupWpfInstaller.msi'' on machines 'Client'
VERBOSE: Get-LabVM Entering... (IncludeLinux=True)
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Get-LabVMStatus...leaving...(Time elapsed: 00:00:00:027)
VERBOSE: Creating session to computer(s) 'Client'
VERBOSE: New-LabPSSession Entering...
(ComputerName=Client,DoNotUseCredSsp=<null>,UseLocalCredential=<null>,Credential=<null>)
VERBOSE: Get-LabVM Entering... (ComputerName=Client,IncludeLinux=True)
VERBOSE: Connecting to machine 'Client' using the DNS name 'Client'
VERBOSE: Creating a new PSSession to machine 'Client:5985' (UserName='Client\Administrator', Password='Somepass1',
DoNotUseCredSsp='False')
VERBOSE: Get-LabVM Entering... (ComputerName=Client)
VERBOSE: Session Client_5e5df176-40b4-4013-8518-ef00955c6a36 is available and will be reused
VERBOSE: New-LabPSSession...leaving - return value is 'Session IDs: 2'...(Time elapsed: 00:00:00:013)
VERBOSE: Adding functions 'Install-SoftwarePackage' to session
VERBOSE: Adding variables 'System.Management.Automation.LocalVariable' to session
VERBOSE: Invoke-LWCommand Entering...
(AsJob=True,DependencyFolderPath=D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi,ComputerName=Client,Retries=3,Pas
sThru=True,ScriptBlock=
Install-SoftwarePackage @installParams
,Verbose=True,Session=System.Management.Automation.Runspaces.PSSession[](1),RetryIntervalInSeconds=10,ActivityName=Inst
allation of 'C:\SetupWpfInstaller.msi')
VERBOSE: Starting Activity 'Installation of 'C:\SetupWpfInstaller.msi''
VERBOSE: Copying files from 'D:\LabSources\SoftwarePackages\SetupWpfInstaller.msi' to Client...
VERBOSE: Finished Installation Activity 'Installation of 'C:\SetupWpfInstaller.msi''
VERBOSE: Invoke-LWCommand...leaving...(Time elapsed: 00:00:00:980)
VERBOSE: Invoke-LabCommand...leaving...(Time elapsed: 00:00:00:993)
VERBOSE: Waiting on job ID '60' with name 'Installation of 'C:\SetupWpfInstaller.msi''
..
Write-Error : c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(7) :
'AutomatedLab.Common.Win32Exception.ErrorCode.get' must declare a body because it is not marked abstract or extern
c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(6) : {
c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(7) : >>> public new int ErrorCode { get; set; }
c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(8) :
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.1.0.115\AutomatedLabWorker.psm1:895 char:17
+ Write-Error -ErrorRecord $jobError
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (c:\Users\Admini...tract or extern:CompilerError) [Write-Error], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Write-Error : c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(7) :
'AutomatedLab.Common.Win32Exception.ErrorCode.set' must declare a body because it is not marked abstract or extern
c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(6) : {
c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(7) : >>> public new int ErrorCode { get; set; }
c:\Users\Administrator\AppData\Local\Temp\f3kmupmf.0.cs(8) :
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.1.0.115\AutomatedLabWorker.psm1:895 char:17
+ Write-Error -ErrorRecord $jobError
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (c:\Users\Admini...tract or extern:CompilerError) [Write-Error], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Write-Error : Cannot add type. There were compilation errors.
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.1.0.115\AutomatedLabWorker.psm1:895 char:17
+ Write-Error -ErrorRecord $jobError
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Write-Error], InvalidOperationException
+ FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
Write-Error : Cannot find type [AutomatedLab.Common.Win32Exception]: make sure the assembly containing this type is
loaded.
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.1.0.115\AutomatedLabWorker.psm1:895 char:17
+ Write-Error -ErrorRecord $jobError
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [Write-Error], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
VERBOSE: Job ID '' with name '' finished
12:56:13|00:11:29|00:00:07.967| - Installation done
VERBOSE: Install-LabSoftwarePackage...leaving...(Time elapsed: 00:00:06:231)
Following a successful run of Install-Lab with a single Windows 7 Machine I am getting the following error when trying to install an MSI file:
The host is Windows 10 Pro, 1803 PowerShell 5.1.17134.228, AutomatedLab 5.1.0.115
Lab details: