Batch – Return User Session Information

This will return the user’s session information locally, and remotely. I use this with SCCM and Intune.   Code.cmd   :: MrNetTek :: eddiejackson.net :: 7/11/2024 :: free for public use :: free to claim as your own @ECHO OFF :: Initialize SETLOCAL enabledelayedexpansion SET tstQUser=false SET tstQWin=false :: Detect Session :: Method 1 quser Read More …

Windows – Servicing – Company Portal

You can use app package servicing commands to add, remove, and list provisioned app packages (.appx or .appxbundle) in a Windows image. Command to Add Company Portal DISM.EXE /Online /Add-ProvisionedAppxPackage /PackagePath:C:\PathToFile\Microsoft.CompanyPortal_2022.409.807.0_neutral___8wekyb3d8bbwe.AppxBundle /SkipLicense   Notes   DISM App Package (.appx or .appxbundle) Servicing Command-Line Options

PowerShell – Scheduled Shutdown

  Code.cpp   # MrNetTek # eddiejackson.net # 6/1/2021 # free for public use # free to claim as your own $action = New-ScheduledTaskAction -Execute ‘Powershell.exe’ -Argument ‘-NoProfile -WindowStyle Hidden -command “& {stop-computer}”‘ $trigger = New-ScheduledTaskTrigger -Daily -At 9pm Register-ScheduledTask -Action $action -Trigger $trigger -TaskName “Shutdown” -Description “Daily shutdown” Maximize Window Copy Code     Read More …

Windows – Rename Computer

PowerShell $(gwmi win32_computersystem).Rename(“PC-NewName”) Rename-Computer -NewName PC-NewName -Restart Invoke-command -computer PC-OldName -script {rename-computer PC-NewName; restart-computer} Commands WMIC ComputerSystem where Name=”PC-NewName” call Rename Name=NewName netdom renamecomputer %computername% /newname:PC-NewName /userd:domain\adminaccount /passwordd:password /reboot:10   Notes Rename-Computer Invoke-Command Netdom.exe WMIC.exe Get-WmiObject (gwmi)

Windows 10 – Freeze a Windows Build Version

This is how you lock the Windows build version—meaning this will prevent a future release from being automatically applied. Useful for gaining control over the build versions in your fleet. Enable reg add “HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate” /v TargetReleaseVersion /t REG_DWORD /d 1 /f /reg:64 Set Version reg add “HKLM\SOFTWARE\Policies\M9icrosoft\Windows\WindowsUpdate” /v TargetReleaseVersionInfo /t REG_SZ /d 2004 /f /reg:64 Read More …

PowerShell – Automate Cleanmgr.exe

/sagerun:1 ‘ Active Setup Temp Folders ‘ Content Indexer Cleaner ‘ Downloaded Program Files ‘ GameNewsFiles ‘ GameStatisticsFiles ‘ GameUpdateFiles ‘ Internet Cache Files ‘ Memory Dump Files ‘ Microsoft Office Temp Files ‘ Offline Pages Files ‘ Old ChkDsk Files ‘ Previous Installations ‘ Recycle Bin ‘ Service Pack Cleanup ‘ Setup Log Files Read More …