Scheduling a reboot of a server

Store this cmd file script somewhere and schedule it using the system task schedule, it will need to have administrator and “run when user not logged in” rights.

The exported XML file from the scheduled task contains this

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2016-01-13T10:41:23.3455701</Date>
    <Author>DOMAIN\adminuser</Author>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2016-01-13T02:00:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByWeek>
        <DaysOfWeek>
          <Sunday />
        </DaysOfWeek>
        <WeeksInterval>1</WeeksInterval>
      </ScheduleByWeek>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>DOMAIN\adminuser1</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>c:\windows\system32\cmd.exe</Command>
      <Arguments>/c "C:\program files\local\rebootme.cmd"</Arguments>
    </Exec>
  </Actions>
</Task>

the cmd file that logs and performs the actual reboot contains this

 

@set logfile="D:\Logfiles\rebootme.log"
echo %0 >> %logfile%
date /t >> %logfile%
time /t  >> %logfile%
shutdown /r /t 5

Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on Scheduling a reboot of a server

Updated powershell exchange reporting

based on sendstats.ps1 , all the various reports as HTML formatted tables.

List mailboxes sorted by size

List mailboxes sorted by date last accessed.

List all email addresses assigned to mailboxes and public folders.

List of mailboxes being forwarded to other addresses.

List of rights to access of mailboxes

###
###
### to schedule this use PowerShell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command "getmailboxinformationandemail.ps1"
###
### Set the email addresses and server

Add-PSSnapin "Microsoft.Exchange.Management.PowerShell.Admin"

# set the from and to email addresses and other details
$FromAddress = "administrator@cortina.com"
$ToAddress = "jefft@cortina.com"
$MessageSubject = "Mailbox Size Report from $env:computername "
$MessageBody = "Attached is the current mailbox report."
## set the smtp servers name or address
$SendingServer = "smtp.local"

$body = @'
<style>
body { background-color:#dddddd;
       font-family:Tahoma;
       font-size:12pt; }
td, th { border:1px solid black; 
         border-collapse:collapse; }
th { color:white;
     background-color:black; }
table, tr, td, th { padding: 2px; margin: 0px }
table { margin-left:50px; }
</style>
'@

