Jump to content


Established Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Always

  • Rank
  1. In the gui i can see two collection under the folder but under powershell i get nothing=? anyone know how to emulate content in the folder?
  2. In the ts i got the return code 16389 - a little googling returned below fix.
  3. I want to build and capture a ref image. Have a "Microsoft .NET Framework 4.7.2" Application Have checked "Allow this application to be installed from install application task sequence action without being deployed" Deployment type: Install: "NDP472-KB4054530-x86-x64-AllOS-ENU.exe" /norestart /q /log "%windir%\Logs\Microsoft_.Net_Framework_4.7.2_Install.log" Uninstall: msiexec.exe /x {09CCBE8E-B964-30EF-AE84-6537AB4197F9} /q /l*v "%windir%\Logs\Microsoft_.Net_Framework_4.7.2_Uninstall.log" Detecion: {09CCBE8E-B964-30EF-AE84-6537AB4197F9} Above Applications work on a live running device. But it fail under a task sequence. My question is why and how do i debug on this?
  4. Hi WN I created a function to connect to the CMSite and load the cmdlet for ConfigurationManager. Could the function be improved in any way or is it as good it can be? is the logic best practice or? You can download it at : https://gallery.technet.microsoft.com/Connect-ConfigMgr64-db5e9d0a function Connect-ConfigMgr64 { $initParams = @{ } if ((Get-Module ConfigurationManager) -eq $null) { try { Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" @initParams -Scope Global } catch { $ModulePath = (Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\ConfigMgr10\Setup -Name "UI Installation Directory").'UI Installation Directory' Import-Module $ModulePath\bin\ConfigurationManager.psd1 -Scope Global } } if ((Get-Module ConfigurationManager) -ne $null) { $SiteCode = Get-PSDrive -PSProvider CMSITE if ((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) { $ProviderMachineName = (Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\ConfigMgr10\AdminUI\Connection -Name Server).Server New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName @initParams } if ((Get-PSProvider -PSProvider CMSite) -ne $null) { Set-Location $SiteCode":\" Write-Host 'Type "Get-Command -Module ConfigurationManager" for a list of SCCM CMDlets.' -ForegroundColor Green } else { $CustomError = [String]"Error: Can't find CMSite provider" Throw $CustomError } } else { $CustomError = [String]"Unable to locate System Center Configuration Manager installation folder!" Throw $CustomError } } Connect-ConfigMgr64
  5. btw is there a powershell way to see what GC there is on a deploymenttype?
  6. Thanks for the link Got it to work with following code Function Connect-SCCM { Param ( [Parameter(Mandatory = $True)] [String]$SiteCode, [Parameter(Mandatory = $True)] [String]$Primary ) If (!(Get-Module -name ConfigurationManager)) { import-module $env:SMS_ADMIN_UI_PATH.Replace('bin\i386', 'bin\ConfigurationManager.psd1') -force if ((get-psdrive $SiteCode -erroraction SilentlyContinue | Measure-Object).Count -ne 1) { new-psdrive -Name $SiteCode -PSProvider 'AdminUI.PS.Provider\CMSite' -Root $Primary -Scope Global } $ConsoleFolder = $Env:SMS_ADMIN_UI_PATH -replace '\\i386', '' [System.Reflection.Assembly]::LoadFrom("$($ConsoleFolder)\Microsoft.ConfigurationManagement.ApplicationManagement.dll") | Out-Null } } #end function Connect-SCCM Function Get-SCCMGlobalCondition($name, $siteServerName) { $connectionManager = new-object Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlConnectionManager $isConnected = $connectionManager.Connect($siteServerName) $SCCMserver = $connectionManager.NamedValueDictionary.ServerName $SCCMsitecode = "PRI" $SCCMNamespace = "root\sms\site_PRI" #$nameformated = $name.Replace(" ","") $objResult = Get-WmiObject -ComputerName $siteServerName -Class SMS_GlobalCondition -Namespace $SCCMNamespace -filter "ModelName like '%$name%' " if ($objResult -eq $null) { $objResult = Get-WmiObject -ComputerName $siteServerName -Class SMS_GlobalCondition -Namespace $SCCMNamespace -filter "ModelName = '$name'" } if ($objResult -eq $null) { $objResult = Get-WmiObject -ComputerName $siteServerName -Class SMS_GlobalCondition -Namespace $SCCMNamespace -filter "LocalizedDisplayName = '$name'" } $objResult | Where-Object{$_.PlatformType -eq 1} } <# .SYNOPSIS Creates a Global Condition rule of type [Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Rules.Rule]. This rule can be added as a requirement for an deployment type .DESCRIPTION This function will Create a rule for an global condition .PARAMETER SiteServerName Name of the SCCM Site server to check Global Conditions .PARAMETER GlobalCondition Name of the global condition you wanted to use .PARAMETER Operator Operator used to validate the rule. Accepted values are Equals,NotEquals,GreaterThan,LessThan,Between,GreaterEquals,LessEquals,BeginsWith,NotBeginsWith,EndsWith,NotEndsWith,Contains,NotContains,AllOf,OneOf,NoneOf,SetEquals,Existential (Custom),NotExistential (Custom) .PARAMETER Value Value on which the rule should check. Use MB when data value is needed .PARAMETER SettingSourceType Default value is CIM if type is of other value please type this value. Possible values: Registry, IisMetabase, SqlQuery, WqlQuery, Script, XPathQuery, ADQuery, Complex, SoftwareUpdate, File, Folder, RegistryKey, Assembly, Uri, Expression, CIM, ParameterizedSetting, PlistKey, MSI, MacDetection .EXAMPLE Create-SCCMGlobalConditionsRule . "TotalPhysicalMemory" "GreaterEquals" 524288000 "CIM" Creates a rule where Total Phyiscal memory is greater than or equals to 500 MB .EXAMPLE Create-SCCMGlobalConditionsRule . "CPU" "GreaterThan" 10000 "CIM" Creates a rule where the cpu speed is greater than 1 GHZ #> Function Create-SCCMGlobalConditionsRule($siteServerName, $GlobalCondition, $Operator, $Value, $SettingSourceType) { if ($GlobalCondition.ModelName -eq $null) { $GlobalCondition = Get-SCCMGlobalCondition $GlobalCondition $siteServerName } if ($GlobalCondition -eq $null) { Write-Error "Global condition not found" return } $gcTmp = $GlobalCondition.ModelName.Split("/") $gcScope = $gcTmp[0] $gcLogicalName = $gcTmp[1] $gcDataType = $GlobalCondition.DataType $gcExpressionDataType = [Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.DataType]::GetDataTypeFromTypeName($gcDataType) if ($operator.ToLower() -eq "notexistential" -OR $operator.ToLower() -eq "existential") { $gcExpressionDataType = [Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.DataType]::Int64 } #Retrieving logical name of setting $settingsxml = [xml] ([wmi]$GlobalCondition.__PATH).SDMPackageXML if ($settingsxml.DesiredConfigurationDigest.GlobalSettings.AuthoringScopeId -eq "GLOBAL") { $global = $true $SettingLogicalName = "$($gcLogicalName)_Setting_LogicalName" } else { $SettingLogicalName = $settingsxml.DesiredConfigurationDigest.GlobalSettings.Settings.FirstChild.FirstChild.LogicalName } if (!($SettingLogicalName)) { $SettingLogicalName = $settingsxml.DesiredConfigurationDigest.GlobalExpression.LogicalName } #Checking for ConfigurationItemSetting if ($SettingSourceType -ne $null -AND $SettingSourceType -ne "") { $CISettingSourceType = [Microsoft.ConfigurationManagement.DesiredConfigurationManagement.ConfigurationItemSettingSourceType]::$SettingSourceType } else { $CISettingSourceType = [Microsoft.ConfigurationManagement.DesiredConfigurationManagement.ConfigurationItemSettingSourceType]::CIM } #if ($global){ $arg = @($gcScope, $gcLogicalName $gcExpressionDataType, $SettingLogicalName, $CISettingSourceType ) $reqSetting = new-object Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.GlobalSettingReference -ArgumentList $arg #custom properties Existential if ($operator.ToLower() -eq "notexistential") { $operator = "Equals" $Value = 0 $reqSetting.MethodType = "Count" } if ($operator.ToLower() -eq "existential") { $operator = "NotEquals" $Value = 0 $reqSetting.MethodType = "Count" } $arg = @($value, $gcExpressionDataType ) $reqValue = new-object Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.ConstantValue -ArgumentList $arg $operands = new-object "Microsoft.ConfigurationManagement.DesiredConfigurationManagement.CustomCollection``1[[Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.ExpressionBase]]" $operands.Add($reqSetting) | Out-Null $operands.Add($reqValue) | Out-Null #Changing Equals to IsEquals if ($operator.ToLower() -eq "equals") { $operator = "IsEquals" } $Expoperator = Invoke-Expression [Microsoft.ConfigurationManagement.DesiredConfigurationManagement.ExpressionOperators.ExpressionOperator]::$operator if ($GlobalCondition.DataType -eq "OperatingSystem") { $operands = new-object "Microsoft.ConfigurationManagement.DesiredConfigurationManagement.CustomCollection``1[[Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.RuleExpression]]" foreach ($os in $value) { $operands.Add($os) } $arg = @($Expoperator, $operands ) $expression = new-object Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.OperatingSystemExpression -ArgumentList $arg } else { $arg = @($Expoperator, $operands ) $expression = new-object Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Expressions.Expression -ArgumentList $arg } $anno = new-object Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Rules.Annotation $annodisplay = "$($GlobalCondition.LocalizedDisplayName) $operator $value" $arg = @( "DisplayName", $annodisplay, $null ) $anno.DisplayName = new-object Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Rules.LocalizableString -ArgumentList $arg $arg = @( ("Rule_" + [Guid]::NewGuid().ToString()), [Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Rules.NoncomplianceSeverity]::None, $anno, $expression ) $rule = new-object "Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Rules.Rule" -ArgumentList $arg return $rule } $Primary = 'CM01.lab.local' $SiteCode = "PRI" Connect-SCCM -SiteCode $SiteCode -Primary $Primary $applicationname = 'Igor Pavlov 7-Zip 18.05 (x64 edition) V1' $GC = "Is user is logged on" $DTName = '_Interactive' set-location "$($SiteCode):" $rule = Create-SCCMGlobalConditionsRule -GlobalCondition $gc -Operator "IsEquals" -Value "True" -siteServerName $Primary -SettingSourceType 'WqlQuery' Set-CMDeploymentType -ApplicationName $applicationname -DeploymentTypeName $DTName -AddRequirement $rule -verbose
  7. I will give that a try. What about cloning a global condition from a deployment to another deployment?
  8. Hi WN I trying to add a custom Global Condition to a deployment type. But cant figure out how it done. and a big error so ?? if (!(Get-CMGlobalCondition -Name "Is user is logged on")) { Remove-Item "$env:temp\Is_user_is_logged_on.ps1" -ea SilentlyContinue Add-Content -Encoding UTF8 "$env:temp\Is_user_is_logged_on.ps1" "[bool] (Get-Process explorer –ea 0)" New-CMGlobalCondition -Name "Is user is logged on" -Description "Check if an user is logged on" -DeviceType Windows -DataType Boolean -ScriptLanguage PowerShell -FilePath "$env:temp\Is_user_is_logged_on.ps1" Remove-Item "$env:temp\Is_user_is_logged_on.ps1" -ea SilentlyContinue } $ApplicationName = "Igor Pavlov 7-Zip 18.05 (x64 edition) V1" $condition = Get-CMGlobalCondition -Name "Is user is logged on" Set-CMDeploymentType -ApplicationName "$ApplicationName" -DeploymentTypeName "_Silent" -AddRequirement "$condition.Rule" console return: Cannot convert value "[SecurityVerbs(-1)] instance of SMS_GlobalCondition ...... ref: https://configurationmanager.uservoice.com/forums/300492-ideas/suggestions/32636506-powershell-cmdlet-for-adding-global-conditions-as anyone done this before?
  9. Hi All, Is it possible to get the save path in the capture & build task sequence?
  10. dobbelt post...remove this thanks Hi All, Is it possible to get the save path in the capture & build task sequence?
  11. M910z return: 10NTS00W00 M710q retrun: 10MQS0H600 Getting this on the M910z: Installing device driver step ind the this. Running action: Lenovo ThinkCentre M910z 0x80004005 error code.
  12. I do as i unsually do download the sccm driverpack from lenovo inject it into a driver package in sccm. Create a wmi query to target the right maschine in the TS. Lenovo ThinkCentre m910z : http://pcsupport.lenovo.com/us/da/products/DESKTOPS-AND-ALL-IN-ONES/THINKCENTRE-M-SERIES-DESKTOPS/TH... Lenovo ThinkCentre m710q : http://pcsupport.lenovo.com/us/da/products/DESKTOPS-AND-ALL-IN-ONES/THINKCENTRE-M-SERIES-DESKTOPS/TH... But get an error on the driver apply how to fix this issue=?
  13. ref to https://scriptimus.wordpress.com/2012/09/17/ltizti-powershell-accessing-task-sequence-variables/ can ZTIUtility.psm1 work under a SCCM task sequence too? if yes how? want access to the PSDrives called TSEnv: and TSEnvList:.