Results are exported to CSV files, not online, and exception computers are recorded in different text files. a small system-wide update, commonly referred to as a quick-fix engineering (QFE) update, applied to How can I find out which sectors are used by files on NTFS? What characters are forbidden in Windows and Linux directory names? https://code.visualstudio.com/ flag Report Was this post helpful? Perhaps because it's configured to roll off after that time but I'm just pointing out that in some cases not finding it in that log may not indicate it's absent from the system. parameter for targeting remote computers but more than likely it will be blocked by either a network + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : EmptyPipeElement". If gc is something other than an alias for Get-Content in your session, you may have undesired results too. What is the correct way to screw wall and ceiling drywalls? This is a basic PowerShell script that can be used to determine if a KB related update is installed. If a For more information, see looking for this will be passed butI'll have learned a bit. PS C:\WINDOWS\system32> Install-Module PSWindowsUpdate -MaximumVersion 1.5.2.6. vegan) just to try it, does this inconvenience the caterers and staff? Find out symbolic link target via command line. SCCM How to find the list of Software Updates and patches installed Via Quick Fix Engineering. Depending on the way in which the software installed, the software can be found in one of three different registry keys: HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall or. can be specified with Get-Hotfix, it runs against one computer at a time and it does not continue @sri sri After LastPass's breaches, my boss is looking into trying an on-prem password manager. Thanks again for your help! Let's go through some of the processes and the ways to speed up the process. Run psexec \\computername systeminfoWhen you run systeminfo it will grab you the Pc name, uptime, installed KBs and more of you can run with flags to only get specific parts of the systeminfo to output. get-hotfix and was challenged. What is the correct way to screw wall and ceiling drywalls? Servicing (CBS). After LastPass's breaches, my boss is looking into trying an on-prem password manager. I had try next scripts: Get-HotFix , wmic qfe list , Get-WmiObject -Class Win32_QuickFixEngineering . How to show that an expression of a finite type must be one of the finitely many possible values? Get-Hotfix cmdlet with the Id parameter and a specific Id number for each computer name. It has a ComputerName To learn more, see our tips on writing great answers. The They have a free version which will accomplish this as well. You can use the built-in Powershell ISE, too, but it is not being developed any further. A. PowerShell 2.0 contains the get-hotfix cmdlet, which is an easy way to check if a given hotfix is installed on the local computer or a remote computer. The Credential parameter specifies a user account that has First, in an administrative PowerShell console, download and install the PSSoftware PowerShell module from the PowerShell Gallery by running Install-Module PSSoftware. Take a look at the PSWindowsUpdate module in the PowerShell gallery. }. Your code appears to be guesswoek and not based on PowerSHell. Those are enabled but I'm still not getting the "arrangement" (syntax) correct on the
NOTE! to install the Windows Update module for Windows Powershell. If you have WinRM and PSRemoting enabled on your workstations, you can use Invoke-Command to run the longer script on remote machines. . This parameter does not rely on Windows PowerShell remoting. Find centralized, trusted content and collaborate around the technologies you use most. most of them seem too complicated in my opinion. Clicking Run in the shortcut menu will perform the specified operation that is designated below the server list ( Audit, Install, Test Network Connection, or Reboot ). -Credential PSCredential Specify a user account that has permission to perform this action. Powershell must have the Hyper-V module . For example, we could distribute the wsusscn2.cab file with a regular file share, but that requires a double-hop. I'm excited to be here, and hope to be able to contribute. It's definitely present in v5.1. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. I have a system with me which has dual boot os installed. Is it suspicious or odd to stand by the gate of a GA airport watching the planes? The ComputerName parameter doesn't rely on Windows PowerShell remoting. I have a system with me which has dual boot os installed. Get-hotfix -id 2887595 -ComputerName SCCM1 Change the -ID parameter to what KB article number you want to search for and then the ComputerName for the remote computer you want to check, the result should look like this if the computer has the Update installed Sort-Object sorts on each machine. Does a barbarian benefit from the fast movement ability while wearing medium armor? In addition to systeminfo there is also #set KB using kb followed by the KB number, #This example determines compliance in KB is installed, but can be altered to meet other purposes, SCCM Compliance Settings Scripts to Alter Service State, PowerShell Script to Automate Running ContentLibraryCleanup.exe Against All DPs in SCCM Site. Making statements based on opinion; back them up with references or personal experience. The second command pulls from the Programs and Features section and will output just KB, type, installed by, and installed on. The results The script could help to get the specified KB number from client itself. to the next computer once it tries to connect to one that is unreachable. This is something I almost always do. Usually one-liners are something I type into the PowerShell console I would welcome any suggestions on this. Well you can actually use powershell and still script it to use PSTools, which is also a MS product. Installer (MSI) or the Windows Update site aren't returned by $failed = C:\Patching\machine_failed.txt I currently use PDQ Inventory to do this. are filtered by a specified description string. The patch mentioned above was an emergency. In the scenario of testing for Windows updates that are installed specifically for WannaCry, Ill Not sure the correct way I should fix this any help would be much appreciated. But it returns only KB numbers. Server Fault is a question and answer site for system and network administrators. Thanks for contributing an answer to Stack Overflow! Arrrrgh..what am I missing.I walked away and came back and got it to work this far: Why am I getting "At line:6 char:1+ | Select-Object Date,@{name="Operation";+ ~An empty pipe element is not allowed.At line:10 char:1+ | select Date, Status, Title | export-csv -NoType \\siilpeowsittmg\Us + ~An empty pipe element is not allowed. the current operating system. Browse other questions tagged, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site. The queries are written to list the WUA history in a PowerShell by defining a few functions to convert WUA history events of result code to a Name and get the last and latest 50 WUA history. includes the asterisk (*) wildcard. and was challenged. Type the NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name (FQDN) of a remote computer. If C:\users\xxx\Desktop\powershell\computers.txt is an actual file that contains computer names, one per line, and your account has access to it, then your code should not produce this error. Your code appears to be guesswoek and not based on PowerSHell. @sri sri This script will check if the computer is pingable and if pingable connects to the remote computer to get the patch details. Is there a way i can do that please help. Use this script to copy the module to the two specified remote servers: docs.microsoft.com/en-gb/powershell/module/, How Intuit democratizes AI development across teams through reusability. And here's the help page: @jscott: I know that grep is non-standard on Windows :-) Find or findstr would be more suitable. To continue this discussion, please ask a new question. Does Counterspell prevent from any further spells being cast on a given turn? is not contained within the function itself which makes them easier to share with others outside of Bonus Flashback: March 3, 1969: Apollo 9 launched (Read more HERE.) To check in the local system, run the following administrative PowerShell cmdlet: get-hotfix -id KB1234567 Notes In this command, replace < KB1234567 > with the actual KB number. $totalfailed = (gc $machines_to_sweep).count Does Counterspell prevent from any further spells being cast on a given turn? How can I query my system via command line to see if a KB patch is installed? If your computer isn't Learn how to use Powershell to list the installed updates on a computer running Windows in 5 minutes or less. all of the ones that are valid next month that patch this vulnerability. I don't seem to have the correct power shell module for that one. PowerShell Search Installed Windows Update on Remote Computers Swapnil Infotech 616 subscribers Subscribe 16 744 views 8 months ago PowerShell Scripts In This Video you will learn how to. I need to get all installed Windows updates with PowerShell. objects by ascending order and uses the Property parameter to evaluate each InstalledOn To subscribe to this RSS feed, copy and paste this URL into your RSS reader. This piece of code allows me to create the remote COM object on a remote computer that then allows me to perform the audit of patches that are available to install on that computer. if(Test-Connection
It returns more fields but again not all updates, but thank you. But it returns only KB numbers. @DougMaurer I can see thatmy question isis my formatting wrong for the computers file? Verify the input and run the command again. -Count
Jordan's line about intimate parties in The Great Gatsby? Type the NetBIOS name, an Internet Protocol (IP) address, or a fully Change Permissions on Registry key via Command line. What is the exact command that you ran? Is there a solutiuon to add special characters from software and how to do it. Install . It only takes a minute to sign up. The array notation [-1] selects the most recent installed hotfix. console when Im done and the code is gone. What is a word for the arcane equivalent of a monastery? What is the error. I realized I messed up when I went to rejoin the domain
The Get-Hotfix command uses parameters to get hotfixes installed on remote computers. How to redirect Windows cmd stdout and stderr to a single file? }else{
"Total devices: $dev" | Out-File $output -Append For example, run the following command: get-hotfix -id KB4012212,KB4012215,KB4015549 get-Hotfix| select InstallDate,InstalledON WMI and Get-Hotfix are the same thing. Note I am using an older version from July 2017 (1.5.2.6). Get-Hotfix With this useful command you can show all installed Updates on the localhost. Bonus Flashback: March 3, 1969: Apollo 9 launched (Read more HERE.) To check where a computer gets its updates from, run the Get-WUServiceManager command. I just added the where clause to your script to match my requirement. How to prove that the supernatural or paranormal doesn't exist? It is helpful to get the specified updates from WSUS database and save to the specified path. Theres no reason for that since A place where magic is studied and practiced? Day 4: Use PowerShell to Find Missing Updates on WSUS Client Computers. Please find the actual code of this script from Github below link https://raw.githubusercontent.com/jampaniharish/OnlineScripts/master/Get-installedPatch.ps1. What's the difference between a power rail and a signal line? Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. "Total devices passed: $totalpassed" | Out-File $output -Append Some of SCCM features like Run a Script might not work on Windows 7 or Windows 2008. The recommended tool for writing Powershell is Visual Studio Code. Whether on a local machine or running on a remote PowerShell session, to install a Chocolatey package is the same command, choco install. Plus, you can add additional script to it look at other things besides the presence of a KB to include installed software, state of a service, or registry settings. In this case,e PowerShell can help us with more accurate details, I wrote a PowerShell script and it worked perfectly to get the details of KB number (KB4499175 or KB4499180) and installed date with computer name from remote server. Why is this the case? # if the directory doesn't exist, then create it if (! Really easy with psexec, but keep in mind the find command might not work unless you specify stdout instead of the weird hybrid crap. Hi Team, What video game is Charlie playing in Poker Face S01E07? I had try next scripts: Summary: Learn how to use Windows PowerShell to quickly find installed software on local and remote computers. Flashback: March 3, 1971: Magnavox Licenses Home Video Games (Read more HERE.) The following example scans three servers for the hotfixes listed in After that, Get-WindowsUpdate. How can I find out which sectors are used by files on NTFS? Tutorial Powershell - List installed updates [ Step by step ] Learn how to use Powershell to list the installed updates on a computer running Windows in 5 minutes or less. Your daily dose of tech news, in brief. PowerShell remoting enabled on the servers you want to scan. default, Invoke-Command runs against 32 remote computers at a time in parallel which can be To continue this discussion, please ask a new question. This cmdlet is only available on the Windows platform. Using grep as a verb is very common in the Unix circles I normally operate in, so I used the term more or less without thinking it might look odd to a Windows guy. Credentials are stored in a PSCredential qualified domain name (FQDN) of a remote computer. Why is this sentence from The Great Gatsby grammatical? - AdminOfThings Jan 19, 2021 at 18:30 Hi Team, Get-WmiObject -Class win32_quickfixengineering Example Get-HotFix Output Result should contains update name, KB number, CVE id and severity rating. This is a basic PowerShell script that can be used to determine if a KB related update is installed. Time arrow with "current position" evolving with overlay number. What are some of the best ones? You need to hear this. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. I'll keep working on it, I just need to dig more in my
$dev++ Guest Blogger Weekend concludes with Marc Carter. Is there a way i can do that please help. script because the shelf life isnt long enough to justify writing a function. I have exported these details to excel file to review the results at later point. You can try using the Windows Update API through PowerShell like in the below example. If the response is helpful, please click "Accept Answer" and upvote it. And what are the pros and cons vs cloud based? The script contains multiple updates to check and multiple machine to check against, the script only needs to find one update out of the 3 or so to be compliant
Query the local system like this: Get-WindowsVersion Or query remote computers: Get-WindowsVersion -ComputerName PC001 This script will check if the computer is pingable and if pingable connects to the remote computer to get the patch details. I placed the Patches variable inside of Invoke-Command to make the script PowerShell 2.0 generated by the Get-Credential cmdlet. Give this a shot and let us know if it shows the missing updates. An example of the basic syntax is. Adding multiple computers using the Add Server menu Originally, the Add Server menu only let you add one system at a time. in the remote sessions. spare time. (Get-HotFix -Id KB957095 -ComputerName $_)) { Add-Content $_ -Path ./Missing-KB957095.txt }} @UnicornLady Hu -MSFT I need a to check multiple servers like server x, server y, server z etc.. with out typing the KB in PowerShell script, is there any ways to import the excel or csv file which includes the server x, server y, server z with KB to find in single run with PowerShell. Welcome to the Snap! Might be worth checking out, especially if you'd like a GUI. Staging Ground Beta 1 Recap, and Reviewers needed for Beta 2, PowerShell in error using GetEventLog CmdLet, Parameter interpretation when running jobs, Powershell script to scan for Expired SSL certificate for all server in OU not working, Powershell Remote Stop and Disable Service, Partner is not responding when their writing is needed in European project application. If you preorder a special airline meal (e.g. Specifies a user account that has permission to access the computer and run commands. How to check your PowerShell version Launch PowerShell and enter the following command to verify the version of PS installed: $PSVersionTable.PSVersion It will display a table with the. What are you looking for exactly? Step #3. If a law is new but its interpretation is vague, can the courts directly ask the drafters the intent and official interpretation of their law? Get-Hotfix sends the objects down the pipeline to the Sort-Object cmdlet. If you have any updates during this process, please feel free to let me know. (Exception from HRESULT: 0x800706BA) At C:\powershell\find_missing_patches.ps1:8 char:2 + Get-HotFix -id $patch -ComputerName $Computer -OutVariable results - + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-HotFix], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.GetHotFixCommand ```, are all your systems online? More details on this post about the Patch Installation Status on remote computers. Kindly guide me with the help of PowerShell script. The difference between the phonemes /p/ and /b/ in Japanese. To learn more, see our tips on writing great answers. Type a NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name of a remote computer' The default is the local computer. Microsoft Security Bulletin MS17-010. Has 90% of ice around Antarctica disappeared in less than a decade? I write functions as reusable tools that I place into modules which I decided to let MS install the 22H2 build. Also, I would not recommend Notepad, Notepad++, or any other text editor for writing Powershell scripts, because sometimes the plain text editors will add zero-width whitespace characters or invisible end-of-line characters that cause weird behavior when they are pasted into Powershell. If youre like me, you wanted to make sure that the Unfortunately, this same trick does not work with the installation of the patches as remote installation via the COM object is forbidden. It can be enabled on other Can you change windows update settings via command line? The following example scans three servers for the hotfixes listed in Microsoft Security Bulletin MS17-010. Did you read the help for Get-HotFix? I am trying below. If the update isn't Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. Hi Team, I just tested it on my own computer before adding the step of checking on a remote computer so I just typed Get-Hotfix and it returned: I did figure it out. Also I tried filter installed updates from next script result: 3 I need to get all installed Windows updates with PowerShell. Opens a new window. Hope the above will be helpful. [Regex]::Matches($Error, (?<=\[)(.*? How do you do the same thing via the GUI? 1. $error.clear(), Write-Progress Collecting update info from: $_, Invoke-Command -ComputerName $_ -ScriptBlock { Why do small African island nations perform better than African continental nations, considering democracy and human development? also with that information I want to know if a certain KB's is on the list of computers as well. So I want to check. We can do the patch reporting with SCCM reports, but we might not get exact details with SCCM reports in some cases. If it goes through the function and it comes to a computer that doesn't have the patch or isn't online then it goes to the catch and it gives Also, I found a useful link for your reference. You can use the built-in Powershell ISE, too, but it is not being developed any further. First of all, it's important to know where exactly the software list is stored. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. How to check IPv6 address via command line? How do I start PowerShell from Windows Explorer? A place where magic is studied and practiced? rev2023.3.3.43278. The default is The Get-HotFix output might vary on different operating systems. configured to run remote commands, use the ComputerName parameter. Type the IP address or name of the remote computer. Get-WmiObject -Class win32_quickfixengineering | where {$_.hotfixid -eq KB4499175 -or $_.hotfixid -eq KB4499180} Or you can use SCCM CMPivot to get the details of Patch Installation Status. We did that to confirm whether a user was a member of an AD group or not for specific ones.Run the psexec \\computername systeminfo (alias systeminfo to the path on the remote PC)Store the output as a variableLoop through the output to check for each KB and a yes or no if its there. Powershell, How to get date of last Windows update install or at least checked for an update? It also confirms that Get-Hotfix does not 1 -Quiet){
Webinar: Reduce Complexity & Optimise IT Capabilities. This command is the part of Microsoft.Management.PowerShell utility. By the time I get it figured out the reason I started
The commands in this example verify whether a particular update installed. About an argument in Famine, Affluence and Morality. There are other methods which you can use to run the PowerShell script using SCCM Run Script method. How do you know it doesn't return all updates? This particular vulnerability is rated as emergency in many organisations and patching\SCCM teams are busy in deploying the fix for this vulnerability. I wanted to know if i can remote access this machine and switch between os or while rebooting the system I can select the specific os. PowerShell Script to Check KB installed on workstations and then output 3 files. \_ ()_/ -id $NeededHotFixes -ComputerName$_) -EA 0{
specific Windows updates that patch the WannaCry ransomware vulnerability have been installed on all The free version of our cloud-based solution Action1 will help you. Invoke-Command -ComputerName server01 -ScriptBlock { c:\software\installer.exe /silent } There are two important details to be aware of right away. wmic qfe list brief /format:table. Long story short, dont use the ComputerName parameter of Get-Hotfix to query remote computers for user-based installs. adjusted using the ThrottleLimit parameter. I did not create any projects in GitHub that could be the reason you are not able to upload it to GitHub. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. In addition, I tested it in my lab environment and I would like to share the screenshot for your reference: saved as scripts or shared with others. Windows XP: How can I get the system language from command-line? Doubling the cube, field extensions and minimal polynoms. rev2023.3.3.43278. Is there a solutiuon to add special characters from software and how to do it, Styling contours by colour and by line thickness in QGIS. Ensure that you have the latest Powershell version installed on all Hyper-V hosts. The following example demonstrates this problem where Get-Hotfix does not continue to the next Ive seen a lot of functions and scripts this week to accomplish that task, but Let me know how this works for you! The recommended tool for writing Powershell is Visual Studio Code. \_ ()_/ Thursday, November 7, 2019 8:52 AM 0 Sign in to vote Hi, You have a few options here: How to check Windows Update History using PowerShell https://www.thewindowsclub.com/check-windows-update-history-using-powershell Yes, you can add updates directly to configuration baselines, but I am still learning PowerShell and wanted to do it the hard way. $ErrorActionPreference = SilentlyContinue using all the aliases and positional parameters that I want since Ill simply close out of the Your daily dose of tech news, in brief. Are there tables of wastage rates for different fruit and veg? Please remember to vote and to mark the replies as answers if they help. allow me to easily access them. The Get-Hotfix cmdlet gets all hotfixes installed on the local computer. Since PSWindowsUpdate is not installed on Windows by default, we have to first install the module. $pcnotfound = "true" which in turn once this happens once it will always be true which in turn gives me the PC Not Found message for every computer after that one. In WinUpdatesView, press F9 to open the 'Advanced Options' window. run in parallel. I am new to GitHub I will find out how can I add you as contributor. # continuehelp Test-Connection -full. This script is currently looking for KB's in
Euler: A baby on his lap, a cat on his back thats how he wrote his immortal works (origin?). Get-HotFix uses the Description parameter to specify hotfix types. KB4499180 (for Windows Server 2008 SP2)KB4499175 (for Windows Server 2008 R2 x64 SP1)KB4499175 (for Windows 7 SP1)KB4500705/KB4500331 (for Windows XP SP3)KB4500705/KB4500331 (for Windows Server 2003 SP2). get specific KBs installed on remote servers, How Intuit democratizes AI development across teams through reusability. wmic qfe list, updates that arent applicable wont be installed anyway and if any of these updates are found, its The ComputerName parameter includes a comma-separated object and the password is stored as a SecureString. Microsoft Scripting Guy Ed Wilson here. Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. The compliance can also be switched around where having the KB installed is not complaint and then a remediation script can be used to uninstall the KB. Day 3: Approve or Decline WSUS Updates by Using PowerShell. Below is what ive got so far but I can seem to figure out what the issue is. (Test-Path -path "$DirectoryToSaveTo")) #create it if not existing { New-Item "$DirectoryToSaveTo" -type directory | out-null } #Create a new Excel object using COM $Excel = New-Object -ComObject Excel.Application $Excel.visible = $True $Excel = $Excel.Workbooks.Add() $Sheet = $Excel.Worksheets.Item(1) $sheet.Name = 'Patch status - ' #Create a Title for the first worksheet $row = 1 $Column = 1 $Sheet.Cells.Item($row,$column)= 'Patch status' $range = $Sheet.Range("a1","f2") $range.Merge() | Out-Null $range.VerticalAlignment = -4160 #Give it a nice Style so it stands out $range.Style = 'Title' #Increment row for next set of data $row++;$row++ #Save the initial row so it can be used later to create a border #Counter variable for rows $intRow = $row $xlOpenXMLWorkbook=[int]51 #Read thru the contents of the Servers.txt file $Sheet.Cells.Item($intRow,1) ="Name" $Sheet.Cells.Item($intRow,2) ="Patch status" $Sheet.Cells.Item($intRow,3) ="OS" $Sheet.Cells.Item($intRow,4) ="SystemType" $Sheet.Cells.Item($intRow,5) ="Last Boot Time"$Sheet.Cells.Item($intRow,6) ="IP Address" #sets the font and color for the headers for ($col = 1; $col le 6; $col++) { $Sheet.Cells.Item($intRow,$col).Font.Bold = $True $Sheet.Cells.Item($intRow,$col).Interior.ColorIndex = 48 $Sheet.Cells.Item($intRow,$col).Font.ColorIndex = 34 } $intRow++ Function GetUpTime { param([string] $LastBootTime) $Uptime = (Get-Date) - [System.Management.ManagementDateTimeconverter]::ToDateTime($LastBootTime) "Days: $($Uptime.Days); Hours: $($Uptime.Hours); Minutes: $($Uptime.Minutes); Seconds: $($Uptime.Seconds)" } #This will try every computer in computers txt against the following$computers = Get-Content -Path $computerListforeach ($computer in $computers) { #If it cant find an IP address it will jump down to the catch and write PC not online#if it can find the KB it will continue down the list and write it out to the excel file#if it can find the KB it will jump to the catch see that the ip is not null so it will write out the the KB isnt found try { $IpV4 = (Test-Connection -ComputerName $computer -count 1).IPV4Address.ipaddressTOstring if ($KbInFo = Get-HotFix -Id $Patch -ComputerName $computer -ErrorAction 1) { $kbiNstall="$patch is installed" } $OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer -ErrorAction SilentlyContinue $sheetS = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $Computer -ErrorAction SilentlyContinue $sheetPU = Get-WmiObject -Class Win32_Processor -ComputerName $Computer -ErrorAction SilentlyContinue $drives = Get-WmiObject -ComputerName $Computer Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3} -ErrorAction SilentlyContinue $OSRunning = $OS.caption + " " + $OS.OSArchitecture + " SP " + $OS.ServicePackMajorVersion $systemType=$sheetS.SystemType $date = Get-Date $uptime = $OS.ConvertToDateTime($OS.lastbootuptime) $sheet.Cells.Item($intRow, 1) = $computer $sheet.Cells.Item($intRow, 2) = $kbiNstall $sheet.Cells.Item($intRow, 3) = $OSRunning $sheet.Cells.Item($intRow, 4) = $SystemType $sheet.Cells.Item($intRow, 5) = $uptime $sheet.Cells.item($intRow, 6) = $IpV4 } catch { If($IpV4 -eq $null){ $sheet.Cells.Item($intRow, 1) = $computer $sheet.Cells.Item($intRow, 2) = "PC is not online"} else{ $sheet.Cells.Item($intRow, 1) = $computer $sheet.Cells.Item($intRow, 2) = "PC HotFix Not Found" $sheet.Cells.Item($intRow, 3) = $OSRunning $sheet.Cells.Item($intRow, 4) = $SystemType $sheet.Cells.Item($intRow, 5) = $uptime $sheet.Cells.item($intRow, 6) = $IpV4 } } $intRow = $intRow + 1 } $erroractionpreference = SilentlyContinue $Sheet.UsedRange.EntireColumn.AutoFit() ########################################333 ############################################################## $filename = "$DirectoryToSaveTo$filename.xlsx" #if (test-path $filename ) { rm $filename } #delete the file if it already exists $Sheet.UsedRange.EntireColumn.AutoFit() $Excel.SaveAs($filename, $xlOpenXMLWorkbook) #save as an XML Workbook (xslx) $Excel.Saved = $True $Excel.Close() $Excel.DisplayAlerts = $False $Excel.quit()[System.Runtime.Interopservices.Marshal]::ReleaseComObject($Excel)spps -n Excel.