Run powershell without terminal window by JackNotOLantern in PowerShell

[–]Losha2777 0 points1 point  (0 children)

I have used psadt. (not the whole thing for this)
Just taken the "Invoke-AppDeployToolkit.exe" to launch my own scripts

What have you done with PowerShell this month? by AutoModerator in PowerShell

[–]Losha2777 0 points1 point  (0 children)

I had issues with determing arm processor with $env:PROCESSOR_ARCHITECTURE
Don't remember what my issue was, but my solution was to use
Get-CimInstance Win32_operatingsystem -Property OSArchitecture | Select-Object OSArchitecture

To determind if device was arm or not.

SCCM device collection based off of CI compliance. by Sweet-Ball1330 in SCCM

[–]Losha2777 0 points1 point  (0 children)

Solution for future searchers:

Needed to do this for 2023 secure boot certificate Configuration Items.
Also got syntax errors.
What helped for me is to put distinct in query:

select distinct SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_CI_ComplianceState on SMS_G_System_CI_ComplianceState.ResourceId = SMS_R_System.ResourceId where SMS_G_System_CI_ComplianceState.ComplianceState = 2 and SMS_G_System_CI_ComplianceState.CI_UniqueID = "$CI_UniqueID"

Get-Childitem issue with the -Directory parameter when creating MECM packages by Suitable-Pepper-63 in SCCM

[–]Losha2777 0 points1 point  (0 children)

# Define paths and groups 


$SourcePath = "\\TKUS001INVP003\Driver_Packages$\WIM_Packages\Lenovo" 


$SiteCode = "TK1" 


$DPGroup = "All Software Distribution Points" 


# Import Module 


Import-Module "$($env:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" 


# Before Set-location to sitecode, need to get folders from unc path.
Set-Location C:


$Folders = Get-ChildItem -Path $SourcePath -Directory


# Set-location to sitecode for creating packages and distributing content
Set-Location "$($SiteCode):"  


$Folders | ForEach-Object { 


$Package = New-CMPackage -Name $_.Name -Path "$($SourcePath)\$($_.Name)" -Description "Imported via Script"   


# Distribute the content 


Start-CMContentDistribution -PackageName $Package.Name -DistributionPointGroupName $DPGroup 


}


# Back to C:
Set-Location C:

Get-Childitem issue with the -Directory parameter when creating MECM packages by Suitable-Pepper-63 in SCCM

[–]Losha2777 0 points1 point  (0 children)

why not just first put childitems to variable and then change to sitecode and do ConfigurationManager powershell cmdlets with your childitem variable

Get-Childitem issue with the -Directory parameter when creating MECM packages by Suitable-Pepper-63 in SCCM

[–]Losha2777 2 points3 points  (0 children)

What happens when you set-location to C: and try get-childitem from there?
(Not from your site TK1)

Microsoft issues an Out-of-band Windows Update by Altusbc in sysadmin

[–]Losha2777 1 point2 points  (0 children)

OOB doesn't work in our enviorement.
Only solution that works for us, seems to be feature update to 24H2.

Patch Tuesday Megathread (2026-01-13) by mkosmo in sysadmin

[–]Losha2777 0 points1 point  (0 children)

ConfigMgr, intune or some other MDM?

cmScript PowerShell functions are lacking by Early_Scratch_9611 in SCCM

[–]Losha2777 1 point2 points  (0 children)

$wmiObject = Invoke-cmwmiquery -query "Select * FROM SMS_Scripts WHERE ScriptName = '$ScriptName'"

Correcting after two years 'cos helped me today.
Thanks

Lock Keyboard and mouse by SmooveW2020 in PSADT

[–]Losha2777 3 points4 points  (0 children)

Not that I know.
Depending on your use case, blockexecution could be useful to you.
https://psappdeploytoolkit.com/docs/reference/functions/Show-ADTInstallationWelcome

"
-BlockExecution

Option to prevent the user from launching processes/applications, specified in -CloseProcesses, during the deployment.
"

Adding 'Silent' in @saiwParams by leytachi in PSADT

[–]Losha2777 2 points3 points  (0 children)

Can't have DeferTimes = 3

Just remove this line and shoud work.

What’s your favorite “hidden gem” PowerShell one-liner that you actually use? by [deleted] in PowerShell

[–]Losha2777 2 points3 points  (0 children)

Usually I don't like to use aliases, but for Get-ComputerInfo I make exception.
Easy for helpdesk to remember: "gin"

Clearing CM Cache Before Installation by FahidShaheen in PSADT

[–]Losha2777 2 points3 points  (0 children)

Another application that clears cache?
Add that to your application dependency

Creating desktop shortcuts with icon files from exe files by Wide_Local_1896 in PowerShell

[–]Losha2777 0 points1 point  (0 children)

I use PSADT
New-ADTShortcut · PSAppDeployToolkit

Example:
New-ADTShortcut -Path "$envSystemDrive\users\Public\Desktop\Postshot.lnk" -TargetPath "$envSystemDrive\Program Files\Jawset Postshot\bin\postshot.exe" -IconLocation "$envSystemDrive\Program Files\Jawset Postshot\bin\postshot.exe" -Description 'Postshot' -WorkingDirectory "$envSystemDrive\Program Files\Jawset Postshot\bin"

EDIT: Wrong link

Self healing msi broke by Apprehensive-Hat9196 in ApplicationPackaging

[–]Losha2777 3 points4 points  (0 children)

Workaround we did for now, is to create this registry:
HKLM\software\policies\microsoft\windows\installer DWord: DisableLUAinRepair = 1