<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://thecastle.me.uk/index.php?action=history&amp;feed=atom&amp;title=Powershell</id>
	<title>Powershell - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://thecastle.me.uk/index.php?action=history&amp;feed=atom&amp;title=Powershell"/>
	<link rel="alternate" type="text/html" href="https://thecastle.me.uk/index.php?title=Powershell&amp;action=history"/>
	<updated>2026-04-17T22:42:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://thecastle.me.uk/index.php?title=Powershell&amp;diff=6561&amp;oldid=prev</id>
		<title>Williamgray ywa14u61 at 13:37, 3 November 2021</title>
		<link rel="alternate" type="text/html" href="https://thecastle.me.uk/index.php?title=Powershell&amp;diff=6561&amp;oldid=prev"/>
		<updated>2021-11-03T13:37:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Send an Email from Powershell=&lt;br /&gt;
Send-MailMessage -To “&amp;lt;recipient’s email address&amp;gt;” -From “&amp;lt;sender’s email address&amp;gt;” -Subject “Your message subject” -Body “Some important plain text!” -Credential (Get-Credential) -SmtpServer “&amp;lt;smtp server&amp;gt;” -Port 587&lt;br /&gt;
&lt;br /&gt;
=Summarise each folder with number of files in each=&lt;br /&gt;
&lt;br /&gt;
get-childitem \\localhost\c$\temp| ?{ $_.PSIsContainer }|foreach-object -Process { write-host $_.Fullname ; (get-childitem $_.Fullname -Recurse |? { ! $_.PSIsContainer} ).Count }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Count number of zero byte files in folder=&lt;br /&gt;
&lt;br /&gt;
get-childitem \\localhost\c$\temp| ?{ $_.PSIsContainer }|foreach-object -Process { write-host $_.Fullname ; (get-childitem $_.Fullname -Recurse |? { ( ! $_.PSIsContainer ) -and ( $_.length -eq 0 ) } ).Count }&lt;br /&gt;
&lt;br /&gt;
=List zero byte files in folder=&lt;br /&gt;
get-childitem \\localhost\c$\temp| ?{ $_.PSIsContainer }|foreach-object -Process { write-host $_.Fullname ; (get-childitem $_.Fullname -Recurse |? { ( ! $_.PSIsContainer ) -and ( $_.length -eq 0 ) } )}&lt;br /&gt;
&lt;br /&gt;
=List zero byte files in folder and create file of output=&lt;br /&gt;
get-childitem \\localhost\c$\temp| ?{ $_.PSIsContainer }|foreach-object -Process { write-host $_.Fullname ; (get-childitem $_.Fullname -Recurse |? { ( ! $_.PSIsContainer ) -and ( $_.length -eq 0 ) } )} |Tee-Object -FilePath &amp;quot;C:\Temp\ZeroByteListPowershell.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
get-childitem \\?\UNC\computer.local\DFSRoot | ?{ $_.PSIsContainer }|foreach-object -Process { write-host $_.Fullname ; (get-childitem $_.Fullname -Recurse |? { ( ! $_.PSIsContainer ) -and ( $_.length -eq 0 ) } )} |Tee-Object -FilePath &amp;quot;C:/\Temp/\ZeroByteListPowershell-long2.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
get-childitem \\?\UNC\computer.local\DFSRoot&lt;br /&gt;
&lt;br /&gt;
=Find xmls in a folder=&lt;br /&gt;
get-childitem c:\temp -Recurse |foreach-object -Process { if ( $_.Fullname -like &amp;quot;*.xml&amp;quot; ) { write-host $_.Fullname } }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
EV Backup Service restart&lt;br /&gt;
&lt;br /&gt;
call &amp;quot;F:\Enterprise Vault\Scripts\prebackup.bat&amp;quot;&lt;br /&gt;
robocopy \\wgserver1\ev \\wgserver2\ev /mir /r:0 /w:0 /mt /a-:a&lt;br /&gt;
call &amp;quot;F:\Enterprise Vault\Scripts\postbackup.bat&amp;quot;&lt;br /&gt;
attrib -a &amp;quot;F:\Enterprise Vault\Store\*.*&amp;quot; /s&lt;br /&gt;
call &amp;quot;F:\Enterprise Vault\Scripts\evrestart.bat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prebackup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -psconsolefile &amp;quot;C:\Program Files (x86)\Enterprise Vault\EVShell.psc1&amp;quot; -command &amp;quot;&amp;amp; {Set-VaultStoreBackupMode -Name WG -EVServerName vault.wggroup.com -EVObjectType Site}&amp;quot;&lt;br /&gt;
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -psconsolefile &amp;quot;C:\Program Files (x86)\Enterprise Vault\EVShell.psc1&amp;quot; -command &amp;quot;&amp;amp; {Set-IndexLocationBackupMode -EVServerName vault.wggroup.com -EVSiteName WG}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Postbackup&lt;br /&gt;
&lt;br /&gt;
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -psconsolefile &amp;quot;C:\Program Files (x86)\Enterprise Vault\EVShell.psc1&amp;quot; -command &amp;quot;&amp;amp; {Clear-VaultStoreBackupMode -Name WG -EVServerName vault.wggroup.com -EVObjectType Site}&amp;quot;&lt;br /&gt;
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -psconsolefile &amp;quot;C:\Program Files (x86)\Enterprise Vault\EVShell.psc1&amp;quot; -command &amp;quot;&amp;amp; {Clear-IndexLocationBackupMode -EVServerName vault.wggroup.com -EVSiteName WG}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=EVRestart=&lt;br /&gt;
net stop /Y &amp;quot;Enterprise Vault Shopping Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;Enterprise Vault Indexing Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;Enterprise Vault Task Controller Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;Enterprise Vault Storage Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;Enterprise Vault Directory Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;Enterprise Vault Admin Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;World Wide Web Publishing Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;IIS Admin Service&amp;quot;&lt;br /&gt;
 net stop /Y &amp;quot;Message Queuing&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
net start /Y &amp;quot;Message Queuing&amp;quot;&lt;br /&gt;
 net start /Y &amp;quot;Enterprise Vault Admin Service&amp;quot;&lt;br /&gt;
 net start /Y &amp;quot;Enterprise Vault Directory Service&amp;quot;&lt;br /&gt;
 net start /Y &amp;quot;Enterprise Vault Storage Service&amp;quot;&lt;br /&gt;
 net start /Y &amp;quot;Enterprise Vault Indexing Service&amp;quot;&lt;br /&gt;
 net start /Y &amp;quot;Enterprise Vault Shopping Service&amp;quot;&lt;br /&gt;
 net start /Y &amp;quot;Enterprise Vault Task Controller Service&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
net start /Y &amp;quot;IIS Admin Service&amp;quot;&lt;br /&gt;
 net start /Y &amp;quot;World Wide Web Publishing Service&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Install net3.5 on Windows 2019=&lt;br /&gt;
&lt;br /&gt;
1. Open an elevated command prompt.&lt;br /&gt;
2. Type the following command: Dism /online /Enable-Feature /FeatureName:&amp;quot;NetFx3&amp;quot; /All /Source:X:\sources\sxs /LimitAccess&lt;br /&gt;
3. Once you press Enter, Windows will download and install .NET Framework 3.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
netsh int ipv4 set subinterface “Ethernet” mtu=1428 store=persistent&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Running powershell script=&lt;br /&gt;
&lt;br /&gt;
powershell.exe -noprofile -executionpolicy bypass -file c:\wgtech\getinfo.ps1&lt;/div&gt;</summary>
		<author><name>Williamgray ywa14u61</name></author>
		
	</entry>
</feed>