<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WSUS &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/tag/wsus/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Thu, 31 Oct 2019 15:08:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>PowerShell: PowerShell, WSUS, and SharePoint</title>
		<link>https://blog.andreev.it/2012/07/powershell-wsus-and-sharepoint/</link>
					<comments>https://blog.andreev.it/2012/07/powershell-wsus-and-sharepoint/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Mon, 09 Jul 2012 15:19:50 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSUS]]></category>
		<guid isPermaLink="false">http://blog.iandreev.com/?p=310</guid>

					<description><![CDATA[Here is a small script that I made based on different PowerShell scripts. This&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>Here is a small script that I made based on different PowerShell scripts. This script will connect to a WSUS server, get a list of all servers and create a CSV file that contains the computer name, how many updates are needed, how many updates were not installed, how many of them were installed and how many of them failed to install. After that, the script will connect to a SMTP server and try to send this CSV file to an e-mail address. Finally, if you have a SharePoint server or the free SharePoint services running, you can publish the file.<br />
Make sure that you have <a href="http://poshwsus.codeplex.com/" target="_blank" rel="noopener noreferrer">PoshWSUS</a> module and WSUS console installed prior to running this script. In addition if you are using v2.0.3 of PoshWSUS module, you have to manually modify Disconnect-WSUSServer.ps1 file as desribed <a href="http://poshwsus.codeplex.com/workitem/10" target="_blank" rel="noopener noreferrer">here</a>.</p>
<pre class="brush: powershell; title: ; notranslate">
Import-Module PoshWSUS
# Use -port 8530 if you are not running WSUS on defualt port 80
Connect-WSUSServer -wsusserver the_name_of_your_wsus_server -port 8530
# The CSV file that has been generated
$file = &quot;c:\Reports\MissingUpdates.csv&quot;
# The IP address of the SMTP server
$smtpserver = &quot;127.0.0.1&quot;
# Get the update status for each client
Get-WSUSUpdateSummaryPerClient | sort neededcount -des | select computer, neededcount, notinstalledcount, \
installedcount, failedcount,lastupdated | Export-CSV $file
# Send an email using SMTP
$att = new-object Net.Mail.Attachment($file)
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = &quot;sender@somedomain.com&quot;
$msg.To.Add(&quot;recepient@anotherdomain.com&quot;)
$msg.Subject = &quot;Notification from WSUS server - Missing Updates&quot;
$msg.Body = &quot;Attached is the Excel file. Do not reply to this message.&quot;
$msg.Attachments.Add($att)
$smtp.Send($msg)
$att.Dispose()

# Upload to SharePoint
$path = &quot;C:\Reports&quot;
$destination = &quot;http://share_point_server/Shared%20Documents/Reports&quot;

# If you want to publish the CSV file using domain credentials, uncomment the following two lines. 
# This will reveal you password
#$securePasssword = ConvertTo-SecureString &quot;Your_Password&quot; -AsPlainText -Force
#$credentials = New-Object System.Management.Automation.PSCredential (&quot;DOMAIN\username&quot;, $securePasssword)
# If you want to publish the file, using the crednetials of the user that's running the script 
# comment the previous two lines, and uncomment the line below.
$credentials = &#x5B;System.Net.CredentialCache]::DefaultCredentials

$webclient = New-Object System.Net.WebClient
$webclient.Credentials = $credentials
# This code will publish all files that are larger than 0 bytes from C:\Reports folder.
# You can modify it to suit your needs
Get-ChildItem $path | Where-Object {$_.Length -gt 0} | ForEach-Object {
    $webclient.UploadFile($destination + &quot;/&quot; + $_.Name, &quot;PUT&quot;, $_.FullName)
    # Remove-Item $_.FullName -Force
    }

# Disconnect from WSUS
Disconnect-WSUSServer
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2012/07/powershell-wsus-and-sharepoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
