powershell
6 TopicsWindows Servers Uptime Report using PowerShell
Hi Folks, A customer has mix of Windows servers (2012, 2016, 2019) on-premises environment. Customer needs to generate a report via PowerShell about the availability of servers. During my search I found a script on this link and its modified version is attached. Please note, this script reads windows events and based on that produces result. There is a problem where I need help, this script doesn't run against list of servers via a CSV file or a text file and we suspect it is not producing correct result. Can somebody please review this script and help us with the right syntax or what is missing here? Thanks in advance.1.4KViews0likes1CommentMSIX write HKLM in the bubble?
Already trying for some days, but can't make it work. Or is it not possible al all? I have MSIX in which (in the bubble!!!) i want to set hkcu and hklm registry settings. For hkcu it is working, but hklm is not writable. What i do wrong or is this not possible at all? I first want to know if it should be possible. If so, i can share my psflauncher and config.json config files.Solved302Views1like7CommentsMSIX dynamic start menu configuration
With AppV it was possible to configure profiles at the streaming server and assign shortcuts/start menu entries from the AppV package to AD groups. Is it possible to so something similar with MSIX? So a MSIX package has four start menu entries abcd. Member of AAD group X get shortcuts ab Member of AAD group Y get shortcuts cd Anyone has an idea if this can be done by some scripting?115Views0likes2CommentsCan you redirect the -UseWindowsPowerShell temp path in a session when running import-module?
Hi All, I'm using PS7 and calling a bunch of modules. To get Microsoft.Online.SharePoint.PowerShell to import correctly in PS7, I need to use the switch -useWindowsPowerShell. Without restrictions this is all fine. Using Constrained Language Mode, WDAC blocks the module on import in PS7, it'll import in PS5 without any changes. Looking at the event viewer its due to the proxy being setup in the user's appdata temp folder. Is there a process to modify the location of the proxy being created in the current session? It'd be great to redirect it to a whitelisted location for execution to avoid the issue. Whitelisting the temp folder for users isn't an option. Thanks!263Views0likes0CommentsDownload and Install Windows Updates offline using the wsusscn2.cab file and Windows Update API
Hi, I'm trying to find a way to install Windows Updates (CAB files) on offline Windows 10 V1809 computers. Overall the process I'm trying to automate is: 1. Scan for missing Windows Updates on the computer and download all missing Windows Updates 2. On an offline computer - install the Updates. I'm using the wsusscn2.cab file as described here: https://learn.microsoft.com/en-us/windows/win32/wua_sdk/using-wua-to-scan-for-updates-offline to search the updates, download them, and then try to install them. I manage to search and download the updates, but I encounter this error when trying to install: When -2145124318 in Hex is: 0x80240022 This error code = WU_E_ALL_UPDATES_FAILED Operation failed for all the updates. How can I fix my code to successfully install this updates? Here is the code I'm using: #Search for Windows Updates: # Load the Windows Update Agent COM object $UpdateSession = New-Object -ComObject Microsoft.Update.Session $UpdateServiceManager = New-Object -ComObject Microsoft.Update.ServiceManager #Load the wsusscn2.cab file that enables offline Updates instllation: $UpdateService = $UpdateServiceManager.AddScanPackageService("Offline Sync Service", "c:\wsusscn2.cab") # Create a searcher for available updates $UpdateSearcher = $UpdateSession.CreateUpdateSearcher() # Search for updates in the SoftwareDistribution folder: #The ServerSelection enumeration defines values that describe the type of server to use for an update search operation. # ssOthers: Search another server, to be specified by other means $updateSearcher.ServerSelection = 3 # ssOthers $UpdateSearcher.ServiceID = $UpdateService.ServiceID $Criteria = "IsInstalled=0 and Type='Software'" $SearchResult = $UpdateSearcher.Search($Criteria) $Updates = $SearchResult.Updates if ($SearchResult.Updates.Count -eq 0) { write-Host "There are no applicable updates" } #Download the Windows Updates (to SoftwareDistribution): $SearchResult = $Updates # Create a Windows Update Session $Session = New-Object -ComObject Microsoft.Update.Session # Create a Windows Update Downloader: $Downloader = $Session.CreateUpdateDownloader() $Downloader.Updates = $SearchResult #Download updates to C:\Windows\SoftwareDistribution $Downloader.Download() #Install the Windows Updates from SoftwareDistribution: # Create the Installer Object: $installer = New-Object -ComObject Microsoft.Update.Installer $Installer.Updates = $Updates #Install updates: $Result = $Installer.Install() Thanks, Ann10KViews0likes0Commentsquick assist deployment thru Powershell-GPO
Since that Microsoft is turned with quick assist to the Windows Store we cannot use Quick assist anymore. I cannot install / deploy it thru Powershell whatever i try thru GPO, manual, scheduled task etc, it will not work. The only way that the install succeeds is when go to the Store and download and install it when i am an admin. But i want to deploy Quick Assist thru Powershell... What i tried: #sets switches param ( [Parameter(Mandatory=$false)][Switch]$Install, [Parameter(Mandatory=$false)][Switch]$Uninstall, [Parameter(ValueFromRemainingArguments=$true)] $args ) #Log output results function LogOutput($Message) { $LogFile = "C:\temp\Quick-Assist.log" "$(get-date -Format 'MM/dd/yyyy HH:mm') $($Message)" | Out-file -FilePath $LogFile -Append -Force } #Start of Script If ($Install){ Try { LogOutput "***This script is used to install the new Quick Assist app that is from the Microsoft Store. It will also remove the old version***" $InstallAppX = Get-AppxPackage -allusers MicrosoftCorporationII.QuickAssist If ($InstallAppX.status -eq 'OK'){ LogOutput "[Info] Windows Store version of Quick Assist is already installed" #lets uninstall the old version. LogOutput "[Info] lets uninstall the old version" Remove-WindowsCapability -Online -Name 'App.Support.QuickAssist~~~~0.0.1.0' -ErrorAction 'SilentlyContinue' LogOutput "[Info] Old version of Quick Assist has been uninstalled" } If ($InstallAppX.status -ne 'OK'){ LogOutput "[Info] Installing the Windows Store version of Quick Assist..." Add-AppxPackage -Path "c:\quickassist\MicrosoftCorporationII.QuickAssist.AppxBundle" #Add-AppxProvisionedPackage -online -SkipLicense -PackagePath '.\MicrosoftCorporationII.QuickAssist.AppxBundle' LogOutput "[Info] Attempting to remove the old version of Quick Assist..." Remove-WindowsCapability -Online -Name 'App.Support.QuickAssist~~~~0.0.1.0' -ErrorAction 'SilentlyContinue' } LogOutput "[Success] The Windows store version of Quick assist has successfully installed and the old version has been removed." } catch [exception] { LogOutput "[Error] An error occurred installing Quick Assist: $($_.Exception.Message)" } } We are using windows 10 21h1-2 Problem with this script is also that it says it removes the old version and installed the new version successfully, and when i look with get-package.... it also states that quick assist package is installed, but it is not in the startmenu anymore.... How can i deploy quick assist best for many computers without Intunes or sccm?18KViews0likes5Comments