<?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>Windows Server 2016 | TekCookie</title>
	<atom:link href="https://tekcookie.com/category/windows-server-2016/feed/" rel="self" type="application/rss+xml" />
	<link>https://tekcookie.com</link>
	<description>Everything about IT</description>
	<lastBuildDate>Wed, 24 Nov 2021 14:31:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/06/cropped-TekCookie-211.png?fit=32%2C17&#038;ssl=1</url>
	<title>Windows Server 2016 | TekCookie</title>
	<link>https://tekcookie.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">174510684</site>	<item>
		<title>Windows Update Information On Remote Servers with Powershell</title>
		<link>https://tekcookie.com/windows-update-information/</link>
					<comments>https://tekcookie.com/windows-update-information/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Fri, 18 Jun 2021 13:20:28 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows 10]]></category>
		<category><![CDATA[Windows Server 2016]]></category>
		<category><![CDATA[Windows update details]]></category>
		<category><![CDATA[Windows Update Information with Powershell]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=3198</guid>

					<description><![CDATA[In this article we will see how to use powershell script to get update information of remote windows servers. Last Windows Update Information We use the com object Microsoft.Update.Session to get the update results. Below one liner will tell us the previous update search and the last update installation date. Output: LastSearchSuccessDate LastInstallationSuccessDate --------------------- --------------------------- [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>In this article we will see how to use powershell script to get update information of remote windows servers.</p>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-3d8d94d9     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#last-windows-update-information" class="uagb-toc-link__trigger">Last Windows Update Information</a><li class="uagb-toc__list"><a href="#new-windows-update-count" class="uagb-toc-link__trigger">New Windows Update Count</a><li class="uagb-toc__list"><a href="#pending-operating-system-restart" class="uagb-toc-link__trigger">Pending Operating System Restart</a><li class="uagb-toc__list"><a href="#windows-update-status" class="uagb-toc-link__trigger">Windows Update Status</a></ol>					</div>
									</div>
				</div>
			


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p></p>



<h2 class="wp-block-heading">Last Windows Update Information</h2>



<p>We use the com object Microsoft.Update.Session to get the update results.</p>



<p>Below one liner will tell us the previous update search and the last update installation date.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">(New-Object -com "Microsoft.Update.AutoUpdate").Results
</code></pre>



<p>Output:</p>



<pre class="wp-block-preformatted">LastSearchSuccessDate LastInstallationSuccessDate
--------------------- --------------------------- 
 6/17/2021 3:54:31 AM  6/16/2021 3:57:34 AM</pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">New Windows Update Count</h2>



<p>Furthermore, to get the number of updates which are yet to be installed.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$UpdateSession = New-Object -ComObject Microsoft.Update.Session
$UpdateSearcher = $UpdateSession.CreateupdateSearcher()
$Updates = @($UpdateSearcher.Search("IsInstalled=0").Updates)

#This will give the number of updates yet to install.
$Updates.Title.count </code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Pending Operating System Restart</h2>



<p>Any pending restart because of previous update can be identified through the registry &#8220;HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired&#8221;</p>



<p>The entry will have a value &#8220;true&#8221; if the operating system is waiting for a restart which is needed to complete an update.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Windows Update Status</h2>



<p>Above codes can be combined to get following information about a computer. </p>



<ol class="wp-block-list"><li>LastSearchSuccessDate</li><li>LastInstallationSuccessDate</li><li>NewUpdateCount</li><li>PendingReboot</li></ol>



<p>We can now wrap the script with invoke-command to remote execute in multiple systems</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">function Get-WindowsUpdateInformation()
 {
     param
     (
         [Parameter()]
         [string[]]
         $ComputerName="localhost"
     )


     <code>$Results = Invoke-Command -ScriptBlock  {     </code>
         <code>$result = (New-Object -com "Microsoft.Update.AutoUpdate").Results     </code>
         <code>$UpdateSession = New-Object -ComObject Microsoft.Update.Session     </code>
         <code>$UpdateSearcher = $UpdateSession.CreateupdateSearcher()     </code>
         <code>$Updates = @($UpdateSearcher.Search("IsInstalled=0").Updates)     </code>
         <code>$PendingReboot = $false     </code>
    
         #Checking pending reboot
         <code>if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { $PendingReboot=$true }     </code>
   
         #Framing the result to a list
         <code>New-Object psobject -Property @{         </code>
              <code>LastSearchSuccessDate = $result.LastSearchSuccessDate         </code>
              <code>LastInstallationSuccessDate = $result.LastInstallationSuccessDate         </code>
              <code>NewUpdateCount = $Updates.Title.count         </code>
              <code>PendingReboot = $PendingReboot     </code>
         <code>} </code>
     <code>} -ComputerName $ComputerName </code>

     <code>$Results | Select-Object @{Name="ServerName"; Expression={$_.PSComputerName}}, LastSearchSuccessDate, LastInstallationSuccessDate, NewUpdateCount, PendingReboot</code>
 }
 </code></pre>



<p>Multiple server/computer names can be passed as an array to get the update information, or the server name can also be read from a text file and passed as parameter.</p>



<pre id="block-a18e501e-39e5-40fa-91ad-224e419f395c" class="wp-block-preformatted">Get-WindowsUpdateInformation -ComputerName testhost1, testhost2</pre>



<p>Output:</p>



<pre class="wp-block-preformatted">ServerName LastSearchSuccessDate LastInstallationSuccessDate NewUpdateCount PendingReboot
---------- --------------------- --------------------------- -------------- -------------
 testhost1  6/17/2021 5:31:12 PM  5/16/2021 2:56:21 PM                     1         False
 testhost2  6/16/2021 6:33:22 PM  5/21/2021 4:22:34 AM                     1         False</pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>If you have some better ideas or know other ways of doing this, please comment it. It will be informative for me and for the readers.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you liked this article and thank you for reading</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/windows-update-information/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3198</post-id>	</item>
		<item>
		<title>Install drivers in Windows using PowerShell</title>
		<link>https://tekcookie.com/auto-install-drivers-using-powershell/</link>
					<comments>https://tekcookie.com/auto-install-drivers-using-powershell/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Wed, 16 Dec 2020 18:22:09 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 10]]></category>
		<category><![CDATA[Windows Server 2016]]></category>
		<category><![CDATA[Install drivers with PowerShell]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=1811</guid>

					<description><![CDATA[Installing drivers for windows is very time consuming when the driver package contain multiple devices/models files with all possible platform architecture(x86, x64, etc.). We can leverage the pnputil.exe tool to perform the installation fast and easy. Consider a scenario of a multiple drivers packed to an iso image. Below script will install all the required [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Installing drivers for windows is very time consuming when the driver package contain multiple devices/models files with all possible platform architecture(x86, x64, etc.).</p>



<p>We can leverage the pnputil.exe tool to perform the installation fast and easy.</p>



<p>Consider a scenario of a multiple drivers packed to an iso image. Below script will install all the required drivers.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell line-numbers"># Mount the driver iso image
Mount-DiskImage D:\Driver\drivers-windows.iso

# Get the mount point/drive letter, considering that the above one is the only disk mounted
$isoMount = (Get-DiskImage -DevicePath \\.\CDROM0  | Get-Volume).DriveLetter

# Find the inf files and install
Get-ChildItem "$($isoMount):\" -Recurse -Include *.inf | ForEach-Object {
     $_.FullName
     pnputil /add-driver $_.FullName /install 
}</code></pre>



<p>Running the script would update all the drivers which are meant for your system hardware.</p>



<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you like this article and thank you for reading.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/auto-install-drivers-using-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1811</post-id>	</item>
		<item>
		<title>Printer Server migration &#8211; 2003 to 2016</title>
		<link>https://tekcookie.com/printer-server-migration-2003-to-2016/</link>
					<comments>https://tekcookie.com/printer-server-migration-2003-to-2016/#comments</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Thu, 21 Nov 2019 13:19:59 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Print Server Migration]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows Server 2003]]></category>
		<category><![CDATA[Windows Server 2016]]></category>
		<category><![CDATA[Printer Server migration]]></category>
		<category><![CDATA[Printer Server migration from Windows 2003 to Windows 2016]]></category>
		<guid isPermaLink="false">https://adminscripter.wordpress.com/?p=213</guid>

					<description><![CDATA[Printer Server migration from Windows 2003 to Windows 2016 Recently, I was assigned with a printer server migration project from Windows Server 2003 to Windows Server 2016. The difficult thing was that, I couldn&#8217;t find any article which explains about the migration from 32-bit architecture to 64-bit architecture. May be I am not that good [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h1 class="has-text-align-left wp-block-heading">Printer Server migration from Windows 2003 to Windows 2016</h1>



<p>Recently, I was assigned with a printer server migration project from Windows Server 2003 to Windows Server 2016.</p>



<p>The difficult thing was that, I couldn&#8217;t find any article which explains about the migration from 32-bit architecture to 64-bit architecture. May be I am not that good in googling.</p>



<p>My task was to migrate 100+ printers from windows server 2003 to windows server 2016 with all configurations.</p>



<p>First thought which came to my mind was to export all printers settings (Printer name, driver name, model, printer port name, printer port IP, printer share name etc.) to a text file using the inbuilt vb scripts in windows and then format it to a CSV file.<br>With the CSV file as source, PowerShell can be used to add printers to the new server using <em><strong>Add-PrinterPort</strong></em> and <strong><em>Add-Printer</em></strong> command-lets. I was able to migrate the printers to new server with the Name, share name, port, comments, location etc. But I was stuck at paper size. I was not able to set custom size(Height and Width) for the label printers.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Here the only change was &#8211; the driver name was different for existing printers in windows server 2003 and the new package for windows server 2016. So I had to change the printer driver name in PowerShell accordingly</p></blockquote>



<p>After some thought process, I thought of printer migration tools. But there was some difficulty, it was for backup and restore of printers within windows server 2003.<br>Then I tried with Print Management tool in windows 2016, connected the print management mmc to windows  server 2003, exported the printer&#8217;s and &#8230; import failed.</p>



<p>Then I used PrintBrm.exe to export the printer&#8217;s and import failed again. 🙁</p>



<p>The issue was with the driver &#8220;<em>name</em>&#8221; as mentioned above.</p>



<ul class="wp-block-list"><li>Windows 2003 : Driver name &#8211; <strong>Zebra GK420t</strong></li><li>Windows 2016 : Driver name &#8211; <strong>ZDesigner GK420t </strong></li></ul>



<hr class="wp-block-separator"/>



<h3 class="wp-block-heading">Below are the steps which I followed to migrate the printers from Windows Server 2003 to Windows Server 2016</h3>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>Step-1</strong></p><cite>Add new driver to windows server 2003</cite></blockquote>



<p>Added the latest driver to windows 2003 to match the driver name. In the list of printer drivers, the new name was available.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>Step-2</strong></p><cite>Change existing printer driver to newly installed driver</cite></blockquote>



<p>For ease of login, both old and new servers local administrator id and password is set to same.<br>From windows server 2016, Following PowerShell script was run to change the drivers in Windows 2003.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell line-numbers">$Windows2003Name = "PRNSVR2003"
#Fetch all printers having driver name starting with Z, i.e. Zebra
$printers = Get-printer -ComputerName $Windows2003Name | where {$_.DriverName -like "Z*"} 
foreach($prns in $printers) 
{	#iterating through each printer and changing the driver name to new drivers
   if($prns.DriverName -like "Zebra  GK420t*")
   {
        #$prns.Name
        Set-Printer -ComputerName $Windows2003Name -Name $prns.Name -DriverName "ZDesigner GK420t"
   }
   elseif($prns.DriverName -like "Zebra  TLP2844-Z*")
   {
        #$prns.Name
        Set-Printer -ComputerName $Windows2003Name -Name $prns.Name -DriverName "ZDesigner TLP 2844-Z"
   }
}</code></pre>



<p>While the script is running, we can see the driver getting changed in the windows 2003 server printer console</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>Step-3</strong></p><cite>Backup printers from old server</cite></blockquote>



<p>From Windows 2016, run printer migration tool &#8211; PrintBrm.exe<br>Open command prompt and run the following </p>



<pre class="wp-block-code"><code lang="bash" class="language-bash line-numbers">cd %WinDir%\System32\Spool\Tools
printbrm.exe -s \\PRNSVR2003 -b -f Win2003Printer.printerExport</code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>Step-4</strong></p><cite>Restore printers to new server</cite></blockquote>



<p>Double click the above created file to import the printers with all settings.</p>



<p>That&#8217;s it! All your printers are in the new server.</p>



<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Thank you for reading my post. Hope it is helpful to you.</p></blockquote>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/printer-server-migration-2003-to-2016/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">213</post-id>	</item>
		<item>
		<title>Folder size using PowerShell</title>
		<link>https://tekcookie.com/folder-size-using-powershell/</link>
					<comments>https://tekcookie.com/folder-size-using-powershell/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Thu, 04 Jul 2019 21:18:41 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows Server 2016]]></category>
		<category><![CDATA[Folder size PowerShell]]></category>
		<category><![CDATA[Folder size using PowerShell]]></category>
		<guid isPermaLink="false">https://adminscripter.wordpress.com/?p=136</guid>

					<description><![CDATA[The cost of hard disk is getting cheaper day by day. Even if we have terabytes of disk space, one fine day it is gonna be full. The difficult job is to find which folder has used more space. Out in the market, there are many tools for analyzing the disk space utilization. The one [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>The cost of hard disk is getting cheaper day by day. Even if we have terabytes of disk space, one fine day it is gonna be full.</p>



<p>The difficult job is to find which folder has used more space. Out in the market, there are many tools for analyzing the disk space utilization. The one which I like is TreeSize.</p>



<p>Did you know that few lines of PowerShell script could do the same?</p>


<p><u>Detailed script with exception handling</u></p>


<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$path = "C:\Users\" 
$depth = 1 
$result = @() 

$folders = (Get-ChildItem -Path $path -Directory -Recurse -Depth $depth).FullName 
$folders | % {     
    try {         
        $size = Get-ChildItem -Path $_ -File -Recurse -ErrorAction SilentlyContinue | measure-object  -property length -Sum | select @{Name="Sum"; Expression={[Math]::Round($($_.Sum/1gb), 2)}}         
        if($size -eq $null) {             
            $result += $_ | Select-object @{Name="Path";Expression={$_}}, @{Name="Size(gb)";Expression={0}}         
            }         
        else {             
            $result += $_ | Select-object @{Name="Path";Expression={$_}}, @{Name="Size(gb)";Expression={$Size.Sum}}         
            }     
        }     
        catch [System.Exception] {         
            "Access Denied to - " + $_     
            } 
        } 
#condition to filter -- below sample shows folder occupying 1GB+ data
$result | Where {$_."Size(gb)" -gt 1} | Sort-Object "Size(gb)" -Descending</code></pre>



<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope this helps you&#8230;</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/folder-size-using-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">136</post-id>	</item>
	</channel>
</rss>