$body+="<h2>List of mailbox information</h2>"
#Get-MailboxDatabase | sort-object "server","storagegroup" | Select Server, StorageGroupName, Name, @{Name="Size (GB)";Expression={$objitem = (Get-MailboxDatabase $_.Identity); $path = "`\`\" + $objitem.server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1048576KB; [math]::round($size, 2)}}, @{Name="Size (MB)";Expression={$objitem = (Get-MailboxDatabase $_.Identity ) ; $path = "`\`\" + $objitem.server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1024KB; [math]::round($size, 2)}}, @{Name="No. Of Mbx";expression={(Get-Mailbox -Database $_.Identity -resultsize unlimited | Measure-Object).Count}} | Format-table -AutoSize
$body +=Get-MailboxDatabase | sort-object "server","storagegroup" | Select Server, StorageGroupName, Name, @{Name="Size (GB)";Expression={$objitem = (Get-MailboxDatabase $_.Identity); $path = "`\`\" + $objitem.server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1048576KB; [math]::round($size, 2)}}, @{Name="Size (MB)";Expression={$objitem = (Get-MailboxDatabase $_.Identity ) ; $path = "`\`\" + $objitem.server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1024KB; [math]::round($size, 2)}}, @{Name="No. Of Mbx";expression={(Get-Mailbox -Database $_.Identity -resultsize unlimited | Measure-Object).Count}}  | convertto-html -Fragment


foreach ($mbdatabase in Get-MailboxDatabase  | sort-object "server","storagegroup"  ) { 
$body += "<h3>Mailboxes in $mbdatabase.identity sorted by size</h3>" 
###Now get the stats and store in a text file
$body +=Get-MailboxStatistics -database $mbdatabase.identity  | Sort-Object    @{Expression="Database";Descending=$false}  ,@{Expression="TotalItemSize";Descending=$true}  | select database, DisplayName, lastlogontime ,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.tomb()}}, ItemCount | convertto-html -fragment

$body +="<h2>Mailboxes in $mbdatabase.identity sorted by last logon (oldest first)</h2>" 
$body +=Get-MailboxStatistics -database $mbdatabase.identity  | Sort-Object @{Expression="Database";Descending=$false}  ,@{Expression="Lastlogontime";Descending=$false}  | select database, DisplayName, lastlogontime ,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.tomb()}}, ItemCount |   convertto-html -fragment

}

$body+="<h2>Email addresses assigned to mailboxes</h2>"


$body += Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | convertto-html -Fragment

$body+="<h2>Email addresses assigned to public folders</h2>"

$body += get-mailpublicfolder  | select-object  displayname, WindowsEmailAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”}   | ForEach-Object {$_.SmtpAddress} } } | convertto-html -Fragment 

$body+="<h2>Forwarding addresses</h2>"

$fwds = get-mailbox | Where-Object { $_.ForwardingAddress -ne $null } | sort Name | select Name, ForwardingAddress

# now get the primary smtp adress of each forward address
foreach ($fwd in $fwds) {
$fwd | add-member -membertype noteproperty -name "ContactAddress" -value (get-Recipient $fwd.ForwardingAddress).PrimarySmtpAddress
}


$body +=  $fwds | convertto-html -Fragment 


$body+="<h2>Mailbox access permissions</h2>"

$body += Get-Mailbox  -ResultSize Unlimited | Get-MailboxPermission | where {$_.user.tostring() -ne "ausgold\nanotera" -and $_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false} | Select Identity,User,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}}  | convertto-html -Fragment 


$messageBody=$body 

###Create the mail message and add the statistics text file as an attachment
$SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody 
$SMTPmessage.IsBodyHtml=$true

##$Attachment = New-Object Net.Mail.Attachment($tempfilename)
##$SMTPMessage.Attachments.Add($Attachment)


###Send the message
$SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
$SMTPClient.Send($SMTPMessage)

remove-variable SMTPclient
remove-variable SMTPmessage
Remove-Variable attachment


Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on Updated powershell exchange reporting

WBAdmin – deleting old backups from the catalogue

Cleaning up the windows server backup catalogue database (server 2012r2).

To get a list of backups

wbadmin get versions

pipe that text to a file and then to get all the backups

findstr “identifier”

Put all of that into a CMD file and then replace

“Version identifier: ”

with

“type y.txt | wbadmin delete backup -version:”

the text file y.txt needs to have two lines with just Y on them. Run that command and it will empty the catalogue.

If you just wanted to remove a particular backup device from the list would have to identify it by the guid in the Backup Target line from the versions list.

Once you have the disk id try.

“wbadmin delete backup -backupTarget:”

Posted in System Administration, Uncategorized | Comments Off on WBAdmin – deleting old backups from the catalogue

Exchange server 2007, log file sector size mismatch.

Moving between virtual VHD type disks (old hyperv server ver 6.1.7601) to VHDX formt (hyperv 2012r2 server version 6.3.9600).

Disaster recovery practice session.

After moving an old hyperv server to a new host and restoring Exchange 2007 backup into the VHDX type disk the stores refuse to mount.

Information store doesn’t mount and if you try and mount it using the exchange server console it shows error code: mapiexceptioncallfailed unable to mount database (hr=0x80004005,ec=-550)

server2007-vhd-vhdx-error1

Application event log Event id: 412 source ESE unable to read the header of logfile E00.log Error -546

server2007-vhd-vhdx-error5

Application event log Event id: 9518 from MSExchangeIS

Error 0xfffffdde starting Storage Group /…./ Exchange/CN=…/ on the Microsoft Exchange Information Store. Storage Group – Initialization of Jet failed.

server2007-vhd-vhdx-error6

Application event log shows event id: 9519 from the MSExchangeIS source, Error Database is in inconsistent state starting database “First Storage Group\Mailbox Database” on the Microsoft Exchange Information Store.

server2007-vhd-vhdx-error7

Trying the microsoft exchange server diagnostic tool eseutil gives some more information.

eseutil.exe /r E00

server2007-vhd-vhdx-error3
Which should commit the log files beginning with E00 the database returns “Operation terminated with error -546 (JET_errLogSectorSizeMismatch, the log file sector size does not match the current volume’s sector size)”

Checking the disks doesnt seem to show any difference, at least using the fsutil tool included with Server2008.

fsutil fsinfo ntfsinfo
server2007-vhd-vhdx-error4

Windows 2008 (ver 6.0.6002) shows the same number of Bytes per Sector and Bytes per Cluster for both “machines” (on Hyperv server 2008 with VHD format disks and on Server 2012r2 with VHDX format disks) and doesn’t include the “bytes per physical sector” information in the output.

Using Windows Server 2008r2 (ver 6.1.7601) the fsutil.exe program shows the extra information.

This is a VHD (old format) under server 2008r2,
bytes_per_physical_sector_vhdx

with Bytes per Physical Sector showing 512

this is a VHDX format disk (same size) showing Bytes per Physical Sector 4096

bytes_per_physical_sector_vhd

Exchange seems to be using this Bytes per Physical Sector value and refuses to let the exchange stores mount as the log files were created with a different size. More correctly it refuses to use the log files restored with the backup because the size recorded in the log check files is different to that on the new server.

To move the files accross the best tactic might be to dismount (shutdown information store) and make sure all logs are committed and then switch from VHD to VHDX drive, and then restart services. If they were in clean shutdown we would be able to delete the log files and it will create new log and chk files with the new correct sector size. Using the Exchange console to Move the database, log and system files seems to work OK and it “fixes” the size of the sectors in the log files to match the physical size.

Posted in System Administration | Comments Off on Exchange server 2007, log file sector size mismatch.

Server 2008 restore from backup

After doing a full system state restore from backup you “may” find that the server will boot and then blue screen.

Pressing F8 and setting to not reboot after the blue screen will let you see if it is error C00002E2 Directory Services Could Not Start. And you need to get into directory services maintenance mode.

To do that press F8 and select it (or choose it from the boot menu if you have enabled it previously).

Once you are in DSM you will need to see what is wrong, following the instructions from this article http://itswapshop.com/tutorial/how-fix-c00002e2-directory-services-could-not-start-blue-screen may fix it. Deleting the log files seems to work, but why the backup/restore leaves it in this state is anyones guess.

Posted in System Administration | Comments Off on Server 2008 restore from backup

Customising office interface with XML

By adding an XML file (and related entries) to a word document you can add or remove menu items.

This includes the backstage as well as the ribbon interface. The objects in the interface need to be addressed using the Msoobjectname format. Microsoft supply a list of the standard items for most versions of office.

This link gives a list of all the objects in the Schema for Office 2010 (Fluent interface)
https://www.microsoft.com/en-us/download/confirmation.aspx?id=1574, for office 2007 https://www.microsoft.com/en-us/download/details.aspx?id=3582, this one gives a list of all the icons (buttons) used, so if you want to make a new tool but reuse the button you can link to it https://www.microsoft.com/en-us/download/confirmation.aspx?id=11675.

The customui tool is very useful for easily adding or editing the XML it is available from http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2009/08/07/7293.aspx and referenced here https://msdn.microsoft.com/en-us/library/cc508991%28office.11%29.aspx#UsingtheCustomUIEditor2_AddingTemplatestotheCustomUIEditor .

However you can open the document with something like 7-zip and then edit the xml with any text editor (such as notepad). But you then need to manually add the correct “relationship” code and it is fairly cryptic to work with.
Adding the XML below will remove the default “send as attachment”, “send as XPS” and “Send as internet fax” options from the word file menu (backstage). It then adds a new button using the same icon as the old save and send one and links it to a macro. The macro and XML can be saved into the normal.dotm template which means this customisation will be current for all documents.

Custom_UI_Word

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <backstage>
    <tab idMso="TabShare">
      <firstColumn>
        <taskFormGroup idMso="GroupShare">
          <category idMso="Share">
	      <task idMso="SendUsingEmail">
		  <group idMso="GroupSendAsAttachment" visible="false"/>
		  <group idMso="GroupSendAsXps" visible="false"/>
		  <group idMso="GroupSendAsInternetFax" visible="false"/>


              <group id="grpSaveCloseOpenSend" label=" " insertBeforeMso="GroupSendAsAttachment"  >
                <topItems>
                  <button id="btnSCOS" label="Save,Close,Open,Send" style="large" onAction="mySaveCloseOpenSend" imageMso="FileSendAsAttachment" />
                </topItems>
              </group>
            </task>
          </category>
        </taskFormGroup>
      </firstColumn>
    </tab>
  </backstage>
</customUI>

This is the VBA code called by the new item added to the “Save/Send” stage. Note that once you define the control As iRibbonControl part it doesnt show as a normal macro. If you dont do that your get “parameter” errors when calling it.

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub mysavecloseopensend(control As IRibbonControl)

        On Error GoTo MyError1
        ActiveDocument.Save
        On Error GoTo MyError2
        Debug.Print ActiveDocument.Name, ActiveDocument.FullName
        mydocumentname = ActiveDocument.FullName
        mytext = ActiveDocument.Name + " attachment. " + mydocumentname
        ActiveDocument.Close
        Documents.Open FileName:=mydocumentname
        'Stop
        On Error GoTo 0
        
        ActiveDocument.SendForReview Recipients:="email@emaildomain.com", Subject:=mytext, showmessage:=True, includeattachment:=True
        
Exit Sub

MyError1:
        Debug.Print MsgBox(mydocumentname + " Could  not be saved, please check the path and try again.", vbCritical, "Error saving document")
Exit Sub

MyError2:
        Debug.Print MsgBox(mydocumentname + " Could  not be opened, please check the path and try again.", vbCritical, "Error opening document")
    
End Sub
Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on Customising office interface with XML

Python language and Fibonacci

Spending a bit of time familiarising myself with the Python language. The mathematics libraries are quite amazing. Bit of a change after PHP and Powershell etc. The first use of it was to use beautiful soup to read in some data from a web site (scraping it into a format that was useful) and “rearrange” it onto a world map (http://www.jetsoft.net.au/gps_distance/). The GPS mapping functions are quite complete and all the choices of projections and map data are very interesting.

Once I had that working I got interested on the mathematical and plotting functions.

I then wrote something to draw fibonacci “spirals”, the interpolation library (spline) does a lot of the heavy lifting. I joined the centres rather than the corners, dont know if that makes much difference but was more interested in the “shape” than the detail. It also shows the ratio of the most recent two terms in a plot to the right of the spiral. You can see how quickly it converges.

import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
import matplotlib as mpl
import numpy as np
from scipy.interpolate import spline 
import numpy as np
import time
		
plt.ion()
class DynamicUpdate():
	min_xy = 0
	max_xy = 0
	numpoly= 30
	square = [ [ 1,1 ] , [ 1,  0 ], [ 0 , 0 ] , [ 0 , 1 ] ]
	edges = {
	0: "T",
	1: "R",
	2: "B",
	3: "L",
	}
	

	def on_launch(self):
		#Set up plot
		self.figure=plt.figure()
		self.ax = plt.subplot2grid( (1,4),(0,0), colspan=3)
		self.ax1 = plt.subplot2grid( (1,4),(0,3) )
		self.ax.set_autoscaley_on(True)
		self.ax1.set_autoscaley_on(True)
		self.ax.grid()

	def on_running(self, sqs,  z  , cpx, cpy, cpsizes, cpratios ):
		#coll = PolyCollection( sqs, array=z, cmap=mpl.cm.jet, edgecolors='k')
		#del self.ax.collections[:]
		self.ax.clear()
		self.ax.set_title('Fibonacci sequence,' + str(len(sqs)) +' terms, centre points joined. ' + str( cpsizes[ len(sqs)-1]) )
		self.ax1.clear()
		self.ax1.set_title('Ratio ' + str(cpratios[len(sqs)-1]) )
		# add all the sqs as a collection of polynomials
		coll = PolyCollection( sqs , array=z, cmap=mpl.cm.jet, edgecolors='k' , alpha=0.5)
		self.ax.add_collection(coll)
		# plot the centre points of each square and join with a line
		self.ax.plot(cpx, cpy, '-o' )
		# Now add a smoothed (spline) to the plot. 
		n=range(0,len(sqs))
		if ( len(sqs) > 3 ) :
			nn=np.linspace(0,len(sqs)-1,20*len(sqs))
			nx=spline(n,cpx,nn)
			ny=spline(n,cpy,nn)
			self.ax.plot(nx,ny,'x')

		# force tp be a square, and make 0,0 always central
		self.ax.relim()
		self.ax.autoscale_view()
		self.ax.set( adjustable='box-forced', aspect='equal')
		newlim=max(abs(self.min_xy), self.max_xy)
		self.ax.set_xlim(-newlim, newlim)
		self.ax.set_ylim(-newlim, newlim)

		self.ax1.plot(cpratios,n, 'o' )
		self.ax1.set_ylim( 0, self.numpoly )
		
		plt.tight_layout()
		self.figure.canvas.draw()
		self.figure.canvas.flush_events()

	#create sqs
	def __call__(self):
		z=np.array([])
		cpx=[]
		cpy=[]
		cpsizes=[]
		cpratios=[]
		color_ratio=250/self.numpoly
		sqs=[]
		self.on_launch()
		tnm2=1
		tnm1=0
		#want the first one to be at 1,0, next one to left, imaginary 0 size block at 2,1 but have to have "forced" 1 size block to start it off
		posx= .5
		posy = .5
		edge=1
		for j in np.arange(0,self.numpoly,1):
			size=tnm2+tnm1
			edge=(edge+1) % 4
			myedge = self.edges.get(edge)
			# need to work out position depending on which edge we should be on (T, R, B , L )
			if myedge == 'T':
				# if on top then x is same corner and y is previous Y plus size 
				posx=posx
				posy=posy+tnm1
			elif myedge == 'R':
				#if on right x is previous x plus size, y is previous y minus size1 plust size 2?
				posx=posx+tnm1
				posy=posy-tnm2
			elif myedge == 'B':
				# if at bottom x is prev minus size previous
				posx=posx-tnm2
				posy=posy-size
			elif myedge == 'L':
				posx=posx-size
				posy=posy
			else:
				print 'Invalid Edge'
				posx=posx+size
				posy=posy+size
			tnm2=tnm1
			tnm1=size
			nsq=np.zeros( (4,2) )
			nsq=nsq  + self.square
			nsq = nsq * size 
			nsq =  ( nsq )  + [ posx, posy]
			sqs.append(nsq)
			# z is color
			z=np.append( z, float ( (250 * ( ( j-1)%2 ) ) + j*color_ratio) )
			# store centre points of each square
			cpx.append( posx+size/2.0 )
			cpy.append( posy+size/2.0 ) 
			cpsizes.append( size )
			myratio=1
			if ( tnm2 > 0 ) : 
				myratio=float(tnm1)  / float(tnm2)
			cpratios.append(  myratio)
			print "count, size, posx, posy",j, size, posx, posy
			self.min_xy = min(min(self.min_xy,posx),posy)
			self.max_xy=max(max(self.max_xy,abs(posx+size)),abs(posy+size))
			
			self.on_running( sqs, z , cpx, cpy , cpsizes, cpratios )
			time.sleep(1)
		return sqs

d = DynamicUpdate()
d()

the output looks like this (and doesn’t change a lot no matter how much you zoom in).

fibanim16

Posted in Uncategorized | Comments Off on Python language and Fibonacci

CENTOS / Redhat and the SysVinit change over to SystemD

The changes to Redhat and CENTOS versions to replace the old SysVinit commands with the new systemd ones has been fairly controversial.

This useful resource gives examples of the old and new ways to do various tasks.

https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet

 cat  /etc/rc.d/init.d/README
You are looking for the traditional init scripts in /etc/rc.d/init.d,
and they are gone?

Here's an explanation on what's going on:

You are running a systemd-based OS where traditional init scripts have
been replaced by native systemd services files. Service files provide
very similar functionality to init scripts. To make use of service
files simply invoke "systemctl", which will output a list of all
currently running services (and other units). Use "systemctl
list-unit-files" to get a listing of all known unit files, including
stopped, disabled and masked ones. Use "systemctl start
foobar.service" and "systemctl stop foobar.service" to start or stop a
service, respectively. For further details, please refer to
systemctl(1).

Note that traditional init scripts continue to function on a systemd
system. An init script /etc/rc.d/init.d/foobar is implicitly mapped
into a service unit foobar.service during system initialization.

Thank you!

Further reading:
        man:systemctl(1)
        man:systemd(1)
        http://0pointer.de/blog/projects/systemd-for-admins-3.html
        http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities
Posted in Bash and perl, System Administration | Comments Off on CENTOS / Redhat and the SysVinit change over to SystemD

Scheduling printing to keep a plotter functioning.

Anyone who has a large format inkjet plotter (HP A0 etc…) knows that if they sit idle for a long time the ink will dry up and clog the print heads. This can be an expensive repair so it is a good idea to print something regularly. If this is run from a server you can use the WORDPAD application to do the printing.
So first create a wordpad (.docx) document with enough color on it to give all the inkjets a good workout and then schedule it to print with the following powershell script. (Put your printer name into the script to make sure it goes to the correct one and the full path to the wordpad document).

$print= Get-WmiObject -Class win32_printer -Filter "Name='HP DesignJet 1055CM'"                                                                                
$print.SetDefaultPrinter()                                                                                                                                           
Start-Process -FilePath "C:\appdata\testprint\testprint.docx" -Verb print  
Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on Scheduling printing to keep a plotter functioning.

Shadow Copy Providers, if backups fail.

https://support.software.dell.com/appassure/kb/129774

Find each of the VSS writers in a failed state by issuing this command in an elevated command prompt – vssadmin list writers.
Make a list of all the failed VSS writers or take a screenshot.
Find the VSS writer’s associated Service Display Name in the table below and restart the service.
Issue the command again to confirm the status has changed Stable with no Error – vssadmin list writers.
Attempt to perform another snapshot.
If the VSS writers fail again, it will be necessary to restart the server.

VSS Writer			Service Name		Service Display Name
------------------------------- ----------------------- ---------------------------------------
ASR Writer			VSS			Volume Shadow Copy
BITS Writer			BITS			Background Intelligent Transfer Service
COM+ REGDB Writer		VSS			Volume Shadow Copy
DFS Replication service writer	DFSR			DFS Replication
DHCP Jet Writer			DHCPServer		DHCP Server
FRS Writer			NtFrs			File Replication
FSRM writer			srmsvc			File Server Resource Manager
IIS Config Writer		AppHostSvc		Application Host Helper Service
IIS Metabase Writer		IISADMIN		IIS Admin Service
Microsoft Exchange Writer	MSExchangeIS		Microsoft Exchange Information Store
Microsoft Hyper-V VSS Writer	vmms			Hyper-V Virtual Machine Management
NTDS				NTDS			Active Directory Domain Services
OSearch VSS Writer		OSearch			Office SharePoint Server Search
OSearch14 VSS Writer		OSearch14		SharePoint Server Search 14
Registry Writer			VSS			Volume Shadow Copy
Shadow Copy Optimization Writer	VSS			Volume Shadow Copy
SPSearch VSS Writer		SPSearch		Windows SharePoint Services Search
SPSearch4 VSS Writer		SPSearch4		SharePoint Foundation Search V4
SqlServerWriter			SQLWriter		SQL Server VSS Writer
System Writer			CryptSvc		Cryptographic Services
TermServLicensing		TermServLicensing	Remote Desktop Licensing
WINS Jet Writer			WINS			Windows Internet Name Service (WINS)
WMI Writer			Winmgmt			Windows Management Instrumentation
Posted in System Administration | Comments Off on Shadow Copy Providers, if backups fail.