-
Dennis Stroble started the topic PowerShell script to download monthly updates from Microsoft Update Catalog in
PowerShell Forum 2 years, 6 months ago
Every month when the latest Microsoft OS updates are released I have to go to the Microsoft Update Catalog website ( https://www.catalog.update.microsoft.com/Home.aspx), and do the following:
1. Type in the month and the OS version of the updates that I want to download (e.g. 2020-09 2012 R2).
2. Copy the names of each of the updates and create folders with these names on my local computer
3. Download the updates into the folder names matching the updates
I have to repeat this process to manually download updates for Server 2008R2, Server 2012R2, Server 2016, and Server 2019.
This has to be done since these updates don’t always appear within the SCCM Software Center console and because it always takes the SCCM team around a month to approve the updates after they have been released from Microsoft. I always need to install the latest updates whenever I patch servers.
Once these updates have been downloaded I put these updates into a folder on a NAS so that these updates can be copied over to servers that need them.
So I’m hoping that a PowerShell script can be written where I can provide the month and OS version (e.g. 2020-09 2012 R2) that will then:
1. Create the folder names corresponding to the updates in the target folder
2. Download the updates into the folder names matching the updates
-
Dennis Stroble started the topic PowerShell command to PIN apps to Windows taskbar in
PowerShell Forum 2 years, 6 months ago
I’m looking for a PowerShell command or script that will pin these applications that I commonly use to the Windows taskbar at the bottom of Windows. (I have included the path to these programs):
1. Computer management. Path: %windir%system32compmgmt.msc
2. The Windows PowerShell icon. Path: %windir%System32WindowsPowerShellv1.0powershell.exe
3. The Task Scheduler icon Path: %windir%system32taskschd.msc
4. The command prompt icon. Path: %windir%system32cmd.exe
5. The Internet Information Services (IIS) Manager icon. Path: %windir%system32inetsrvInetMgr.exe
6. The Notepad icon. Path: %windir%system32notepad.exe
This script will mostly be used in environments where I don’t have access to Active Directory or Group Policy but where I can have the AD team put in a PowerShell script to run one time on several servers or where I will be running this PowerShell script whenever necessary on the individual servers and workstations that I am customizing.
Someone wrote the following script which needs just a few more modifications until it will work properly:
function New-ShortCut { [cmdletbinding()] Param ( [parameter(Mandatory)] [ValidateScript({ Test-Path -path $_ })] [string] $sourceExe, [parameter(ValueFromPipelineByPropertyName)] [string]$Arguments, [parameter(ValueFromPipelineByPropertyName)] [ValidateScript({ (Test-Path -path $_) -and ( (Get-Item -path $_).PSIsContainer ) })] [string]$WorkingDirectory, [parameter(ValueFromPipelineByPropertyName)] [string] $DestinationLinkName = '{0}temp.lnk' -f [environment]::GetFolderPath("desktop"), [parameter(ValueFromPipelineByPropertyName)] [ValidateSet('Default','Maximized','Minimized')] [string]$WindowStyle = 'Default', [parameter(ValueFromPipelineByPropertyName)] [ValidateScript({ Test-Path -path $_ })] [string]$IconPath, [parameter(ValueFromPipelineByPropertyName)] [ValidateScript({ $null -ne $IconPath })] [int]$IconIndexNumber, [parameter(ValueFromPipelineByPropertyName)] [string]$HotKeyString ) $wshShell = New-Object -ComObject WScript.Shell $WindowStyles = @{ Default = 1 Maximized = 3 Minimized = 7 } $shortcut = $wshShell.CreateShortcut( $DestinationLinkName ) $shortcut.TargetPath = $sourceExe if ($arguments) { $shortcut.Arguments = $Arguments } if ($WorkingDirectory) { $shortcut.WorkingDirectory = $WorkingDirectory } if ($WindowStyle) { $shortcut.WindowStyle = $WindowStyles.$WindowStyle } if ($HotKeyString) { $shortcut.Hotkey = $HotKeyString} if ($IconPath) { if ($IconIndexNumber) { $shortcut.IconLocation = '{0},{1}' -f $IconPath,$IconIndexNumber } else { $shortcut.IconLocation = $IconPath } } try { $shortcut.Save() } catch { $_.Exception.Message } $null = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($wshShell) }
.New-ShortCut -sourceExe 'c:windowsSystem32mmc.exe' -arguments 'compmgmt.msc' -DestinationLinkName $env:userprofiledesktopComputerManagement.lnk .New-Shortcut -sourceExe 'c:windowssystem32windowspowershellv1.0powershell.exe' -DestinationLinkName $env:userprofiledesktoppowershell.lnk
-
-