mirror of
https://github.com/jonbranan/globalscape.git
synced 2025-01-17 22:41:56 -06:00
adding all the existing scripts
This commit is contained in:
parent
a1854fc57b
commit
80e14431da
14
aml/GS_Variablize remote files.aml
Normal file
14
aml/GS_Variablize remote files.aml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<AMTASK>
|
||||||
|
<AMTASKHEAD>
|
||||||
|
<TASKINFO TASKVERSION="8090" />
|
||||||
|
</AMTASKHEAD>
|
||||||
|
|
||||||
|
<AMFUNCTION NAME="Main" RETURNTYPE="variable">
|
||||||
|
<AMFTP ACTIVITY="logon" SERVER="192.168.102.28" USERNAME="test" PASSWORD="AM2T0ncdJUXqLI7Sbl05hfcsg==aME" TYPE="sftp" PORT="22" />
|
||||||
|
<AMFTP ACTIVITY="advanced" FTPCOMMAND="long_list" PARAMETER="*.*" FTPLONGLISTDATASET="NewDataset" />
|
||||||
|
<AMLOOP TYPE="DATASET" DATASET="NewDataset">
|
||||||
|
<AMFILEWRITE FILE="C:\wd\filelist.txt">%NewDataset.FTPFileName%</AMFILEWRITE>
|
||||||
|
</AMLOOP>
|
||||||
|
</AMFUNCTION>
|
||||||
|
|
||||||
|
</AMTASK>
|
10
bat/Batch to call multiple things/call all.bat
Normal file
10
bat/Batch to call multiple things/call all.bat
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@echo off
|
||||||
|
c:\
|
||||||
|
cd "C:\Users\jbranan\Desktop\Batch to call multiple things"
|
||||||
|
start wireshark.bat
|
||||||
|
start procdump.bat
|
||||||
|
start procmon.bat
|
||||||
|
timeout /T 135
|
||||||
|
start killwireshark.bat
|
||||||
|
start killprocmon.bat
|
||||||
|
exit
|
3
bat/Batch to call multiple things/killprocmon.bat
Normal file
3
bat/Batch to call multiple things/killprocmon.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
taskkill /IM "Procmon64.exe" /F
|
||||||
|
exit
|
3
bat/Batch to call multiple things/killwireshark.bat
Normal file
3
bat/Batch to call multiple things/killwireshark.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
taskkill /IM "Wireshark.exe" /F
|
||||||
|
exit
|
6
bat/Batch to call multiple things/procdump.bat
Normal file
6
bat/Batch to call multiple things/procdump.bat
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@echo off
|
||||||
|
c:\
|
||||||
|
cd "C:\Users\jbranan\Desktop\Batch to call multiple things\procdump"
|
||||||
|
procdump.exe -n 1 -ma cftpstes.exe "C:\Users\jbranan\Desktop\Batch to call multiple things\dumps" -accepteula
|
||||||
|
timeout /T 15
|
||||||
|
exit
|
75
bat/Batch to call multiple things/procdump/Eula.txt
Normal file
75
bat/Batch to call multiple things/procdump/Eula.txt
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
Sysinternals Software License Terms
|
||||||
|
These license terms are an agreement between Sysinternals (a wholly owned subsidiary of Microsoft Corporation) and you. Please read them. They apply to the software you are downloading from technet.microsoft.com/sysinternals, which includes the media on which you received it, if any. The terms also apply to any Sysinternals
|
||||||
|
* updates,
|
||||||
|
* supplements,
|
||||||
|
* Internet-based services,
|
||||||
|
* and support services
|
||||||
|
for this software, unless other terms accompany those items. If so, those terms apply.
|
||||||
|
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.
|
||||||
|
If you comply with these license terms, you have the rights below.
|
||||||
|
|
||||||
|
Installation and User Rights
|
||||||
|
|
||||||
|
You may install and use any number of copies of the software on your devices.
|
||||||
|
|
||||||
|
Scope of License
|
||||||
|
|
||||||
|
The software is licensed, not sold. This agreement only gives you some rights to use the software. Sysinternals reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
|
||||||
|
* work around any technical limitations in the software;
|
||||||
|
* reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
|
||||||
|
* make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;
|
||||||
|
* publish the software for others to copy;
|
||||||
|
* rent, lease or lend the software;
|
||||||
|
* transfer the software or this agreement to any third party; or
|
||||||
|
* use the software for commercial software hosting services.
|
||||||
|
|
||||||
|
Sensitive Information
|
||||||
|
|
||||||
|
Please be aware that, similar to other debug tools that capture “process state” information, files saved by Sysinternals tools may include personally identifiable or other sensitive information (such as usernames, passwords, paths to files accessed, and paths to registry accessed). By using this software, you acknowledge that you are aware of this and take sole responsibility for any personally identifiable or other sensitive information provided to Microsoft or any other party through your use of the software.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
|
||||||
|
Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
|
||||||
|
|
||||||
|
Export Restrictions
|
||||||
|
|
||||||
|
The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting .
|
||||||
|
|
||||||
|
Support Services
|
||||||
|
|
||||||
|
Because this software is "as is," we may not provide support services for it.
|
||||||
|
|
||||||
|
Entire Agreement
|
||||||
|
|
||||||
|
This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
|
||||||
|
|
||||||
|
Applicable Law
|
||||||
|
|
||||||
|
United States . If you acquired the software in the United States , Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
|
||||||
|
Outside the United States . If you acquired the software in any other country, the laws of that country apply.
|
||||||
|
|
||||||
|
Legal Effect
|
||||||
|
|
||||||
|
This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
|
||||||
|
|
||||||
|
Disclaimer of Warranty
|
||||||
|
|
||||||
|
The software is licensed "as-is." You bear the risk of using it. Sysinternals gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, sysinternals excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
||||||
|
|
||||||
|
Limitation on and Exclusion of Remedies and Damages
|
||||||
|
|
||||||
|
You can recover from sysinternals and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.
|
||||||
|
This limitation applies to
|
||||||
|
* anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
|
||||||
|
* claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
|
||||||
|
|
||||||
|
It also applies even if Sysinternals knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
|
||||||
|
Please note: As this software is distributed in Quebec , Canada , some of the clauses in this agreement are provided below in French.
|
||||||
|
Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.
|
||||||
|
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Sysinternals n'accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection dues consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d'adéquation à un usage particulier et d'absence de contrefaçon sont exclues.
|
||||||
|
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Sysinternals et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
|
||||||
|
Cette limitation concerne :
|
||||||
|
tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
|
||||||
|
les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d'une autre faute dans la limite autorisée par la loi en vigueur.
|
||||||
|
Elle s'applique également, même si Sysinternals connaissait ou devrait connaître l'éventualité d'un tel dommage. Si votre pays n'autorise pas l'exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l'exclusion ci-dessus ne s'appliquera pas à votre égard.
|
||||||
|
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d'autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.
|
BIN
bat/Batch to call multiple things/procdump/procdump.exe
Normal file
BIN
bat/Batch to call multiple things/procdump/procdump.exe
Normal file
Binary file not shown.
4
bat/Batch to call multiple things/procmon.bat
Normal file
4
bat/Batch to call multiple things/procmon.bat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
c:
|
||||||
|
cd "C:\Users\jbranan\Desktop\Batch to call multiple things\procmon"
|
||||||
|
procmon.exe /accepteula /Nofilter /Quiet /BackingFile "C:\Users\jbranan\Desktop\Batch to call multiple things\dumps\log.PML" /Minimized
|
75
bat/Batch to call multiple things/procmon/Eula.txt
Normal file
75
bat/Batch to call multiple things/procmon/Eula.txt
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
Sysinternals Software License Terms
|
||||||
|
These license terms are an agreement between Sysinternals (a wholly owned subsidiary of Microsoft Corporation) and you. Please read them. They apply to the software you are downloading from technet.microsoft.com/sysinternals, which includes the media on which you received it, if any. The terms also apply to any Sysinternals
|
||||||
|
* updates,
|
||||||
|
* supplements,
|
||||||
|
* Internet-based services,
|
||||||
|
* and support services
|
||||||
|
for this software, unless other terms accompany those items. If so, those terms apply.
|
||||||
|
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.
|
||||||
|
If you comply with these license terms, you have the rights below.
|
||||||
|
|
||||||
|
Installation and User Rights
|
||||||
|
|
||||||
|
You may install and use any number of copies of the software on your devices.
|
||||||
|
|
||||||
|
Scope of License
|
||||||
|
|
||||||
|
The software is licensed, not sold. This agreement only gives you some rights to use the software. Sysinternals reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
|
||||||
|
* work around any technical limitations in the software;
|
||||||
|
* reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
|
||||||
|
* make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;
|
||||||
|
* publish the software for others to copy;
|
||||||
|
* rent, lease or lend the software;
|
||||||
|
* transfer the software or this agreement to any third party; or
|
||||||
|
* use the software for commercial software hosting services.
|
||||||
|
|
||||||
|
Sensitive Information
|
||||||
|
|
||||||
|
Please be aware that, similar to other debug tools that capture “process state” information, files saved by Sysinternals tools may include personally identifiable or other sensitive information (such as usernames, passwords, paths to files accessed, and paths to registry accessed). By using this software, you acknowledge that you are aware of this and take sole responsibility for any personally identifiable or other sensitive information provided to Microsoft or any other party through your use of the software.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
|
||||||
|
Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
|
||||||
|
|
||||||
|
Export Restrictions
|
||||||
|
|
||||||
|
The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting .
|
||||||
|
|
||||||
|
Support Services
|
||||||
|
|
||||||
|
Because this software is "as is," we may not provide support services for it.
|
||||||
|
|
||||||
|
Entire Agreement
|
||||||
|
|
||||||
|
This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
|
||||||
|
|
||||||
|
Applicable Law
|
||||||
|
|
||||||
|
United States . If you acquired the software in the United States , Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
|
||||||
|
Outside the United States . If you acquired the software in any other country, the laws of that country apply.
|
||||||
|
|
||||||
|
Legal Effect
|
||||||
|
|
||||||
|
This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
|
||||||
|
|
||||||
|
Disclaimer of Warranty
|
||||||
|
|
||||||
|
The software is licensed "as-is." You bear the risk of using it. Sysinternals gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, sysinternals excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
||||||
|
|
||||||
|
Limitation on and Exclusion of Remedies and Damages
|
||||||
|
|
||||||
|
You can recover from sysinternals and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.
|
||||||
|
This limitation applies to
|
||||||
|
* anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
|
||||||
|
* claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
|
||||||
|
|
||||||
|
It also applies even if Sysinternals knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
|
||||||
|
Please note: As this software is distributed in Quebec , Canada , some of the clauses in this agreement are provided below in French.
|
||||||
|
Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.
|
||||||
|
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Sysinternals n'accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection dues consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d'adéquation à un usage particulier et d'absence de contrefaçon sont exclues.
|
||||||
|
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Sysinternals et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
|
||||||
|
Cette limitation concerne :
|
||||||
|
tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
|
||||||
|
les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d'une autre faute dans la limite autorisée par la loi en vigueur.
|
||||||
|
Elle s'applique également, même si Sysinternals connaissait ou devrait connaître l'éventualité d'un tel dommage. Si votre pays n'autorise pas l'exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l'exclusion ci-dessus ne s'appliquera pas à votre égard.
|
||||||
|
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d'autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.
|
BIN
bat/Batch to call multiple things/procmon/Procmon.exe
Normal file
BIN
bat/Batch to call multiple things/procmon/Procmon.exe
Normal file
Binary file not shown.
4
bat/Batch to call multiple things/wireshark.bat
Normal file
4
bat/Batch to call multiple things/wireshark.bat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
c:
|
||||||
|
cd "C:\Program Files\Wireshark"
|
||||||
|
wireshark -k -i Ethernet0 -f "host 192.168.102.10" -a duration:120 -w "C:\Users\jbranan\Desktop\Batch to call multiple things\dumps\capture.pcapng"
|
10
bat/call all.bat
Normal file
10
bat/call all.bat
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@echo off
|
||||||
|
c:\
|
||||||
|
cd "C:\Users\jbranan\Desktop\Batch to call multiple things"
|
||||||
|
start wireshark.bat
|
||||||
|
start procdump.bat
|
||||||
|
start procmon.bat
|
||||||
|
timeout /T 135
|
||||||
|
start killwireshark.bat
|
||||||
|
start killprocmon.bat
|
||||||
|
exit
|
3
bat/dmz thread dupmp.bat
Normal file
3
bat/dmz thread dupmp.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
C:
|
||||||
|
cd “C:\Program Files\GlobalSCAPE\DMZ Gateway\bin”
|
||||||
|
DMZGatewayServerService.exe -d “C:\Program Files\GlobalSCAPE\DMZ Gateway\conf\DMZGatewayServerService.conf”
|
4
bat/dump-crash/Admin Console Hang Dump.bat
Normal file
4
bat/dump-crash/Admin Console Hang Dump.bat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pushd "%~d0\"
|
||||||
|
pushd "%~dp0\"
|
||||||
|
"%~dp0procdump.exe" -n 3 -s 60 -ma -accepteula cftpsai.exe .\
|
||||||
|
pause
|
4
bat/dump-crash/EFT Service Hang Dump.bat
Normal file
4
bat/dump-crash/EFT Service Hang Dump.bat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pushd "%~d0\"
|
||||||
|
pushd "%~dp0\"
|
||||||
|
"%~dp0procdump.exe" -n 3 -s 60 -ma -accepteula cftpstes.exe .\
|
||||||
|
pause
|
75
bat/dump-crash/Eula.txt
Normal file
75
bat/dump-crash/Eula.txt
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
Sysinternals Software License Terms
|
||||||
|
These license terms are an agreement between Sysinternals (a wholly owned subsidiary of Microsoft Corporation) and you. Please read them. They apply to the software you are downloading from technet.microsoft.com/sysinternals, which includes the media on which you received it, if any. The terms also apply to any Sysinternals
|
||||||
|
* updates,
|
||||||
|
* supplements,
|
||||||
|
* Internet-based services,
|
||||||
|
* and support services
|
||||||
|
for this software, unless other terms accompany those items. If so, those terms apply.
|
||||||
|
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.
|
||||||
|
If you comply with these license terms, you have the rights below.
|
||||||
|
|
||||||
|
Installation and User Rights
|
||||||
|
|
||||||
|
You may install and use any number of copies of the software on your devices.
|
||||||
|
|
||||||
|
Scope of License
|
||||||
|
|
||||||
|
The software is licensed, not sold. This agreement only gives you some rights to use the software. Sysinternals reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
|
||||||
|
* work around any technical limitations in the software;
|
||||||
|
* reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
|
||||||
|
* make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;
|
||||||
|
* publish the software for others to copy;
|
||||||
|
* rent, lease or lend the software;
|
||||||
|
* transfer the software or this agreement to any third party; or
|
||||||
|
* use the software for commercial software hosting services.
|
||||||
|
|
||||||
|
Sensitive Information
|
||||||
|
|
||||||
|
Please be aware that, similar to other debug tools that capture “process state” information, files saved by Sysinternals tools may include personally identifiable or other sensitive information (such as usernames, passwords, paths to files accessed, and paths to registry accessed). By using this software, you acknowledge that you are aware of this and take sole responsibility for any personally identifiable or other sensitive information provided to Microsoft or any other party through your use of the software.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
|
||||||
|
Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
|
||||||
|
|
||||||
|
Export Restrictions
|
||||||
|
|
||||||
|
The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting .
|
||||||
|
|
||||||
|
Support Services
|
||||||
|
|
||||||
|
Because this software is "as is," we may not provide support services for it.
|
||||||
|
|
||||||
|
Entire Agreement
|
||||||
|
|
||||||
|
This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
|
||||||
|
|
||||||
|
Applicable Law
|
||||||
|
|
||||||
|
United States . If you acquired the software in the United States , Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
|
||||||
|
Outside the United States . If you acquired the software in any other country, the laws of that country apply.
|
||||||
|
|
||||||
|
Legal Effect
|
||||||
|
|
||||||
|
This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
|
||||||
|
|
||||||
|
Disclaimer of Warranty
|
||||||
|
|
||||||
|
The software is licensed "as-is." You bear the risk of using it. Sysinternals gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, sysinternals excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
||||||
|
|
||||||
|
Limitation on and Exclusion of Remedies and Damages
|
||||||
|
|
||||||
|
You can recover from sysinternals and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.
|
||||||
|
This limitation applies to
|
||||||
|
* anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
|
||||||
|
* claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
|
||||||
|
|
||||||
|
It also applies even if Sysinternals knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
|
||||||
|
Please note: As this software is distributed in Quebec , Canada , some of the clauses in this agreement are provided below in French.
|
||||||
|
Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.
|
||||||
|
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Sysinternals n'accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection dues consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d'adéquation à un usage particulier et d'absence de contrefaçon sont exclues.
|
||||||
|
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Sysinternals et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
|
||||||
|
Cette limitation concerne :
|
||||||
|
tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
|
||||||
|
les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d'une autre faute dans la limite autorisée par la loi en vigueur.
|
||||||
|
Elle s'applique également, même si Sysinternals connaissait ou devrait connaître l'éventualité d'un tel dommage. Si votre pays n'autorise pas l'exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l'exclusion ci-dessus ne s'appliquera pas à votre égard.
|
||||||
|
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d'autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.
|
7
bat/dump-crash/README.txt
Normal file
7
bat/dump-crash/README.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
How to capture Crash/Hang dumps:
|
||||||
|
|
||||||
|
Hang Dumps:
|
||||||
|
Use "Admin Console Hang Dump.bat" and "EFT Service Hang Dump.bat".
|
||||||
|
|
||||||
|
Crash Dump:
|
||||||
|
Merge the WER.reg registry key and make a folder at C:\dumps if you wish to capture crash dumps. You can edit the path of the dumps folder in the WER.reg file or edit directly in the registry after merging it. Make sure it is done for both services.
|
BIN
bat/dump-crash/WER.reg
Normal file
BIN
bat/dump-crash/WER.reg
Normal file
Binary file not shown.
BIN
bat/dump-crash/procdump.exe
Normal file
BIN
bat/dump-crash/procdump.exe
Normal file
Binary file not shown.
3
bat/killprocmon.bat
Normal file
3
bat/killprocmon.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
taskkill /IM "Procmon64.exe" /F
|
||||||
|
exit
|
3
bat/killwireshark.bat
Normal file
3
bat/killwireshark.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
taskkill /IM "Wireshark.exe" /F
|
||||||
|
exit
|
6
bat/procdump.bat
Normal file
6
bat/procdump.bat
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@echo off
|
||||||
|
c:\
|
||||||
|
cd "C:\Users\jbranan\Desktop\Batch to call multiple things\procdump"
|
||||||
|
procdump.exe -n 1 -ma cftpstes.exe "C:\Users\jbranan\Desktop\Batch to call multiple things\dumps" -accepteula
|
||||||
|
timeout /T 15
|
||||||
|
exit
|
4
bat/procmon.bat
Normal file
4
bat/procmon.bat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
c:
|
||||||
|
cd "C:\Users\jbranan\Desktop\Batch to call multiple things\procmon"
|
||||||
|
procmon.exe /accepteula /Nofilter /Quiet /BackingFile "C:\Users\jbranan\Desktop\Batch to call multiple things\dumps\log.PML" /Minimized
|
4
bat/wireshark.bat
Normal file
4
bat/wireshark.bat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
c:
|
||||||
|
cd "C:\Program Files\Wireshark"
|
||||||
|
wireshark -k -i Ethernet0 -f "host 192.168.102.10" -a duration:120 -w "C:\Users\jbranan\Desktop\Batch to call multiple things\dumps\capture.pcapng"
|
22
powershell/AWE_PID.ps1
Normal file
22
powershell/AWE_PID.ps1
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
$AMLHead = '</AMTASKHEAD>
|
||||||
|
|
||||||
|
<AMFUNCTION NAME="Main" ACCESS="private" RETURNTYPE="variable">'
|
||||||
|
|
||||||
|
# Set Variable to replace start of AWE with Start of AWE and Capture PID flow
|
||||||
|
#Change "<AMFILESYSTEM ACTIVITY" Line to a file location on your server
|
||||||
|
|
||||||
|
$AMLtask = '</AMTASKHEAD>
|
||||||
|
|
||||||
|
<AMFUNCTION NAME="Main" ACCESS="private" RETURNTYPE="variable">
|
||||||
|
<AMVARIABLE NAME="ProcessPID" VALUE="" PRIVATE="YES" />
|
||||||
|
<AMSCRIPT>Declare Function GetCurrentProcessId Lib "kernel32" () As Long
|
||||||
|
Sub Main
|
||||||
|
ProcessPID = GetCurrentProcessId()
|
||||||
|
End Sub</AMSCRIPT>
|
||||||
|
<AMFILESYSTEM ACTIVITY="write_file" FILE="C:\Temp\PID%ProcessPID%.log">%Now()%, %GetTaskName()% --- %AWE_TASK_NAME%, PID: %ProcessPID%</AMFILESYSTEM>
|
||||||
|
|
||||||
|
'
|
||||||
|
Get-ChildItem 'C:\Users\jbranan\Desktop\test\*.aml' -Recurse | ForEach {
|
||||||
|
(Get-Content $_ | ForEach { $_ -replace $AMLHead, $AMLtask }) |
|
||||||
|
Set-Content $_
|
||||||
|
}
|
72
powershell/AdminLockTest.ps1
Normal file
72
powershell/AdminLockTest.ps1
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#List of hostnames
|
||||||
|
$hostnames=@("CELES0272016","TERRA0372016");
|
||||||
|
|
||||||
|
#EFT Admin Credentials
|
||||||
|
$EFTAdminUsername = "a";
|
||||||
|
$EFTAdminPassword = "a";
|
||||||
|
$EFTAdminPort = 1100;
|
||||||
|
|
||||||
|
#EFT Com Object
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
||||||
|
#List of hostnames that can be administrated at the same time
|
||||||
|
$output=@();
|
||||||
|
#$output=$hostnames# Debug, uncomment this line and set $lockfailure to "true".
|
||||||
|
#String representing lock failure.
|
||||||
|
$lockfailure=$false;
|
||||||
|
|
||||||
|
#Output <DATE> <TIME> <UTC Offset>
|
||||||
|
Function getdate
|
||||||
|
{
|
||||||
|
Get-Date -Format "MM/dd/yyyy HH:mm:ss K "
|
||||||
|
}
|
||||||
|
$currenttime = getdate
|
||||||
|
|
||||||
|
#Path to log file
|
||||||
|
$Logfile = "\\IV-S2019B-3\config\adminlock.log"
|
||||||
|
|
||||||
|
#Function to accept string input and append to $Logfile
|
||||||
|
Function LogWrite
|
||||||
|
{
|
||||||
|
Param ([string]$logstring)
|
||||||
|
|
||||||
|
Add-content $Logfile -value $logstring
|
||||||
|
}
|
||||||
|
#$EFTnodename = ''
|
||||||
|
#Set-Variable -Name "EFTnodename" ($EFT_CONTEXT.GetVariable("SERVER.NODE_NAME"))
|
||||||
|
#$logstring = $EFTnodename
|
||||||
|
#LogWrite $logstring
|
||||||
|
#Main, Loop through hostnames in $hostname array and attempt connection via com.Successful connections are counted by $flag.
|
||||||
|
#If a COM connection is successful to more than one server in the array, the $lockfailure variable is set to true.
|
||||||
|
$flag=0;
|
||||||
|
$output=''
|
||||||
|
for ($i=0;$i -le $hostnames.count-1; $i++){
|
||||||
|
foreach ($EFTAdminHostname in $hostnames[$i]){
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $EFTAdminPassword)
|
||||||
|
$flag++;
|
||||||
|
$output=$output +' '+ $EFTAdminHostname
|
||||||
|
$script:EftServer.close();
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($flag -gt 1){
|
||||||
|
$lockfailure=$true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($lockfailure -eq $true){
|
||||||
|
$lockstatus = 'AdminsLock unstable.';
|
||||||
|
$lockstatusdetail = " Multiple servers can be accessed:"+' '+$output;
|
||||||
|
$logstring= $currenttime + $lockstatus + $lockstatusdetail+" LockFailure:Yes" +" Flag:"+ $flag #+ " ERNode:" + $EFT_CONTEXT.GetVariable("SERVER.NODE_NAME")
|
||||||
|
Write-Host $currenttime $lockstatus $lockstatusdetail
|
||||||
|
LogWrite $logstring
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$lockstatus = 'AdminsLock stable.'
|
||||||
|
$lockstatusdetail = " Connected to:"+' '+$output;
|
||||||
|
$logstring= $currenttime + $lockstatus +$lockstatusdetail + " LockFailure:No" +" Flag:"+ $flag #+ " ERNode:" + $EFT_CONTEXT.GetVariable("SERVER.NODE_NAME")
|
||||||
|
Write-Host $currenttime $lockstatus + $output
|
||||||
|
LogWrite $logstring
|
||||||
|
}
|
5
powershell/Arcus_domain_checker.ps1
Normal file
5
powershell/Arcus_domain_checker.ps1
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
$clients_to_check = @('ibc001', 'cblone', 'masco1', 'nullf1', 'svbdev', 'svbprd', 'balboa', 'triump', 'mri001')
|
||||||
|
|
||||||
|
foreach($client in $clients_to_check){
|
||||||
|
Start-Process https://$client.arcusapp.globalscape.com
|
||||||
|
}
|
26
powershell/Bank of San Antonio.ps1
Normal file
26
powershell/Bank of San Antonio.ps1
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
$server_ip = "192.168.102.28"
|
||||||
|
$server_port = 1100
|
||||||
|
$admin_username = "insight"
|
||||||
|
$admin_password = "a"
|
||||||
|
$site_name = "GS"
|
||||||
|
|
||||||
|
$server = New-Object -ComObject SFTPCOMInterface.CIServer
|
||||||
|
$server.connect($server_ip,$server_port,$admin_username,$admin_password)
|
||||||
|
|
||||||
|
$site_list = $server.Sites()
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $site_list.Count(); $i++) {
|
||||||
|
$site = $site_list.Item($i)
|
||||||
|
if ($site.Name -eq $site_name) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$date = "11/1/2006"
|
||||||
|
$date = [datetime] $date
|
||||||
|
|
||||||
|
$username = Read-Host "Which user do you want to remove a key from?"
|
||||||
|
|
||||||
|
$settings = $site.GetUserSettings($username)
|
||||||
|
|
||||||
|
$settings.setExpirationDate($date, 0)
|
139
powershell/DummyFileCreatorRelase1.ps1
Normal file
139
powershell/DummyFileCreatorRelase1.ps1
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
# Hide PowerShell Console
|
||||||
|
Add-Type -Name Window -Namespace Console -MemberDefinition '
|
||||||
|
[DllImport("Kernel32.dll")]
|
||||||
|
public static extern IntPtr GetConsoleWindow();
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);
|
||||||
|
'
|
||||||
|
$consolePtr = [Console.Window]::GetConsoleWindow()
|
||||||
|
[Console.Window]::ShowWindow($consolePtr, 0)
|
||||||
|
|
||||||
|
|
||||||
|
Add-Type -AssemblyName System.Windows.Forms
|
||||||
|
[System.Windows.Forms.Application]::EnableVisualStyles()
|
||||||
|
|
||||||
|
$Form = New-Object system.Windows.Forms.Form
|
||||||
|
$Form.ClientSize = '528,70'
|
||||||
|
$Form.text = "Dummy File Creator v1.0"
|
||||||
|
$Form.TopMost = $false
|
||||||
|
$Form.KeyPreview = $True
|
||||||
|
|
||||||
|
$Form.Add_KeyDown({if ($_.KeyCode -eq "Enter")
|
||||||
|
{Create-Dummy}})
|
||||||
|
$Form.Add_KeyDown({if ($_.KeyCode -eq "Escape")
|
||||||
|
{$Form.Close()}})
|
||||||
|
|
||||||
|
$PathBx = New-Object system.Windows.Forms.TextBox
|
||||||
|
$PathBx.multiline = $false
|
||||||
|
$PathBx.width = 172
|
||||||
|
$PathBx.height = 20
|
||||||
|
$PathBx.location = New-Object System.Drawing.Point(9,35)
|
||||||
|
$PathBx.Font = 'Microsoft Sans Serif,10'
|
||||||
|
$PathBx.Text = $Env:userprofile + "\Desktop"
|
||||||
|
|
||||||
|
$CreateBt = New-Object system.Windows.Forms.Button
|
||||||
|
$CreateBt.text = "Create"
|
||||||
|
$CreateBt.width = 60
|
||||||
|
$CreateBt.height = 30
|
||||||
|
$CreateBt.location = New-Object System.Drawing.Point(449,19)
|
||||||
|
$CreateBt.Font = 'Microsoft Sans Serif,10,style=Bold'
|
||||||
|
|
||||||
|
$SizeBx = New-Object system.Windows.Forms.TextBox
|
||||||
|
$SizeBx.multiline = $false
|
||||||
|
$SizeBx.width = 51
|
||||||
|
$SizeBx.height = 20
|
||||||
|
$SizeBx.location = New-Object System.Drawing.Point(321,35)
|
||||||
|
$SizeBx.Font = 'Microsoft Sans Serif,10'
|
||||||
|
$SizeBx.Text = '20'
|
||||||
|
|
||||||
|
$QuantityBx = New-Object system.Windows.Forms.TextBox
|
||||||
|
$QuantityBx.multiline = $false
|
||||||
|
$QuantityBx.width = 36
|
||||||
|
$QuantityBx.height = 20
|
||||||
|
$QuantityBx.location = New-Object System.Drawing.Point(383,35)
|
||||||
|
$QuantityBx.Font = 'Microsoft Sans Serif,10'
|
||||||
|
$QuantityBx.Text = '1'
|
||||||
|
|
||||||
|
$PathLb = New-Object system.Windows.Forms.Label
|
||||||
|
$PathLb.text = "Path to file:"
|
||||||
|
$PathLb.AutoSize = $true
|
||||||
|
$PathLb.width = 25
|
||||||
|
$PathLb.height = 10
|
||||||
|
$PathLb.location = New-Object System.Drawing.Point(9,12)
|
||||||
|
$PathLb.Font = 'Microsoft Sans Serif,10'
|
||||||
|
|
||||||
|
$SizeLb = New-Object system.Windows.Forms.Label
|
||||||
|
$SizeLb.text = "Size MB:"
|
||||||
|
$SizeLb.AutoSize = $true
|
||||||
|
$SizeLb.width = 25
|
||||||
|
$SizeLb.height = 10
|
||||||
|
$SizeLb.location = New-Object System.Drawing.Point(321,12)
|
||||||
|
$SizeLb.Font = 'Microsoft Sans Serif,10'
|
||||||
|
|
||||||
|
$QuantityLb = New-Object system.Windows.Forms.Label
|
||||||
|
$QuantityLb.text = "Quantity:"
|
||||||
|
$QuantityLb.AutoSize = $true
|
||||||
|
$QuantityLb.width = 25
|
||||||
|
$QuantityLb.height = 10
|
||||||
|
$QuantityLb.location = New-Object System.Drawing.Point(383,11)
|
||||||
|
$QuantityLb.Font = 'Microsoft Sans Serif,10'
|
||||||
|
|
||||||
|
$BrowseBt = New-Object system.Windows.Forms.Button
|
||||||
|
$BrowseBt.text = "..."
|
||||||
|
$BrowseBt.width = 27
|
||||||
|
$BrowseBt.height = 24
|
||||||
|
$BrowseBt.location = New-Object System.Drawing.Point(195,35)
|
||||||
|
$BrowseBt.Font = 'Microsoft Sans Serif,10'
|
||||||
|
$BrowseBt.Add_Click({$browse.ShowDialog();$PathBx.Text = $Browse.SelectedPath })
|
||||||
|
|
||||||
|
$FileNameBx = New-Object system.Windows.Forms.TextBox
|
||||||
|
$FileNameBx.multiline = $false
|
||||||
|
$FileNameBx.width = 75
|
||||||
|
$FileNameBx.height = 20
|
||||||
|
$FileNameBx.location = New-Object System.Drawing.Point(233,35)
|
||||||
|
$FileNameBx.Font = 'Microsoft Sans Serif,10'
|
||||||
|
$FileNameBx.Text = "dummy.txt"
|
||||||
|
|
||||||
|
$FileNameLb = New-Object system.Windows.Forms.Label
|
||||||
|
$FileNameLb.text = "FileName:"
|
||||||
|
$FileNameLb.AutoSize = $true
|
||||||
|
$FileNameLb.width = 25
|
||||||
|
$FileNameLb.height = 10
|
||||||
|
$FileNameLb.location = New-Object System.Drawing.Point(233,13)
|
||||||
|
$FileNameLb.Font = 'Microsoft Sans Serif,10'
|
||||||
|
|
||||||
|
$Browse = new-object system.windows.Forms.FolderBrowserDialog
|
||||||
|
$Browse.RootFolder = [System.Environment+SpecialFolder]'MyComputer'
|
||||||
|
$Browse.ShowNewFolderButton = $true
|
||||||
|
$Browse.selectedPath = "C:\"
|
||||||
|
$Browse.Description = "Choose a directory:"
|
||||||
|
|
||||||
|
$Form.controls.AddRange(@($PathBx,$CreateBt,$SizeBx,$QuantityBx,$PathLb,$SizeLb,$QuantityLb,$BrowseBt,$FileNameBx,$FileNameLb))
|
||||||
|
|
||||||
|
$CreateBt.Add_Click({Create-Dummy})
|
||||||
|
|
||||||
|
Function Create-Dummy {
|
||||||
|
|
||||||
|
$exten = $null
|
||||||
|
|
||||||
|
If ($FileNameBx.Text.Contains('.'))
|
||||||
|
{
|
||||||
|
$exten = '.' + $FileNameBx.Text.Split('.')[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
fsutil file createnew ($PathBx.Text + '\' + $FileNameBx.Text) (($SizeBx.Text -as [INT]) * 1048576)
|
||||||
|
|
||||||
|
For($j = ($QuantityBx.Text -as [INT]); $j -gt 1; $j--)
|
||||||
|
{
|
||||||
|
|
||||||
|
fsutil file createnew ($PathBx.Text + '\' + $FileNameBx.Text.Split('.')[0] + $j + $exten) (($SizeBx.Text -as [INT]) * 1048576)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#Show form
|
||||||
|
$Form.Topmost = $True
|
||||||
|
$Form.Add_Shown({$Form.Activate()})
|
||||||
|
[void] $Form.ShowDialog()
|
49
powershell/EFTPowerToolsPS/EFTPowerToolsPS/.vscode/launch.json
vendored
Normal file
49
powershell/EFTPowerToolsPS/EFTPowerToolsPS/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "PowerShell",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PowerShell Launch Current File",
|
||||||
|
"script": "${file}",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${file}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PowerShell",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PowerShell Launch Current File in Temporary Console",
|
||||||
|
"script": "${file}",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${file}",
|
||||||
|
"createTemporaryIntegratedConsole": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PowerShell",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PowerShell Launch Current File w/Args Prompt",
|
||||||
|
"script": "${file}",
|
||||||
|
"args": [
|
||||||
|
"${command:SpecifyScriptArgs}"
|
||||||
|
],
|
||||||
|
"cwd": "${file}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PowerShell",
|
||||||
|
"request": "attach",
|
||||||
|
"name": "PowerShell Attach to Host Process",
|
||||||
|
"processId": "${command:PickPSHostProcess}",
|
||||||
|
"runspaceId": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PowerShell",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PowerShell Interactive Session",
|
||||||
|
"cwd": "${workspaceRoot}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
290
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.AdvanceStats.ps1
Normal file
290
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.AdvanceStats.ps1
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Folder Monitor Paths")]
|
||||||
|
[switch] $ValidatePath
|
||||||
|
)
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.type)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
$FM_Path = ""
|
||||||
|
$FM_CheckHealthInterval = ""
|
||||||
|
$FM_CheckHealth = ""
|
||||||
|
$FM_IncludeSubfolders = ""
|
||||||
|
$FM_UseAlternateCredentials = ""
|
||||||
|
$FM_UserName = ""
|
||||||
|
$FM_Password = ""
|
||||||
|
$FM_UseFileSystemNotifications = ""
|
||||||
|
$FM_UsePeriodicDirectoryPoll = ""
|
||||||
|
$FM_PollIntervalSeconds = ""
|
||||||
|
$FM_ArchiveSubFolderName = ""
|
||||||
|
$FM_UseInteractiveLogon = ""
|
||||||
|
$FM_ArchiveLeftovers = ""
|
||||||
|
$FM_AddTimestampToArchivedFileNames = ""
|
||||||
|
$FM_PollIntervalType = ""
|
||||||
|
$FM_PollInterval = ""
|
||||||
|
|
||||||
|
$HA_SchedulingParams = ""
|
||||||
|
$HA_SchedulingBackupParams = ""
|
||||||
|
|
||||||
|
$SCH_DailyEveryWeekDay = ""
|
||||||
|
$SCH_DailyDayPeriod = ""
|
||||||
|
$SCH_WeeklyWeekPeriod = ""
|
||||||
|
$SCH_WeeklySunday = ""
|
||||||
|
$SCH_WeeklyMonday = ""
|
||||||
|
$SCH_WeeklyTuesday = ""
|
||||||
|
$SCH_WeeklyWednesday = ""
|
||||||
|
$SCH_WeeklyThursday = ""
|
||||||
|
$SCH_WeeklyFriday = ""
|
||||||
|
$SCH_WeeklySaturday = ""
|
||||||
|
$SCH_MonthlyFixedDay = ""
|
||||||
|
$SCH_MonthlyDayPeriod = ""
|
||||||
|
$SCH_MonthlyMonthPeriod = ""
|
||||||
|
$SCH_MonthlyRelativeWeekday = ""
|
||||||
|
$SCH_MonthlyWeekday = ""
|
||||||
|
$SCH_YearlyFixedDay = ""
|
||||||
|
$SCH_YearlyMonth = ""
|
||||||
|
$SCH_YearlyDayPeriod = ""
|
||||||
|
$SCH_YearlyRelativeWeekday = ""
|
||||||
|
$SCH_YearlyWeekday = ""
|
||||||
|
$SCH_RepeatPattern = ""
|
||||||
|
$SCH_RepeatRate = ""
|
||||||
|
$SCH_RepeatEnabled = ""
|
||||||
|
$SCH_DateTimeEnd = ""
|
||||||
|
$SCH_TimeEndEnabled = ""
|
||||||
|
$SCH_DateEndEnabled = ""
|
||||||
|
$SCH_RundayCalendar = ""
|
||||||
|
$SCH_HolidayCalendar = ""
|
||||||
|
$SCH_NextRun = ""
|
||||||
|
$SCH_Recurrence = ""
|
||||||
|
$SCH_DateTimeStart = ""
|
||||||
|
$Validpath = ""
|
||||||
|
if ($eventType.Name -eq "Folder Monitor") {
|
||||||
|
|
||||||
|
$FM_Path = $objParams.Path
|
||||||
|
if ($ValidatePath) {
|
||||||
|
try {
|
||||||
|
if (Test-Path $FM_Path) {
|
||||||
|
$Validpath = "OK"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$Validpath = "FOLDER_NOT_FOUND"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$Validpath = "ERROR: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {$FM_CheckHealthInterval = $objParams.CheckHealthInterval} catch {}
|
||||||
|
try {$FM_CheckHealth = $objParams.CheckHealth} catch {}
|
||||||
|
try {$FM_IncludeSubfolders = $objParams.IncludeSubfolders} catch {}
|
||||||
|
try {$FM_UseAlternateCredentials = $objParams.UseAlternateCredentials} catch {}
|
||||||
|
try {$FM_UserName = $objParams.UserName} catch {}
|
||||||
|
try {$FM_Password = $objParams.Password} catch {}
|
||||||
|
try {$FM_UseFileSystemNotifications = $objParams.UseFileSystemNotifications} catch {}
|
||||||
|
try {$FM_UsePeriodicDirectoryPoll = $objParams.UsePeriodicDirectoryPoll} catch {}
|
||||||
|
try {$FM_PollIntervalSeconds = $objParams.PollIntervalSeconds } catch {}
|
||||||
|
try {$FM_ArchiveSubFolderName = $objParams.ArchiveSubFolderName } catch {}
|
||||||
|
try {$FM_UseInteractiveLogon = $objParams.UseInteractiveLogon } catch {}
|
||||||
|
try {$FM_ArchiveLeftovers = $objParams.ArchiveLeftovers} catch {}
|
||||||
|
try {$FM_AddTimestampToArchivedFileNames = $objParams.AddTimestampToArchivedFileNames} catch {}
|
||||||
|
try {$FM_PollIntervalType = $objParams.PollIntervalType } catch {}
|
||||||
|
try {$FM_PollInterval = $objParams.PollInterval } catch {}
|
||||||
|
}
|
||||||
|
if ($eventType.Name -eq "Scheduler (Timer) Event") {
|
||||||
|
try {$SCH_DailyEveryWeekDay = $objParams.DailyEveryWeekDay} catch {}
|
||||||
|
try {$SCH_DailyDayPeriod = $objParams.DailyDayPeriod} catch {}
|
||||||
|
try {$SCH_WeeklyWeekPeriod = $objParams.WeeklyWeekPeriod} catch {}
|
||||||
|
try {$SCH_WeeklySunday = $objParams.WeeklySunday} catch {}
|
||||||
|
try {$SCH_WeeklyMonday = $objParams.WeeklyMonday} catch {}
|
||||||
|
try {$SCH_WeeklyTuesday = $objParams.WeeklyTuesday} catch {}
|
||||||
|
try {$SCH_WeeklyWednesday = $objParams.WeeklyWednesday} catch {}
|
||||||
|
try {$SCH_WeeklyThursday = $objParams.WeeklyThursday} catch {}
|
||||||
|
try {$SCH_WeeklyFriday = $objParams.WeeklyFriday } catch {}
|
||||||
|
try {$SCH_WeeklySaturday = $objParams.WeeklySaturday } catch {}
|
||||||
|
try {$SCH_MonthlyFixedDay = $objParams.MonthlyFixedDay } catch {}
|
||||||
|
try {$SCH_MonthlyDayPeriod = $objParams.MonthlyDayPeriod} catch {}
|
||||||
|
try {$SCH_MonthlyMonthPeriod = $objParams.MonthlyMonthPeriod} catch {}
|
||||||
|
try {$SCH_MonthlyRelativeWeekday = $objParams.MonthlyRelativeWeekday } catch {}
|
||||||
|
try {$SCH_MonthlyWeekday = $objParams.MonthlyWeekday } catch {}
|
||||||
|
try {$SCH_YearlyFixedDay = $objParams.YearlyFixedDay } catch {}
|
||||||
|
try {$SCH_YearlyMonth = $objParams.YearlyMonth } catch {}
|
||||||
|
try {$SCH_YearlyDayPeriod = $objParams.YearlyDayPeriod } catch {}
|
||||||
|
try {$SCH_YearlyRelativeWeekday = $objParams.YearlyRelativeWeekday } catch {}
|
||||||
|
try {$SCH_YearlyWeekday = $objParams.YearlyWeekday } catch {}
|
||||||
|
try {$SCH_RepeatPattern = $objParams.RepeatPattern } catch {}
|
||||||
|
try {$SCH_RepeatRate = $objParams.RepeatRate } catch {}
|
||||||
|
try {$SCH_RepeatEnabled = $objParams.RepeatEnabled } catch {}
|
||||||
|
try {$SCH_DateTimeEnd = $objParams.DateTimeEnd } catch {}
|
||||||
|
try {$SCH_TimeEndEnabled = $objParams.TimeEndEnabled } catch {}
|
||||||
|
try {$SCH_DateEndEnabled = $objParams.DateEndEnabled } catch {}
|
||||||
|
try {$SCH_RundayCalendar = $objParams.RundayCalendar } catch {}
|
||||||
|
try {$SCH_HolidayCalendar = $objParams.HolidayCalendar } catch {}
|
||||||
|
try {$SCH_NextRun = $objParams.NextRun } catch {}
|
||||||
|
try {$SCH_Recurrence = $objParams.Recurrence } catch {}
|
||||||
|
try {$SCH_DateTimeStart = $objParams.DateTimeStart } catch {}
|
||||||
|
}
|
||||||
|
if($script:EftServer.HAEnabled){
|
||||||
|
$EFTHAParams = $objEvent.GetHASchedulingParams()
|
||||||
|
$EFTHABackupParams = $objEvent.GetHABackupSchedulingParams()
|
||||||
|
for ($i=0;$i -lt $EFTHAParams.Count();$i++){
|
||||||
|
$HA_SchedulingParams += "$($EFTHAParams.Item($i)),"
|
||||||
|
}
|
||||||
|
for ($i=0;$i -lt $EFTHABackupParams.Count();$i++){
|
||||||
|
$HA_SchedulingBackupParams += "$($EFTHABackupParams.Item($i)),"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName;
|
||||||
|
EventRuleName = $objParams.name;
|
||||||
|
Trigger = $eventType.Name;
|
||||||
|
Enabled = $objParams.Enabled;
|
||||||
|
Validpath = $Validpath
|
||||||
|
|
||||||
|
FM_Path = $FM_Path;
|
||||||
|
FM_CheckHealthInterval = $FM_CheckHealthInterval;
|
||||||
|
FM_CheckHealth = $FM_CheckHealth;
|
||||||
|
FM_IncludeSubfolders = $FM_IncludeSubfolders;
|
||||||
|
FM_UseAlternateCredentials = $FM_UseAlternateCredentials;
|
||||||
|
FM_UserName = $FM_UserName;
|
||||||
|
FM_Password = $FM_Password;
|
||||||
|
FM_UseFileSystemNotifications = $FM_UseFileSystemNotifications;
|
||||||
|
FM_UsePeriodicDirectoryPoll = $FM_UsePeriodicDirectoryPoll;
|
||||||
|
FM_PollIntervalSeconds = $FM_PollIntervalSeconds;
|
||||||
|
FM_ArchiveSubFolderName = $FM_ArchiveSubFolderName;
|
||||||
|
FM_UseInteractiveLogon = $FM_UseInteractiveLogon;
|
||||||
|
FM_ArchiveLeftovers = $FM_ArchiveLeftovers;
|
||||||
|
FM_AddTimestampToArchivedFileNames = $FM_AddTimestampToArchivedFileNames;
|
||||||
|
FM_PollIntervalType = $FM_PollIntervalType;
|
||||||
|
FM_PollInterval = $FM_PollInterval;
|
||||||
|
|
||||||
|
SCH_DailyEveryWeekDay = $SCH_DailyEveryWeekDay
|
||||||
|
SCH_DailyDayPeriod = $SCH_DailyDayPeriod
|
||||||
|
SCH_WeeklyWeekPeriod = $SCH_WeeklyWeekPeriod
|
||||||
|
SCH_WeeklySunday = $SCH_WeeklySunday
|
||||||
|
SCH_WeeklyMonday = $SCH_WeeklyMonday
|
||||||
|
SCH_WeeklyTuesday = $SCH_WeeklyTuesday
|
||||||
|
SCH_WeeklyWednesday = $SCH_WeeklyWednesday
|
||||||
|
SCH_WeeklyThursday = $SCH_WeeklyThursday
|
||||||
|
SCH_WeeklyFriday = $SCH_WeeklyFriday
|
||||||
|
SCH_WeeklySaturday = $SCH_WeeklySaturday
|
||||||
|
SCH_MonthlyFixedDay = $SCH_MonthlyFixedDay
|
||||||
|
SCH_MonthlyDayPeriod = $SCH_MonthlyDayPeriod
|
||||||
|
SCH_MonthlyMonthPeriod = $SCH_MonthlyMonthPeriod
|
||||||
|
SCH_MonthlyRelativeWeekday = $SCH_MonthlyRelativeWeekday
|
||||||
|
SCH_MonthlyWeekday = $SCH_MonthlyWeekday
|
||||||
|
SCH_YearlyFixedDay = $SCH_YearlyFixedDay
|
||||||
|
SCH_YearlyMonth = $SCH_YearlyMonth
|
||||||
|
SCH_YearlyDayPeriod = $SCH_YearlyDayPeriod
|
||||||
|
SCH_YearlyRelativeWeekday = $SCH_YearlyRelativeWeekday
|
||||||
|
SCH_YearlyWeekday = $SCH_YearlyWeekday
|
||||||
|
SCH_RepeatPattern = $SCH_RepeatPattern
|
||||||
|
SCH_RepeatRate = $SCH_RepeatRate
|
||||||
|
SCH_RepeatEnabled = $SCH_RepeatEnabled
|
||||||
|
SCH_DateTimeEnd = $SCH_DateTimeEnd
|
||||||
|
SCH_TimeEndEnabled = $SCH_TimeEndEnabled
|
||||||
|
SCH_DateEndEnabled = $SCH_DateEndEnabled
|
||||||
|
SCH_RundayCalendar = $SCH_RundayCalendar
|
||||||
|
SCH_HolidayCalendar = $SCH_HolidayCalendar
|
||||||
|
SCH_NextRun = $SCH_NextRun
|
||||||
|
SCH_Recurrence = $SCH_Recurrence
|
||||||
|
SCH_DateTimeStart = $SCH_DateTimeStart
|
||||||
|
|
||||||
|
HA_SchedulingParams = $HA_SchedulingParams;
|
||||||
|
HA_SchedulingBackupParams = $HA_SchedulingBackupParams;
|
||||||
|
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, SCH_NextRun, Validpath, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
535
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Build.ps1
Normal file
535
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Build.ps1
Normal file
@ -0,0 +1,535 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
###
|
||||||
|
# cd C:\Users\rguzman\Desktop\src\src
|
||||||
|
# . .\deploy.ps1 -EFTHostname localhost -EFTSiteName Rogers -EFTAdmin admin -password Super2017!!
|
||||||
|
# TEST TEST TEST111
|
||||||
|
###
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $False, HelpMessage = "Enter the output folder where files will be created")]
|
||||||
|
[String] $BuildFolder = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
Function RemoveInvalidChars($path) {
|
||||||
|
$path -replace ("[{0}]" -f (([System.IO.Path]::GetInvalidFileNameChars()| ForEach-Object {[regex]::Escape($_)}) -join '|')), '_'
|
||||||
|
#return $path
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "******* EFT Build SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host " > This script will perform read-only operations your EFT configuration " -ForegroundColor Yellow
|
||||||
|
Write-host " > It is recommend you test this script in a non-production environment before " -ForegroundColor Yellow
|
||||||
|
Write-host " using in production to validate its functionality" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
if ($BuildFolder -eq "") {
|
||||||
|
$transactionId = [guid]::NewGuid() -Replace "-", ""
|
||||||
|
$transactionId = $transactionId.Substring(0, 8)
|
||||||
|
$OutputFolder = "build-$transactionId"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$OutputFolder = $BuildFolder
|
||||||
|
}
|
||||||
|
#Output parameters
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red}
|
||||||
|
Write-host "BuildName : $OutputFolder"
|
||||||
|
Write-host "EFT Admin Hostname : $EFTAdminHostname"
|
||||||
|
Write-host "EFT Admin Port : $EFTAdminPort"
|
||||||
|
Write-host "EFT Site Name : $EFTSiteName"
|
||||||
|
Write-host "EFT Admin Auth Type : $EFTAdminAuthType"
|
||||||
|
Write-host "EFT Admin Username : $EFTAdminUsername"
|
||||||
|
#$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Constants
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
$EFTServer = $null
|
||||||
|
$EFTSites = $null
|
||||||
|
$EFTSite = $null
|
||||||
|
|
||||||
|
$MXE_AW_INVALID_TASK_NAME = "MX Error: 71 (00000047)"
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST = "MX Error: 106 (0000006A)"
|
||||||
|
$MXE_CANNOT_EXPORT_EVENT_RULE = "MX Error: 120 (00000078)"
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
if ($OutputFolder -notmatch '.+?\\$') {
|
||||||
|
$OutputFolder += '\'
|
||||||
|
}
|
||||||
|
|
||||||
|
If ( (Test-Path $OutputFolder) -eq $false) {
|
||||||
|
Write-Verbose "Creating $OutputFolder"
|
||||||
|
new-item $OutputFolder -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$OutputFolder = Convert-Path $OutputFolder
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteGuid = $null
|
||||||
|
$siteName = $script:EftSite.Name
|
||||||
|
try {
|
||||||
|
$SiteGuid = $script:EftSite.GUID
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Verbose "Can't get GUID for Site $siteName"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host " "
|
||||||
|
Write-host " $siteName [$SiteGuid]".PadRight(65, "*").Padleft(100, "*")
|
||||||
|
|
||||||
|
$commandBasePath = "$OutputFolder$($siteName)\commands\"
|
||||||
|
If ( (Test-Path $commandBasePath) -eq $false) {
|
||||||
|
Write-Verbose "Creating $commandBasePath"
|
||||||
|
new-item $commandBasePath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
Write-host "[Custom Commands]"
|
||||||
|
write-host " Path: $commandBasePath "
|
||||||
|
|
||||||
|
$exportCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
$customcommandslist = $eftsite.GetCommands()
|
||||||
|
|
||||||
|
If ($customcommandslist) {
|
||||||
|
foreach ($customCommand in $customcommandslist) {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
$customCommandSettings = $eftsite.GetCommandSettings($customCommand)
|
||||||
|
$exportedfilename = RemoveInvalidChars $customCommandSettings.Name
|
||||||
|
$exportedfilename = $exportedfilename + ".xml"
|
||||||
|
|
||||||
|
Write-host "Exporting: $customCommand".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
Export-Clixml -path "$commandBasePath\$exportedfilename" -inputObject $customCommandSettings -depth 4 -Encoding UTF8
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$exportCount++
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Magenta
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host " Exported: " -NoNewline
|
||||||
|
Write-host "$exportCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
$commandBasePath = "$OutputFolder$($siteName)\commands_userpermissions\"
|
||||||
|
If ( (Test-Path $commandBasePath) -eq $false) {
|
||||||
|
Write-Verbose "Creating $commandBasePath"
|
||||||
|
new-item $commandBasePath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
Write-host "[Custom Commands Users Permissions]"
|
||||||
|
write-host " Path: $commandBasePath "
|
||||||
|
|
||||||
|
$exportCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
$customcommandslist = $eftsite.GetCommands()
|
||||||
|
|
||||||
|
If ($customcommandslist) {
|
||||||
|
foreach ($customCommand in $customcommandslist) {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
$customCommandSettings = $eftsite.GetCommandSettings($customCommand)
|
||||||
|
$exportedfilename = RemoveInvalidChars $customCommandSettings.Name
|
||||||
|
$exportedfilename = $exportedfilename + ".xml"
|
||||||
|
|
||||||
|
$userPermissions = $customCommandSettings.GetUserPermissions()
|
||||||
|
Write-host "Exporting: $customCommand".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
Export-Clixml -path "$commandBasePath\$exportedfilename" -inputObject $userPermissions -depth 4 -Encoding UTF8
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$exportCount++
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Magenta
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host " Exported: " -NoNewline
|
||||||
|
Write-host "$exportCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
$AMLbasePath = "$OutputFolder$($siteName)\workflows\"
|
||||||
|
If ( (Test-Path $AMLbasePath) -eq $false) {
|
||||||
|
Write-Verbose "Creating $AMLbasePath"
|
||||||
|
new-item $AMLbasePath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
$taskCount = $EFTSite.AdvancedWorkflowsCount
|
||||||
|
Write-host "[Advanced Workflows]"
|
||||||
|
Write-host " Path: $AMLbasePath"
|
||||||
|
|
||||||
|
$exportCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
If ($taskcount -gt 0) {
|
||||||
|
For ($iTask = 0; $iTask -lt $taskCount; $iTask++) {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
$objTask = $eftsite.GetAdvancedWorkflowParams($itask)
|
||||||
|
$task = $objTask.Name
|
||||||
|
$SafeTaskName = RemoveInvalidChars $task
|
||||||
|
$exportedfilename = "$SafeTaskName.xml"
|
||||||
|
|
||||||
|
Write-host "Exporting: $task ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
Export-Clixml -path "$AMLbasePath\$exportedfilename" -inputObject $objTask -depth 4 -Encoding UTF8
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$exportCount++
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Magenta
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_AW_INVALID_TASK_NAME { Write-host "MXE_AW_INVALID_TASK_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST { Write-host "MXE_EVENT_AW_TASK_DOES_NOT_EXIST : $_ " -ForegroundColor Red }
|
||||||
|
Default {Write-Host "COM Exception : $error[0]" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
# Write-Host "current Task: " $objTask.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host " Exported: " -NoNewline
|
||||||
|
Write-host "$exportCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
$basePath = Join-Path "$OutputFolder" "$($siteName)\as2_profiles\"
|
||||||
|
If ( (Test-Path $basePath) -eq $false) {
|
||||||
|
Write-Verbose "Creating $basePath"
|
||||||
|
new-item $basePath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalUsers = -1
|
||||||
|
$users = $script:EftSite.GetUsers()
|
||||||
|
$totalUsers = $users.length
|
||||||
|
|
||||||
|
if ($totalUsers -gt -1 ) {
|
||||||
|
Write-host "[AS2 Profiles] "
|
||||||
|
Write-host " Path: $basePath"
|
||||||
|
}
|
||||||
|
$exportCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $users.length; $i++ ) {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
$username = $users[$i]
|
||||||
|
$detail = $script:EftSite.GetUserSettings($users[$i])
|
||||||
|
|
||||||
|
$AS2InboundProfile = $detail.AS2InboundSettings
|
||||||
|
$AS2OutboundProfile = $detail.AS2OutboundSettings
|
||||||
|
|
||||||
|
if ($null -eq $AS2InboundProfile -and $null -eq $AS2OutboundProfile) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
Write-host "Exporting: $username ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
# Create username folder
|
||||||
|
$userPath = Join-Path "$basePath" "$username"
|
||||||
|
If ( (Test-Path $userPath) -eq $false) {
|
||||||
|
new-item $userPath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -ne $AS2InboundProfile) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Inbound.xml" -inputObject $AS2InboundProfile -depth 4 -Encoding UTF8
|
||||||
|
|
||||||
|
$successEmail = $AS2InboundProfile.GetSuccessEmail()
|
||||||
|
if ($null -ne $successEmail) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Inbound_SuccessEmail.xml" -inputObject $successEmail -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
|
||||||
|
$FailureEmail = $AS2InboundProfile.GetFailureEmail()
|
||||||
|
if ($null -ne $FailureEmail) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Inbound_FailureEmail.xml" -inputObject $FailureEmail -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
|
||||||
|
$SuccessCommand = $AS2InboundProfile.GetSuccessCommand()
|
||||||
|
if ($null -ne $SuccessCommand) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Inbound_SuccessCommand.xml" -inputObject $SuccessCommand -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
$FailureCommand = $AS2InboundProfile.GetFailureCommand()
|
||||||
|
if ($null -ne $FailureCommand) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Inbound_FailureCommand.xml" -inputObject $FailureCommand -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -ne $AS2OutboundProfile) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Outbound.xml" -inputObject $AS2OutboundProfile -depth 4 -Encoding UTF8
|
||||||
|
|
||||||
|
$successEmail = $AS2OutboundProfile.GetSuccessEmail()
|
||||||
|
if ($null -ne $successEmail) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Outbound_SuccessEmail.xml" -inputObject $successEmail -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
|
||||||
|
$FailureEmail = $AS2OutboundProfile.GetFailureEmail()
|
||||||
|
if ($null -ne $FailureEmail) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Outbound_FailureEmail.xml" -inputObject $FailureEmail -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
|
||||||
|
$SuccessCommand = $AS2OutboundProfile.GetSuccessCommand()
|
||||||
|
if ($null -ne $SuccessCommand) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Outbound_SuccessCommand.xml" -inputObject $SuccessCommand -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
|
||||||
|
$FailureCommand = $AS2OutboundProfile.GetFailureCommand()
|
||||||
|
if ($null -ne $FailureCommand) {
|
||||||
|
Export-Clixml -path "$userPath\AS2Outbound_FailureCommand.xml" -inputObject $FailureCommand -depth 4 -Encoding UTF8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$exportCount++
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Magenta
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$basePath = Join-Path "$OutputFolder" "$($siteName)\connection_profiles\"
|
||||||
|
If ( (Test-Path $basePath) -eq $false) {
|
||||||
|
Write-Verbose "Creating $basePath"
|
||||||
|
new-item $basePath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalProfiles = -1
|
||||||
|
try {
|
||||||
|
$totalProfiles = $script:eftsite.GetConnectionProfilesCount()
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$totalProfiles = -1
|
||||||
|
}
|
||||||
|
if ($totalProfiles -ne -1) {
|
||||||
|
Write-host "[Connection Profiles] "
|
||||||
|
Write-host " Path: $basePath"
|
||||||
|
}
|
||||||
|
$exportCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
|
||||||
|
For ($iprofile = 0; $iprofile -lt $totalProfiles; $iprofile++) {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
$objTask = $script:eftsite.GetConnectionProfileParams($iprofile)
|
||||||
|
$task = $objTask.Name
|
||||||
|
$SafeTaskName = RemoveInvalidChars $task
|
||||||
|
$exportedfilename = "$SafeTaskName.xml"
|
||||||
|
Write-host "Exporting: $task ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
Export-Clixml -path "$basePath\$exportedfilename" -inputObject $objTask -depth 4 -Encoding UTF8
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$exportCount++
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Magenta
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($totalProfiles -ne -1) {
|
||||||
|
Write-host " Exported: " -NoNewline
|
||||||
|
Write-host "$exportCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
}
|
||||||
|
|
||||||
|
$eventRulesbasePath = Join-Path "$OutputFolder" "$($siteName)\event_rules\"
|
||||||
|
If ( (Test-Path $eventRulesbasePath) -eq $false) {
|
||||||
|
Write-Verbose "Creating $eventRulesbasePath"
|
||||||
|
new-item $eventRulesbasePath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
|
||||||
|
Write-host "[Event Rules] "
|
||||||
|
Write-host " Path: $eventRulesbasePath"
|
||||||
|
|
||||||
|
$exportCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
|
||||||
|
|
||||||
|
$EventFolders = $null
|
||||||
|
$EFTUsingFolders = $false
|
||||||
|
try {
|
||||||
|
$EventFolders = $EFTsite.EventRuleFolders()
|
||||||
|
$EFTUsingFolders = $true
|
||||||
|
# Creating event rules folders as file directories
|
||||||
|
for ($i = 0 ; $i -le $EventFolders.Count() - 1 ; $i++) {
|
||||||
|
$eventFolder = $EventFolders.Item($i)
|
||||||
|
$eventFolderPath = Join-Path $eventRulesbasePath $eventFolder.Name
|
||||||
|
If ( (Test-Path $eventFolderPath) -eq $false) {
|
||||||
|
new-item $eventFolderPath -ItemType directory | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-verbose "Event Rule folders feature not found via COM"
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($erules -and $eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
#$exported = $false
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
|
||||||
|
$rulename = $objParams.name
|
||||||
|
$exportedfilename = RemoveInvalidChars $objParams.name
|
||||||
|
$exportedfilename = $exportedfilename + ".xml"
|
||||||
|
$eventRulesPath = $eventRulesbasePath
|
||||||
|
Write-host "Exporting: $rulename ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
# Write-Verbose "$eventRulesbasePath$exportedfilename"
|
||||||
|
|
||||||
|
if ($EFTUsingFolders) {
|
||||||
|
for ($i = 0 ; $i -le $EventFolders.Count() - 1 ; $i++) {
|
||||||
|
$EventFolder = $EventFolders.Item($i)
|
||||||
|
if ($EventFolder.Find($rulename)) {
|
||||||
|
$eventRulesPath = Join-Path $eventRulesPath $EventFolder.Name
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$eventRulesPath = Join-Path $eventRulesPath $exportedfilename
|
||||||
|
Write-Verbose "$eventRulesPath"
|
||||||
|
$objEvent.Export("$eventRulesPath")
|
||||||
|
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$exportCount++
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Magenta
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_CANNOT_EXPORT_EVENT_RULE { Write-host "MXE_CANNOT_EXPORT_EVENT_RULE : $_ " -ForegroundColor Red }
|
||||||
|
Default {Write-Host "COM Exception : $error[0]" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Write-host " Exported: " -NoNewline
|
||||||
|
Write-host "$exportCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$EFTSite = $null
|
||||||
|
$EFTSites = $null
|
||||||
|
$EFTServer.Close()
|
||||||
|
$EFTServer = $null
|
||||||
|
|
||||||
|
# Dev machine
|
||||||
|
# git clone
|
||||||
|
# EFT.export -> File System XML
|
||||||
|
# Edit files (Change, Edit, etc)
|
||||||
|
# Update parameters
|
||||||
|
# git -m "Commit"
|
||||||
|
# git push/Sync
|
||||||
|
|
||||||
|
|
||||||
|
# Prod machine
|
||||||
|
# git clone
|
||||||
|
#EFT.Deploy -clean -force -ParametersCsv ProductionParams.csv
|
32
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.CLI.md
Normal file
32
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.CLI.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
Use Powershell (x86) console
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Loading the CLI script
|
||||||
|
|
||||||
|
``` powershell
|
||||||
|
. .\EFT.CLI.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Example on how to remove event rules with an exact name
|
||||||
|
``` powershell
|
||||||
|
Connect-EFT
|
||||||
|
Set-Site MySite
|
||||||
|
Get-EventRules | where {$_.Name -eq 'On File Downloaded Rule imported 1'} | ForEach-Object { Remove-eventrule -Name $_.Name }
|
||||||
|
```
|
||||||
|
|
||||||
|
Example on how to remove event rules that event rule name has 'imported' on the name
|
||||||
|
|
||||||
|
``` powershell
|
||||||
|
Connect-EFT
|
||||||
|
Set-Site MySite
|
||||||
|
Get-EventRules | where {$_.Name -like '*imported*'} | ForEach-Object { Remove-eventrule -Name $_.Name }
|
||||||
|
```
|
||||||
|
|
||||||
|
Example shows how to remove advanced Worflows with the 'asd' in the workflow name
|
||||||
|
``` powershell
|
||||||
|
Connect-EFT
|
||||||
|
Set-Site MySite
|
||||||
|
Get-AdvancedWorkflows | where {$_.Name -like '*asd*'} | ForEach-Object { Remove-AdvancedWorkflow -Name $_.Name }
|
||||||
|
```
|
674
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.CLI.ps1
Normal file
674
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.CLI.ps1
Normal file
@ -0,0 +1,674 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param()
|
||||||
|
$global:Server = $null
|
||||||
|
$global:sites = $null
|
||||||
|
$global:site = $null
|
||||||
|
$global:user = $null
|
||||||
|
$global:event = $null
|
||||||
|
$global:version = 2.0
|
||||||
|
function Get-EFT-CLI-Version() {
|
||||||
|
Write-Host $global:version
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## Server
|
||||||
|
#####################################################################
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Connects to an EFT Server
|
||||||
|
.EXAMPLE
|
||||||
|
Connect-EFT localhost 1100 admin admin
|
||||||
|
This commands will connect to an EFT server listening in localhost using port 1100 and using
|
||||||
|
admin/admin as username/password.
|
||||||
|
#>
|
||||||
|
function Connect-EFT(
|
||||||
|
[Parameter(Position = 0, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $Hostname = "localhost",
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] $Port = 1100,
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] $AuthType = 1,
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $Login,
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
) {
|
||||||
|
Write-Verbose "hostname :$hostname"
|
||||||
|
Write-Verbose "port :$port"
|
||||||
|
Write-Verbose "Login :$login"
|
||||||
|
Write-Verbose "len(Password) :$password.length"
|
||||||
|
Write-Verbose "SiteName :$siteName"
|
||||||
|
$global:Server = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
try {
|
||||||
|
$global:Server.ConnectEx($hostname, $port, $AuthType, $login, $password)
|
||||||
|
$global:sites = $global:server.Sites()
|
||||||
|
Write-Host "You are now connected !!" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Exception : $error[0]" -ForegroundColor Red
|
||||||
|
Write-Host "You are NOT connected !!" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Disconnect-EFT() {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Disconnect the connection to EFT Server
|
||||||
|
.EXAMPLE
|
||||||
|
Disconnect-EFT
|
||||||
|
This commands will disconnect from an EFT server.
|
||||||
|
#>
|
||||||
|
if ($null -ne $global:site) {
|
||||||
|
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($global:site)
|
||||||
|
$global:site = $null
|
||||||
|
}
|
||||||
|
if ($null -ne $global:sites) {
|
||||||
|
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($global:sites)
|
||||||
|
$global:sites = $null
|
||||||
|
}
|
||||||
|
if ($null -ne $global:Server) {
|
||||||
|
$global:Server.Close()
|
||||||
|
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($global:Server)
|
||||||
|
$global:sites = $null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-EFT-ConnectionStatus() {
|
||||||
|
if ($null -eq $global:Server) {
|
||||||
|
Write-Host "Disconnected" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Connected" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#####################################################################
|
||||||
|
## Sites
|
||||||
|
#####################################################################
|
||||||
|
function Get-Sites() {
|
||||||
|
if ($null -eq $global:Server) {
|
||||||
|
Write-Host "You need to connect to EFT Server first" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$results = @()
|
||||||
|
for ($i = 0; $i -le $global:sites.Count() - 1; $i++ ) {
|
||||||
|
$site = $global:sites.Item($i)
|
||||||
|
$row = New-Object PSObject
|
||||||
|
$row | Add-Member -type NoteProperty -name SiteName -Value $site.Name
|
||||||
|
$row | Add-Member -type NoteProperty -name IsRunning -Value $site.IsStarted
|
||||||
|
$row | Add-Member -type NoteProperty -name "Active Sessions" -Value $site.GetConnectedCount()
|
||||||
|
$row | Add-Member -type NoteProperty -name UsersDefined -Value $site.UsersDefined
|
||||||
|
$row | Add-Member -type NoteProperty -name "WTC Sessions Active" -Value $site.WTCSessionsActive
|
||||||
|
$row | Add-Member -type NoteProperty -name "WTC Sessions Remaining" -Value $site.WTCSessionsActive
|
||||||
|
$row | Add-Member -type NoteProperty -name "Active Uploads" -Value $site.GetUploadCount()
|
||||||
|
$row | Add-Member -type NoteProperty -name "Active Downloads" -Value $site.GetDownloadCount()
|
||||||
|
$results += $row
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Set-Site(
|
||||||
|
[Parameter(Position = 0, Mandatory = $True, HelpMessage = "Enter a site name")]
|
||||||
|
[String]$siteName) {
|
||||||
|
Write-Verbose "SiteName :$siteName"
|
||||||
|
if ($null -eq $global:Server) {
|
||||||
|
Write-Host "You need to connect to EFT Server first" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for ($i = 0; $i -le $global:sites.Count() - 1; $i++ ) {
|
||||||
|
$global:site = $global:sites.Item($i)
|
||||||
|
if ($global:site.Name -eq $siteName) {
|
||||||
|
Write-Host "Site '$siteName' selected" -ForegroundColor Green
|
||||||
|
return $siteName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Host "Site '$siteName' not found" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#####################################################################
|
||||||
|
## Users
|
||||||
|
#####################################################################
|
||||||
|
function Get-Users() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String[]]$Usernames)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$results = @()
|
||||||
|
if ($null -eq $Usernames) {
|
||||||
|
$usernames = Get-Usernames | Select-Object -Expand Username
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($username in $usernames) {
|
||||||
|
$user = Set-User $username
|
||||||
|
$row = New-Object PSObject
|
||||||
|
$row | Add-Member -type NoteProperty -name Username -Value $username
|
||||||
|
$row | Add-Member -type NoteProperty -name IsEnabled -Value $user.GetEnableAccount()
|
||||||
|
$row | Add-Member -type NoteProperty -name Email -Value $user.Email
|
||||||
|
$row | Add-Member -type NoteProperty -name FullName -Value $user.FullName
|
||||||
|
$row | Add-Member -type NoteProperty -name HasHomeFolder -Value $user.GetHomeDir()
|
||||||
|
$row | Add-Member -type NoteProperty -name HomeFolder -Value $user.GetHomeDirString()
|
||||||
|
$row | Add-Member -type NoteProperty -name HomeFolderIsRoot -Value $user.GetHomeDirIsRoot()
|
||||||
|
$row | Add-Member -type NoteProperty -name Description -Value $user.GetDescription()
|
||||||
|
$row | Add-Member -type NoteProperty -name Phone -Value $user.Phone
|
||||||
|
$row | Add-Member -type NoteProperty -name Pager -Value $user.Pager
|
||||||
|
$row | Add-Member -type NoteProperty -name Fax -Value $user.Fax
|
||||||
|
$row | Add-Member -type NoteProperty -name Custom1 -Value $user.Custom1
|
||||||
|
$row | Add-Member -type NoteProperty -name Custom2 -Value $user.Custom2
|
||||||
|
$row | Add-Member -type NoteProperty -name Custom3 -Value $user.Custom3
|
||||||
|
$row | Add-Member -type NoteProperty -name Comments -Value $user.Comments
|
||||||
|
$row | Add-Member -type NoteProperty -name IsLocked -Value $user.IsLocked
|
||||||
|
$row | Add-Member -type NoteProperty -name IsConnected -Value $user.IsConnected
|
||||||
|
$row | Add-Member -type NoteProperty -name LastConnectionTime -Value $user.LastConnectionTime
|
||||||
|
$row | Add-Member -type NoteProperty -name AccountCreationTime -Value $user.AccountCreationTime
|
||||||
|
$row | Add-Member -type NoteProperty -name LastModificationTime -Value $user.LastModificationTime
|
||||||
|
$results += $row
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Get-Usernames() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String[]]$settingsTemplates)
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$results = @()
|
||||||
|
if ($null -eq $settingsTemplates) {
|
||||||
|
$settingsTemplates = Get-SettingsTemplates | Select-Object -Expand SettingsTemplate # Expand is used to convert from object attribute to array of strings
|
||||||
|
write-verbose "$settingsTemplates"
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($settingsTemplate in $settingsTemplates) {
|
||||||
|
$users = $null
|
||||||
|
try {
|
||||||
|
write-verbose "Getting users from '$settingsTemplate'"
|
||||||
|
$users = $global:site.GetSettingsLevelUsers($settingsTemplate)
|
||||||
|
}
|
||||||
|
catch [Exception] {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i -le $users.length - 1; $i++ ) {
|
||||||
|
$row = New-Object PSObject
|
||||||
|
$row | Add-Member -type NoteProperty -name Username -Value $users[$i]
|
||||||
|
$row | Add-Member -type NoteProperty -name SettingsTemplate -Value $settingsTemplate
|
||||||
|
$results += $row
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Set-User() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$username)
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
if ($global:site.DoesUsernameExist($username)) {
|
||||||
|
$global:user = $global:site.GetUserSettings($username)
|
||||||
|
#Write-Host "User '$username' selected" -ForegroundColor Green
|
||||||
|
return $global:user
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "User '$username' doesn't exist" -ForegroundColor Red
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-Users() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String[]]$Usernames)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
foreach ( $username in $Usernames) {
|
||||||
|
EFT-RM-User $username
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-User() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$username)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
$global:site.RemoveUser($username)
|
||||||
|
Write-Host "Username '$username' removed" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "User '$username' not found" -ForegroundColor Red
|
||||||
|
Write-Host "Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-SettingsTemplates() {
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use EFT-CD-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$results = @()
|
||||||
|
$settingsTemplates = $global:site.GetSettingsLevels()
|
||||||
|
|
||||||
|
for ($i = 0; $i -le $settingsTemplates.length - 1; $i++ ) {
|
||||||
|
$row = New-Object PSObject
|
||||||
|
$row | Add-Member -type NoteProperty -name SettingsTemplate -Value $settingsTemplates[$i]
|
||||||
|
$results += $row
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#####################################################################
|
||||||
|
## Virtual Folder
|
||||||
|
#####################################################################
|
||||||
|
function Get-VirtualFolders() {
|
||||||
|
Write-Verbose "SiteName :$global:site.Name"
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$results = @()
|
||||||
|
$paths = $global:site.GetVirtualFolderList("").Split()
|
||||||
|
for ($i = 0 ; $i -le $paths.Length - 1 ; $i++) {
|
||||||
|
$currentPath = $paths.GetValue($i)
|
||||||
|
if ($currentPath -ne "") {
|
||||||
|
$row = New-Object PSObject
|
||||||
|
$row | Add-Member -type NoteProperty -name Path -Value $currentPath
|
||||||
|
$row | Add-Member -type NoteProperty -name PhysicalPath -Value $global:site.GetPhysicalPath($currentPath)
|
||||||
|
$results += $row
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Add-VirtualFolder() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$path, [String]$physicalPath, [bool]$validateTarget)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$global:site.CreateVirtualFolder($path, $physicalPath, $validateTarget);
|
||||||
|
Write-Host "Virtual folder '$path' added" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Edit-VirtualFolder() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$path, [String]$newPhysicalPath)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$global:site.RemapVirtualFolder($path, $newPhysicalPath);
|
||||||
|
Write-Host "Virtual folder '$path' updated" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-VirtualFolder() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$path)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($global:site.IsFolderVirtual($path)) {
|
||||||
|
$global:site.RemoveFolder($path);
|
||||||
|
Write-Host "path '$path' removed" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "path '$path' is not virtual folder" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## Permisions
|
||||||
|
#####################################################################
|
||||||
|
function Add-Permissions() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[String]$path,
|
||||||
|
[String]$clientId,
|
||||||
|
[bool] $ReplaceExisting,
|
||||||
|
[bool] $FileUpload ,
|
||||||
|
[bool] $FileDownload,
|
||||||
|
[bool] $FileDelete ,
|
||||||
|
[bool] $FileRename ,
|
||||||
|
[bool] $FileAppend ,
|
||||||
|
[bool] $DirCreate ,
|
||||||
|
[bool] $DirDelete ,
|
||||||
|
[bool] $DirShowHidden,
|
||||||
|
[bool] $DirShowReadOnly,
|
||||||
|
[bool] $DirShowInList,
|
||||||
|
[bool] $DirList
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
$perm = $global:site.GetBlankPermission($path, $clientId)
|
||||||
|
$perm.FileUpload = $FileUpload;
|
||||||
|
$perm.FileDownload = $FileDownload;
|
||||||
|
$perm.FileDelete = $FileDelete;
|
||||||
|
$perm.FileRename = $FileRename;
|
||||||
|
$perm.FileAppend = $FileAppend;
|
||||||
|
$perm.DirCreate = $DirCreate;
|
||||||
|
$perm.DirDelete = $DirDelete;
|
||||||
|
$perm.DirShowHidden = $DirShowHidden;
|
||||||
|
$perm.DirShowReadOnly = $DirShowReadOnly;
|
||||||
|
$perm.DirShowInList = $DirShowInList;
|
||||||
|
$perm.DirList = $DirList;
|
||||||
|
$global:site.SetPermission($perm, $ReplaceExisting);
|
||||||
|
Write-Host "permission '$path' for client '$clientId' has been added" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Edit-Permissions() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[String]$path,
|
||||||
|
[String]$clientId,
|
||||||
|
[bool] $ReplaceExisting,
|
||||||
|
[bool] $FileUpload ,
|
||||||
|
[bool] $FileDownload,
|
||||||
|
[bool] $FileDelete ,
|
||||||
|
[bool] $FileRename ,
|
||||||
|
[bool] $FileAppend ,
|
||||||
|
[bool] $DirCreate ,
|
||||||
|
[bool] $DirDelete ,
|
||||||
|
[bool] $DirShowHidden,
|
||||||
|
[bool] $DirShowReadOnly,
|
||||||
|
[bool] $DirShowInList,
|
||||||
|
[bool] $DirList
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
$permissions = $global:site.GetFolderPermissions($path)
|
||||||
|
for ($i = 0; $i -le $permissions.length - 1; $i++) {
|
||||||
|
$perm = $permissions.GetValue($i)
|
||||||
|
if ($perm.Client -eq $clientId) {
|
||||||
|
$perm.FileUpload = $FileUpload;
|
||||||
|
$perm.FileDownload = $FileDownload;
|
||||||
|
$perm.FileDelete = $FileDelete;
|
||||||
|
$perm.FileRename = $FileRename;
|
||||||
|
$perm.FileAppend = $FileAppend;
|
||||||
|
$perm.DirCreate = $DirCreate;
|
||||||
|
$perm.DirDelete = $DirDelete;
|
||||||
|
$perm.DirShowHidden = $DirShowHidden;
|
||||||
|
$perm.DirShowReadOnly = $DirShowReadOnly;
|
||||||
|
$perm.DirShowInList = $DirShowInList;
|
||||||
|
$perm.DirList = $DirList;
|
||||||
|
$global:site.SetPermission($perm, $ReplaceExisting);
|
||||||
|
Write-Host "permission '$path' for client '$clientId' has been updated" -ForegroundColor Green
|
||||||
|
break
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "permission '$path' for client '$clientId' not found" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Get-Permissions() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[String]$path)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
return $global:site.GetFolderPermissions($path)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-Permission() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[String]$path,
|
||||||
|
[String]$clientId)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
$global:site.RemovePermission($path, $clientId )
|
||||||
|
Write-Host "permission '$path' for client '$clientId' has been removed" -ForegroundColor Green
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Exception : $error[0]" -ForegroundColor Red
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## EventRules
|
||||||
|
#####################################################################
|
||||||
|
function Get-EventRules() {
|
||||||
|
Write-Verbose "SiteName :$global:site.Name"
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$results = @()
|
||||||
|
$eventTypes = $global:server.AvailableEvents
|
||||||
|
|
||||||
|
for ($i = 0 ; $i -le $eventTypes.Length - 1 ; $i++) {
|
||||||
|
$currentEventType = $eventTypes[$i].type
|
||||||
|
$currentEventTypeName = $eventTypes[$i].Name
|
||||||
|
|
||||||
|
$eventRules = $global:site.EventRules($currentEventType)
|
||||||
|
|
||||||
|
for ($j = 0 ; $j -le $eventRules.Count() - 1 ; $j++ ) {
|
||||||
|
$eventRule = $eventRules.Item($j)
|
||||||
|
|
||||||
|
$row = New-Object PSObject
|
||||||
|
$row | Add-Member -type NoteProperty -name Name -Value $eventRule.GetParams().Name
|
||||||
|
$row | Add-Member -type NoteProperty -name IsEnabled -Value $eventRule.GetParams().Enabled
|
||||||
|
$row | Add-Member -type NoteProperty -name Description -Value $eventRule.GetParams().Description
|
||||||
|
$row | Add-Member -type NoteProperty -name TypeName -Value $currentEventTypeName
|
||||||
|
$row | Add-Member -type NoteProperty -name Type -Value $currentEventType
|
||||||
|
|
||||||
|
$results += $row
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Set-EventRule() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$eventRuleName)
|
||||||
|
|
||||||
|
Write-Verbose "SiteName :$global:site.Name"
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$eventTypes = $global:server.AvailableEvents
|
||||||
|
$global:event = $null
|
||||||
|
for ($i = 0 ; $i -le $eventTypes.Length - 1 ; $i++) {
|
||||||
|
$currentEventType = $eventTypes[$i].type
|
||||||
|
|
||||||
|
$eventRules = $global:site.EventRules($currentEventType)
|
||||||
|
for ($j = 0 ; $j -le $eventRules.Count() - 1 ; $j++ ) {
|
||||||
|
$eventRule = $eventRules.Item($j)
|
||||||
|
if ( $eventRule.GetParams().Name -eq $eventRuleName) {
|
||||||
|
$global:event = $eventRule
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $global:event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-EventRule() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$Name)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$eventTypes = $global:server.AvailableEvents
|
||||||
|
|
||||||
|
for ($i = 0 ; $i -le $eventTypes.Length - 1 ; $i++) {
|
||||||
|
$currentEventType = $eventTypes[$i].type
|
||||||
|
|
||||||
|
$eventRules = $global:site.EventRules($currentEventType)
|
||||||
|
|
||||||
|
for ($j = 0 ; $j -le $eventRules.Count() - 1 ; $j++ ) {
|
||||||
|
$eventRule = $eventRules.Item($j)
|
||||||
|
|
||||||
|
if ($Name -eq $eventRule.GetParams().Name) {
|
||||||
|
$eventRules.Delete($j)
|
||||||
|
Write-Host "EventRule '$Name' removed" -ForegroundColor Green
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Host "EventRule '$Name' not found" -ForegroundColor red
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-EventRules() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String[]]$Names)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
foreach ($Name in $Names) {
|
||||||
|
Remove-EventRule $Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## Advanced Workflows
|
||||||
|
#####################################################################
|
||||||
|
function Get-AdvancedWorkflows() {
|
||||||
|
Write-Verbose "SiteName :$global:site.Name"
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$results = @()
|
||||||
|
$taskCount = $global:site.AdvancedWorkflowsCount
|
||||||
|
For ($iTask = 0; $iTask -lt $taskCount; $iTask++) {
|
||||||
|
$objTask = $global:site.GetAdvancedWorkflowParams($iTask)
|
||||||
|
$row = New-Object PSObject
|
||||||
|
$row | Add-Member -type NoteProperty -name Name -Value $objTask.Name
|
||||||
|
$row | Add-Member -type NoteProperty -name Description -Value $objTask.Description
|
||||||
|
$row | Add-Member -type NoteProperty -name TimeoutSeconds -Value $objTask.TimeoutSeconds
|
||||||
|
$row | Add-Member -type NoteProperty -name LogMode -Value $objTask.$LogMode
|
||||||
|
$row | Add-Member -type NoteProperty -name LogDir -Value $objTask.$LogDir
|
||||||
|
$row | Add-Member -type NoteProperty -name RetainSuccessfulLogsEnabled -Value $objTask.$RetainSuccessfulLogsEnabled
|
||||||
|
$row | Add-Member -type NoteProperty -name RetainFailedLogsEnabled -Value $objTask.$RetainFailedLogsEnabled
|
||||||
|
$results += $row
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
function Set-AdvancedWorkflow() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$AdvancedWorkflowName)
|
||||||
|
|
||||||
|
Write-Verbose "SiteName :$global:site.Name"
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$global:advancedWorkflow = $null
|
||||||
|
$taskCount = $global:site.AdvancedWorkflowsCount
|
||||||
|
For ($iTask = 0; $iTask -lt $taskCount; $iTask++) {
|
||||||
|
$objTask = $global:site.GetAdvancedWorkflowParams($iTask)
|
||||||
|
if ( $objTask.Name -eq $AdvancedWorkflowName) {
|
||||||
|
$global:advancedWorkflow = $objTask
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $global:advancedWorkflow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-AdvancedWorkflow() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String]$Name)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$taskCount = $global:site.AdvancedWorkflowsCount
|
||||||
|
For ($iTask = 0; $iTask -lt $taskCount; $iTask++) {
|
||||||
|
$objTask = $global:site.GetAdvancedWorkflowParams($iTask)
|
||||||
|
|
||||||
|
if ($Name -eq $objTask.Name) {
|
||||||
|
$global:site.RemoveAdvancedWorkflow($iTask)
|
||||||
|
Write-Host "Advanced Workflow '$Name' removed" -ForegroundColor Green
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Host "Advanced Workflow '$Name' not found" -ForegroundColor red
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Remove-AdvancedWorkflows() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([String[]]$Names)
|
||||||
|
|
||||||
|
if ($null -eq $global:site) {
|
||||||
|
Write-Host "You need to select a EFT Site first use Set-Site <sitename>" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
foreach ($Name in $Names) {
|
||||||
|
Remove-AdvancedWorkflow $Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,164 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
)
|
||||||
|
## To Export to CSV use:
|
||||||
|
## .\EFT.Profiles-Export.ps1 |Export-csv profiles.csv -NoTypeInformation
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$SiteGuid = $null
|
||||||
|
try {
|
||||||
|
$SiteGuid = $script:EftSite.GUID
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
|
||||||
|
}
|
||||||
|
$totalProfiles = -1
|
||||||
|
try {
|
||||||
|
$totalProfiles = $script:eftsite.GetConnectionProfilesCount()
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$totalProfiles = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
For ($iprofile = 0; $iprofile -lt $totalProfiles; $iprofile++) {
|
||||||
|
$objTask = $null
|
||||||
|
Write-Progress -Activity "Processing Connection Profile" -status "Profile ($iprofile/$($totalProfiles))" -percentComplete ($iprofile / $totalProfiles * 100)
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
$objTask = $script:eftsite.GetConnectionProfileParams($iprofile)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Magenta
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$ConnectionProfileGUID=""
|
||||||
|
try { $ConnectionProfileGUID = $objTask.GUID } catch{}
|
||||||
|
|
||||||
|
if ($null -ne $objTask ){
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
SiteGuid = $SiteGuid;
|
||||||
|
ConnectionProfileGUID = $ConnectionProfileGUID;
|
||||||
|
Name = $objTask.Name;
|
||||||
|
Type = $objTask.type;
|
||||||
|
Description = $objTask.Description;
|
||||||
|
Protocol = $objTask.Protocol;
|
||||||
|
Host = $objTask.Host;
|
||||||
|
Port = $objTask.Port;
|
||||||
|
AutoLogin = $objTask.AutoLogin;
|
||||||
|
User = $objTask.User;
|
||||||
|
Password = $objTask.Password;
|
||||||
|
PrivateKeyPath = $objTask.PrivateKeyPath;
|
||||||
|
PrivateKeyPassword = $objTask.PrivateKeyPassword;
|
||||||
|
PublicKeyPath = $objTask.PublicKeyPath;
|
||||||
|
TrustedPublicKeyPath = $objTask.TrustedPublicKeyPath;
|
||||||
|
MaxConcurrentThreads = $objTask.MaxConcurrentThreads;
|
||||||
|
ConnectionTimeoutSeconds= $objTask.ConnectionTimeoutSeconds;
|
||||||
|
ConnectionRetryAttempts = $objTask.ConnectionRetryAttempts;
|
||||||
|
RetryDelaySeconds = $objTask.RetryDelaySeconds;
|
||||||
|
ValidateIntegrity = $objTask.ValidateIntegrity;
|
||||||
|
FTPDataConnectionMode = $objTask.FTPDataConnectionMode;
|
||||||
|
FTPDataConnectionPortMin= $objTask.FTPDataConnectionPortMin;
|
||||||
|
FTPDataConnectionPortMax= $objTask.FTPDataConnectionPortMax;
|
||||||
|
FTPSClearCommandChannel = $objTask.FTPSClearCommandChannel;
|
||||||
|
FTPSClearDataChannel = $objTask.FTPSClearDataChannel;
|
||||||
|
TransferEncoding = $objTask.TransferEncoding;
|
||||||
|
TextFileTypes = $objTask.TextFileTypes;
|
||||||
|
PreserveRemoteFileTime = $objTask.PreserveRemoteFileTime;
|
||||||
|
PreserveLocalFileTime = $objTask.PreserveLocalFileTime;
|
||||||
|
UseProxy = $objTask.UseProxy;
|
||||||
|
ProxyType = $objTask.ProxyType;
|
||||||
|
ProxyHostName = $objTask.ProxyHostName;
|
||||||
|
ProxyPort = $objTask.ProxyPort;
|
||||||
|
ProxyUserName = $objTask.ProxyUserName;
|
||||||
|
ProxyPassword = $objTask.ProxyPassword;
|
||||||
|
ProxyAuthenticationType = $objTask.ProxyAuthenticationType;
|
||||||
|
ProxyAdvSeparator = $objTask.ProxyAdvSeparator;
|
||||||
|
ProxyAdvCustomCmds = $objTask.ProxyAdvCustomCmds;
|
||||||
|
UseSOCKS = $objTask.UseSOCKS;
|
||||||
|
SOCKSType = $objTask.SOCKSType;
|
||||||
|
SOCKSHostName = $objTask.SOCKSHostName;
|
||||||
|
SOCKSPort = $objTask.SOCKSPort;
|
||||||
|
SOCKSUseAuthentication = $objTask.SOCKSUseAuthentication;
|
||||||
|
SOCKSUserName = $objTask.SOCKSUserName;
|
||||||
|
SOCKSPassword = $objTask.SOCKSPassword;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$userHash = -join ( $u | Select-Object * -ExcludeProperty SiteName,SiteGuid, ConnectionProfileGUID, Name, CheckSum)
|
||||||
|
$userHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($userHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $userHash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
$results | Sort-Object Name
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,186 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the connection profiles CSV file ")]
|
||||||
|
[string] $ConnectioProfileCsvFile = "profiles.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($ConnectioProfileCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
# $EFTPermissions = @(
|
||||||
|
# @{ SiteName = "MySite"; Path = "\"; Client= "" IsInherited = "" ; InheritedFrom =""; Permissions = "" }
|
||||||
|
# @{ SiteName = "MySite"; Path = "\"; Client= "" IsInherited = "" ; InheritedFrom =""; Permissions = "" }
|
||||||
|
#)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ConnectioProfiles = Import-Csv $ConnectioProfileCsvFile
|
||||||
|
# "SiteName","Path", "Client","Permissions",IsInherited","InheritedFrom"
|
||||||
|
}
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Importing Folder Permissions:"
|
||||||
|
$Imported = 0
|
||||||
|
$errorCount = 0
|
||||||
|
foreach ($ConnectioProfile in $ConnectioProfiles) {
|
||||||
|
$index = -1
|
||||||
|
try {
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$ConnectioProfile.SiteName])
|
||||||
|
|
||||||
|
Write-host "Importing: [$($ConnectioProfile.SiteName)] $($ConnectioProfile.Name)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $script:EFTSite.GetConnectionProfilesCount(); $i++) {
|
||||||
|
if ($ConnectioProfile.Name -eq $EFTSite.GetConnectionProfileParams($i).Name) {
|
||||||
|
$index = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Importing connection profile
|
||||||
|
if ($index -gt -1) {
|
||||||
|
# Updating connection profile
|
||||||
|
$connectionProfileParams = $EFTSite.GetConnectionProfileParams($index)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Adding Workflow
|
||||||
|
$connectionProfileParams = new-object -ComObject "SFTPCOMInterface.CIConnectionProfileParams"
|
||||||
|
$connectionProfileParams.Name = $ConnectioProfile.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($ConnectioProfile.ConnectionProfileGUID -ne "") {
|
||||||
|
$connectionProfileParams.GUID = $ConnectioProfile.ConnectionProfileGUID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {}
|
||||||
|
|
||||||
|
$connectionProfileParams.Type = [int]$ConnectioProfile.type;
|
||||||
|
$connectionProfileParams.Description = $ConnectioProfile.Description;
|
||||||
|
$connectionProfileParams.Protocol = [int]$ConnectioProfile.Protocol;
|
||||||
|
$connectionProfileParams.Host = $ConnectioProfile.Host;
|
||||||
|
$connectionProfileParams.Port = [int]$ConnectioProfile.Port;
|
||||||
|
$connectionProfileParams.AutoLogin = [bool]$ConnectioProfile.AutoLogin;
|
||||||
|
$connectionProfileParams.User = $ConnectioProfile.User;
|
||||||
|
$connectionProfileParams.Password = $ConnectioProfile.Password;
|
||||||
|
$connectionProfileParams.PrivateKeyPath = $ConnectioProfile.PrivateKeyPath;
|
||||||
|
$connectionProfileParams.PrivateKeyPassword = $ConnectioProfile.PrivateKeyPassword;
|
||||||
|
$connectionProfileParams.PublicKeyPath = $ConnectioProfile.PublicKeyPath;
|
||||||
|
$connectionProfileParams.TrustedPublicKeyPath = $ConnectioProfile.TrustedPublicKeyPath;
|
||||||
|
$connectionProfileParams.MaxConcurrentThreads = [int]$ConnectioProfile.MaxConcurrentThreads;
|
||||||
|
$connectionProfileParams.ConnectionTimeoutSeconds = [int]$ConnectioProfile.ConnectionTimeoutSeconds;
|
||||||
|
$connectionProfileParams.ConnectionRetryAttempts = [int]$ConnectioProfile.ConnectionRetryAttempts;
|
||||||
|
$connectionProfileParams.RetryDelaySeconds = [int]$ConnectioProfile.RetryDelaySeconds;
|
||||||
|
$connectionProfileParams.ValidateIntegrity = [bool]$ConnectioProfile.ValidateIntegrity;
|
||||||
|
$connectionProfileParams.FTPDataConnectionMode = [int]$ConnectioProfile.FTPDataConnectionMode;
|
||||||
|
$connectionProfileParams.FTPDataConnectionPortMin = [int]$ConnectioProfile.FTPDataConnectionPortMin;
|
||||||
|
$connectionProfileParams.FTPDataConnectionPortMax = [int]$ConnectioProfile.FTPDataConnectionPortMax;
|
||||||
|
$connectionProfileParams.FTPSClearCommandChannel = [bool]$ConnectioProfile.FTPSClearCommandChannel;
|
||||||
|
$connectionProfileParams.FTPSClearDataChannel = [bool]$ConnectioProfile.FTPSClearDataChannel;
|
||||||
|
$connectionProfileParams.TransferEncoding = [int]$ConnectioProfile.TransferEncoding;
|
||||||
|
$connectionProfileParams.TextFileTypes = $ConnectioProfile.TextFileTypes;
|
||||||
|
$connectionProfileParams.PreserveRemoteFileTime = [bool]$ConnectioProfile.PreserveRemoteFileTime;
|
||||||
|
$connectionProfileParams.PreserveLocalFileTime = [bool]$ConnectioProfile.PreserveLocalFileTime;
|
||||||
|
$connectionProfileParams.UseProxy = [bool]$ConnectioProfile.UseProxy;
|
||||||
|
$connectionProfileParams.ProxyType = [int]$ConnectioProfile.ProxyType;
|
||||||
|
$connectionProfileParams.ProxyHostName = $ConnectioProfile.ProxyHostName;
|
||||||
|
$connectionProfileParams.ProxyPort = [int]$ConnectioProfile.ProxyPort;
|
||||||
|
$connectionProfileParams.ProxyUserName = $ConnectioProfile.ProxyUserName;
|
||||||
|
$connectionProfileParams.ProxyPassword = $ConnectioProfile.ProxyPassword;
|
||||||
|
$connectionProfileParams.ProxyAuthenticationType = [int]$ConnectioProfile.ProxyAuthenticationType;
|
||||||
|
$connectionProfileParams.ProxyAdvSeparator = $ConnectioProfile.ProxyAdvSeparator;
|
||||||
|
$connectionProfileParams.ProxyAdvCustomCmds = $ConnectioProfile.ProxyAdvCustomCmds;
|
||||||
|
$connectionProfileParams.UseSOCKS = [bool]$ConnectioProfile.UseSOCKS;
|
||||||
|
$connectionProfileParams.SOCKSType = [int]$ConnectioProfile.SOCKSType;
|
||||||
|
$connectionProfileParams.SOCKSHostName = $ConnectioProfile.SOCKSHostName;
|
||||||
|
$connectionProfileParams.SOCKSPort = [int]$ConnectioProfile.SOCKSPort;
|
||||||
|
$connectionProfileParams.SOCKSUseAuthentication = [bool]$ConnectioProfile.SOCKSUseAuthentication;
|
||||||
|
$connectionProfileParams.SOCKSUserName = $ConnectioProfile.SOCKSUserName;
|
||||||
|
$connectionProfileParams.SOCKSPassword = $ConnectioProfile.SOCKSPassword;
|
||||||
|
If ($index -lt 0) {
|
||||||
|
$connectionProfileIndex = $eftsite.AddConnectionProfile($connectionProfileParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$Imported++
|
||||||
|
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Imported: " -NoNewline
|
||||||
|
Write-host "$Imported " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
888
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Deploy.ps1
Normal file
888
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Deploy.ps1
Normal file
@ -0,0 +1,888 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
###
|
||||||
|
# cd C:\Users\rguzman\Desktop\src\src
|
||||||
|
# . .\deploy.ps1 -EFTHostname localhost -EFTSiteName Rogers -EFTAdmin admin -password Super2017!!
|
||||||
|
# TEST TEST TEST
|
||||||
|
|
||||||
|
###
|
||||||
|
param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $True, HelpMessage = "Enter the input folder where files will be read for deploy")]
|
||||||
|
[String] $BuildFolder = "" ,
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[switch] $Mirror = $false,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
|
||||||
|
)
|
||||||
|
Function RemoveInvalidChars($path) {
|
||||||
|
$path -replace ("[{0}]" -f (([System.IO.Path]::GetInvalidFileNameChars() | ForEach-Object { [regex]::Escape($_) }) -join '|')), '_'
|
||||||
|
#return $path
|
||||||
|
}
|
||||||
|
function ParseValues ($source, $target) {
|
||||||
|
$sourceProps = Get-Member -InputObject $source -MemberType Properties
|
||||||
|
$targetProps = Get-Member -InputObject $target -MemberType Properties
|
||||||
|
foreach ($targetprop in $targetProps) {
|
||||||
|
foreach ($sourceProp in $sourceProps) {
|
||||||
|
Write-Debug "Source: $($sourceProp.Name) .. Target: $($targetProp.Name)"
|
||||||
|
# Manual Properties , these must be set Manually
|
||||||
|
if ($targetProp.Name -eq "ProxyType") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($sourceProp.Name -eq $targetProp.Name) {
|
||||||
|
#$Name = $targetProp.Name
|
||||||
|
#$definition =$targetProp.Definition
|
||||||
|
#$i = $definition.indexOf(" ")
|
||||||
|
#$targettype = $Definition.substring(0,$i)
|
||||||
|
if ($sourceProp.definition -like "*get*" -and $targetProp.definition -like "*set*" ) {
|
||||||
|
$target."$($targetProp.Name)" = $source."$($sourceProp.Name)"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function RenameEventRule($originalName, $newName) {
|
||||||
|
|
||||||
|
$eventTypes = $EFTServer.AvailableEvents
|
||||||
|
for ($i = 0 ; $i -le $eventTypes.Length - 1 ; $i++) {
|
||||||
|
$currentEventType = $eventTypes[$i].type
|
||||||
|
#$currentEventTypeName = $eventTypes[$i].Name
|
||||||
|
$eventRules = $EFTSite.EventRules($currentEventType)
|
||||||
|
for ($j = 0 ; $j -le $eventRules.Count() - 1 ; $j++ ) {
|
||||||
|
$eventRule = $eventRules.Item($j)
|
||||||
|
$eventParams = $eventRule.GetParams()
|
||||||
|
if ($originalName -eq $eventParams.Name) {
|
||||||
|
$eventParams.Name = $newName
|
||||||
|
$eventRule.SetParams($eventParams)
|
||||||
|
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($isRenamed) {
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "******* EFT Deploy SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " > This script will modify your EFT configuration and these changes can't be undone" -ForegroundColor Yellow
|
||||||
|
Write-host " > You must perform backups of your EFT config before using this script" -ForegroundColor Yellow
|
||||||
|
Write-host " > It is recommend you test this script in a non-production environment before " -ForegroundColor Yellow
|
||||||
|
Write-host " using in production to validate its functionality" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
|
||||||
|
#Output parameters
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") { Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green } else { Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red }
|
||||||
|
Write-host "Build Folder : $BuildFolder"
|
||||||
|
Write-host "Mirror Artifacts : $Mirror"
|
||||||
|
Write-host "EFT Admin Hostname : $EFTAdminHostname"
|
||||||
|
Write-host "EFT Admin Port : $EFTAdminPort"
|
||||||
|
Write-host "EFT Admin Auth Type : $EFTAdminAuthType"
|
||||||
|
Write-host "EFT Admin Username : $EFTAdminUsername"
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Constants
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
$EFTServer = $null
|
||||||
|
$EFTSites = $null
|
||||||
|
$EFTSite = $null
|
||||||
|
$CUSTOM_COMMAND_NOT_FOUND = "Could not find specified command in this site"
|
||||||
|
$MXE_CANNOT_IMPORT_EVENT_RULE = "MX Error: 119 (00000077)"
|
||||||
|
$MXE_INVALID_CONNECTION_PROFILE_DATA = "MX Error: 109 (0000006D)"
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
if ($BuildFolder -notmatch '.+?\\$') {
|
||||||
|
$BuildFolder += '\'
|
||||||
|
}
|
||||||
|
|
||||||
|
If ( (Test-Path $BuildFolder) -eq $false) {
|
||||||
|
Write-host "Build folder '$BuildFolder' doesn't exist" -ForegroundColor red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$BuildFolder = Convert-Path $BuildFolder
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
#$sitesCount = $script:EftSites.Count()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$eventTypes = $EFTServer.AvailableEvents
|
||||||
|
|
||||||
|
Get-ChildItem $BuildFolder -Directory |
|
||||||
|
Foreach-Object {
|
||||||
|
|
||||||
|
$EFTSiteName = $_.BaseName
|
||||||
|
|
||||||
|
Write-host "Detecting EFT site: $EFTSiteName ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
|
||||||
|
$siteFound = $false
|
||||||
|
#Finding sitename
|
||||||
|
$sw.Restart()
|
||||||
|
for ($i = 0; $i -le $sitesCount - 1; $i++ ) {
|
||||||
|
$EFTSite = $EFTSites.Item($i)
|
||||||
|
if ($EFTSite.Name -eq $EFTSiteName) {
|
||||||
|
$siteFound = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($siteFound) {
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-Host "Site Not found" -ForegroundColor Red
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[Advanced Workflows]"
|
||||||
|
if (Test-Path "$BuildFolder\$EFTSiteName\workflows\") {
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\workflows\" -Filter *.xml |
|
||||||
|
Foreach-Object {
|
||||||
|
|
||||||
|
Write-Host "Importing: $($_.BaseName)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$objParams = Import-Clixml $_.FullName
|
||||||
|
$workflowIndex = -1
|
||||||
|
try {
|
||||||
|
$workflowIndex = $EFTSite.GetAdvancedWorkflowIndex($objParams.Name)
|
||||||
|
# Importing workflow
|
||||||
|
|
||||||
|
if ($workflowIndex -gt -1) {
|
||||||
|
# Updating Workflow
|
||||||
|
$workflowParams = $EFTSite.GetAdvancedWorkflowParams($workflowIndex)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Adding Workflow
|
||||||
|
$workflowParams = new-object -ComObject "SFTPCOMInterface.CIAdvancedWorkflowParams"
|
||||||
|
}
|
||||||
|
|
||||||
|
$sourceHash = -join ( $objParams | Select-Object * -ExcludeProperty DateCreated )
|
||||||
|
$targetHash = -join ( $workflowParams | Select-Object * -ExcludeProperty DateCreated)
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1
|
||||||
|
$targetHash = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
ParseValues $objParams $workflowParams
|
||||||
|
#$workflowParams = $objParams
|
||||||
|
If ($workflowIndex -ge 0) {
|
||||||
|
$eftsite.SetAdvancedWorkflowParams($workflowIndex, $workflowParams)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$eftsite.AddAdvancedWorkflow($workflowParams)
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[Custom Commands]"
|
||||||
|
if (Test-Path "$BuildFolder\$EFTSiteName\commands\") {
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\commands\" -Filter *.xml |
|
||||||
|
Foreach-Object {
|
||||||
|
|
||||||
|
Write-Host "Importing: $($_.BaseName)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$objParams = Import-Clixml $_.FullName
|
||||||
|
$index = -1
|
||||||
|
try {
|
||||||
|
$found = $false
|
||||||
|
|
||||||
|
# Updating command
|
||||||
|
try {
|
||||||
|
$commandSettings = $EFTSite.GetCommandSettings($objParams.Name)
|
||||||
|
$found = $true
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$found = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found) {
|
||||||
|
# Adding Workflow
|
||||||
|
$commandSettings = new-object -ComObject "SFTPCOMInterface.CICommandSettings"
|
||||||
|
}
|
||||||
|
|
||||||
|
$sourceHash = -join ( $objParams | Select-Object *)
|
||||||
|
$targetHash = -join ( $commandSettings | Select-Object *)
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1
|
||||||
|
$targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$commandSettings = $objParams
|
||||||
|
If (!$found) {
|
||||||
|
$commandSettings = $eftsite.CreateCommand($objParams.Name)
|
||||||
|
}
|
||||||
|
ParseValues $objParams $commandSettings
|
||||||
|
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[Custom Commands User Permissions]"
|
||||||
|
if (Test-Path "$BuildFolder\$EFTSiteName\commands_userpermissions\") {
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\commands_userpermissions\" -Filter *.xml |
|
||||||
|
Foreach-Object {
|
||||||
|
|
||||||
|
Write-Host "Importing: $($_.BaseName)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$objParams = Import-Clixml $_.FullName
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Updating command
|
||||||
|
$commandSettings = $EFTSite.GetCommandSettings($_.BaseName)
|
||||||
|
$userPermissions = $commandSettings.GetUserPermissions()
|
||||||
|
|
||||||
|
|
||||||
|
$sourceHash = -join ( $objParams )
|
||||||
|
$targetHash = -join ( $userPermissions )
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1
|
||||||
|
$targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
|
||||||
|
foreach ($userperm in $userPerfmissions) {
|
||||||
|
$commandSettings.RemoveUserPermission($userperm);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($userperm in $objParams) {
|
||||||
|
$commandSettings.AddUserPermission($userperm);
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[AS2 Profiles]"
|
||||||
|
if (Test-Path "$BuildFolder\$EFTSiteName\as2_profiles\") {
|
||||||
|
$baseAS2Path = join-path "$BuildFolder" "$EFTSiteName\as2_profiles\"
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\as2_profiles\" -Directory -Recurse | Where-Object { $_.PSIsContainer } |
|
||||||
|
Foreach-Object {
|
||||||
|
#$Username = $_.BaseName
|
||||||
|
$username = $_.FullName.Replace($baseAS2Path, "")
|
||||||
|
$userfound = $false
|
||||||
|
Write-Host "Importing: $($username) [AS2Inbound]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
try {
|
||||||
|
$detail = $script:EftSite.GetUserSettings($Username)
|
||||||
|
$userfound = $true
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($userfound) {
|
||||||
|
$AS2Inbound_Path = Join-Path $_.FullName "AS2Inbound.xml"
|
||||||
|
if (Test-Path $AS2Inbound_Path -PathType Leaf) {
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
$sourceAS2InboundProfile = Import-Clixml $AS2Inbound_Path
|
||||||
|
$targetAS2InboundProfile = $detail.AS2InboundSettings
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2InboundProfile | Select-Object * ) ;
|
||||||
|
$targetHash = -join ( $targetAS2InboundProfile | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2InboundProfile $targetAS2InboundProfile
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$AS2Inbound_FailureCommand_Path = Join-Path $_.FullName "AS2Inbound_FailureCommand.xml"
|
||||||
|
if (Test-Path $AS2Inbound_FailureCommand_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Inbound_FailureCommand]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$sourceAS2Inbound_FailureCommand = Import-Clixml $AS2Inbound_FailureCommand_Path
|
||||||
|
$targetAS2Inbound_FailureCommand = $detail.AS2InboundSettings.GetFailureCommand()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Inbound_FailureCommand | Select-Object * ) ;
|
||||||
|
$targetHash = -join ( $targetAS2Inbound_FailureCommand | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Inbound_FailureCommand $targetAS2Inbound_FailureCommand
|
||||||
|
$detail.AS2InboundSettings.SetFailureCommand($targetAS2Inbound_FailureCommand)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $AS2Inbound_FailureEmail_Path = Join-Path $_.FullName "AS2Inbound_FailureEmail.xml"
|
||||||
|
$AS2Inbound_FailureEmail_Path = Join-Path $_.FullName "AS2Inbound_FailureEmail.xml"
|
||||||
|
if (Test-Path $AS2Inbound_FailureEmail_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Inbound_FailureEmail]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$sourceAS2Inbound_FailureEmail = Import-Clixml $AS2Inbound_FailureEmail_Path
|
||||||
|
$targetAS2Inbound_FailureEmail = $detail.AS2InboundSettings.GetFailureEmail()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Inbound_FailureEmail | Select-Object * ) ;
|
||||||
|
$targetHash = -join ( $targetAS2Inbound_FailureEmail | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Inbound_FailureEmail $targetAS2Inbound_FailureEmail
|
||||||
|
$detail.AS2InboundSettings.SetFailureEmail($targetAS2Inbound_FailureEmail)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $AS2Inbound_SuccessCommand_Path = Join-Path $_.FullName "AS2Inbound_SuccessCommand.xml"
|
||||||
|
$AS2Inbound_SuccessCommand_Path = Join-Path $_.FullName "AS2Inbound_SuccessCommand.xml"
|
||||||
|
if (Test-Path $AS2Inbound_SuccessCommand_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Inbound_SuccessCommand]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$sourceAS2Inbound_SuccessCommand = Import-Clixml $AS2Inbound_SuccessCommand_Path
|
||||||
|
$targetAS2Inbound_SuccessCommand = $detail.AS2InboundSettings.GetSuccessCommand()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Inbound_SuccessCommand | Select-Object * ) ;
|
||||||
|
$targetHash = -join ( $targetAS2Inbound_SuccessCommand | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Inbound_SuccessCommand $targetAS2Inbound_SuccessCommand
|
||||||
|
$detail.AS2InboundSettings.SetSuccessCommand($targetAS2Inbound_SuccessCommand)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $AS2Inbound_SuccessEmail_Path = Join-Path $_.FullName "AS2Inbound_SuccessEmail.xml"
|
||||||
|
$AS2Inbound_SuccessEmail_Path = Join-Path $_.FullName "AS2Inbound_SuccessEmail.xml"
|
||||||
|
if (Test-Path $AS2Inbound_SuccessCommand_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Inbound_SuccessEmail]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$sourceAS2Inbound_SuccessEmail = Import-Clixml $AS2Inbound_SuccessEmail_Path
|
||||||
|
$targetAS2Inbound_SuccessEmail = $detail.AS2InboundSettings.GetSuccessEmail()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Inbound_SuccessEmail | Select-Object * ) ;
|
||||||
|
$targetHash = -join ( $targetAS2Inbound_SuccessEmail | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Inbound_SuccessEmail $targetAS2Inbound_SuccessEmail
|
||||||
|
$detail.AS2InboundSettings.SetSuccessEmail($targetAS2Inbound_SuccessEmail)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$AS2Outbound_Path = Join-Path $_.FullName "AS2Outbound.xml"
|
||||||
|
if (Test-Path $AS2Outbound_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Outbound]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
$sourceAS2OutboundProfile = Import-Clixml $AS2Outbound_Path
|
||||||
|
$targetAS2OutboundProfile = $detail.AS2OutboundSettings
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2OutboundProfile | Select-Object * )
|
||||||
|
$targetHash = -join ( $targetAS2OutboundProfile | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2OutboundProfile $targetAS2OutboundProfile
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $AS2Outbound_FailureCommand_Path = Join-Path $_.FullName "AS2Outbound_FailureCommand.xml"
|
||||||
|
$AS2Outbound_FailureCommand_Path = Join-Path $_.FullName "AS2Outbound_FailureCommand.xml"
|
||||||
|
if (Test-Path $AS2Outbound_FailureCommand_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Outbound_FailureCommand]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
$sourceAS2Outbound_FailureCommand = Import-Clixml $AS2Outbound_FailureCommand_Path
|
||||||
|
$targetAS2Outbound_FailureCommand = $detail.AS2OutboundSettings.GetFailureCommand()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Outbound_FailureCommand | Select-Object * )
|
||||||
|
$targetHash = -join ( $targetAS2Outbound_FailureCommand | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Outbound_FailureCommand $targetAS2Outbound_FailureCommand
|
||||||
|
$detail.AS2OutboundSettings.SetFailureCommand($targetAS2Outbound_FailureCommand)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $AS2Outbound_FailureEmail_Path = Join-Path $_.FullName "AS2Outbound_FailureEmail.xml"
|
||||||
|
$AS2Outbound_FailureEmail_Path = Join-Path $_.FullName "AS2Outbound_FailureEmail.xml"
|
||||||
|
if (Test-Path $AS2Outbound_FailureEmail_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Outbound_FailureEmail]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
$sourceAS2Outbound_FailureEmail = Import-Clixml $AS2Outbound_FailureEmail_Path
|
||||||
|
$targetAS2Outbound_FailureEmail = $detail.AS2OutboundSettings.GetFailureEmail()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Outbound_FailureEmail | Select-Object * )
|
||||||
|
$targetHash = -join ( $targetAS2Outbound_FailureEmail | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Outbound_FailureEmail $targetAS2Outbound_FailureEmail
|
||||||
|
$detail.AS2OutboundSettings.SetFailureEmail($targetAS2Outbound_FailureEmail)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# $AS2Outbound_SuccessCommand_Path = Join-Path $_.FullName "AS2Outbound_SuccessCommand.xml"
|
||||||
|
$AS2Outbound_SuccessCommand_Path = Join-Path $_.FullName "AS2Outbound_SuccessCommand.xml"
|
||||||
|
if (Test-Path $AS2Outbound_SuccessCommand_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Outbound_SuccessCommand]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
$sourceAS2Outbound_SuccessCommand = Import-Clixml $AS2Outbound_SuccessCommand_Path
|
||||||
|
$targetAS2Outbound_SuccessCommand = $detail.AS2OutboundSettings.GetSuccessCommand()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Outbound_SuccessCommand | Select-Object * )
|
||||||
|
$targetHash = -join ( $targetAS2Outbound_SuccessCommand | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Outbound_SuccessCommand $targetAS2Outbound_SuccessCommand
|
||||||
|
$detail.AS2OutboundSettings.SetSuccessCommand($targetAS2Outbound_SuccessCommand)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $AS2Outbound_SuccessEmail_Path = Join-Path $_.FullName "AS2Outbound_SuccessEmail.xml"
|
||||||
|
$AS2Outbound_SuccessEmail_Path = Join-Path $_.FullName "AS2Outbound_SuccessEmail.xml"
|
||||||
|
if (Test-Path $AS2Outbound_SuccessEmail_Path -PathType Leaf) {
|
||||||
|
Write-Host "Importing: $($_.BaseName) [AS2Outbound_SuccessEmail]".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
$sourceAS2Outbound_SuccessEmail = Import-Clixml $AS2Outbound_SuccessEmail_Path
|
||||||
|
$targetAS2Outbound_SuccessEmail = $detail.AS2OutboundSettings.GetSuccessEmail()
|
||||||
|
|
||||||
|
$sourceHash = -join ( $sourceAS2Outbound_SuccessEmail | Select-Object * )
|
||||||
|
$targetHash = -join ( $targetAS2Outbound_SuccessEmail | Select-Object * )
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1; $targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $sourceAS2Outbound_SuccessEmail $targetAS2Outbound_SuccessEmail
|
||||||
|
$detail.AS2OutboundSettings.SetSuccessEmail($targetAS2Outbound_SuccessEmail)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[Connection Profiles]"
|
||||||
|
if (Test-Path "$BuildFolder\$EFTSiteName\connection_profiles\") {
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\connection_profiles\" -Filter *.xml |
|
||||||
|
Foreach-Object {
|
||||||
|
|
||||||
|
Write-Host "Importing: $($_.BaseName)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$objParams = Import-Clixml $_.FullName
|
||||||
|
$index = -1
|
||||||
|
try {
|
||||||
|
# $workflowIndex = $EFTSite.GetAdvancedWorkflowIndex($objParams.Name)
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $EFTSite.GetConnectionProfilesCount(); $i++) {
|
||||||
|
if ($objParams.Name -eq $EFTSite.GetConnectionProfileParams($i).Name) {
|
||||||
|
$index = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Importing connection profile
|
||||||
|
if ($index -gt -1) {
|
||||||
|
# Updating connection profile
|
||||||
|
$connectionProfileParams = $EFTSite.GetConnectionProfileParams($index)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Adding Workflow
|
||||||
|
$connectionProfileParams = new-object -ComObject "SFTPCOMInterface.CIConnectionProfileParams"
|
||||||
|
}
|
||||||
|
|
||||||
|
$sourceHash = -join ( $objParams | Select-Object * -ExcludeProperty DateCreated )
|
||||||
|
$targetHash = -join ( $connectionProfileParams | Select-Object * -ExcludeProperty DateCreated)
|
||||||
|
try {
|
||||||
|
$sourceHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($sourceHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$targetHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($targetHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$sourceHash = 1
|
||||||
|
$targetHash = 2
|
||||||
|
}
|
||||||
|
if ($sourceHash -ne $targetHash) {
|
||||||
|
#$connectionProfileParams = $objParams
|
||||||
|
ParseValues $objParams $connectionProfileParams
|
||||||
|
if ($objParams.UseProxy) {
|
||||||
|
$connectionProfileParams.ProxyType = $objParams.ProxyType
|
||||||
|
}
|
||||||
|
If ($index -lt 0) {
|
||||||
|
$connectionProfileIndex = $eftsite.AddConnectionProfile($connectionProfileParams)
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path "$BuildFolder\$EFTSiteName\event_rules\") {
|
||||||
|
|
||||||
|
$EventFolders = $null
|
||||||
|
$EFTUsingFolders = $false
|
||||||
|
try {
|
||||||
|
$EventFolders = $EFTsite.EventRuleFolders()
|
||||||
|
$EFTUsingFolders = $true
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-verbose "Event Rule folders feature not found via COM"
|
||||||
|
}
|
||||||
|
|
||||||
|
## creating Folders on EFT
|
||||||
|
if ($EFTUsingFolders) {
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[Event Rules Folders]"
|
||||||
|
if (Test-Path "$BuildFolder\$EFTSiteName\event_rules\") {
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\event_rules\" -Directory |
|
||||||
|
Foreach-Object {
|
||||||
|
$EventFolderName = $_.BaseName
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
$EventFolder = $EventFolders.Find($EventFolderName)
|
||||||
|
If ($null -eq $EventFolder) {
|
||||||
|
Write-host "Creating: $EventFolderName".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
|
||||||
|
$EventFolders.Add($EventFolders.Count(), $EventFolderName)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## SubFolders if any
|
||||||
|
if ($EFTUsingFolders) {
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[Event Rules in Folder]"
|
||||||
|
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\event_rules\" -Directory |
|
||||||
|
Foreach-Object {
|
||||||
|
$EventFolderName = $_.BaseName
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\event_rules\$EventFolderName" -Filter *.xml |
|
||||||
|
Foreach-Object {
|
||||||
|
try {
|
||||||
|
$EventFolder = $EventFolders.Find($EventFolderName)
|
||||||
|
$EventRuleName = $_.BaseName
|
||||||
|
|
||||||
|
# Delete event Rule if is found on EFT
|
||||||
|
$sw.Restart()
|
||||||
|
$isDeleted = $false
|
||||||
|
for ($i = 0 ; $i -le $eventTypes.Length - 1 ; $i++) {
|
||||||
|
$currentEventType = $eventTypes[$i].type
|
||||||
|
#$currentEventTypeName = $eventTypes[$i].Name
|
||||||
|
$eventRules = $EFTSite.EventRules($currentEventType)
|
||||||
|
for ($j = 0 ; $j -le $eventRules.Count() - 1 ; $j++ ) {
|
||||||
|
$eventRule = $eventRules.Item($j)
|
||||||
|
#Write-Host "Base filename:$($_.BaseName)"
|
||||||
|
if ($EventRuleName -eq $eventRule.GetParams().Name) {
|
||||||
|
Write-host "Deleting: $($_.BaseName)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$eventRules.Delete($j)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$isDeleted = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($isDeleted) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Import Event Rule into EFT
|
||||||
|
# Importing Event Rules
|
||||||
|
Write-host "Importing: $EventFolderName/$EventRuleName".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
# Adding Event Rule
|
||||||
|
$EventFolder.Import($_.FullName)
|
||||||
|
$xml = [xml](Get-Content $_.FullName)
|
||||||
|
if ($xml.root.EventRulesList.Item.Name -ne $_.BaseName) {
|
||||||
|
RenameEventRule $_.BaseName $xml.root.EventRulesList.Item.Name
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-Host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
exit
|
||||||
|
Write-host ""
|
||||||
|
Write-host "[Event Rules]"
|
||||||
|
## Root folder
|
||||||
|
Get-ChildItem "$BuildFolder\$EFTSiteName\event_rules\" -Filter *.xml |
|
||||||
|
Foreach-Object {
|
||||||
|
|
||||||
|
## Used when Event Rules Folders doesn't exist
|
||||||
|
$isDeleted = $false
|
||||||
|
try {
|
||||||
|
# Delete event Rule if is found on EFT
|
||||||
|
$sw.Restart()
|
||||||
|
for ($i = 0 ; $i -le $eventTypes.Length - 1 ; $i++) {
|
||||||
|
$currentEventType = $eventTypes[$i].type
|
||||||
|
#$currentEventTypeName = $eventTypes[$i].Name
|
||||||
|
$eventRules = $EFTSite.EventRules($currentEventType)
|
||||||
|
for ($j = 0 ; $j -le $eventRules.Count() - 1 ; $j++ ) {
|
||||||
|
$eventRule = $eventRules.Item($j)
|
||||||
|
#Write-Host "Base filename:$($_.BaseName)"
|
||||||
|
if ($_.BaseName -eq $eventRule.GetParams().Name) {
|
||||||
|
Write-host "Deleting: $($_.BaseName)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$eventRules.Delete($j)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$isDeleted = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($isDeleted) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Import Event Rule into EFT
|
||||||
|
# Importing Event Rules
|
||||||
|
Write-host "Importing: $($_.BaseName)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
# Adding Event Rule
|
||||||
|
$EFTSite.ImportEventRules($_.FullName)
|
||||||
|
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_CANNOT_IMPORT_EVENT_RULE { Write-host "MXE_CANNOT_IMPORT_EVENT_RULE : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_CONNECTION_PROFILE_DATA { Write-host "MXE_INVALID_CONNECTION_PROFILE_DATA : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red }
|
||||||
|
}
|
||||||
|
Write-Host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$EFTSite = $null
|
||||||
|
$EFTSites = $null
|
||||||
|
$EFTServer.Close()
|
||||||
|
$EFTServer = $null
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,300 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Exports Execute AWE actions and its parameters used in event rules.
|
||||||
|
.DESCRIPTION
|
||||||
|
This script return Execute AWE actions and its parameters used in event rules for all or a specific EFT site
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-AWEParams.ps1 | Export-Csv .\AWEParams_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export actions with Execute AWE action in event rules for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in localhost using port 1100 and using
|
||||||
|
the current windows login credentials
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
function GetValue($value) {
|
||||||
|
if ($value -is [array]) {
|
||||||
|
return $value -join "|"
|
||||||
|
}
|
||||||
|
return $value
|
||||||
|
}
|
||||||
|
Function GetPropertyName ($EventProperty) {
|
||||||
|
switch ($EventProperty) {
|
||||||
|
1003 { return "ServerLogOldPath" }
|
||||||
|
1004 { return "ServerLogNewPath" }
|
||||||
|
1006 { return "ServerLogFolder" }
|
||||||
|
3006 { return "HttpQueryString" }
|
||||||
|
3007 { return "HttpHeadersList" }
|
||||||
|
5000 { return "VirtualPath" }
|
||||||
|
5001 { return "PhysicalPath" }
|
||||||
|
5003 { return "DestinationPhysicalPath" }
|
||||||
|
5004 { return "FolderName" }
|
||||||
|
5005 { return "FileName" }
|
||||||
|
5006 { return "DestinationFolderName" }
|
||||||
|
5007 { return "DestinationFileName" }
|
||||||
|
5013 { return "ReportPath" }
|
||||||
|
5015 { return "ReportFileName" }
|
||||||
|
5016 { return "VirtualFolderName" }
|
||||||
|
5017 { return "BaseFileName" }
|
||||||
|
5018 { return "FileFolderExists" }
|
||||||
|
5019 { return "CompressedPhysicalPath" }
|
||||||
|
5020 { return "CompressedFileName" }
|
||||||
|
5021 { return "CompressedBaseFileName" }
|
||||||
|
7000 { return "WSVirtualPath" }
|
||||||
|
7001 { return "WSPhysicalPath" }
|
||||||
|
8000 { return "ContextVariable" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Function GetOperationName ($Operation) {
|
||||||
|
switch ($Operation) {
|
||||||
|
0 { return "Encrypt" }
|
||||||
|
1 { return "EncryptAndSign" }
|
||||||
|
2 { return "Sign" }
|
||||||
|
3 { return "SDA" }
|
||||||
|
4 { return "Decrypt" }
|
||||||
|
5 { return "DecryptAndVerify" }
|
||||||
|
6 { return "VerifyOnly" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Function GetActionName ($EventActionType) {
|
||||||
|
switch ($EventActionType) {
|
||||||
|
1 { return "CommandAction" }
|
||||||
|
2 { return "MailAction" }
|
||||||
|
4 { return "UploadAction" }
|
||||||
|
8 { return "DownloadAction" }
|
||||||
|
32 { return "PGPAction" }
|
||||||
|
64 { return "StopAction" }
|
||||||
|
128 { return "CleanupAction" }
|
||||||
|
256 { return "ReportAction" }
|
||||||
|
512 { return "AS2SendAction" }
|
||||||
|
1024 { return "AWTaskAction" }
|
||||||
|
2048 { return "BackupAction" }
|
||||||
|
4096 { return "WindowsEventLog" }
|
||||||
|
8192 { return "ContentIntegrityControl" }
|
||||||
|
16384 { return "FolderAction" }
|
||||||
|
32768 { return "FileAction" }
|
||||||
|
65536 { return "CompressAction" }
|
||||||
|
262144 { return "WebServiceAction" }
|
||||||
|
524288 { return "CloudUploadAction" }
|
||||||
|
1048576 { return "CloudDownloadAction" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExportAWEParamsInAction ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionPosition, $IsElse, $action, $IsFailAction, $FailActionPosition) {
|
||||||
|
$objParams = $EventRule.GetParams()
|
||||||
|
$results = @()
|
||||||
|
if ($action.type -ne $AWEACTION) {
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
$actionParams = $action.GetParams() # CIAWTaskActionParams
|
||||||
|
|
||||||
|
switch ($action.type) {
|
||||||
|
$AWEACTION {
|
||||||
|
$VariablesCount = $actionParams.VariablesCount
|
||||||
|
if ($VariablesCount -eq 0) {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
TaskName = $actionParams.TaskName;
|
||||||
|
VariableName = "";
|
||||||
|
VariableValue = "";
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for ($j = 0 ; $j -le $VariablesCount - 1 ; $j++) {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
TaskName = $actionParams.TaskName;
|
||||||
|
VariableName = $actionParams.GetVariableName($j);
|
||||||
|
VariableValue = $actionParams.GetVariableValue($j);
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
|
||||||
|
function ProcessActionStatement ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionStatement , $ActionPosition, $IsElse) {
|
||||||
|
#$objParams = $EventRule.GetParams()
|
||||||
|
$action = $ActionStatement.Action()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
|
||||||
|
$results += ExportAWEParamsInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $action -IsElse $IsElse -IsFailAction 0 -FailActionPosition 0
|
||||||
|
|
||||||
|
#process additional Actions in the Fail Section
|
||||||
|
$failSection = $ActionStatement.FailSection()
|
||||||
|
# Fail Action Section
|
||||||
|
if ($null -ne $failSection) {
|
||||||
|
for ($indexfail = 0; $indexfail -le $failSection.Count() - 1 ; $indexfail++ ) {
|
||||||
|
$failaction = $failSection.item($indexfail)
|
||||||
|
|
||||||
|
$script:Line++
|
||||||
|
$results += ExportAWEParamsInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $failaction -IsElse $IsElse -IsFailAction 1 -FailActionPosition $indexfail
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:Line = 0
|
||||||
|
|
||||||
|
$AWEACTION = 1024
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.Name)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$Trigger = $eventType.Name
|
||||||
|
|
||||||
|
$totalStatements = $objEvent.StatementsCount()
|
||||||
|
$script:Line = 0
|
||||||
|
for ($StatementPosition = 0; $StatementPosition -le $totalStatements - 1 ; $StatementPosition++) {
|
||||||
|
$statement = $objEvent.statement($StatementPosition)
|
||||||
|
|
||||||
|
if ($statement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$actionStatement = $statement
|
||||||
|
$script:Line++
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition 0 -IsElse 0
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$script:Line++
|
||||||
|
# statement is ConditionStatement
|
||||||
|
$ifActions = $statement.IfSection # CIActionStatements
|
||||||
|
$elseActions = $statement.ElseSection # CIActionStatements
|
||||||
|
#Actions in If section
|
||||||
|
if ($null -ne $ifActions ) {
|
||||||
|
for ($indexAction = 0; $indexAction -le $ifActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $ifActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Actions in Else section
|
||||||
|
if ($null -ne $elseActions ) {
|
||||||
|
$script:Line++
|
||||||
|
for ($indexAction = 0; $indexAction -le $elseActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $elseActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,303 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Exports actions and its connection profiles used in event rules.
|
||||||
|
.DESCRIPTION
|
||||||
|
This script return actions and its connection profiles used in event rules for all or a specific EFT site
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-ConnectionProfilesInActions.ps1 | Export-Csv .\ProfilesInActions_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export actions with connection profiles in event rules for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in localhost using port 1100 and using
|
||||||
|
the current windows login credentials
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-ConnectionProfilesInActions.ps1 -EFTAdminHostName 127.0.0.1 -EFTAdminPort 1100 -EFTAdminAuthType 0 -EFTAdminUsername myusername -Password Mypassword | Export-Csv .\PathsInActions_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export actions with connection profiles in event rules for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in 127.0.0.1 using port 1100 and using EFT Admin credentials myusername/mypassword
|
||||||
|
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
function GetValue($value) {
|
||||||
|
if ($value -is [array]) {
|
||||||
|
return $value -join "|"
|
||||||
|
}
|
||||||
|
return $value
|
||||||
|
}
|
||||||
|
Function GetPropertyName ($EventProperty) {
|
||||||
|
switch ($EventProperty) {
|
||||||
|
1003 { return "ServerLogOldPath"}
|
||||||
|
1004 { return "ServerLogNewPath"}
|
||||||
|
1006 { return "ServerLogFolder"}
|
||||||
|
3006 { return "HttpQueryString"}
|
||||||
|
3007 { return "HttpHeadersList"}
|
||||||
|
5000 { return "VirtualPath"}
|
||||||
|
5001 { return "PhysicalPath"}
|
||||||
|
5003 { return "DestinationPhysicalPath"}
|
||||||
|
5004 { return "FolderName"}
|
||||||
|
5005 { return "FileName"}
|
||||||
|
5006 { return "DestinationFolderName"}
|
||||||
|
5007 { return "DestinationFileName"}
|
||||||
|
5013 { return "ReportPath"}
|
||||||
|
5015 { return "ReportFileName"}
|
||||||
|
5016 { return "VirtualFolderName"}
|
||||||
|
5017 { return "BaseFileName"}
|
||||||
|
5018 { return "FileFolderExists"}
|
||||||
|
5019 { return "CompressedPhysicalPath"}
|
||||||
|
5020 { return "CompressedFileName"}
|
||||||
|
5021 { return "CompressedBaseFileName"}
|
||||||
|
7000 { return "WSVirtualPath"}
|
||||||
|
7001 { return "WSPhysicalPath"}
|
||||||
|
8000 { return "ContextVariable"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Function GetOperationName ($Operation) {
|
||||||
|
switch ($Operation) {
|
||||||
|
0 { return "Encrypt"}
|
||||||
|
1 { return "EncryptAndSign"}
|
||||||
|
2 { return "Sign"}
|
||||||
|
3 { return "SDA"}
|
||||||
|
4 { return "Decrypt"}
|
||||||
|
5 { return "DecryptAndVerify"}
|
||||||
|
6 { return "VerifyOnly"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Function GetActionName ($EventActionType) {
|
||||||
|
switch ($EventActionType) {
|
||||||
|
1 { return "CommandAction"}
|
||||||
|
2 { return "MailAction"}
|
||||||
|
4 { return "UploadAction"}
|
||||||
|
8 { return "DownloadAction"}
|
||||||
|
32 { return "PGPAction"}
|
||||||
|
64 { return "StopAction"}
|
||||||
|
128 { return "CleanupAction"}
|
||||||
|
256 { return "ReportAction"}
|
||||||
|
512 { return "AS2SendAction"}
|
||||||
|
1024 { return "AWTaskAction"}
|
||||||
|
2048 { return "BackupAction"}
|
||||||
|
4096 { return "WindowsEventLog"}
|
||||||
|
8192 { return "ContentIntegrityControl"}
|
||||||
|
16384 { return "FolderAction"}
|
||||||
|
32768 { return "FileAction"}
|
||||||
|
65536 { return "CompressAction"}
|
||||||
|
262144 { return "WebServiceAction"}
|
||||||
|
524288 { return "CloudUploadAction"}
|
||||||
|
1048576 { return "CloudDownloadAction"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExportConnectionProfileInAction ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionPosition, $IsElse, $action, $IsFailAction, $FailActionPosition) {
|
||||||
|
$objParams = $EventRule.GetParams()
|
||||||
|
$results = @()
|
||||||
|
if ($action.type -ne $UPLOADACTION -and $action.type -ne $DOWNLOADACTION)
|
||||||
|
{
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
$actionParams = $action.GetParams()
|
||||||
|
|
||||||
|
|
||||||
|
switch ($action.type) {
|
||||||
|
$UPLOADACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "ConnectionProfileName"
|
||||||
|
ActionValue = $actionParams.ConnectionProfileName;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$DOWNLOADACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "ConnectionProfileName"
|
||||||
|
ActionValue = $actionParams.ConnectionProfileName;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
|
||||||
|
function ProcessActionStatement ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionStatement , $ActionPosition, $IsElse) {
|
||||||
|
#$objParams = $EventRule.GetParams()
|
||||||
|
$action = $ActionStatement.Action()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
|
||||||
|
$results += ExportConnectionProfileInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $action -IsElse $IsElse -IsFailAction 0 -FailActionPosition 0
|
||||||
|
|
||||||
|
#process additional Actions in the Fail Section
|
||||||
|
$failSection = $ActionStatement.FailSection()
|
||||||
|
# Fail Action Section
|
||||||
|
if ($null -ne $failSection) {
|
||||||
|
for ($indexfail = 0; $indexfail -le $failSection.Count() - 1 ; $indexfail++ ) {
|
||||||
|
$failaction = $failSection.item($indexfail)
|
||||||
|
|
||||||
|
$script:Line++
|
||||||
|
$results += ExportConnectionProfileInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $failaction -IsElse $IsElse -IsFailAction 1 -FailActionPosition $indexfail
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:Line = 0
|
||||||
|
|
||||||
|
$UPLOADACTION = 4
|
||||||
|
$DOWNLOADACTION = 8
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.Name)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$Trigger = $eventType.Name
|
||||||
|
|
||||||
|
$totalStatements = $objEvent.StatementsCount()
|
||||||
|
$script:Line = 0
|
||||||
|
for ($StatementPosition = 0; $StatementPosition -le $totalStatements - 1 ; $StatementPosition++) {
|
||||||
|
$statement = $objEvent.statement($StatementPosition)
|
||||||
|
|
||||||
|
if ($statement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$actionStatement = $statement
|
||||||
|
$script:Line++
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition 0 -IsElse 0
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$script:Line++
|
||||||
|
# statement is ConditionStatement
|
||||||
|
$ifActions = $statement.IfSection # CIActionStatements
|
||||||
|
$elseActions = $statement.ElseSection # CIActionStatements
|
||||||
|
#Actions in If section
|
||||||
|
if ($null -ne $ifActions ) {
|
||||||
|
for ($indexAction = 0; $indexAction -le $ifActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $ifActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Actions in Else section
|
||||||
|
if ($null -ne $elseActions ) {
|
||||||
|
$script:Line++
|
||||||
|
for ($indexAction = 0; $indexAction -le $elseActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $elseActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,508 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Exports Hostnames used in event rules actions.
|
||||||
|
.DESCRIPTION
|
||||||
|
This script return hostnames used in event rules actions for all or a specific EFT site
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-HostNamesInActions.ps1 | Export-Csv .\HostnamesInActions_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export all Paths in actions in the event rules for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in localhost using port 1100 and using
|
||||||
|
the current windows login credentials
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-HostNamesInActions.ps1 -EFTAdminHostName 127.0.0.1 -EFTAdminPort 1100 -EFTAdminAuthType 0 -EFTAdminUsername myusername -Password Mypassword | Export-Csv .\PathsInActions_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export all Paths in actions in the event rules for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in 127.0.0.1 using port 1100 and using EFT Admin credentials myusername/mypassword
|
||||||
|
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
|
||||||
|
)
|
||||||
|
function GetValue($value) {
|
||||||
|
if ($value -is [array]) {
|
||||||
|
return $value -join "|"
|
||||||
|
}
|
||||||
|
return $value
|
||||||
|
}
|
||||||
|
Function GetPropertyName ($EventProperty) {
|
||||||
|
switch ($EventProperty) {
|
||||||
|
1003 { return "ServerLogOldPath"}
|
||||||
|
1004 { return "ServerLogNewPath"}
|
||||||
|
1006 { return "ServerLogFolder"}
|
||||||
|
3006 { return "HttpQueryString"}
|
||||||
|
3007 { return "HttpHeadersList"}
|
||||||
|
5000 { return "VirtualPath"}
|
||||||
|
5001 { return "PhysicalPath"}
|
||||||
|
5003 { return "DestinationPhysicalPath"}
|
||||||
|
5004 { return "FolderName"}
|
||||||
|
5005 { return "FileName"}
|
||||||
|
5006 { return "DestinationFolderName"}
|
||||||
|
5007 { return "DestinationFileName"}
|
||||||
|
5013 { return "ReportPath"}
|
||||||
|
5015 { return "ReportFileName"}
|
||||||
|
5016 { return "VirtualFolderName"}
|
||||||
|
5017 { return "BaseFileName"}
|
||||||
|
5018 { return "FileFolderExists"}
|
||||||
|
5019 { return "CompressedPhysicalPath"}
|
||||||
|
5020 { return "CompressedFileName"}
|
||||||
|
5021 { return "CompressedBaseFileName"}
|
||||||
|
7000 { return "WSVirtualPath"}
|
||||||
|
7001 { return "WSPhysicalPath"}
|
||||||
|
8000 { return "ContextVariable"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function GetProtocolName ($EventProperty) {
|
||||||
|
switch ($EventProperty) {
|
||||||
|
1073741829 { return "ProtocolFASTAST"}
|
||||||
|
0 { return "ProtocolFTP"}
|
||||||
|
1 { return "ProtocolFTPS"}
|
||||||
|
8 { return "ProtocolFTPSAuthTLS"}
|
||||||
|
2 { return "ProtocolFTPSExpl"}
|
||||||
|
4 { return "ProtocolHTTP "}
|
||||||
|
5 { return "ProtocolHTTPS"}
|
||||||
|
-1 { return "ProtocolLocal"}
|
||||||
|
3 { return "ProtocolSFTP"}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Function GetActionName ($EventActionType) {
|
||||||
|
switch ($EventActionType) {
|
||||||
|
1 { return "CommandAction"}
|
||||||
|
2 { return "MailAction"}
|
||||||
|
4 { return "UploadAction"}
|
||||||
|
8 { return "DownloadAction"}
|
||||||
|
32 { return "PGPAction"}
|
||||||
|
64 { return "StopAction"}
|
||||||
|
128 { return "CleanupAction"}
|
||||||
|
256 { return "ReportAction"}
|
||||||
|
512 { return "AS2SendAction"}
|
||||||
|
1024 { return "AWTaskAction"}
|
||||||
|
2048 { return "BackupAction"}
|
||||||
|
4096 { return "WindowsEventLog"}
|
||||||
|
8192 { return "ContentIntegrityControl"}
|
||||||
|
16384 { return "FolderAction"}
|
||||||
|
32768 { return "FileAction"}
|
||||||
|
65536 { return "CompressAction"}
|
||||||
|
262144 { return "WebServiceAction"}
|
||||||
|
524288 { return "CloudUploadAction"}
|
||||||
|
1048576 { return "CloudDownloadAction"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExportHostnameInAction ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionPosition, $IsElse, $action, $IsFailAction, $FailActionPosition) {
|
||||||
|
$objParams = $EventRule.GetParams()
|
||||||
|
$actionParams = $action.GetParams()
|
||||||
|
$results = @()
|
||||||
|
|
||||||
|
switch ($action.type) {
|
||||||
|
|
||||||
|
$UPLOADACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Host"
|
||||||
|
ActionValue = $actionParams.Host;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "User"
|
||||||
|
ActionValue = $actionParams.User;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
Line = $script:Line;
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Port"
|
||||||
|
ActionValue = $actionParams.Port;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Password"
|
||||||
|
ActionValue = $actionParams.Password;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
Line = $script:Line;
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Protocol"
|
||||||
|
ActionValue = GetProtocolName($actionParams.Protocol);
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$DOWNLOADACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Host"
|
||||||
|
ActionValue = $actionParams.Host;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "User"
|
||||||
|
ActionValue = $actionParams.User;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Password"
|
||||||
|
ActionValue = $actionParams.Password;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "PrivateKeyPath"
|
||||||
|
ActionValue = $actionParams.PrivateKeyPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Port"
|
||||||
|
ActionValue = $actionParams.Port;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$AS2SENDACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Host"
|
||||||
|
ActionValue = $actionParams.Host;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "User"
|
||||||
|
ActionValue = $actionParams.User;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Port"
|
||||||
|
ActionValue = $actionParams.Port;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$CONTENTINTEGRITYCONTROL {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Host"
|
||||||
|
ActionValue = $actionParams.Host;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Port"
|
||||||
|
ActionValue = $actionParams.User;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$WEBSERVICEACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "URL"
|
||||||
|
ActionValue = $actionParams.URL;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$CLOUDUPLOADACTION {
|
||||||
|
|
||||||
|
}
|
||||||
|
$CLOUDDOWNLOADACTION {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
|
||||||
|
function ProcessActionStatement ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionStatement , $ActionPosition, $IsElse) {
|
||||||
|
#$objParams = $EventRule.GetParams()
|
||||||
|
$action = $ActionStatement.Action()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
$results += ExportHostnameInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $action -IsElse $IsElse -IsFailAction 0 -FailActionPosition 0
|
||||||
|
|
||||||
|
#process additional Actions in the Fail Section
|
||||||
|
$failSection = $ActionStatement.FailSection()
|
||||||
|
# Fail Action Section
|
||||||
|
if ($null -ne $failSection) {
|
||||||
|
for ($indexfail = 0; $indexfail -le $failSection.Count() - 1 ; $indexfail++ ) {
|
||||||
|
$failaction = $failSection.item($indexfail)
|
||||||
|
$script:Line++
|
||||||
|
$results += ExportHostnameInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $failaction -IsElse $IsElse -IsFailAction 1 -FailActionPosition $indexfail
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:Line = 0
|
||||||
|
|
||||||
|
$UPLOADACTION = 4
|
||||||
|
$DOWNLOADACTION = 8
|
||||||
|
$AS2SENDACTION = 512
|
||||||
|
$WEBSERVICEACTION = 262144
|
||||||
|
$CLOUDUPLOADACTION = 524288
|
||||||
|
$CLOUDDOWNLOADACTION = 1048576
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.Name)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$Trigger = $eventType.Name
|
||||||
|
|
||||||
|
$totalStatements = $objEvent.StatementsCount()
|
||||||
|
$script:Line = 0
|
||||||
|
for ($StatementPosition = 0; $StatementPosition -le $totalStatements - 1 ; $StatementPosition++) {
|
||||||
|
$statement = $objEvent.statement($StatementPosition)
|
||||||
|
if ($statement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$actionStatement = $statement
|
||||||
|
$script:Line++
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition 0 -IsElse 0
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ConditionStatement = $statement.Condition
|
||||||
|
$script:Line++
|
||||||
|
# statement is ConditionStatement
|
||||||
|
$ifActions = $statement.IfSection # CIActionStatements
|
||||||
|
$elseActions = $statement.ElseSection # CIActionStatements
|
||||||
|
#Actions in If section
|
||||||
|
if ($null -ne $ifActions ) {
|
||||||
|
|
||||||
|
for ($indexAction = 0; $indexAction -le $ifActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $ifActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Actions in Else section
|
||||||
|
if ($null -ne $elseActions ) {
|
||||||
|
$script:Line++
|
||||||
|
for ($indexAction = 0; $indexAction -le $elseActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $elseActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# $results += new-object psobject -Property @{
|
||||||
|
# SiteName = $siteName; EventRuleName = $EventRuleName; Trigger = $eventType.Name; Enabled = $Enabled; Comments = $Comments;
|
||||||
|
# EmailNotifications_Actions = $EmailNotifications_Actions; EmailNotifications_FailedActions = $EmailNotifications_FailedActions;
|
||||||
|
# PGP_Key_Name = $PGP_Key_Name; PGP_Description = $PGP_Description; PGP_Size = $PGP_Size;
|
||||||
|
# PGP_Key_Expiration = $PGP_Key_Expiration; PGP_Fingerprint = $PGP_Fingerprint; PGP_CreatedOn = $PGP_CreatedOn;
|
||||||
|
# CheckSum = "";
|
||||||
|
# }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,322 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Exports PGP keys used in evet rules with its associated metadata.
|
||||||
|
.DESCRIPTION
|
||||||
|
This script will retrieve all PGP Keys used from all the event rules for all or a specific EFT site
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-PGPKeysUsed.ps1 | Export-Csv .\PGPKeysUsed_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export all PGP Keys used for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in localhost using port 1100 and using
|
||||||
|
the current windows login credentials
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-PGPKeysUsed.ps1 -EFTAdminHostName 127.0.0.1 -EFTAdminPort 1100 -EFTAdminAuthType 0 -EFTAdminUsername myusername -Password Mypassword | Export-Csv .\PGPKeysUsed_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export all PGP Keys used for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in 127.0.0.1 using port 1100 and using EFT Admin credentials myusername/mypassword
|
||||||
|
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
|
||||||
|
)
|
||||||
|
function GetEmailNotificationNextAction ( $Action) {
|
||||||
|
$EmailNotifications_Actions = ""
|
||||||
|
if ( $Action.type -eq $MailAction) {
|
||||||
|
$actionParams = $Action.GetParams() #CIMailActionParams
|
||||||
|
$EmailNotifications_Actions += $actionParams.TOAddresses + ';' + $actionParams.CCAddresses + ";" + $actionParams.BCCAddresses
|
||||||
|
}
|
||||||
|
|
||||||
|
return $EmailNotifications_Actions
|
||||||
|
}
|
||||||
|
Function GetOperationName ($Operation){
|
||||||
|
# Encrypt = 0,
|
||||||
|
# EncryptAndSign = 1,
|
||||||
|
# Sign = 2,
|
||||||
|
# SDA = 3,
|
||||||
|
# Decrypt = 4,
|
||||||
|
# DecryptAndVerify = 5,
|
||||||
|
# VerifyOnly = 6
|
||||||
|
switch ($Operation){
|
||||||
|
0 { return "Encrypt"}
|
||||||
|
1 { return "EncryptAndSign"}
|
||||||
|
2 { return "Sign"}
|
||||||
|
3 { return "SDA"}
|
||||||
|
4 { return "Decrypt"}
|
||||||
|
5 { return "DecryptAndVerify"}
|
||||||
|
6 { return "VerifyOnly"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExportPGPAction ($SiteName, $objEvent, $Trigger, $action, $EmailNotifications_Actions, $EmailNotifications_FailedActions) {
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
$actionParams = $action.GetParams()
|
||||||
|
$results = @()
|
||||||
|
|
||||||
|
if ($actionParams.Operation -eq 1 -or $actionParams.Operation -eq 2 -or $actionParams.Operation -eq 5 -or $actionParams.Operation -eq 6 ){
|
||||||
|
$PGP_SignKey_Fingerprint = $actionParams.SignKeyID
|
||||||
|
$PGP_SignKey_Name = ""
|
||||||
|
$PGP_SignKey_Description =""
|
||||||
|
$PGP_SignKey_Size = ""
|
||||||
|
$PGP_SignKey_Expiration = ""
|
||||||
|
$PGP_SignKey_CreatedOn = ""
|
||||||
|
$PGP_SignKey_IsPrivate = ""
|
||||||
|
|
||||||
|
$PGP_SignKey_Name = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_SignKey_Fingerprint} | Select-Object Name -ExpandProperty Name
|
||||||
|
$PGP_SignKey_Description = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_SignKey_Fingerprint} | Select-Object Description -ExpandProperty Description
|
||||||
|
$PGP_SignKey_Size = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_SignKey_Fingerprint} |Select-Object Size -ExpandProperty Size
|
||||||
|
$PGP_SignKey_Expiration = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_SignKey_Fingerprint} | Select-Object ExpirationDate -ExpandProperty ExpirationDate
|
||||||
|
$PGP_SignKey_CreatedOn = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_SignKey_Fingerprint} | Select-Object CreationDate -ExpandProperty CreationDate
|
||||||
|
$PGP_SignKey_IsPrivate = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_SignKey_Fingerprint} | Select-Object IsPrivate -ExpandProperty IsPrivate
|
||||||
|
}
|
||||||
|
foreach ($key in $actionParams.KeyIDs ) {
|
||||||
|
$PGP_Key_Fingerprint = $key
|
||||||
|
|
||||||
|
$PGP_Key_Name = ""
|
||||||
|
$PGP_Key_Description =""
|
||||||
|
$PGP_Key_Size = ""
|
||||||
|
$PGP_Key_Expiration =""
|
||||||
|
$PGP_Key_CreatedOn = ""
|
||||||
|
$PGP_Key_IsPrivate = ""
|
||||||
|
|
||||||
|
$PGP_Key_Name = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_Key_Fingerprint} | Select-Object Name -ExpandProperty Name
|
||||||
|
$PGP_Key_Description = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_Key_Fingerprint} | Select-Object Description -ExpandProperty Description
|
||||||
|
$PGP_Key_Size = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_Key_Fingerprint} |Select-Object Size -ExpandProperty Size
|
||||||
|
$PGP_Key_Expiration = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_Key_Fingerprint} | Select-Object ExpirationDate -ExpandProperty ExpirationDate
|
||||||
|
$PGP_Key_CreatedOn = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_Key_Fingerprint} | Select-Object CreationDate -ExpandProperty CreationDate
|
||||||
|
$PGP_Key_IsPrivate = $PgpKeyRing | Where-Object {$_.ID -eq $PGP_Key_Fingerprint} | Select-Object IsPrivate -ExpandProperty IsPrivate ;
|
||||||
|
$OperationName = GetOperationName -Operation $actionParams.Operation
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled; Comments = $objParams.Description;
|
||||||
|
EmailNotifications_Actions = $EmailNotifications_Actions; EmailNotifications_FailedActions = $EmailNotifications_FailedActions;
|
||||||
|
PGP_Operation = $OperationName;
|
||||||
|
PGP_Key_Fingerprint = $PGP_Key_Fingerprint;PGP_Key_Name = $PGP_Key_Name; PGP_Key_Description = $PGP_Key_Description; PGP_Key_Size = $PGP_Key_Size;
|
||||||
|
PGP_Key_Expiration = $PGP_Key_Expiration; PGP_Key_CreatedOn = $PGP_Key_CreatedOn; PGP_Key_IsPrivate = $PGP_Key_IsPrivate;
|
||||||
|
PGP_SignKey_Fingerprint = $PGP_SignKey_Fingerprint;PGP_SignKey_Name = $PGP_SignKey_Name; PGP_SignKey_Description = $PGP_SignKey_Description; PGP_SignKey_Size = $PGP_SignKey_Size;
|
||||||
|
PGP_SignKey_Expiration = $PGP_SignKey_Expiration; PGP_SignKey_CreatedOn = $PGP_SignKey_CreatedOn; PGP_SignKey_IsPrivate = $PGP_SignKey_IsPrivate;
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
|
||||||
|
function ProcessActionStatement ($SiteName, $objEvent, $Trigger, $ActionStatement, $nextActionStatement ) {
|
||||||
|
$EmailNotifications_Actions = ""
|
||||||
|
$EmailNotifications_FailedActions = ""
|
||||||
|
$action = $ActionStatement.Action()
|
||||||
|
$nextaction = $null
|
||||||
|
if ($nextActionStatement.type -eq 0) {
|
||||||
|
$nextaction = $nextActionStatement.Action()
|
||||||
|
$EmailNotifications_Actions = GetEmailNotificationNextAction -Action $nextaction
|
||||||
|
}
|
||||||
|
$results = @()
|
||||||
|
if ( $action.type -eq $PGPAction) {
|
||||||
|
|
||||||
|
# Check for Emails in the failed action section of the PGP Action
|
||||||
|
$failSection = $ActionStatement.FailSection()
|
||||||
|
if ($null -ne $failSection) {
|
||||||
|
for ($indexfail = 0; $indexfail -le $failSection.Count() - 1 ; $indexfail++ ) {
|
||||||
|
$failaction = $failSection.item($indexfail)
|
||||||
|
$EmailNotifications_FailedActions += GetEmailNotificationNextAction -Action $failaction
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$results += ExportPGPAction -sitename $SiteName -objEvent $objEvent -Trigger $Trigger -action $action -EmailNotifications_Actions $EmailNotifications_Actions -EmailNotifications_FailedActions $EmailNotifications_FailedActions
|
||||||
|
|
||||||
|
}
|
||||||
|
#process additional PGP Actions in the Fail Section
|
||||||
|
$failSection = $ActionStatement.FailSection()
|
||||||
|
# Fail Action Section
|
||||||
|
if ($null -ne $failSection) {
|
||||||
|
for ($indexfail = 0; $indexfail -le $failSection.Count() - 1 ; $indexfail++ ) {
|
||||||
|
$failaction = $failSection.item($indexfail)
|
||||||
|
if ( $failaction.type -eq $PGPAction) {
|
||||||
|
if ($indexfail -lt $failSection.Count() - 1) {
|
||||||
|
$nextfailaction = $failSection.item($indexfail + 1)
|
||||||
|
}
|
||||||
|
$EmailNotifications_Actions = GetEmailNotificationNextAction -Action $nextfailaction
|
||||||
|
$EmailNotifications_FailedActions = ""
|
||||||
|
$results += ExportPGPAction -sitename $SiteName -objEvent $objEvent -Trigger $Trigger -action $failaction -EmailNotifications_Actions $EmailNotifications_Actions -EmailNotifications_FailedActions $EmailNotifications_FailedActions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$MailAction = 2
|
||||||
|
$PGPAction = 32
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
$PgpKeyRing = @()
|
||||||
|
$AvaliablePgpKeys = $script:EftServer.AvailablePGPKeys
|
||||||
|
$totalKeys = $AvaliablePgpKeys.Length
|
||||||
|
for ($k = 0; $k -le $totalKeys - 1; $k++) {
|
||||||
|
$keyinfo = $AvaliablePgpKeys.GetValue($k);
|
||||||
|
Write-Progress -Activity "Loading PGP Keyring" -status " $k/$totalKeys" -percentComplete ($k / $totalKeys * 100)
|
||||||
|
$PgpKeyRing += new-object psobject -Property @{
|
||||||
|
ID = $keyinfo.ID;
|
||||||
|
Name = $keyinfo.Name;
|
||||||
|
Description = $keyinfo.Description;
|
||||||
|
Size = $keyinfo.Size;
|
||||||
|
CreationDate = $keyinfo.CreationDate;
|
||||||
|
NeverExpires = $keyinfo.NeverExpires;
|
||||||
|
ExpirationDate = $keyinfo.ExpirationDate;
|
||||||
|
IsPrivate = $keyinfo.Private;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.Name)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$Trigger = $eventType.Name
|
||||||
|
|
||||||
|
$totalStatements = $objEvent.StatementsCount()
|
||||||
|
for ($index = 0; $index -le $totalStatements - 1 ; $index++) {
|
||||||
|
$statement = $objEvent.statement($index)
|
||||||
|
|
||||||
|
if ($statement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$actionStatement = $statement
|
||||||
|
|
||||||
|
$nextstatement = $null
|
||||||
|
if ($index -lt $totalStatements - 1) {
|
||||||
|
$nextstatement = $objEvent.statement($index + 1)
|
||||||
|
}
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -Trigger $Trigger -objEvent $objEvent -ActionStatement $actionStatement -nextActionStatement $nextstatement
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# statement is ConditionStatement
|
||||||
|
$ifActions = $statement.IfSection # CIActionStatements
|
||||||
|
$elseActions = $statement.ElseSection # CIActionStatements
|
||||||
|
#Actions in If section
|
||||||
|
if ($null -ne $ifActions ) {
|
||||||
|
for ($indexAction = 0; $indexAction -le $ifActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $ifActions.item($indexAction)
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
|
||||||
|
$nextstatement = $null
|
||||||
|
if ($null -ne $ifActions -and $indexAction -lt $ifActions.Count() - 1) {
|
||||||
|
$nextstatement = $ifActions.Item($indexAction + 1)
|
||||||
|
}
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -Trigger $Trigger -objEvent $objEvent -ActionStatement $actionStatement -nextActionStatement $nextstatement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Actions in Else section
|
||||||
|
if ($null -ne $elseActions ) {
|
||||||
|
for ($indexAction = 0; $indexAction -le $elseActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $elseActions.item($indexAction)
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
|
||||||
|
$nextstatement = $null
|
||||||
|
if ($indexAction -lt $ifActions.Count() - 1) {
|
||||||
|
$nextstatement = $ifActions.Item($index + 1)
|
||||||
|
}
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -Trigger $Trigger -objEvent $objEvent -ActionStatement $actionStatement -nextActionStatement $nextstatement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# $results += new-object psobject -Property @{
|
||||||
|
# SiteName = $siteName; EventRuleName = $EventRuleName; Trigger = $eventType.Name; Enabled = $Enabled; Comments = $Comments;
|
||||||
|
# EmailNotifications_Actions = $EmailNotifications_Actions; EmailNotifications_FailedActions = $EmailNotifications_FailedActions;
|
||||||
|
# PGP_Key_Name = $PGP_Key_Name; PGP_Description = $PGP_Description; PGP_Size = $PGP_Size;
|
||||||
|
# PGP_Key_Expiration = $PGP_Key_Expiration; PGP_Fingerprint = $PGP_Fingerprint; PGP_CreatedOn = $PGP_CreatedOn;
|
||||||
|
# CheckSum = "";
|
||||||
|
# }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,289 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Folder Monitor Paths")]
|
||||||
|
[switch] $ValidatePath
|
||||||
|
)
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.type)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
$FM_Path = ""
|
||||||
|
$FM_CheckHealthInterval = ""
|
||||||
|
$FM_CheckHealth = ""
|
||||||
|
$FM_IncludeSubfolders = ""
|
||||||
|
$FM_UseAlternateCredentials = ""
|
||||||
|
$FM_UserName = ""
|
||||||
|
$FM_Password = ""
|
||||||
|
$FM_UseFileSystemNotifications = ""
|
||||||
|
$FM_UsePeriodicDirectoryPoll = ""
|
||||||
|
$FM_PollIntervalSeconds = ""
|
||||||
|
$FM_ArchiveSubFolderName = ""
|
||||||
|
$FM_UseInteractiveLogon = ""
|
||||||
|
$FM_ArchiveLeftovers = ""
|
||||||
|
$FM_AddTimestampToArchivedFileNames = ""
|
||||||
|
$FM_PollIntervalType = ""
|
||||||
|
$FM_PollInterval = ""
|
||||||
|
|
||||||
|
$HA_SchedulingParams = ""
|
||||||
|
$HA_SchedulingBackupParams = ""
|
||||||
|
|
||||||
|
$SCH_DailyEveryWeekDay = ""
|
||||||
|
$SCH_DailyDayPeriod = ""
|
||||||
|
$SCH_WeeklyWeekPeriod = ""
|
||||||
|
$SCH_WeeklySunday = ""
|
||||||
|
$SCH_WeeklyMonday = ""
|
||||||
|
$SCH_WeeklyTuesday = ""
|
||||||
|
$SCH_WeeklyWednesday = ""
|
||||||
|
$SCH_WeeklyThursday = ""
|
||||||
|
$SCH_WeeklyFriday = ""
|
||||||
|
$SCH_WeeklySaturday = ""
|
||||||
|
$SCH_MonthlyFixedDay = ""
|
||||||
|
$SCH_MonthlyDayPeriod = ""
|
||||||
|
$SCH_MonthlyMonthPeriod = ""
|
||||||
|
$SCH_MonthlyRelativeWeekday = ""
|
||||||
|
$SCH_MonthlyWeekday = ""
|
||||||
|
$SCH_YearlyFixedDay = ""
|
||||||
|
$SCH_YearlyMonth = ""
|
||||||
|
$SCH_YearlyDayPeriod = ""
|
||||||
|
$SCH_YearlyRelativeWeekday = ""
|
||||||
|
$SCH_YearlyWeekday = ""
|
||||||
|
$SCH_RepeatPattern = ""
|
||||||
|
$SCH_RepeatRate = ""
|
||||||
|
$SCH_RepeatEnabled = ""
|
||||||
|
$SCH_DateTimeEnd = ""
|
||||||
|
$SCH_TimeEndEnabled = ""
|
||||||
|
$SCH_DateEndEnabled = ""
|
||||||
|
$SCH_RundayCalendar = ""
|
||||||
|
$SCH_HolidayCalendar = ""
|
||||||
|
$SCH_NextRun = ""
|
||||||
|
$SCH_Recurrence = ""
|
||||||
|
$SCH_DateTimeStart = ""
|
||||||
|
$Validpath = ""
|
||||||
|
if ($eventType.Name -eq "Folder Monitor") {
|
||||||
|
|
||||||
|
$FM_Path = $objParams.Path
|
||||||
|
if ($ValidatePath) {
|
||||||
|
try {
|
||||||
|
if (Test-Path $FM_Path) {
|
||||||
|
$Validpath = "OK"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$Validpath = "FOLDER_NOT_FOUND"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$Validpath = "ERROR: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {$FM_CheckHealthInterval = $objParams.CheckHealthInterval} catch {}
|
||||||
|
try {$FM_CheckHealth = $objParams.CheckHealth} catch {}
|
||||||
|
try {$FM_IncludeSubfolders = $objParams.IncludeSubfolders} catch {}
|
||||||
|
try {$FM_UseAlternateCredentials = $objParams.UseAlternateCredentials} catch {}
|
||||||
|
try {$FM_UserName = $objParams.UserName} catch {}
|
||||||
|
try {$FM_Password = $objParams.Password} catch {}
|
||||||
|
try {$FM_UseFileSystemNotifications = $objParams.UseFileSystemNotifications} catch {}
|
||||||
|
try {$FM_UsePeriodicDirectoryPoll = $objParams.UsePeriodicDirectoryPoll} catch {}
|
||||||
|
try {$FM_PollIntervalSeconds = $objParams.PollIntervalSeconds } catch {}
|
||||||
|
try {$FM_ArchiveSubFolderName = $objParams.ArchiveSubFolderName } catch {}
|
||||||
|
try {$FM_UseInteractiveLogon = $objParams.UseInteractiveLogon } catch {}
|
||||||
|
try {$FM_ArchiveLeftovers = $objParams.ArchiveLeftovers} catch {}
|
||||||
|
try {$FM_AddTimestampToArchivedFileNames = $objParams.AddTimestampToArchivedFileNames} catch {}
|
||||||
|
try {$FM_PollIntervalType = $objParams.PollIntervalType } catch {}
|
||||||
|
try {$FM_PollInterval = $objParams.PollInterval } catch {}
|
||||||
|
}
|
||||||
|
if ($eventType.Name -eq "Scheduler (Timer) Event") {
|
||||||
|
try {$SCH_DailyEveryWeekDay = $objParams.DailyEveryWeekDay} catch {}
|
||||||
|
try {$SCH_DailyDayPeriod = $objParams.DailyDayPeriod} catch {}
|
||||||
|
try {$SCH_WeeklyWeekPeriod = $objParams.WeeklyWeekPeriod} catch {}
|
||||||
|
try {$SCH_WeeklySunday = $objParams.WeeklySunday} catch {}
|
||||||
|
try {$SCH_WeeklyMonday = $objParams.WeeklyMonday} catch {}
|
||||||
|
try {$SCH_WeeklyTuesday = $objParams.WeeklyTuesday} catch {}
|
||||||
|
try {$SCH_WeeklyWednesday = $objParams.WeeklyWednesday} catch {}
|
||||||
|
try {$SCH_WeeklyThursday = $objParams.WeeklyThursday} catch {}
|
||||||
|
try {$SCH_WeeklyFriday = $objParams.WeeklyFriday } catch {}
|
||||||
|
try {$SCH_WeeklySaturday = $objParams.WeeklySaturday } catch {}
|
||||||
|
try {$SCH_MonthlyFixedDay = $objParams.MonthlyFixedDay } catch {}
|
||||||
|
try {$SCH_MonthlyDayPeriod = $objParams.MonthlyDayPeriod} catch {}
|
||||||
|
try {$SCH_MonthlyMonthPeriod = $objParams.MonthlyMonthPeriod} catch {}
|
||||||
|
try {$SCH_MonthlyRelativeWeekday = $objParams.MonthlyRelativeWeekday } catch {}
|
||||||
|
try {$SCH_MonthlyWeekday = $objParams.MonthlyWeekday } catch {}
|
||||||
|
try {$SCH_YearlyFixedDay = $objParams.YearlyFixedDay } catch {}
|
||||||
|
try {$SCH_YearlyMonth = $objParams.YearlyMonth } catch {}
|
||||||
|
try {$SCH_YearlyDayPeriod = $objParams.YearlyDayPeriod } catch {}
|
||||||
|
try {$SCH_YearlyRelativeWeekday = $objParams.YearlyRelativeWeekday } catch {}
|
||||||
|
try {$SCH_YearlyWeekday = $objParams.YearlyWeekday } catch {}
|
||||||
|
try {$SCH_RepeatPattern = $objParams.RepeatPattern } catch {}
|
||||||
|
try {$SCH_RepeatRate = $objParams.RepeatRate } catch {}
|
||||||
|
try {$SCH_RepeatEnabled = $objParams.RepeatEnabled } catch {}
|
||||||
|
try {$SCH_DateTimeEnd = $objParams.DateTimeEnd } catch {}
|
||||||
|
try {$SCH_TimeEndEnabled = $objParams.TimeEndEnabled } catch {}
|
||||||
|
try {$SCH_DateEndEnabled = $objParams.DateEndEnabled } catch {}
|
||||||
|
try {$SCH_RundayCalendar = $objParams.RundayCalendar } catch {}
|
||||||
|
try {$SCH_HolidayCalendar = $objParams.HolidayCalendar } catch {}
|
||||||
|
try {$SCH_NextRun = $objParams.NextRun } catch {}
|
||||||
|
try {$SCH_Recurrence = $objParams.Recurrence } catch {}
|
||||||
|
try {$SCH_DateTimeStart = $objParams.DateTimeStart } catch {}
|
||||||
|
}
|
||||||
|
if($script:EftServer.HAEnabled){
|
||||||
|
$EFTHAParams = $objEvent.GetHASchedulingParams()
|
||||||
|
$EFTHABackupParams = $objEvent.GetHABackupSchedulingParams()
|
||||||
|
for ($i=0;$i -lt $EFTHAParams.Count();$i++){
|
||||||
|
$HA_SchedulingParams += "$($EFTHAParams.Item($i)),"
|
||||||
|
}
|
||||||
|
for ($i=0;$i -lt $EFTHABackupParams.Count();$i++){
|
||||||
|
$HA_SchedulingBackupParams += "$($EFTHABackupParams.Item($i)),"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName;
|
||||||
|
EventRuleName = $objParams.name;
|
||||||
|
Trigger = $eventType.Name;
|
||||||
|
Enabled = $objParams.Enabled;
|
||||||
|
Validpath = $Validpath
|
||||||
|
|
||||||
|
FM_Path = $FM_Path;
|
||||||
|
FM_CheckHealthInterval = $FM_CheckHealthInterval;
|
||||||
|
FM_CheckHealth = $FM_CheckHealth;
|
||||||
|
FM_IncludeSubfolders = $FM_IncludeSubfolders;
|
||||||
|
FM_UseAlternateCredentials = $FM_UseAlternateCredentials;
|
||||||
|
FM_UserName = $FM_UserName;
|
||||||
|
FM_Password = $FM_Password;
|
||||||
|
FM_UseFileSystemNotifications = $FM_UseFileSystemNotifications;
|
||||||
|
FM_UsePeriodicDirectoryPoll = $FM_UsePeriodicDirectoryPoll;
|
||||||
|
FM_PollIntervalSeconds = $FM_PollIntervalSeconds;
|
||||||
|
FM_ArchiveSubFolderName = $FM_ArchiveSubFolderName;
|
||||||
|
FM_UseInteractiveLogon = $FM_UseInteractiveLogon;
|
||||||
|
FM_ArchiveLeftovers = $FM_ArchiveLeftovers;
|
||||||
|
FM_AddTimestampToArchivedFileNames = $FM_AddTimestampToArchivedFileNames;
|
||||||
|
FM_PollIntervalType = $FM_PollIntervalType;
|
||||||
|
FM_PollInterval = $FM_PollInterval;
|
||||||
|
|
||||||
|
SCH_DailyEveryWeekDay = $SCH_DailyEveryWeekDay
|
||||||
|
SCH_DailyDayPeriod = $SCH_DailyDayPeriod
|
||||||
|
SCH_WeeklyWeekPeriod = $SCH_WeeklyWeekPeriod
|
||||||
|
SCH_WeeklySunday = $SCH_WeeklySunday
|
||||||
|
SCH_WeeklyMonday = $SCH_WeeklyMonday
|
||||||
|
SCH_WeeklyTuesday = $SCH_WeeklyTuesday
|
||||||
|
SCH_WeeklyWednesday = $SCH_WeeklyWednesday
|
||||||
|
SCH_WeeklyThursday = $SCH_WeeklyThursday
|
||||||
|
SCH_WeeklyFriday = $SCH_WeeklyFriday
|
||||||
|
SCH_WeeklySaturday = $SCH_WeeklySaturday
|
||||||
|
SCH_MonthlyFixedDay = $SCH_MonthlyFixedDay
|
||||||
|
SCH_MonthlyDayPeriod = $SCH_MonthlyDayPeriod
|
||||||
|
SCH_MonthlyMonthPeriod = $SCH_MonthlyMonthPeriod
|
||||||
|
SCH_MonthlyRelativeWeekday = $SCH_MonthlyRelativeWeekday
|
||||||
|
SCH_MonthlyWeekday = $SCH_MonthlyWeekday
|
||||||
|
SCH_YearlyFixedDay = $SCH_YearlyFixedDay
|
||||||
|
SCH_YearlyMonth = $SCH_YearlyMonth
|
||||||
|
SCH_YearlyDayPeriod = $SCH_YearlyDayPeriod
|
||||||
|
SCH_YearlyRelativeWeekday = $SCH_YearlyRelativeWeekday
|
||||||
|
SCH_YearlyWeekday = $SCH_YearlyWeekday
|
||||||
|
SCH_RepeatPattern = $SCH_RepeatPattern
|
||||||
|
SCH_RepeatRate = $SCH_RepeatRate
|
||||||
|
SCH_RepeatEnabled = $SCH_RepeatEnabled
|
||||||
|
SCH_DateTimeEnd = $SCH_DateTimeEnd
|
||||||
|
SCH_TimeEndEnabled = $SCH_TimeEndEnabled
|
||||||
|
SCH_DateEndEnabled = $SCH_DateEndEnabled
|
||||||
|
SCH_RundayCalendar = $SCH_RundayCalendar
|
||||||
|
SCH_HolidayCalendar = $SCH_HolidayCalendar
|
||||||
|
SCH_NextRun = $SCH_NextRun
|
||||||
|
SCH_Recurrence = $SCH_Recurrence
|
||||||
|
SCH_DateTimeStart = $SCH_DateTimeStart
|
||||||
|
|
||||||
|
HA_SchedulingParams = $HA_SchedulingParams;
|
||||||
|
HA_SchedulingBackupParams = $HA_SchedulingBackupParams;
|
||||||
|
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, SCH_NextRun, Validpath, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,797 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Exports Paths used in event rules actions.
|
||||||
|
.DESCRIPTION
|
||||||
|
This script return paths used in event rules actions for all or a specific EFT site
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-PathsInActions.ps1 | Export-Csv .\PathsInActions_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export all Paths in actions in the event rules for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in localhost using port 1100 and using
|
||||||
|
the current windows login credentials
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.EventRules.Export-PathsInActions.ps1 -EFTAdminHostName 127.0.0.1 -EFTAdminPort 1100 -EFTAdminAuthType 0 -EFTAdminUsername myusername -Password Mypassword | Export-Csv .\PathsInActions_Report.csv -NoTypeInformation
|
||||||
|
|
||||||
|
Export all Paths in actions in the event rules for all sites into a CSV file
|
||||||
|
This commands will connect to an EFT server listening in 127.0.0.1 using port 1100 and using EFT Admin credentials myusername/mypassword
|
||||||
|
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Paths")]
|
||||||
|
[switch] $ValidatePath
|
||||||
|
|
||||||
|
)
|
||||||
|
function GetValue($value) {
|
||||||
|
if ($value -is [array]) {
|
||||||
|
return $value -join "|"
|
||||||
|
}
|
||||||
|
return $value
|
||||||
|
}
|
||||||
|
Function GetPropertyName ($EventProperty) {
|
||||||
|
switch ($EventProperty) {
|
||||||
|
1003 { return "ServerLogOldPath"}
|
||||||
|
1004 { return "ServerLogNewPath"}
|
||||||
|
1006 { return "ServerLogFolder"}
|
||||||
|
3006 { return "HttpQueryString"}
|
||||||
|
3007 { return "HttpHeadersList"}
|
||||||
|
5000 { return "VirtualPath"}
|
||||||
|
5001 { return "PhysicalPath"}
|
||||||
|
5003 { return "DestinationPhysicalPath"}
|
||||||
|
5004 { return "FolderName"}
|
||||||
|
5005 { return "FileName"}
|
||||||
|
5006 { return "DestinationFolderName"}
|
||||||
|
5007 { return "DestinationFileName"}
|
||||||
|
5013 { return "ReportPath"}
|
||||||
|
5015 { return "ReportFileName"}
|
||||||
|
5016 { return "VirtualFolderName"}
|
||||||
|
5017 { return "BaseFileName"}
|
||||||
|
5018 { return "FileFolderExists"}
|
||||||
|
5019 { return "CompressedPhysicalPath"}
|
||||||
|
5020 { return "CompressedFileName"}
|
||||||
|
5021 { return "CompressedBaseFileName"}
|
||||||
|
7000 { return "WSVirtualPath"}
|
||||||
|
7001 { return "WSPhysicalPath"}
|
||||||
|
8000 { return "ContextVariable"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Function GetOperationName ($Operation) {
|
||||||
|
switch ($Operation) {
|
||||||
|
0 { return "Encrypt"}
|
||||||
|
1 { return "EncryptAndSign"}
|
||||||
|
2 { return "Sign"}
|
||||||
|
3 { return "SDA"}
|
||||||
|
4 { return "Decrypt"}
|
||||||
|
5 { return "DecryptAndVerify"}
|
||||||
|
6 { return "VerifyOnly"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Function GetActionName ($EventActionType) {
|
||||||
|
switch ($EventActionType) {
|
||||||
|
1 { return "CommandAction"}
|
||||||
|
2 { return "MailAction"}
|
||||||
|
4 { return "UploadAction"}
|
||||||
|
8 { return "DownloadAction"}
|
||||||
|
32 { return "PGPAction"}
|
||||||
|
64 { return "StopAction"}
|
||||||
|
128 { return "CleanupAction"}
|
||||||
|
256 { return "ReportAction"}
|
||||||
|
512 { return "AS2SendAction"}
|
||||||
|
1024 { return "AWTaskAction"}
|
||||||
|
2048 { return "BackupAction"}
|
||||||
|
4096 { return "WindowsEventLog"}
|
||||||
|
8192 { return "ContentIntegrityControl"}
|
||||||
|
16384 { return "FolderAction"}
|
||||||
|
32768 { return "FileAction"}
|
||||||
|
65536 { return "CompressAction"}
|
||||||
|
262144 { return "WebServiceAction"}
|
||||||
|
524288 { return "CloudUploadAction"}
|
||||||
|
1048576 { return "CloudDownloadAction"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function ValidatePath ($path){
|
||||||
|
$Validpath = ""
|
||||||
|
if ($ValidatePath -and $null -ne $path -and $path -ne '') {
|
||||||
|
try {
|
||||||
|
if (Test-Path $path) {
|
||||||
|
$Validpath = "OK"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$Validpath = "PATH_NOT_FOUND"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$Validpath = "ERROR: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Validpath
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExportPathInAction ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionPosition, $IsElse, $action, $IsFailAction, $FailActionPosition) {
|
||||||
|
$objParams = $EventRule.GetParams()
|
||||||
|
$actionParams = $action.GetParams()
|
||||||
|
$results = @()
|
||||||
|
|
||||||
|
switch ($action.type) {
|
||||||
|
$PGPACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "FilePath"
|
||||||
|
ActionValue = $actionParams.FilePath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.FilePath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$COMMANDACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "WorkingFolder"
|
||||||
|
ActionValue = $actionParams.WorkingFolder;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.WorkingFolder);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Parameters"
|
||||||
|
ActionValue = $actionParams.Parameters;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.Parameters);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$UPLOADACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "LocalPath"
|
||||||
|
ActionValue = $actionParams.LocalPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.LocalPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "RemotePath"
|
||||||
|
ActionValue = $actionParams.RemotePath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.RemotePath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
Line = $script:Line;
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "PrivateKeyPath"
|
||||||
|
ActionValue = $actionParams.PrivateKeyPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.PrivateKeyPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "PublicKeyPath"
|
||||||
|
ActionValue = $actionParams.PublicKeyPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.PublicKeyPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "TrustedPublicKeyPath"
|
||||||
|
ActionValue = $actionParams.TrustedPublicKeyPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.TrustedPublicKeyPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$DOWNLOADACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "LocalPath"
|
||||||
|
ActionValue = $actionParams.LocalPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.LocalPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "RemotePath"
|
||||||
|
ActionValue = $actionParams.RemotePath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.RemotePath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "PrivateKeyPath"
|
||||||
|
ActionValue = $actionParams.PrivateKeyPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.PrivateKeyPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "PublicKeyPath"
|
||||||
|
ActionValue = $actionParams.PublicKeyPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.PublicKeyPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "TrustedPublicKeyPath"
|
||||||
|
ActionValue = $actionParams.TrustedPublicKeyPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.TrustedPublicKeyPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$CLEANUPACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Folder"
|
||||||
|
ActionValue = $actionParams.Folder;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.Folder);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$AS2SENDACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "LocalPath"
|
||||||
|
ActionValue = $actionParams.LocalPath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.LocalPath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "RemotePath"
|
||||||
|
ActionValue = $actionParams.RemotePath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.RemotePath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "PartnerCertificatePath"
|
||||||
|
ActionValue = $actionParams.PartnerCertificatePath;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.PartnerCertificatePath);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$BACKUPACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Folder"
|
||||||
|
ActionValue = $actionParams.Folder;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.Folder);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$CONTENTINTEGRITYCONTROL {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "File"
|
||||||
|
ActionValue = $actionParams.File;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.File);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$CONTENTINTEGRITYCONTROL {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "File"
|
||||||
|
ActionValue = $actionParams.File;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.File);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$FOLDERACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Path"
|
||||||
|
ActionValue = $actionParams.Path;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.Path);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "NewFolderName"
|
||||||
|
ActionValue = $actionParams.NewFolderName;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath( $actionParams.NewFolderName);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$FILEACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Path"
|
||||||
|
ActionValue = $actionParams.Path;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.Path);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$COMPRESSACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Source"
|
||||||
|
ActionValue = $actionParams.Source;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.Source);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "Destination"
|
||||||
|
ActionValue = $actionParams.Destination;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.Destination);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$WEBSERVICEACTION {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "BodyFile"
|
||||||
|
ActionValue = $actionParams.BodyFile;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.BodyFile);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "ResponseFile"
|
||||||
|
ActionValue = $actionParams.ResponseFile;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.ResponseFile);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "SslClientCertificate"
|
||||||
|
ActionValue = $actionParams.SslClientCertificate;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.SslClientCertificate);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "SslPrivateKey"
|
||||||
|
ActionValue = $actionParams.SslPrivateKey;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.SslPrivateKey);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = $ActionPosition ;
|
||||||
|
IsElse = $IsElse;
|
||||||
|
ActionName = GetActionName($action.type);
|
||||||
|
ActionParameter = "SslServerCertificate"
|
||||||
|
ActionValue = $actionParams.SslServerCertificate;
|
||||||
|
IsFailAction = $IsFailAction;
|
||||||
|
FailActionPosition = $FailActionPosition;
|
||||||
|
Validpath = ValidatePath($actionParams.SslServerCertificate);
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$CLOUDUPLOADACTION {
|
||||||
|
|
||||||
|
}
|
||||||
|
$CLOUDDOWNLOADACTION {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
function ProcessConditionStatement ($SiteName, $EventRule, $Trigger, $StatementPosition, $SimpleCondition ) {
|
||||||
|
$results = @()
|
||||||
|
$objParams = $EventRule.GetParams()
|
||||||
|
if (GetPropertyName($SimpleCondition.property) -ne "") {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName; EventRuleName = $objParams.name; Trigger = $Trigger; Enabled = $objParams.Enabled;
|
||||||
|
Line = $script:Line;
|
||||||
|
StatementPosition = $StatementPosition;
|
||||||
|
ActionPosition = "" ;
|
||||||
|
IsElse = "";
|
||||||
|
ActionName = "IFCondition"
|
||||||
|
ActionParameter = GetPropertyName($SimpleCondition.property);
|
||||||
|
ActionValue = GetValue($SimpleCondition.Value);
|
||||||
|
IsFailAction = "";
|
||||||
|
FailActionPosition = "";
|
||||||
|
Validpath = "";
|
||||||
|
CheckSum = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
}
|
||||||
|
function ProcessActionStatement ($SiteName, $EventRule, $Trigger, $StatementPosition, $ActionStatement , $ActionPosition, $IsElse) {
|
||||||
|
#$objParams = $EventRule.GetParams()
|
||||||
|
$action = $ActionStatement.Action()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
$results += ExportPathInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $action -IsElse $IsElse -IsFailAction 0 -FailActionPosition 0
|
||||||
|
|
||||||
|
#process additional Actions in the Fail Section
|
||||||
|
$failSection = $ActionStatement.FailSection()
|
||||||
|
# Fail Action Section
|
||||||
|
if ($null -ne $failSection) {
|
||||||
|
for ($indexfail = 0; $indexfail -le $failSection.Count() - 1 ; $indexfail++ ) {
|
||||||
|
$failaction = $failSection.item($indexfail)
|
||||||
|
$script:Line++
|
||||||
|
$results += ExportPathInAction -SiteName $SiteName -EventRule $EventRule -Trigger $Trigger -StatementPosition $StatementPosition -ActionPosition $ActionPosition -action $failaction -IsElse $IsElse -IsFailAction 1 -FailActionPosition $indexfail
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:Line = 0
|
||||||
|
|
||||||
|
$COMMANDACTION = 1
|
||||||
|
$MAILACTION = 2
|
||||||
|
$UPLOADACTION = 4
|
||||||
|
$DOWNLOADACTION = 8
|
||||||
|
$PGPACTION = 32
|
||||||
|
$STOPACTION = 64
|
||||||
|
$CLEANUPACTION = 128
|
||||||
|
$REPORTACTION = 256
|
||||||
|
$AS2SENDACTION = 512
|
||||||
|
$AWTASKACTION = 1024
|
||||||
|
$BACKUPACTION = 2048
|
||||||
|
$WINDOWSEVENTLOG = 4096
|
||||||
|
$CONTENTINTEGRITYCONTROL = 8192
|
||||||
|
$FOLDERACTION = 16384
|
||||||
|
$FILEACTION = 32768
|
||||||
|
$COMPRESSACTION = 65536
|
||||||
|
$WEBSERVICEACTION = 262144
|
||||||
|
$CLOUDUPLOADACTION = 524288
|
||||||
|
$CLOUDDOWNLOADACTION = 1048576
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.Name)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$Trigger = $eventType.Name
|
||||||
|
|
||||||
|
$totalStatements = $objEvent.StatementsCount()
|
||||||
|
$script:Line = 0
|
||||||
|
for ($StatementPosition = 0; $StatementPosition -le $totalStatements - 1 ; $StatementPosition++) {
|
||||||
|
$statement = $objEvent.statement($StatementPosition)
|
||||||
|
if ($statement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$actionStatement = $statement
|
||||||
|
$script:Line++
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition 0 -IsElse 0
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ConditionStatement = $statement.Condition
|
||||||
|
$script:Line++
|
||||||
|
if ($ConditionStatement.Operator -eq 0 -or $ConditionStatement.Operator -eq 1 ) {
|
||||||
|
#Compound condition
|
||||||
|
for ($conditionindex = 0; $conditionindex -le $ConditionStatement.Count() - 1; $conditionindex++) {
|
||||||
|
$simplecondition = $ConditionStatement.Item($conditionindex);
|
||||||
|
$results += ProcessConditionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -StatementPosition $StatementPosition -SimpleCondition $SimpleCondition
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#simple condition
|
||||||
|
$simplecondition = $statement.Condition
|
||||||
|
$results += ProcessConditionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -StatementPosition $StatementPosition -SimpleCondition $SimpleCondition
|
||||||
|
}
|
||||||
|
# statement is ConditionStatement
|
||||||
|
$ifActions = $statement.IfSection # CIActionStatements
|
||||||
|
$elseActions = $statement.ElseSection # CIActionStatements
|
||||||
|
#Actions in If section
|
||||||
|
if ($null -ne $ifActions ) {
|
||||||
|
|
||||||
|
for ($indexAction = 0; $indexAction -le $ifActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $ifActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Actions in Else section
|
||||||
|
if ($null -ne $elseActions ) {
|
||||||
|
$script:Line++
|
||||||
|
for ($indexAction = 0; $indexAction -le $elseActions.Count() - 1 ; $indexAction++ ) {
|
||||||
|
#process Action statement
|
||||||
|
$actionStatement = $elseActions.item($indexAction)
|
||||||
|
$script:Line++
|
||||||
|
if ($actionStatement.type -eq 0) {
|
||||||
|
# statement is ActionStatement
|
||||||
|
$results += ProcessActionStatement -sitename $SiteName -EventRule $objEvent -Trigger $Trigger -ActionStatement $actionStatement -StatementPosition $StatementPosition -ActionPosition $indexAction -IsElse 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# $results += new-object psobject -Property @{
|
||||||
|
# SiteName = $siteName; EventRuleName = $EventRuleName; Trigger = $eventType.Name; Enabled = $Enabled; Comments = $Comments;
|
||||||
|
# EmailNotifications_Actions = $EmailNotifications_Actions; EmailNotifications_FailedActions = $EmailNotifications_FailedActions;
|
||||||
|
# PGP_Key_Name = $PGP_Key_Name; PGP_Description = $PGP_Description; PGP_Size = $PGP_Size;
|
||||||
|
# PGP_Key_Expiration = $PGP_Key_Expiration; PGP_Fingerprint = $PGP_Fingerprint; PGP_CreatedOn = $PGP_CreatedOn;
|
||||||
|
# CheckSum = "";
|
||||||
|
# }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,91 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
)
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "$($eventType.type)" -percentComplete -1
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
If ($erules) {
|
||||||
|
If ($eRules.Count() -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -lt $eRules.Count(); $iRule++) {
|
||||||
|
Write-Progress -Activity "Processing Event Rules" -status "Event Rule $iRule/$($eRules.Count())" -percentComplete ($iRule / $eRules.Count() * 100)
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName;
|
||||||
|
EventRuleName = $objParams.name;
|
||||||
|
Trigger = $eventType.Name;
|
||||||
|
Enabled = $objParams.Enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results | Sort-Object SiteName, Trigger, EventRuleName
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,159 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the event rules Paramaters CSV file")]
|
||||||
|
[string] $InputCsvFile = "ev.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
if ($InputCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
$EventRulesList = @(
|
||||||
|
# @{ SiteName = "MySite"; Enabled = "False"; EventRuleName = "Event Rule 1"; Trigger = "File Downloaded" }
|
||||||
|
# @{ SiteName = "MySite"; Enabled = "True" ; EventRuleName = "Event Rule 2" Trigger = "File Uploaded" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EventRulesList = Import-Csv $InputCsvFile
|
||||||
|
# "SiteName","Enabled", "EventRuleName,Trigger"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE = "MX Error: 100 (00000064)"
|
||||||
|
$MXE_EVENTRULE_NOT_FOUND = "MX Error: 89 (00000059)"
|
||||||
|
$MXE_EVENTRULE_CHANGEDESC_MISSING = "MX Error: 90 (0000005A)"
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST = "MX Error: 106 (0000006A)"
|
||||||
|
$MXE_EVENT_COMMAND_DOES_NOT_EXIST = "MX Error: 107 (0000006B)"
|
||||||
|
$MXE_EVENT_PGP_PASS_INVALID = "MX Error: 54 (00000036)"
|
||||||
|
$MXE_EVENT_INVALID = "MX Error: 43 (0000002B)"
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Removing event rules"
|
||||||
|
$removedCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
|
||||||
|
ForEach ($EventRuleItem in $EventRulesList) {
|
||||||
|
$count = $count + 1
|
||||||
|
$processed = $false
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EventRuleItem.SiteName])
|
||||||
|
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
$EventCount = $eRules.Count()
|
||||||
|
If ($erules) {
|
||||||
|
If ($EventCount -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -le $EventCount - 1; $iRule++) {
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
$eventNameParam = $objParams.name
|
||||||
|
$chkName = $eventNameParam + ">" + $EventName
|
||||||
|
Write-Verbose $chkName
|
||||||
|
If ($eventNameParam -eq $EventRuleItem.EventRuleName) {
|
||||||
|
try {
|
||||||
|
Write-Host "Removed: [$($EventRuleItem.SiteName)] [$($EventRuleItem.EventRuleName)] $originalState->$($EventRuleItem.Enabled)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
if ($pscmdlet.ShouldProcess($EventRuleItem.EventRuleName, "deleted" )) {
|
||||||
|
$eRules.Delete($iRule)
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$removedCount++
|
||||||
|
break
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_EVENTRULE_NOT_FOUND { Write-host "MXE_EVENTRULE_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE { Write-host "MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENTRULE_CHANGEDESC_MISSING { Write-host "MXE_EVENTRULE_CHANGEDESC_MISSING : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST { Write-host "MXE_EVENT_AW_TASK_DOES_NOT_EXIST : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_COMMAND_DOES_NOT_EXIST { Write-host "MXE_EVENT_COMMAND_DOES_NOT_EXIST : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_PGP_PASS_INVALID { Write-host "MXE_EVENT_PGP_PASS_INVALID : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_INVALID { Write-host "MXE_EVENT_INVALID : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($processed) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($processed) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Removed: " -NoNewline
|
||||||
|
Write-host "$removedCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,171 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the CSV file ")]
|
||||||
|
[string] $InputCsvFile = "EventRules_EnableState.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
if ($InputCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
$EventRulesList = @(
|
||||||
|
# @{ SiteName = "MySite"; Enabled = "False"; EventRuleName = "Event Rule 1"; Trigger = "File Downloaded" }
|
||||||
|
# @{ SiteName = "MySite"; Enabled = "True" ; EventRuleName = "Event Rule 2" Trigger = "File Uploaded" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EventRulesList = Import-Csv $InputCsvFile
|
||||||
|
# "SiteName","Enabled", "EventRuleName"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE = "MX Error: 100 (00000064)"
|
||||||
|
$MXE_EVENTRULE_NOT_FOUND = "MX Error: 89 (00000059)"
|
||||||
|
$MXE_EVENTRULE_CHANGEDESC_MISSING = "MX Error: 90 (0000005A)"
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST = "MX Error: 106 (0000006A)"
|
||||||
|
$MXE_EVENT_COMMAND_DOES_NOT_EXIST = "MX Error: 107 (0000006B)"
|
||||||
|
$MXE_EVENT_PGP_PASS_INVALID = "MX Error: 54 (00000036)"
|
||||||
|
$MXE_EVENT_INVALID = "MX Error: 43 (0000002B)"
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{ }
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Updating event rule enabled state"
|
||||||
|
$updateCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
$processed = 0
|
||||||
|
if ($EventRulesList.Count -ne 0 ) {
|
||||||
|
ForEach ($EventRuleItem in $EventRulesList) {
|
||||||
|
$count = $count + 1
|
||||||
|
$processed = $false
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
Write-Verbose "Site: $($EventRuleItem.SiteName)"
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EventRuleItem.SiteName])
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
$EventCount = $eRules.Count()
|
||||||
|
If ($erules) {
|
||||||
|
If ($EventCount -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -le $EventCount - 1; $iRule++) {
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
$eventNameParam = $objParams.name
|
||||||
|
$chkName = $eventNameParam + ">" + $EventName
|
||||||
|
Write-Verbose $chkName
|
||||||
|
If ($eventNameParam -eq $EventRuleItem.EventRuleName) {
|
||||||
|
$originalState = "$($objParams.Enabled)"
|
||||||
|
try {
|
||||||
|
Write-Host "Update: [$($EventRuleItem.SiteName)] [$($EventRuleItem.EventRuleName)] $originalState->$($EventRuleItem.Enabled)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
|
||||||
|
if( $originalState -eq $EventRuleItem.Enabled ) {
|
||||||
|
Write-host " SAME ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$objParams.Enabled = $EventRuleItem.Enabled
|
||||||
|
$updateCount++
|
||||||
|
if ($pscmdlet.ShouldProcess($EventRuleItem.EventRuleName, "Enabled=$originalState" )) {
|
||||||
|
$objEvent.SetParams($objParams)
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
$processed = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_EVENTRULE_NOT_FOUND { Write-host "MXE_EVENTRULE_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE { Write-host "MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENTRULE_CHANGEDESC_MISSING { Write-host "MXE_EVENTRULE_CHANGEDESC_MISSING : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST { Write-host "MXE_EVENT_AW_TASK_DOES_NOT_EXIST : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_COMMAND_DOES_NOT_EXIST { Write-host "MXE_EVENT_COMMAND_DOES_NOT_EXIST : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_PGP_PASS_INVALID { Write-host "MXE_EVENT_PGP_PASS_INVALID : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_INVALID { Write-host "MXE_EVENT_INVALID : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red }
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($processed) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($processed) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
Write-host " Updated: " -NoNewline
|
||||||
|
Write-host "$updateCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,251 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the event rules Paramaters CSV file")]
|
||||||
|
[string] $InputCsvFile = "EventRules_Params.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
if ($InputCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
$EventRulesList = @(
|
||||||
|
# @{ SiteName = "MySite"; Enabled = "False"; EventRuleName = "Event Rule 1"; Trigger = "File Downloaded" }
|
||||||
|
# @{ SiteName = "MySite"; Enabled = "True" ; EventRuleName = "Event Rule 2" Trigger = "File Uploaded" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EventRulesList = Import-Csv $InputCsvFile
|
||||||
|
# "SiteName","Enabled", "EventRuleName,Trigger"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE = "MX Error: 100 (00000064)"
|
||||||
|
$MXE_EVENTRULE_NOT_FOUND = "MX Error: 89 (00000059)"
|
||||||
|
$MXE_EVENTRULE_CHANGEDESC_MISSING = "MX Error: 90 (0000005A)"
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST = "MX Error: 106 (0000006A)"
|
||||||
|
$MXE_EVENT_COMMAND_DOES_NOT_EXIST = "MX Error: 107 (0000006B)"
|
||||||
|
$MXE_EVENT_PGP_PASS_INVALID = "MX Error: 54 (00000036)"
|
||||||
|
$MXE_EVENT_INVALID = "MX Error: 43 (0000002B)"
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Updating event rule enabled state:"
|
||||||
|
$updateCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
$warnCount = 0
|
||||||
|
ForEach ($EventRuleItem in $EventRulesList) {
|
||||||
|
$count = $count + 1
|
||||||
|
$processed = $false
|
||||||
|
$EventType = $script:EftServer.AvailableEvents
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EventRuleItem.SiteName])
|
||||||
|
|
||||||
|
foreach ($eventtype in $EventType) {
|
||||||
|
Try {
|
||||||
|
$eRules = $script:eftsite.EventRules($eventType.type)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "COM Exception : $error[0]" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
$EventCount = $eRules.Count()
|
||||||
|
If ($erules) {
|
||||||
|
If ($EventCount -gt 0) {
|
||||||
|
For ($iRule = 0; $iRule -le $EventCount - 1; $iRule++) {
|
||||||
|
$objEvent = $eRules.Item($iRule)
|
||||||
|
$objParams = $objEvent.GetParams()
|
||||||
|
$eventNameParam = $objParams.name
|
||||||
|
$chkName = $eventNameParam + ">" + $EventName
|
||||||
|
Write-Verbose $chkName
|
||||||
|
If ($eventNameParam -eq $EventRuleItem.EventRuleName) {
|
||||||
|
$originalState = $objParams.Enabled
|
||||||
|
try {
|
||||||
|
$objParams.Enabled = $EventRuleItem.Enabled
|
||||||
|
Write-Host "Update: [$($EventRuleItem.SiteName)] [$($EventRuleItem.EventRuleName)] $originalState->$($EventRuleItem.Enabled)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
if ($pscmdlet.ShouldProcess($EventRuleItem.EventRuleName, "Enabled=$originalState" )) {
|
||||||
|
|
||||||
|
if ($EventRuleItem.Trigger -eq "Folder Monitor") {
|
||||||
|
try { if ($EventRuleItem.FM_Path -ne $objParams.path) {$objParams.path = $EventRuleItem.FM_Path}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_CheckHealthInterval -ne $objParams.CheckHealthInterval) {$objParams.CheckHealthInterval = $EventRuleItem.FM_CheckHealthInterval}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_CheckHealth -ne $objParams.CheckHealth) {$objParams.CheckHealth = $EventRuleItem.FM_CheckHealth}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_IncludeSubfolders -ne $objParams.IncludeSubfolders) {$objParams.IncludeSubfolders = $EventRuleItem.FM_IncludeSubfolders}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_UseAlternateCredentials -ne $objParams.UseAlternateCredentials) {$objParams.UseAlternateCredentials = $EventRuleItem.FM_UseAlternateCredentials}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_UserName -ne $objParams.UserName) {$objParams.UserName = $EventRuleItem.FM_UserName}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_Password -ne $objParams.Password) {$objParams.Password = $EventRuleItem.FM_Password}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_UseFileSystemNotifications -ne $objParams.UseFileSystemNotifications) {$objParams.UseFileSystemNotifications = $EventRuleItem.FM_UseFileSystemNotifications }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_UsePeriodicDirectoryPoll -ne $objParams.UsePeriodicDirectoryPoll) {$objParams.UsePeriodicDirectoryPoll = $EventRuleItem.FM_UsePeriodicDirectoryPoll}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_PollIntervalSeconds -ne $objParams.PollIntervalSeconds) {$objParams.PollIntervalSeconds = $EventRuleItem.FM_PollIntervalSeconds }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_ArchiveSubFolderName -ne $objParams.ArchiveSubFolderName) {$objParams.ArchiveSubFolderName = $EventRuleItem.FM_ArchiveSubFolderName }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_UseInteractiveLogon -ne $objParams.UseInteractiveLogon) {$objParams.UseInteractiveLogon = $EventRuleItem.FM_UseInteractiveLogon }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_ArchiveLeftovers -ne $objParams.ArchiveLeftovers) {$objParams.ArchiveLeftovers = $EventRuleItem.FM_ArchiveLeftovers}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_AddTimestampToArchivedFileNames -ne $objParams.AddTimestampToArchivedFileNames) {$objParams.AddTimestampToArchivedFileNames = $EventRuleItem.FM_AddTimestampToArchivedFileNames }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_PollIntervalType -ne $objParams.PollIntervalType) {$objParams.PollIntervalType = $EventRuleItem.FM_PollIntervalType }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.FM_PollInterval -ne $objParams.PollInterval) {$objParams.PollInterval = $EventRuleItem.FM_PollInterval }} catch {$warnCount++}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($EventRuleItem.Trigger -eq "Scheduler (Timer) Event") {
|
||||||
|
try { if ($EventRuleItem.SCH_DailyEveryWeekDay -ne $objParams.DailyEveryWeekDay) {$objParams.DailyEveryWeekDay = $EventRuleItem.SCH_DailyEveryWeekDay} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_DailyDayPeriod -ne $objParams.DailyDayPeriod) {$objParams.DailyDayPeriod = $EventRuleItem.SCH_DailyDayPeriod}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklyWeekPeriod -ne $objParams.WeeklyWeekPeriod) {$objParams.WeeklyWeekPeriod = $EventRuleItem.SCH_WeeklyWeekPeriod}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklySunday -ne $objParams.WeeklySunday) {$objParams.WeeklySunday = $EventRuleItem.SCH_WeeklySunday}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklyMonday -ne $objParams.WeeklyMonday) {$objParams.WeeklyMonday = $EventRuleItem.SCH_WeeklyMonday}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklyTuesday -ne $objParams.WeeklyTuesday) {$objParams.WeeklyTuesday = $EventRuleItem.SCH_WeeklyTuesday }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklyWednesday -ne $objParams.WeeklyWednesday) {$objParams.WeeklyWednesday = $EventRuleItem.SCH_WeeklyWednesday}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklyThursday -ne $objParams.WeeklyThursday) {$objParams.WeeklyThursday = $EventRuleItem.SCH_WeeklyThursday}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklyFriday -ne $objParams.WeeklyFriday) {$objParams.WeeklyFriday = $EventRuleItem.SCH_WeeklyFriday}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_WeeklySaturday -ne $objParams.WeeklySaturday) {$objParams.WeeklySaturday = $EventRuleItem.SCH_WeeklySaturday} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_MonthlyFixedDay -ne $objParams.MonthlyFixedDay) {$objParams.MonthlyFixedDay = $EventRuleItem.SCH_MonthlyFixedDay} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_MonthlyDayPeriod -ne $objParams.MonthlyDayPeriod) {$objParams.MonthlyDayPeriod = $EventRuleItem.SCH_MonthlyDayPeriod}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_MonthlyMonthPeriod -ne $objParams.MonthlyMonthPeriod) {$objParams.MonthlyMonthPeriod = $EventRuleItem.SCH_MonthlyMonthPeriod}} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_MonthlyRelativeWeekday -ne $objParams.MonthlyRelativeWeekday) {$objParams.MonthlyRelativeWeekday = $EventRuleItem.SCH_MonthlyRelativeWeekday} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_MonthlyWeekday -ne $objParams.MonthlyWeekday) {$objParams.MonthlyWeekday = $EventRuleItem.SCH_MonthlyWeekday} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_YearlyFixedDay -ne $objParams.YearlyFixedDay) {$objParams.YearlyFixedDay = $EventRuleItem.SCH_YearlyFixedDay} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_YearlyMonth -ne $objParams.YearlyMonth) {$objParams.YearlyMonth = $EventRuleItem.SCH_YearlyMonth }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_YearlyDayPeriod -ne $objParams.YearlyDayPeriod) {$objParams.YearlyDayPeriod = $EventRuleItem.SCH_YearlyDayPeriod} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_YearlyRelativeWeekday -ne $objParams.YearlyRelativeWeekday) {$objParams.YearlyRelativeWeekday = $EventRuleItem.SCH_YearlyRelativeWeekday} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_YearlyWeekday -ne $objParams.YearlyWeekday) {$objParams.YearlyWeekday = $EventRuleItem.SCH_YearlyWeekday} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_RepeatPattern -ne $objParams.RepeatPattern) {$objParams.RepeatPattern = $EventRuleItem.SCH_RepeatPattern} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_RepeatRate -ne $objParams.RepeatRate) {$objParams.RepeatRate = $EventRuleItem.SCH_RepeatRate }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_RepeatEnabled -ne $objParams.RepeatEnabled) {$objParams.RepeatEnabled = $EventRuleItem.SCH_RepeatEnabled} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_DateTimeEnd -ne $objParams.DateTimeEnd) {$objParams.DateTimeEnd = $EventRuleItem.SCH_DateTimeEnd} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_TimeEndEnabled -ne $objParams.TimeEndEnabled) {$objParams.TimeEndEnabled = $EventRuleItem.SCH_TimeEndEnabled} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_DateEndEnabled -ne $objParams.DateEndEnabled) {$objParams.DateEndEnabled = $EventRuleItem.SCH_DateEndEnabled} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_RundayCalendar -ne $objParams.RundayCalendar) {$objParams.RundayCalendar = $EventRuleItem.SCH_RundayCalendar} } catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_HolidayCalendar -ne $objParams.HolidayCalendar) { $objParams.HolidayCalendar = $EventRuleItem.SCH_HolidayCalendar} } catch {$warnCount++}
|
||||||
|
#try { if ($EventRuleItem.FM_CheckHealthInterval -ne $objParams.CheckHealthInterval) {ry {$objParams.NextRun = $EventRuleItem.SCH_NextRun } catch} {}
|
||||||
|
try { if ($EventRuleItem.SCH_Recurrence -ne $objParams.Recurrence) {$objParams.Recurrence = $EventRuleItem.SCH_Recurrence }} catch {$warnCount++}
|
||||||
|
try { if ($EventRuleItem.SCH_DateTimeStart -ne $objParams.DateTimeStart) {$objParams.DateTimeStart = $EventRuleItem.SCH_DateTimeStart} } catch {$warnCount++}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($script:EftServer.HAEnabled) {
|
||||||
|
try {
|
||||||
|
$EFTHAParams = $EventRuleItem.HA_SchedulingParams -split ","
|
||||||
|
$EFTHAParams = $EFTHAParams | Where-Object {$_ -ne ""}
|
||||||
|
|
||||||
|
if ($EFTHAParams.lenght -gt 0) {
|
||||||
|
$params = new-object -ComObject "SFTPCOMInterface.CIRoundRobinEventRuleSchedulingParams"
|
||||||
|
foreach ($nodeName in $EFTHABackupParams) {
|
||||||
|
$params.Add($nodeName)
|
||||||
|
}
|
||||||
|
$objEvent.SetHASchedulingParams($params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$warnCount++
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$EFTHABackupParams = $EventRuleItem.HA_SchedulingBackupParams -split ","
|
||||||
|
$EFTHABackupParams = $EFTHABackupParams | Where-Object {$_ -ne ""}
|
||||||
|
if ($EFTHAParams.lenght -gt 0) {
|
||||||
|
$paramsBackup = new-object -ComObject "SFTPCOMInterface.CIRoundRobinEventRuleSchedulingParams"
|
||||||
|
foreach ($nodeName in $EFTHABackupParams) {
|
||||||
|
$paramsBackup.Add($nodeName)
|
||||||
|
}
|
||||||
|
$objEvent.SetHABackupSchedulingParams($paramsBackup)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$warnCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$objEvent.SetParams($objParams)
|
||||||
|
}
|
||||||
|
$changed++
|
||||||
|
if($warnCount -gt 0) {
|
||||||
|
Write-host " WARN [$warnCount]" -ForegroundColor Yellow -NoNewline
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$processed = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_EVENTRULE_NOT_FOUND { Write-host "MXE_EVENTRULE_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE { Write-host "MXE_EVENT_FM_FOLDER_NOT_ACCESSIBLE : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENTRULE_CHANGEDESC_MISSING { Write-host "MXE_EVENTRULE_CHANGEDESC_MISSING : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_AW_TASK_DOES_NOT_EXIST { Write-host "MXE_EVENT_AW_TASK_DOES_NOT_EXIST : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_COMMAND_DOES_NOT_EXIST { Write-host "MXE_EVENT_COMMAND_DOES_NOT_EXIST : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_PGP_PASS_INVALID { Write-host "MXE_EVENT_PGP_PASS_INVALID : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_EVENT_INVALID { Write-host "MXE_EVENT_INVALID : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($processed) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($processed) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Updated: " -NoNewline
|
||||||
|
Write-host "$updateCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
<#
|
||||||
|
|
||||||
|
.SYNOPSIS
|
||||||
|
This Script retrives prduct serial codes from the node
|
||||||
|
.DESCRIPTION
|
||||||
|
This script will query the Windows registry and collect the serial numbers used by the node
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.Export-SerialsKeys.ps1 | Tee-Object Executive_Config_Report.txt
|
||||||
|
.\EFT.Export-SerialsKeys.ps1 > report.txt
|
||||||
|
.NOTES
|
||||||
|
Globalscape Inc.
|
||||||
|
Version: 1.0
|
||||||
|
Last Modified Date: 09/24/2017
|
||||||
|
This script is intended to be run safetly without impacting or changing any EFT configuration, so you can use it any time as many times you would like.
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $Hostname = "localhost"
|
||||||
|
)
|
||||||
|
|
||||||
|
$serials = @()
|
||||||
|
$DMZGateway = "IOleVariance.Source2"
|
||||||
|
$EFTAS2 = "HIERCOJ\GREEN"
|
||||||
|
$AWE = "NL.wga.wGm.B2008"
|
||||||
|
$EFT6Baseline = "RDK"
|
||||||
|
$EFT7Baseline = "R2D2"
|
||||||
|
$EFT6Enterprise = "Win64.compat/wow64"
|
||||||
|
$EFT7Enterprise = "SMB.cluster\availability"
|
||||||
|
$HighSecurity = "GRR\TRIAM"
|
||||||
|
$DMZ3SingleSite = "IOleVariance.Source3"
|
||||||
|
$DMZ3MultiSite = "IOleVariance.Source4"
|
||||||
|
$Workspaces = "IOleVariance.Source7"
|
||||||
|
$ARM = "ARM_RANdl.1"
|
||||||
|
$PGP = "SPLehP\dlog8"
|
||||||
|
$CIC = "HKEY_CLASSES_ROOT\IOleVariance.Source6"
|
||||||
|
$EFT73WTCCAL = "NNIF\NAMUH"
|
||||||
|
$EFT73WTCCAL = "DTI\EWB"
|
||||||
|
$EFT73SMBFileTransferClient = "SCL"
|
||||||
|
$EFT73SMBFolderMonitorEventRule = "SFM"
|
||||||
|
$EFT73SMBTimerEventModule = "STM"
|
||||||
|
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "DMZGateway" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($DMZGateway).GetValue('1')) } } catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "EFTAS2" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFTAS2).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "AWE" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($AWE).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "EFT6Baseline" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT6Baseline).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "EFT7Baseline" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT7Baseline).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "EFT6Enterprise" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT6Enterprise).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "EFT7Enterprise" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT7Enterprise).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "HighSecurity" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($HighSecurity).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "DMZ3SingleSite" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($DMZ3SingleSite).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "DMZ3MultiSite" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($DMZ3MultiSite).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "Workspaces" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($Workspaces).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "ARM" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($ARM).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "PGP" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($PGP).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "CIC" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($CIC).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "EFT73WTCCAL" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT73WTCCAL).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname; Name = "EFT73WTCCAL" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT73WTCCAL).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname;Name = "EFT73SMBFileTransferClient" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT73SMBFileTransferClient).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname;Name = "EFT73SMBFolderMonitorEventRule" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT73SMBFolderMonitorEventRule).GetValue('1')) } }catch {}
|
||||||
|
try { $serials += new-object psobject -Property @{ ComputerName = $Hostname;Name = "EFT73SMBTimerEventModule" ; Serial = [System.Text.Encoding]::ASCII.GetString([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('ClassesRoot',$Hostname).OpenSubKey($EFT73SMBTimerEventModule).GetValue('1')) } }catch {}
|
||||||
|
|
||||||
|
$serials | Format-Table
|
||||||
|
|
@ -0,0 +1,98 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
)
|
||||||
|
## To Export to CSV use:
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
$i = 0
|
||||||
|
# Retrieve all the paths that have permissions in the config and decorate the orphans with a *
|
||||||
|
$folders = $script:EftSite.GetPermPathsList("-do")
|
||||||
|
$folderList = $folders.Split([string[]]"`r`n", "RemoveEmptyEntries")
|
||||||
|
|
||||||
|
Foreach ($folder in $folderList) {
|
||||||
|
Write-Progress -Activity "Processing Folders" -status "Folder $folder ($i/$($folderList.length))" -percentComplete ($i / $folderList.length * 100)
|
||||||
|
$i++
|
||||||
|
# check if folder paths ends with * (orphans) and ignore
|
||||||
|
if ($folder[-1] -ne "*") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
$folder = $folder.Substring(0,$folder.Length-1)
|
||||||
|
try {
|
||||||
|
$physicalPath = $script:EftSite.GetPhysicalPath($folder)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { $physicalPath = "**MXE_FOLDER_NOT_FOUND** : $_ " }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { $physicalPath = "**MXE_INVALID_FOLDER_NAME** : $_ "}
|
||||||
|
Default { $physicalPath = "**Exception** : $_"}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
Path = $folder;
|
||||||
|
PhysicalPath = $physicalPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$results | Sort-Object SiteName, Path, Client
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,207 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "path filter (I.E. /usr/*), wildcards allowed")]
|
||||||
|
[String]$path = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $false, HelpMessage = "Client name, filter to this client (Optional)")]
|
||||||
|
[String]$client = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Physical Path exists and Client (user or group exists) ")]
|
||||||
|
[switch] $Validate = $false,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $false, HelpMessage = "Show inherited permissions")]
|
||||||
|
[switch]$showInherited = $false
|
||||||
|
)
|
||||||
|
## To Export to CSV use:
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 |Format-Table
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 | Export-csv permissions.csv -NoTypeInformation
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -EFTSiteName "MySite"
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -FolderFilter "/usr/*"
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -FolderFilter "/usr/*" -client "Guest"
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -EFTSiteName "MySite" | Where-Object {$_.Permissions -gt 1152} | format-table
|
||||||
|
|
||||||
|
Function PermissionsToInt($permission) {
|
||||||
|
|
||||||
|
$permissionAsInt = 0
|
||||||
|
|
||||||
|
if ($null -ne $permission) {
|
||||||
|
if ($permission.FileUpload -eq $true) {$permissionAsInt += 1}
|
||||||
|
if ($permission.FileDelete -eq $true) {$permissionAsInt += 2}
|
||||||
|
if ($permission.FileRename -eq $true) {$permissionAsInt += 4}
|
||||||
|
if ($permission.FileAppend -eq $true) {$permissionAsInt += 8}
|
||||||
|
if ($permission.FileDownload -eq $true) {$permissionAsInt += 16}
|
||||||
|
if ($permission.DirCreate -eq $true) {$permissionAsInt += 32}
|
||||||
|
if ($permission.DirDelete -eq $true) {$permissionAsInt += 64}
|
||||||
|
if ($permission.DirList -eq $true) {$permissionAsInt += 128}
|
||||||
|
if ($permission.DirShowHidden -eq $true) {$permissionAsInt += 256}
|
||||||
|
if ($permission.DirShowReadOnly -eq $true) {$permissionAsInt += 512}
|
||||||
|
if ($permission.DirShowInList -eq $true) {$permissionAsInt += 1024}
|
||||||
|
}
|
||||||
|
return $permissionAsInt
|
||||||
|
}
|
||||||
|
Function StripVirtualPortion ($path) {
|
||||||
|
if ($path -like "* - Virtual*") {
|
||||||
|
$path = $path.Substring(0, $path.Indexof(" - Virtual"))
|
||||||
|
}
|
||||||
|
return $path
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
$i = 0
|
||||||
|
$errorCount = 0
|
||||||
|
# Retrieve all the paths that have permissions in the config and decorate the orphans with a *
|
||||||
|
$folders = $script:EftSite.GetPermPathsList("-do")
|
||||||
|
if ($Validate) {
|
||||||
|
$users = $script:EftSite.GetUsers()
|
||||||
|
$groups = $script:EftSite.GetPermissionGroups()
|
||||||
|
}
|
||||||
|
$folderList = $folders.Split([string[]]"`r`n", "RemoveEmptyEntries")
|
||||||
|
|
||||||
|
Foreach ($folder in $folderList) {
|
||||||
|
Write-Progress -Activity "Processing Folders" -status "Folder $folder ($i/$($folderList.length))" -percentComplete ($i / $folderList.length * 100)
|
||||||
|
$i++
|
||||||
|
# check if folder paths ends with * (orphans) and ignore
|
||||||
|
if ($folder[-1] -eq "*") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($path -ne "" -and $folder -notlike $path) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$folder = StripVirtualPortion($folder)
|
||||||
|
try {
|
||||||
|
$permissions = $script:EftSite.GetFolderPermissions($folder)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { $Errors = "**MXE_FOLDER_NOT_FOUND** : $_ " }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { $Errors = "**MXE_INVALID_FOLDER_NAME** : $_ "}
|
||||||
|
Default { $Errors = "**Exception** : $_"}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
Foreach ($permission in $permissions) {
|
||||||
|
|
||||||
|
## Is this filtered to a client?
|
||||||
|
if ($null -ne $client -and $client.Length -gt 0 -and $permission.Client -ne $client) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$permissionsAsInt = PermissionsToInt $permission
|
||||||
|
$InheritedFrom = $permission.InheritedFrom
|
||||||
|
if ($InheritedFrom[-1] -ne '/') {
|
||||||
|
$InheritedFrom = $InheritedFrom + "/"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Is this $showInherited
|
||||||
|
if ($showInherited -eq $false -and $permission.IsInherited -eq $true) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if ($Validate) {
|
||||||
|
try {
|
||||||
|
$physicalPath = $script:EftSite.GetPhysicalPath($folder)
|
||||||
|
|
||||||
|
if (Test-Path $physicalPath) {
|
||||||
|
$ValidPath = "OK"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ValidPath = "FOLDER_NOT_FOUND: $physicalPath"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { $ValidPath = "MXE_FOLDER_NOT_FOUND :$physicalPath $_ " }
|
||||||
|
Default { $ValidPath = "Exception: $_"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$ValidPath = "ERROR : $physicalPath $_"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($users -contains $permission.Client -or $groups -contains $permission.Client) {
|
||||||
|
$ValidClient = "OK"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ValidClient = "USER_GROUP_NOT_FOUND"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$results += new-object PSObject -Property @{
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
Path = $folder;
|
||||||
|
Client = $permission.Client;
|
||||||
|
Permissions = $permissionsAsInt;
|
||||||
|
IsInherited = $permission.IsInherited;
|
||||||
|
InheritedFrom = $InheritedFrom;
|
||||||
|
ValidPath = $ValidPath;
|
||||||
|
ValidClient = $ValidClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$results | Sort-Object SiteName, Path, Client
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,142 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the permissions CSV file ")]
|
||||||
|
[string] $PermissionsCsvFile = "permissions.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
Function IntToPermissions($permissionAsInt, $permission) {
|
||||||
|
|
||||||
|
if ($null -ne $permission ) {
|
||||||
|
$permission.FileUpload = [bool](($permissionAsInt -band 1) -eq 1)
|
||||||
|
$permission.FileDelete = [bool](($permissionAsInt -band 2) -eq 2)
|
||||||
|
$permission.FileRename = [bool](($permissionAsInt -band 4) -eq 4)
|
||||||
|
$permission.FileAppend = [bool](($permissionAsInt -band 8) -eq 8)
|
||||||
|
$permission.FileDownload = [bool](($permissionAsInt -band 16) -eq 16)
|
||||||
|
$permission.DirCreate = [bool](($permissionAsInt -band 32) -eq 32)
|
||||||
|
$permission.DirDelete = [bool](($permissionAsInt -band 64) -eq 64)
|
||||||
|
$permission.DirList = [bool](($permissionAsInt -band 128) -eq 128)
|
||||||
|
$permission.DirShowHidden = [bool](($permissionAsInt -band 256) -eq 256)
|
||||||
|
$permission.DirShowReadOnly = [bool](($permissionAsInt -band 512) -eq 512)
|
||||||
|
$permission.DirShowInList = [bool](($permissionAsInt -band 1024) -eq 1024)
|
||||||
|
}
|
||||||
|
|
||||||
|
return $permission
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PermissionsCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
# $EFTPermissions = @(
|
||||||
|
# @{ SiteName = "MySite"; Path = "\"; Client= "" IsInherited = "" ; InheritedFrom =""; Permissions = "" }
|
||||||
|
# @{ SiteName = "MySite"; Path = "\"; Client= "" IsInherited = "" ; InheritedFrom =""; Permissions = "" }
|
||||||
|
#)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EFTPermissions = Import-Csv $PermissionsCsvFile
|
||||||
|
# "SiteName","Path", "Client","Permissions",IsInherited","InheritedFrom"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$MXE_FOLDER_NOT_EMPTY = "MX Error: 117 (00000075)"
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Importing Folder Permissions:"
|
||||||
|
$Imported = 0
|
||||||
|
$errorCount = 0
|
||||||
|
foreach ($EFTPermission in $EFTPermissions) {
|
||||||
|
try {
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EFTPermission.SiteName])
|
||||||
|
$requestedPermissionsAsInt = [int]$EFTPermission.Permissions
|
||||||
|
$folderPath = $EFTPermission.Path
|
||||||
|
$permissionsInherited = [bool]::Parse($EFTPermission.IsInherited)
|
||||||
|
if (!$permissionsInherited) {
|
||||||
|
Write-host "Importing: [$($EFTPermission.SiteName)] $($EFTPermission.Client) on $folderPath ->$requestedPermissionsAsInt".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$permission = IntToPermissions $requestedPermissionsAsInt $script:EftSite.GetBlankPermission($folderPath, $EFTPermission.Client)
|
||||||
|
$script:EftSite.SetPermission($permission, $false)
|
||||||
|
$Imported++
|
||||||
|
Write-host " OK $($sw.ElapsedMilliseconds )ms" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Imported: " -NoNewline
|
||||||
|
Write-host "$Imported " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,187 @@
|
|||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
)
|
||||||
|
Function StripVirtualPortion ($path) {
|
||||||
|
if ($path -like "* - Virtual*") {
|
||||||
|
$path = $path.Substring(0, $path.Indexof(" - Virtual"))
|
||||||
|
}
|
||||||
|
return $path
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# the script will recreate the original physical path remove the permissions associated then remove
|
||||||
|
#
|
||||||
|
Write-host "******* EFT Remove Orphan permissions in paths SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host "When permissions are added to folders using EFT and if folders are deleted from the file system and not from EFT, " -ForegroundColor Yellow
|
||||||
|
Write-host "permissions still be stored in EFT and considered orphaned, this is as designed behiavour as when network is " -ForegroundColor Yellow
|
||||||
|
Write-host "unavialbile permissions must be kept so when the network access is restored permissions are not removed" -ForegroundColor Yellow
|
||||||
|
Write-host ""
|
||||||
|
Write-host "This script will create a virtual folder with original path associated with the orphan path" -ForegroundColor Yellow
|
||||||
|
Write-host "then it will remove the virtual folder using EFT API and removing its permisions from the EFT configuration" -ForegroundColor Yellow
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " > This script will modify your EFT configuration and these changes can't be undone" -ForegroundColor Yellow
|
||||||
|
Write-host " > You must perform backups of your EFT config before using this script" -ForegroundColor Yellow
|
||||||
|
Write-host " > It is recommend you test this script in a non-production environment before " -ForegroundColor Yellow
|
||||||
|
Write-host " using in production to validate its functionality" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
#Output parameters
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red}
|
||||||
|
Write-host "EFT Admin Hostname : $EFTAdminHostname"
|
||||||
|
Write-host "EFT Admin Port : $EFTAdminPort"
|
||||||
|
Write-host "EFT Admin Auth Type : $EFTAdminAuthType"
|
||||||
|
Write-host "EFT Site Name : $EFTSiteName"
|
||||||
|
Write-host "EFT Admin Username : $EFTAdminUsername"
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$MXE_FOLDER_NOT_EMPTY = "MX Error: 117 (00000075)"
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$fixCount = 0
|
||||||
|
$skipCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i = 0
|
||||||
|
# Retrieve all the paths that have permissions in the config and decorate the orphans with a *
|
||||||
|
$folders = $script:EftSite.GetPermPathsList("-do")
|
||||||
|
$folderList = $folders.Split([string[]]"`r`n", "RemoveEmptyEntries") | Where-Object {$_[-1] -eq "*"}
|
||||||
|
|
||||||
|
Foreach ($folder in $folderList) {
|
||||||
|
$i++
|
||||||
|
Write-host "[$siteName] Removing orphan: $($folder) ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
# check if folder paths ends with * (orphans) and ignore
|
||||||
|
if ($folder[-1] -ne "*") {
|
||||||
|
Write-host " SKIPPED ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
Write-host "Folder without orphan permissions"
|
||||||
|
$skipCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
$folder = $folder.Substring(0, $folder.Length - 1)
|
||||||
|
|
||||||
|
$folder = StripVirtualPortion($folder)
|
||||||
|
try {
|
||||||
|
$physicalPath = $script:EftSite.GetPhysicalPath($folder)
|
||||||
|
|
||||||
|
if (Test-Path $physicalPath) {
|
||||||
|
Write-host " SKIPPED ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Yellow
|
||||||
|
Write-host " WARNING: Pysical path '$physicalPath' does exist, possible access permissions issues for EFT service account?"
|
||||||
|
$skipCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
#recreate original Path
|
||||||
|
|
||||||
|
if ($pscmdlet.ShouldProcess($folder, "Remove($physicalPath) " )) {
|
||||||
|
$script:EftSite.CreateVirtualFolder($folder, $physicalPath, $false)
|
||||||
|
$script:EftSite.RemoveFolder($folder)
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$fixcount++
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Fixed: " -NoNewline
|
||||||
|
Write-host "$fixcount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Skipped: " -NoNewline
|
||||||
|
Write-host "$skipCount " -NoNewline -ForegroundColor Yellow
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,132 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Exports PGP keys used in evet rules with its associated metadata.
|
||||||
|
.DESCRIPTION
|
||||||
|
This script will retrieve all PGP Keys used from all the event rules for all or a specific EFT site
|
||||||
|
|
||||||
|
DrainingTimeoutSecs
|
||||||
|
Draining timeout in seconds allows you to adjust the time for ongoing event rules and transfers to complete before draining starts.
|
||||||
|
Default is 900 seconds (15 minutes).
|
||||||
|
Maximum is 86400 seconds (24 hours).
|
||||||
|
If set to 0, then immediately shutdown and do not drain.
|
||||||
|
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GlobalSCAPE Inc.\EFT Server 7.4\DrainingTimeoutSecs=900
|
||||||
|
|
||||||
|
ClusterOutOfSyncHealSecs
|
||||||
|
Amount of time in seconds that an HA node will wait for incoming administrative messages to arrive before declaring itself to be out-of-sync with the cluster and initiating draining and restart.
|
||||||
|
Default is 30 seconds.
|
||||||
|
If out of sync is detected, the node attempts to heal; if it can heal within the timeout period, the system resyncs and continues to operate as expected.
|
||||||
|
If out of sync is detected and cannot be repaired within the heal timeout period, the node will enter drain mode and then restart the service.
|
||||||
|
If set to 0, then do not attempt to heal; continue to operate the node out of sync.
|
||||||
|
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GlobalSCAPE Inc.\EFT Server 7.4\ClusterOutOfSyncHealSecs=30
|
||||||
|
|
||||||
|
ClusterCoherenceQueueMsmqType
|
||||||
|
By default the MSMQ Broadcasting. TCP method of broadcasting ftp.cfg changes was developed for environments that do not support multicast (e.g., Azure and vMotion). Although AWS does not support Multicast, this was developed prior to the support of this option and so uses the AWS SQS/SNS services for now.
|
||||||
|
To use the TCP instead of MSMQ Broadcasting, set the Advanced Registry key ClusterCoherenceQueueMsmqType to msmq-iterative
|
||||||
|
To use MSMQ Broadcasting, either delete the key or set the ClusterCoherenceQueueMsmqType = msmq-broadcasting
|
||||||
|
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GlobalSCAPE Inc.\EFT Server 7.4\ClusterCoherenceQueueMsmqType=msmq-multicast
|
||||||
|
|
||||||
|
ClusterCoherenceQueueDetectPrivateIP
|
||||||
|
Used to explicitly define the IP/Subnet via registry entry/advanced property, localized per node.
|
||||||
|
The key should be created in the EFT Server 7.4 registry location
|
||||||
|
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GlobalSCAPE Inc.\EFT Server 7.4\ClusterCoherenceQueueDetectPrivateIP=autodetect
|
||||||
|
|
||||||
|
It can either be set to autodetect (which is the default, which causes it to find and use the first private subnet it finds), or it can be set to the prefix of the interface to use (e.g., “192.168.0", "192.168." or "192.168" just the prefix of the subnet, with no quotes).
|
||||||
|
Changes made in the registry are recorded in the ActiveNodes.json (located in the HA cluster's Shared configuration folder), which is used automatically by the EFT nodes to pass information between themselves and should not be edited.
|
||||||
|
If you do not choose to use the default subnet on a particular EFT node, that node will simply place the IP address you put for the advanced properties key in the “IP” field. That IP address will be the one the other nodes use to try to talk to it.
|
||||||
|
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.HA.ReconfigureAdvanceSettings.ps1
|
||||||
|
|
||||||
|
Reconfigure EFT to use TCP Unicast (msmq-iterative) with default values
|
||||||
|
This script may restart your EFT Service
|
||||||
|
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Position = 6, Mandatory = $False)]
|
||||||
|
[int] [ValidateRange(0, 86400)] $DrainingTimeoutSecs = 900,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[int] $ClusterOutOfSyncHealSecs = 30,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[string][ValidateSet("msmq-iterative","msmq-broadcasting","msmq-multicast")] $ClusterCoherenceQueueMsmqType = "msmq-iterative",
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[int]$ClusterCoherenceQueueDetectPrivateIP = 0,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
|
||||||
|
)
|
||||||
|
Write-host "******* EFT Reconfigure HA Mode SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " > This script will modify your EFT registry settings it's recommended you make a backup " -ForegroundColor Yellow
|
||||||
|
Write-host " > You must perform backups of your EFT config and registry before using this script" -ForegroundColor Yellow
|
||||||
|
Write-host " > It is recommend you test this script in a non-production environment before " -ForegroundColor Yellow
|
||||||
|
Write-host " using in production to validate its functionality" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Output parameters
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red}
|
||||||
|
Write-host "DrainingTimeoutSecs : $DrainingTimeoutSecs"
|
||||||
|
Write-host "ClusterOutOfSyncHealSecs : $ClusterOutOfSyncHealSecs"
|
||||||
|
Write-host "ClusterCoherenceQueueMsmqType : $ClusterCoherenceQueueMsmqType"
|
||||||
|
Write-host "ClusterCoherenceQueueDetectPrivateIP: $ClusterCoherenceQueueDetectPrivateIP"
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$EFTServerPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\"
|
||||||
|
New-Item -Path $EFTServerPath -Name "EFT Server 7.4" -Force | Out-Null
|
||||||
|
|
||||||
|
$EFTServer74RegPath = "$($EFTServerPath)\EFT Server 7.4"
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name DrainingTimeoutSecs -value $DrainingTimeoutSecs -Force
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name ClusterOutOfSyncHealSecs -value $ClusterOutOfSyncHealSecs -Force
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name ClusterCoherenceQueueMsmqType -value $ClusterCoherenceQueueMsmqType -Force
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name ClusterCoherenceQueueDetectPrivateIP -value $ClusterCoherenceQueueDetectPrivateIP -Force
|
||||||
|
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
|
||||||
|
$restart = "y"
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$restart = Read-Host "Do you want to restart EFT Service now (y/n)? "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($restart.ToUpper() -eq "Y" ) {
|
||||||
|
$EftService | Restart-Service
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
Write-host "Waiting EFT Service to be Started ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$EftService.WaitForStatus("Running", "00:00:30")
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
154
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.HealthCheck.ps1
Normal file
154
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.HealthCheck.ps1
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2019 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
performs a series of Healthchecks to a node and exports the results .
|
||||||
|
.DESCRIPTION
|
||||||
|
performs a series of Healthchecks to a node and exports the results
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.Healthcheck..ps1 | Export-Csv .\HealthCheck_Report.csv -NoTypeInformation
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
|
||||||
|
)
|
||||||
|
function Invoke-Check_CA001 () {
|
||||||
|
$score = 0
|
||||||
|
|
||||||
|
if ([System.Environment]::OSVersion.Version.Major -ge 6 -and [System.Environment]::OSVersion.Version.Minor -ge 3 ) {
|
||||||
|
# Windows Server 2012 R2
|
||||||
|
$score = 0.5
|
||||||
|
}
|
||||||
|
if ([System.Environment]::OSVersion.Version.Major -ge 10 ) {
|
||||||
|
$score = 1
|
||||||
|
}
|
||||||
|
return new-object psobject -Property @{
|
||||||
|
Category = "Architecture" ;
|
||||||
|
Code = "CA001"; Description = "Unsupported versions of OS running EFT"; Recommendation = "Migrate EFT to a Microsoft and Globalscape supported OS Version"
|
||||||
|
Source = ""; Severity = "High"
|
||||||
|
Value = (Get-WmiObject -class Win32_OperatingSystem).Caption;
|
||||||
|
Recommended = "Windows Server 2016" ;
|
||||||
|
Score = $score
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function Invoke-Check_CA002 () {
|
||||||
|
|
||||||
|
|
||||||
|
$EftServicePath = Get-WmiObject win32_service | Where-Object { $_.name -Like "EFT Server*"} | Select-Object pathname -ExpandProperty pathname
|
||||||
|
$EftServicePath = $EftServicePath -replace """", ""
|
||||||
|
$EftFileVersion = Get-ItemProperty $EftServicePath -name "VersionInfo" | Select-Object VersionInfo -ExpandProperty VersionInfo
|
||||||
|
|
||||||
|
$score = 0
|
||||||
|
|
||||||
|
if ($EftFileVersion.ProductVersion.split(',')[0].trim() -eq 7 -and $EftFileVersion.ProductVersion.split(',')[1].trim() -ge 3) {
|
||||||
|
# EFT 7.3.X
|
||||||
|
$score = 0.5
|
||||||
|
}
|
||||||
|
if ($EftFileVersion.ProductVersion.split(',')[0].trim() -eq 7 -and $EftFileVersion.ProductVersion.split(',')[1].trim() -eq 4 -and $EftFileVersion.ProductVersion.split(',')[2].trim() -eq 13 -and $EftFileVersion.ProductVersion.split(',')[3].trim() -eq 14 ) {
|
||||||
|
$score = 0.75
|
||||||
|
}
|
||||||
|
if ($EftFileVersion.ProductVersion.split(',')[0].trim() -eq 7 -and $EftFileVersion.ProductVersion.split(',')[1].trim() -eq 4 -and $EftFileVersion.ProductVersion.split(',')[2].trim() -eq 13 -and $EftFileVersion.ProductVersion.split(',')[3].trim() -eq 15 ) {
|
||||||
|
$score = 1
|
||||||
|
}
|
||||||
|
return new-object psobject -Property @{
|
||||||
|
Category = "Architecture" ;
|
||||||
|
Code = "CA002"; Description = "Unsupported versions of EFT "; Recommendation = "Upgrade to EFT to GA release"
|
||||||
|
Source = ""; Severity = "High"
|
||||||
|
Value = $EftFileVersion.ProductVersion;
|
||||||
|
Recommended = "7.4.13.15" ;
|
||||||
|
Score = $score
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Invoke-Check_CA003 (){
|
||||||
|
## Check more than 1000 files in logs and logs size
|
||||||
|
}
|
||||||
|
|
||||||
|
function Invoke-Check_CA004 (){
|
||||||
|
## Check for file invalid characters in event rules
|
||||||
|
return new-object psobject -Property @{
|
||||||
|
Category = "Architecture" ;
|
||||||
|
Code = "CA004"; Description = "Unsupported versions of EFT "; Recommendation = "Upgrade to EFT to GA release"
|
||||||
|
Source = ""; Severity = "High"
|
||||||
|
Value = $EftFileVersion.ProductVersion;
|
||||||
|
Recommended = "7.4.13.15" ;
|
||||||
|
Score = $score
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Invoke-EFTConfiguration_Checks () {
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
# Check Service Account permissions on MSMQ
|
||||||
|
# Check Service Account Permissions on file share
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
}
|
||||||
|
|
||||||
|
## Main validation checks
|
||||||
|
$results = @()
|
||||||
|
$results += Invoke-Check_CA001
|
||||||
|
$results += Invoke-Check_CA002
|
||||||
|
$results += Invoke-EFTConfiguration_Checks
|
||||||
|
|
||||||
|
$results | Sort-Object Code
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,220 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $true, HelpMessage = "Enter the event rule name")]
|
||||||
|
[string] $EventRuleName = "PROCESS-Pull",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $false, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTHost = "https://localhost:4433",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $false, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername = "admin",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $false, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password = "Super2003"
|
||||||
|
)
|
||||||
|
## Make sure you have HKLM\SOFTWARE\WOW6432Node\GlobalScape Inc.\EFT Server 7.4\EventWebServiceResponseAddContextVariables = 1
|
||||||
|
# to get all the context variables in the response body
|
||||||
|
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$MAX_TIMEOUT = 1000 * 30
|
||||||
|
$WAIT_SECONDS = 2
|
||||||
|
|
||||||
|
Enum ResultCodes {
|
||||||
|
UnhandledException = -1
|
||||||
|
Success = 0
|
||||||
|
ErrorInvokingWebService = 1
|
||||||
|
UnkownResponse = 2
|
||||||
|
EventRuleNotFound = 3
|
||||||
|
FailureInvokingEventRule = 4
|
||||||
|
ResponseTimeout = 5
|
||||||
|
FilesWithErrors = 6
|
||||||
|
}
|
||||||
|
|
||||||
|
$customWebclientCode = @"
|
||||||
|
using System.Net;
|
||||||
|
public class CustomWebclientCode : WebClient {
|
||||||
|
public int TimeoutSeconds;
|
||||||
|
protected override WebRequest GetWebRequest(System.Uri address) {
|
||||||
|
WebRequest request = base.GetWebRequest(address);
|
||||||
|
if (request != null) { request.Timeout = TimeoutSeconds * 1000; }
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
public CustomWebclientCode() {
|
||||||
|
TimeoutSeconds = 300; // Timeout value by default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"@
|
||||||
|
|
||||||
|
## Private Functions
|
||||||
|
function Invoke-EventRule($RequestID) {
|
||||||
|
$output = ""
|
||||||
|
$url = "$EFTHost/WebService/InvokeEventRule?EventRuleName=$EventRuleName&EventParams=VAR.REQUEST_ID=$RequestID"
|
||||||
|
$webclient = New-Object CustomWebclientCode
|
||||||
|
$credCache = new-object System.Net.CredentialCache
|
||||||
|
#Setting timeout to 900 seconds
|
||||||
|
$webclient.TimeoutSeconds = 900
|
||||||
|
$creds = new-object System.Net.NetworkCredential($EFTAdminUsername, $Password)
|
||||||
|
$credCache.Add($url, "Basic", $creds)
|
||||||
|
$webclient.Credentials = $credCache
|
||||||
|
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
|
||||||
|
try {
|
||||||
|
$output = $webclient.DownloadString($url)
|
||||||
|
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "Error Calling EFT Web Service $_"
|
||||||
|
$returnCode = [ResultCodes]::ErrorInvokingWebService
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$xml = New-Object -TypeName System.Xml.XmlDocument
|
||||||
|
$xml.LoadXml($output)
|
||||||
|
switch ($xml.root.ResultCode) {
|
||||||
|
"1" { $returnCode = [ResultCodes]::Success}
|
||||||
|
"-1" { $returnCode = [ResultCodes]::EventRuleNotFound}
|
||||||
|
"0" { $returnCode = [ResultCodes]::FailureInvokingEventRule}
|
||||||
|
default { $returnCode = [ResultCodes]::UnkownResponse}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "Error parsing Web Service result $_"
|
||||||
|
$returnCode = [ResultCodes]::UnkownResponse
|
||||||
|
}
|
||||||
|
return $returnCode, $xml
|
||||||
|
}
|
||||||
|
function Wait-File ($path) {
|
||||||
|
$fileReady = $false
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
while ($sw.ElapsedMilliseconds -le $MAX_TIMEOUT) {
|
||||||
|
if (test-path $path) {
|
||||||
|
$fileReady = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
Start-Sleep $WAIT_SECONDS
|
||||||
|
}
|
||||||
|
$sw.Stop()
|
||||||
|
if (!($fileReady)) {
|
||||||
|
return [ResultCodes]::ResponseTimeout
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return [ResultCodes]::Success
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Exec-Query( $sql, $parameters = @{}, $conn, $timeout = 30, [bool]$Wait = $false) {
|
||||||
|
|
||||||
|
$cmd = new-object system.Data.SqlClient.SqlCommand($sql, $conn)
|
||||||
|
$cmd.CommandTimeout = $timeout
|
||||||
|
foreach ($p in $parameters.Keys) {
|
||||||
|
[Void] $cmd.Parameters.AddWithValue("@$p", $parameters[$p])
|
||||||
|
}
|
||||||
|
$ds = New-Object system.Data.DataSet
|
||||||
|
$da = New-Object system.Data.SqlClient.SqlDataAdapter($cmd)
|
||||||
|
|
||||||
|
# Query DB until results are found
|
||||||
|
|
||||||
|
if (!($Wait)) {
|
||||||
|
$da.fill($ds) | Out-Null
|
||||||
|
return [ResultCodes]::Success, $ds
|
||||||
|
}
|
||||||
|
|
||||||
|
#Query and wait for data
|
||||||
|
$dataReady = $false
|
||||||
|
$sw.Restart()
|
||||||
|
while ($sw.ElapsedMilliseconds -le $MAX_TIMEOUT) {
|
||||||
|
$da.fill($ds) | Out-Null
|
||||||
|
|
||||||
|
if ($null -ne $ds.Tables[0] -and $ds.Tables[0].Rows.Count -ge 1) {
|
||||||
|
$dataReady = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
Start-Sleep $WAIT_SECONDS
|
||||||
|
}
|
||||||
|
$sw.Stop()
|
||||||
|
if (!($dataReady)) {
|
||||||
|
return [ResultCodes]::ResponseTimeout, $null
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return [ResultCodes]::Success, $ds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Main
|
||||||
|
Add-Type -TypeDefinition $customWebclientCode -Language CSharp
|
||||||
|
$returnCode = [ResultCodes]::Success
|
||||||
|
|
||||||
|
$RequestID = [guid]::NewGuid()
|
||||||
|
write-host "RequestID: $RequestID"
|
||||||
|
$responsePath = "$RequestID"
|
||||||
|
|
||||||
|
## Invoke EFT Event Rule
|
||||||
|
$output = Invoke-EventRule $RequestID
|
||||||
|
$returnCode = $output[0]
|
||||||
|
$responseXml = $output[1]
|
||||||
|
|
||||||
|
# retrive the Event Transaction context value of the transaction
|
||||||
|
$EventTransactionId = $responseXml.root.ContextVariables.Variable | Where-Object { $_.Name -eq "EVENT.TRANSACTION_ID"} | Select-Object -ExpandProperty "#cdata-section"
|
||||||
|
Write-host "EventTransactionId: $EventTransactionId"
|
||||||
|
|
||||||
|
#Exit if Error
|
||||||
|
if ($returnCode -ne [ResultCodes]::Success) {
|
||||||
|
return $returnCode
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Query for Files transfers
|
||||||
|
$sqlConn = New-Object System.Data.SqlClient.SqlConnection
|
||||||
|
$sqlConn.ConnectionString = "Server=GS0334;Integrated Security=true;Initial Catalog=EFTDB"
|
||||||
|
|
||||||
|
$sqlConn.Open()
|
||||||
|
$result = exec-query 'select * from tbl_Transactions WHERE TransactionGUID = @EventTransactionId' -parameter @{EventTransactionId = $EventTransactionId} -conn $sqlConn -Wait $true
|
||||||
|
|
||||||
|
$returnCode = $result[0]
|
||||||
|
if ($returnCode -ne [ResultCodes]::Success) {
|
||||||
|
return $returnCode
|
||||||
|
}
|
||||||
|
$data = $result[1]
|
||||||
|
$transactionID = $data.tables[0].TransactionID
|
||||||
|
|
||||||
|
Write-host "transactionID: $transactionID"
|
||||||
|
|
||||||
|
$result = exec-query 'Select * from tbl_Actions where TransactionID = @TransactionID' -parameter @{TransactionID = $transactionID} -conn $sqlConn
|
||||||
|
|
||||||
|
$returnCode = $result[0]
|
||||||
|
if ($returnCode -ne [ResultCodes]::Success) {
|
||||||
|
return $returnCode
|
||||||
|
}
|
||||||
|
$actionTransactions = $result[1]
|
||||||
|
|
||||||
|
Write-host "Actions"
|
||||||
|
$actionTransactions.tables[0] | Format-Table
|
||||||
|
|
||||||
|
Write-host "Client Operations"
|
||||||
|
$transferTransactions = exec-query 'select * from tbl_ClientOperations where TransactionID = @TransactionID' -parameter @{TransactionID = $transactionID} -conn $sqlConn
|
||||||
|
$transferTransactions.tables[0] | Format-List
|
||||||
|
|
||||||
|
foreach ($row in $transferTransactions.tables[0].Rows){
|
||||||
|
if ($row.ResultID -ne 1 )
|
||||||
|
{
|
||||||
|
$returnCode = [ResultCodes]::FilesWithErrors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($returnCode -ne [ResultCodes]::Success) {
|
||||||
|
return $returnCode
|
||||||
|
}
|
||||||
|
|
||||||
|
$sqlConn.Close()
|
||||||
|
|
||||||
|
# ## Move the response to history
|
||||||
|
# if (!(Test-path $SchedulerQueueHistory)) {
|
||||||
|
# New-Item -ItemType directory -Path $SchedulerQueueHistory
|
||||||
|
# }
|
||||||
|
# $ArchivePath = "$SchedulerQueueHistory$RequestID"
|
||||||
|
# Move-Item $responsePath $ArchivePath
|
||||||
|
|
||||||
|
$returnCode
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,214 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2019 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Get the current registry settings of the EFT Server
|
||||||
|
.DESCRIPTION
|
||||||
|
This script will list the current registry settings of the EFT Server
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.RegistrySettings.ps1
|
||||||
|
|
||||||
|
This script may restart your EFT Service
|
||||||
|
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Position = 6, Mandatory = $False)]
|
||||||
|
[int] [ValidateRange(0, 86400)] $DrainingTimeoutSecs = 900,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[int] $ClusterOutOfSyncHealSecs = 30,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[string][ValidateSet("msmq-iterative","msmq-broadcasting","msmq-multicast")] $ClusterCoherenceQueueMsmqType = "msmq-iterative",
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[int]$ClusterCoherenceQueueDetectPrivateIP = 0,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
#DEBUGGING LINE
|
||||||
|
#$RegPath = "HKLM:\SOFTWARE\WOW6432Node\GlobalSCAPE Inc.\EFT Server 7.4"
|
||||||
|
#$RegName = "ShowQuotaControls"
|
||||||
|
|
||||||
|
function Test-RegistryKeyValue
|
||||||
|
{
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Tests if a registry value exists.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
CHecks to see if registry path and name exists. Returns either True or False.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Test-RegistryKeyValue -Path 'HKLM:\SOFTWARE\WOW6432Node\GlobalSCAPE Inc.\EFT Server 7.4' -Name 'ShowQuotaControls'
|
||||||
|
Returns `True` if `HKLM:\SOFTWARE\WOW6432Node\GlobalSCAPE Inc.\EFT Server 7.` contains a value named 'ShowQuotaControls'. `False` otherwise.
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]
|
||||||
|
# The path to the registry key where the value should be set.
|
||||||
|
$Path,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]
|
||||||
|
# The name of the value being set.
|
||||||
|
$Name
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if( -not (Test-Path -Path $Path -PathType Container) )
|
||||||
|
{
|
||||||
|
#DEBUGGING LINE
|
||||||
|
#Write-host "Reg Path does not exist"
|
||||||
|
return $false
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$properties = Get-ItemProperty -Path $Path
|
||||||
|
if( -not $properties )
|
||||||
|
{
|
||||||
|
#DEBUGGING LINE
|
||||||
|
#Write-host "Reg Path does not exist"
|
||||||
|
return $false
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$member = Get-Member -InputObject $properties -Name $Name
|
||||||
|
if( $member )
|
||||||
|
{
|
||||||
|
#DEBUGGING LINE
|
||||||
|
#Write-host "Registry Name exists"
|
||||||
|
return $true
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#DEBUGGING LINE
|
||||||
|
#Write-host "Reg Name does not exist"
|
||||||
|
return $false
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-RegInfo {
|
||||||
|
Param ([string]$RegPath, [string]$RegName)
|
||||||
|
#DEBUGGING LINE
|
||||||
|
#Write-host "Get-RegInfo Running"
|
||||||
|
|
||||||
|
if( -not (Test-RegistryKeyValue -Path $RegPath -Name $RegName))
|
||||||
|
{
|
||||||
|
Write-host $RegPath : "Key Does not Exist"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-host $RegPath\$RegName : (Get-ItemProperty -Path $RegPath -Name $RegName).$RegName
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@()
|
||||||
|
|
||||||
|
$results += new-object psobject -Property @{ Name = "MySite"; Path = "\"; Description = ""; }
|
||||||
|
$results += new-object psobject -Property @{ Name = "MySite2222"; Path = "asasdasd"; Description = ""; }
|
||||||
|
|
||||||
|
$results | select Name, Path, Description
|
||||||
|
$results | ForEach-Object {Test-path $_.Path}
|
||||||
|
foreach ($row in $results) {$row.Name}
|
||||||
|
|
||||||
|
##
|
||||||
|
try {
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$Hash = -join ( $u | Select-Object * -ExcludeProperty SiteName, SCH_NextRun, Validpath, CheckSum)
|
||||||
|
$Hash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($Hash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $Hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Write-host "******* EFT Registry Checker *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " > This script will modify your EFT registry settings it's recommended you make a backup " -ForegroundColor Yellow
|
||||||
|
Write-host " > You must perform backups of your EFT config and registry before using this script" -ForegroundColor Yellow
|
||||||
|
Write-host " > It is recommend you test this script in a non-production environment before " -ForegroundColor Yellow
|
||||||
|
Write-host " using in production to validate its functionality" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Output parameters
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red}
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
Write-host "HA Settings"
|
||||||
|
Write-host ""
|
||||||
|
Get-RegInfo -RegPath "HKLM:\SOFTWARE\WOW6432Node\GlobalSCAPE Inc.\EFT Server 7.4" -RegName "ShowQuotaControls"
|
||||||
|
Write-host "ClusterOutOfSyncHealSecs : $ClusterOutOfSyncHealSecs"
|
||||||
|
Write-host "ClusterCoherenceQueueMsmqType : $ClusterCoherenceQueueMsmqType"
|
||||||
|
Write-host "ClusterCoherenceQueueDetectPrivateIP: $ClusterCoherenceQueueDetectPrivateIP"
|
||||||
|
|
||||||
|
<#
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$EFTServerPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\"
|
||||||
|
New-Item -Path $EFTServerPath -Name "EFT Server 7.4" -Force | Out-Null
|
||||||
|
|
||||||
|
$EFTServer74RegPath = "$($EFTServerPath)\EFT Server 7.4"
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name DrainingTimeoutSecs -value $DrainingTimeoutSecs -Force
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name ClusterOutOfSyncHealSecs -value $ClusterOutOfSyncHealSecs -Force
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name ClusterCoherenceQueueMsmqType -value $ClusterCoherenceQueueMsmqType -Force
|
||||||
|
Set-ItemProperty -Path $EFTServer74RegPath -Name ClusterCoherenceQueueDetectPrivateIP -value $ClusterCoherenceQueueDetectPrivateIP -Force
|
||||||
|
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
|
||||||
|
$restart = "y"
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$restart = Read-Host "Do you want to restart EFT Service now (y/n)? "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($restart.ToUpper() -eq "Y" ) {
|
||||||
|
$EftService | Restart-Service
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
Write-host "Waiting EFT Service to be Started ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$EftService.WaitForStatus("Running", "00:00:30")
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
#>
|
@ -0,0 +1,925 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
|
||||||
|
.SYNOPSIS
|
||||||
|
This Script generates a useful configuration information used as report after a Globalscape Quick Start service is completed
|
||||||
|
.DESCRIPTION
|
||||||
|
This script will connect to you EFT Server using EFT SFTPCOMInterface API and extract configuration information and it will be output into a TXT file (-ReportFile)
|
||||||
|
Some cases depending on the EFT version some information won't be available by EFT SFPTCOMInterface API, in such case values will be apperead as ERROR.
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.Report.ps1 | Tee-Object Executive_Config_Report.txt
|
||||||
|
.\EFT.Report.ps1 > report.txt
|
||||||
|
.NOTES
|
||||||
|
Globalscape Inc.
|
||||||
|
Version: 1.0
|
||||||
|
Last Modified Date: 09/24/2017
|
||||||
|
This script is intended to be run safetly without impacting or changing any EFT configuration, so you can use it any time as many times you would like.
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "HTML Format")]
|
||||||
|
[switch] $FormatToHTML
|
||||||
|
|
||||||
|
)
|
||||||
|
function GetRegistrationState ($value) {
|
||||||
|
$result = -1
|
||||||
|
try {
|
||||||
|
$result = $EFTServer.ModuleRegistrationState($value)
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
switch ($result) {
|
||||||
|
-1 { return "Unknown" }
|
||||||
|
0 { return "Registered" }
|
||||||
|
1 { return "Evaluation" }
|
||||||
|
2 { return "Expired" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function GetSiteNodeState($value) {
|
||||||
|
switch ($value) {
|
||||||
|
0 { return "SiteIsRunning" }
|
||||||
|
1 { return "SiteIsStopped" }
|
||||||
|
2 { return "SiteFailedToStart" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function GetDiskType ($value) {
|
||||||
|
switch ($value) {
|
||||||
|
0 { return "$value Unknown" }
|
||||||
|
1 { return "$value No Root Directory" }
|
||||||
|
2 { return "$value Removable Disk" }
|
||||||
|
3 { return "$value Local Drive" }
|
||||||
|
4 { return "$value Network Drive" }
|
||||||
|
5 { return "$value Compact Disc" }
|
||||||
|
6 { return "$value RAM Disk" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function GetSerials() {
|
||||||
|
$serials = @()
|
||||||
|
|
||||||
|
$DMZGateway = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source2"
|
||||||
|
$EFTAS2 = "Registry::HKEY_CLASSES_ROOT\HIERCOJ\GREEN"
|
||||||
|
$AWE = "Registry::HKEY_CLASSES_ROOT\NL.wga.wGm.B2008"
|
||||||
|
$EFT6Baseline = "Registry::HKEY_CLASSES_ROOT\RDK"
|
||||||
|
$EFT7Baseline = "Registry::HKEY_CLASSES_ROOT\R2D2"
|
||||||
|
$EFT6Enterprise = "Registry::HKEY_CLASSES_ROOT\Win64.compat/wow64 "
|
||||||
|
$EFT7Enterprise = "Registry::HKEY_CLASSES_ROOT\SMB.cluster\availability"
|
||||||
|
$HighSecurity = "Registry::HKEY_CLASSES_ROOT\GRR\TRIAM"
|
||||||
|
$DMZ3SingleSite = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source3"
|
||||||
|
$DMZ3MultiSite = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source4"
|
||||||
|
$Workspaces = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source7"
|
||||||
|
$ARM = "Registry::HKEY_CLASSES_ROOT\ARM_RANdl.1"
|
||||||
|
$PGP = "Registry::HKEY_CLASSES_ROOT\SPLehP\dlog8"
|
||||||
|
$CIC = "Registry::HKEY_CLASSES_ROOT\HKEY_CLASSES_ROOT\IOleVariance.Source6"
|
||||||
|
$EFT73WTCCAL = "Registry::HKEY_CLASSES_ROOT\NNIF\NAMUH "
|
||||||
|
$EFT73WTCCAL = "Registry::HKEY_CLASSES_ROOT\DTI\EWB"
|
||||||
|
$EFT73SMBFileTransferClient = "Registry::HKEY_CLASSES_ROOT\SCL"
|
||||||
|
$EFT73SMBFolderMonitorEventRule = "Registry::HKEY_CLASSES_ROOT\SFM"
|
||||||
|
$EFT73SMBTimerEventModule = "Registry::HKEY_CLASSES_ROOT\STM"
|
||||||
|
|
||||||
|
if (test-path -Path $DMZGateway) { $serials += new-object psobject -Property @{ Name = "DMZGateway" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $DMZGateway).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFTAS2) { $serials += new-object psobject -Property @{ Name = "EFTAS2" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFTAS2).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $AWE) { $serials += new-object psobject -Property @{ Name = "AWE" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $AWE).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT6Baseline) { $serials += new-object psobject -Property @{ Name = "EFT6Baseline" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT6Baseline).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT7Baseline) { $serials += new-object psobject -Property @{ Name = "EFT7Baseline" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT7Baseline).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT6Enterprise) { $serials += new-object psobject -Property @{ Name = "EFT6Enterprise" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT6Enterprise).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT7Enterprise) { $serials += new-object psobject -Property @{ Name = "EFT7Enterprise" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT7Enterprise).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $HighSecurity) { $serials += new-object psobject -Property @{ Name = "HighSecurity" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $HighSecurity).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $DMZ3SingleSite) { $serials += new-object psobject -Property @{ Name = "DMZ3SingleSite" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $DMZ3SingleSite).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $DMZ3MultiSite) { $serials += new-object psobject -Property @{ Name = "DMZ3MultiSite" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $DMZ3MultiSite).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $Workspaces) { $serials += new-object psobject -Property @{ Name = "Workspaces" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $Workspaces).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $ARM) { $serials += new-object psobject -Property @{ Name = "ARM" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $ARM).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $PGP) { $serials += new-object psobject -Property @{ Name = "PGP" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $PGP).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $CIC) { $serials += new-object psobject -Property @{ Name = "CIC" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $CIC).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73WTCCAL) { $serials += new-object psobject -Property @{ Name = "EFT73WTCCAL" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73WTCCAL).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73WTCCAL) { $serials += new-object psobject -Property @{ Name = "EFT73WTCCAL" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73WTCCAL).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73SMBFileTransferClient) { $serials += new-object psobject -Property @{ Name = "EFT73SMBFileTransferClient" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73SMBFileTransferClient).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73SMBFolderMonitorEventRule) { $serials += new-object psobject -Property @{ Name = "EFT73SMBFolderMonitorEventRule" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73SMBFolderMonitorEventRule).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73SMBTimerEventModule) { $serials += new-object psobject -Property @{ Name = "EFT73SMBTimerEventModule" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73SMBTimerEventModule).1) }
|
||||||
|
}
|
||||||
|
|
||||||
|
return $serials
|
||||||
|
}
|
||||||
|
|
||||||
|
function GenerateHTMLReport ($report){
|
||||||
|
$Header = @"
|
||||||
|
<title>EFT Configuration Report - $($env:computername)</title>
|
||||||
|
<style>
|
||||||
|
table {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
|
||||||
|
th {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED; color: white}
|
||||||
|
td {border-width: 1px; padding: 3px; border-style: solid; border-color: black; vertical-align: top; }
|
||||||
|
</style>
|
||||||
|
"@
|
||||||
|
|
||||||
|
$fragements = "<h1>EFT Configuration Report</h1>"
|
||||||
|
$fragements += "Creation Date : $($report.CreationDate) <br/>"
|
||||||
|
$fragements += "Computer Name : $($report:ComputerName) <br/>"
|
||||||
|
$fragements += $report.Parameters | Select-Object Name, Value | convertto-html -Fragment -PreContent "<h3>Report Parameters </h3>"
|
||||||
|
$fragements += "<h2>EFT Configuration </h2>"
|
||||||
|
|
||||||
|
$fragements += "<h2>Server </h2>"
|
||||||
|
$fragements += "<h3>General</h3>"
|
||||||
|
$fragements += $report.GeneralStatistics | select-object ServiceStarted, StartTime, Uptime, LastModifiedTime,LastModifiedBy | convertto-html -Fragment -as list -PreContent "<h4>Statistics</h4>"
|
||||||
|
$fragements += $report.GeneralSettings | select-object ConfigurationFilePath, AllowRemoteAdministration, UseSSLForAdministration, UseUTCInListings| convertto-html -Fragment -as list -PreContent "<h4>General Settings</h4>"
|
||||||
|
$fragements += $report.ModuleRegistrationState | select-object Module, State | convertto-html -Fragment -PreContent "<h4>Module Registration State </h4>"
|
||||||
|
$fragements += $report.SerialKeys | convertto-html -Fragment -PreContent "<h4>Serial Keys </h4>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Administration</h3>"
|
||||||
|
$fragements += $report.Administration | convertto-html -Fragment -as List -PreContent "<h4>Server Administration Connectivity </h4>"
|
||||||
|
$fragements += $report.AdminAccounts | Select-Object login, permissions | convertto-html -Fragment -PreContent "<h4>Admin Accounts </h4>"
|
||||||
|
|
||||||
|
$fragements += $report.Security | convertto-html -Fragment -as List -PreContent "<h3>Security Settings </h3>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Logs</h3>"
|
||||||
|
$fragements += $report.LogFileSettings | Select-Object LogPath, LogFormat, LogType, LogRotation | convertto-html -Fragment -as List -PreContent "<h4>Log File Settings </h4>"
|
||||||
|
$fragements += $report.ARMSettings | Select-Object ARMConnectionStatus, EnableARM, ARMDatabaseType, ARMServerName, ARMDatabaseName, ARMAuthenticationType, ARMUserName, ARMDiagnosticLogging, ARMWhenError,ARMFailureAuditFolder, ARMAttemptToReconnect, ARMReconnectPeriod, ARMNotifyOnDisconnect, ARMNotifyOnReconnect, ARMFailureEmailList | convertto-html -Fragment -as List -PreContent "<h4>Audit Database Settings </h4>"
|
||||||
|
|
||||||
|
$fragements += $report.SMTP | select-object SMTPServer,SMTPPort, SMTPSenderAddr, SMTPSenderName, SMTPUseAuthentication, SMTPLogin, SMTPPassword, SMTPUseImplicitTLS, SMTPAddressBook, SMTPRecipientAddr,SMTPRecipientName | convertto-html -Fragment -as List -PreContent "<h3>SMTP Settings</h3>"
|
||||||
|
|
||||||
|
$fragements += $report.HighAvailability | select-object HAEnabled, HAEventQueue, HAMulticastAddress, HAMulticastPort, HACoherenceQueue, HAConfigurationFilePath, DefaultNodeList, BackupNodeList | convertto-html -Fragment -as List -PreContent "<h3>High Availability</h3>"
|
||||||
|
|
||||||
|
$fragements += "<h2>Sites</h2>"
|
||||||
|
|
||||||
|
|
||||||
|
$fragements += "<h3>Site General Settings</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteGeneralSettings | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site GS Authentication Settings</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteGSAuthSettings | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site ODBC Authentication Settings</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteODBCAuthSettings | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
|
||||||
|
$fragements += "<h3>Site Active Directory Authentication Settings</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteADAuthSettings | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site LDAP Authentication Settings</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteLDAPAuthSettings | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site Statistics</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteStatistics | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site Connections</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteConnections | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site Security Complexity</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteSecurityComplexity | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site Security ResetPassword</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteSecurityResetPassword | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h3>Site Login Invalid Settings</h3>"
|
||||||
|
$fragements += "<table class='ColumnTable'><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process { $fragements += "<th>$($_.SiteName)</th>" }
|
||||||
|
$fragements += "</tr><tr>"
|
||||||
|
$report.sites | ForEach-Object -Process {
|
||||||
|
$fragements +="<td>"
|
||||||
|
$fragements += $_.SiteLoginInvalidSettings | convertto-html -Fragment
|
||||||
|
$fragements += "</td>"
|
||||||
|
}
|
||||||
|
$fragements += "</tr></table>"
|
||||||
|
|
||||||
|
$fragements += "<h2>EFT Node Settings </h2>"
|
||||||
|
|
||||||
|
$fragements += $report.EFTFileVersion | convertto-html -Fragment -As List -PreContent "<h3>EFT File Version </h3>"
|
||||||
|
$fragements += $report.EFTServices |Select-Object Name, Displayname, StartMode, State, Status, Startname, Pathname | convertto-html -Fragment -PreContent "<h3>EFT Services </h3>"
|
||||||
|
$fragements += $report.EFTSFTPCOMInterfaceFileVersion | convertto-html -Fragment -As List -PreContent "<h3>EFT SFTPCOMInterface File Version </h3>"
|
||||||
|
$fragements += $report.EFTSFTPCOMInterfaceObject | convertto-html -Fragment -As List -PreContent "<h3>EFT SFTPCOMInterface Object </h3>"
|
||||||
|
|
||||||
|
$fragements += $report.EFTRegistry | Select-Object -ExcludeProperty PSProvider, PSParentPath | convertto-html -Fragment -as list -PreContent "<h3>EFT Registry </h3>"
|
||||||
|
$fragements += $report.ServerInfo | convertto-html -Fragment -as list -PreContent "<h3>EFT Server Info </h3>"
|
||||||
|
$fragements += $report.HotFixes | convertto-html -Fragment -PreContent "<h3>OS HotFixes </h3>"
|
||||||
|
$fragements += $report.DiskInfo | convertto-html -Fragment -PreContent "<h3>Disk Info </h3>"
|
||||||
|
convertto-html -Head $Header -body $fragements | Out-File EFT.Report.Configuration.html ; invoke-item EFT.Report.Configuration.html
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$parameters = @()
|
||||||
|
$parameters += New-object psobject -Property @{Name = "EFTAdminHostname"; Value= $EFTAdminHostname;}
|
||||||
|
$parameters += New-object psobject -Property @{Name = "EFTAdminPort" ; Value= $EFTAdminPort;}
|
||||||
|
$parameters += New-object psobject -Property @{Name = "EFTAdminAuthType"; Value= $EFTAdminAuthType;}
|
||||||
|
$parameters += New-object psobject -Property @{Name = "EFTAdminUsername"; Value= $EFTAdminUsername;}
|
||||||
|
|
||||||
|
$report = new-object psobject -Property @{
|
||||||
|
CreationDate = (Get-Date -f $df);
|
||||||
|
ComputerName = $env:computername;
|
||||||
|
Parameters = $parameters;
|
||||||
|
GeneralStatistics = $null;
|
||||||
|
GeneralSettings = $null;
|
||||||
|
ModuleRegistrationState = $null;
|
||||||
|
SerialKeys = $null;
|
||||||
|
|
||||||
|
Administration = $null;
|
||||||
|
AdminAccounts = $null;
|
||||||
|
Security = $null;
|
||||||
|
LogFileSettings = $null;
|
||||||
|
ARMSettings = $null;
|
||||||
|
SMTP = $null;
|
||||||
|
HighAvailability = $null;
|
||||||
|
Sites = $null;
|
||||||
|
EFTService = $null;
|
||||||
|
EFTFileVersion = $null;
|
||||||
|
EFTServices = $null;
|
||||||
|
EFTSFTPCOMInterfaceFileVersion = $null;
|
||||||
|
EFTSFTPCOMInterfaceObject = $null;
|
||||||
|
EFTRegistry = $null;
|
||||||
|
ServerInfo = $null;
|
||||||
|
HotFixes = $null;
|
||||||
|
DiskInfo = $null;
|
||||||
|
WindowsServices = $null;
|
||||||
|
}
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
try {
|
||||||
|
Write-Progress -Activity "Connecting to EFT " -status "EFTAdmin HostName: $EFTAdminHostname"
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
write-Verbose "[$(Get-Date -f $df)] ICIServer.ConnectEx() $($sw.ElapsedMilliseconds)ms"
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
write-output "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "EFT Config" -status "Server Settings"
|
||||||
|
|
||||||
|
$GeneralStatistics = new-object psobject -Property @{
|
||||||
|
ServiceStarted = $script:EftServer.IsStarted;
|
||||||
|
StartTime = $script:EftServer.StartTime;
|
||||||
|
Uptime = $script:EftServer.Uptime;
|
||||||
|
LastModifiedTime = $script:EftServer.LastModifiedTime;
|
||||||
|
LastModifiedBy = $script:EftServer.LastModifiedBy ;
|
||||||
|
}
|
||||||
|
$GeneralSettings = new-object psobject -Property @{
|
||||||
|
ConfigurationFilePath = $script:EftServer.ConfigurationFilePath;
|
||||||
|
AllowRemoteAdministration = $script:EftServer.AllowRemoteAdministration;
|
||||||
|
UseSSLForAdministration = $script:EftServer.UseSSLForAdministration;
|
||||||
|
UseUTCInListings = $script:EftServer.UseUTCInListings;
|
||||||
|
}
|
||||||
|
$report.GeneralStatistics = $GeneralStatistics
|
||||||
|
$report.GeneralSettings = $GeneralSettings
|
||||||
|
|
||||||
|
$EFTServerModule = 0
|
||||||
|
$SSHModule = 1
|
||||||
|
$HTTPModule = 2
|
||||||
|
$WTCModule = 3
|
||||||
|
$ARModule = 4
|
||||||
|
$PGPModule = 5
|
||||||
|
$HSModule = 6 #(In v7.4.7 and later, this is for the ASM (in Enterprise) or the ESM (in Express)
|
||||||
|
$AS2Module = 7
|
||||||
|
$AWModule = 8
|
||||||
|
$DMZGWModule = 9
|
||||||
|
$FolderMonitorEventModule = 10 #(v7.2.2 and later)
|
||||||
|
$TimerEventModule = 11 #(v7.2.2 and later)
|
||||||
|
$FileTransferClientModule = 12 #(v7.2.2 and later)
|
||||||
|
$WorkspacesModule = 13 #(v7.2.3 and later)
|
||||||
|
$AccelerateModule = 14 # (v7.3 and later)
|
||||||
|
$AAMModule = 15 #(v7.3.3 and later)
|
||||||
|
$MTCModule = 16 #(v7.3.9 and v7.4.7 and later)
|
||||||
|
$CICModule = 17 #(v7.3.9 and v7.4.7 and later)
|
||||||
|
$CCMModule = 18 #(v7.3.9 and v7.4.7 and later)
|
||||||
|
|
||||||
|
$ModuleRegistrationState = @()
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="EFTServerModule" ; State = GetRegistrationState($EFTServerModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="SSHModule" ; State = GetRegistrationState($SSHModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="HTTPModule" ; State = GetRegistrationState($HTTPModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="WTCModule" ; State = GetRegistrationState($WTCModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="ARModule" ; State = GetRegistrationState($ARModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="PGPModule" ; State = GetRegistrationState($PGPModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="HSModule" ; State = GetRegistrationState($HSModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="AS2Module" ; State = GetRegistrationState($AS2Module) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="AWModule" ; State = GetRegistrationState($AWModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="DMZGWModule" ; State = GetRegistrationState($DMZGWModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="FolderMonitorEventModule" ; State = GetRegistrationState($FolderMonitorEventModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="TimerEventModule" ; State= GetRegistrationState($TimerEventModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="FileTransferClientModule" ; State = GetRegistrationState($FileTransferClientModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="AccelerateModule" ; State = GetRegistrationState($AccelerateModule) }} catch { }
|
||||||
|
try { $ModuleRegistrationState += new-object psobject -Property @{ Module ="AAM" ; State = GetRegistrationState($AAM) } } catch { }
|
||||||
|
|
||||||
|
$report.ModuleRegistrationState = $ModuleRegistrationState
|
||||||
|
$report.SerialKeys = GetSerials
|
||||||
|
|
||||||
|
$report.Administration = new-object psobject -Property @{
|
||||||
|
AdminPort = $EFTServer.AdminPort;
|
||||||
|
AdminIPAddresses = $EFTServer.GetAdminIPs() -join ';';
|
||||||
|
AdminListenIPAddresses = $EFTServer.ListenIPs -join ';';
|
||||||
|
WebAdminEnabled = $EFTServer.WebAdminEnabled;
|
||||||
|
WebAdminPort = $EFTServer.WebAdminPort;
|
||||||
|
}
|
||||||
|
$AdminAccounts = @()
|
||||||
|
ForEach ($admin in $script:EftServer.AdminAccounts) {
|
||||||
|
$sw.Restart()
|
||||||
|
$PermissionsCount = $admin.GetPermissionsCount()
|
||||||
|
$permissionString = ""
|
||||||
|
for ($i = 0; $i -le $PermissionsCount - 1; $i++) {
|
||||||
|
$sw.Restart()
|
||||||
|
$permission = $admin.GetPermission($i)
|
||||||
|
# AdminPermissionsPolicy:
|
||||||
|
# ServerManagement = 0,
|
||||||
|
# SiteManagement = 1,
|
||||||
|
# STManagement = 2,
|
||||||
|
# UserCreation = 3,
|
||||||
|
# ChangePassword = 4,
|
||||||
|
# COMManagement = 5,
|
||||||
|
# ReportManagement = 6,
|
||||||
|
Switch ($permission.Permission) {
|
||||||
|
0 { $permissionString = "$permissionString Server Admin(Full);" }
|
||||||
|
1 { $permissionString = "$permissionString Site Admin [$($permission.SiteName)];" }
|
||||||
|
2 { $permissionString = "$permissionString Template Admin [$($permission.SiteName)->$($permission.TemplateName)]; " }
|
||||||
|
3 { $permissionString = "$permissionString User Admin [$($permission.SiteName)->$($permission.TemplateName)];" }
|
||||||
|
4 { $permissionString = "$permissionString Change Password Admin [$($permission.SiteName)->$($permission.TemplateName)];" }
|
||||||
|
5 { $permissionString = "$permissionString COM;" }
|
||||||
|
6 { $permissionString = "$permissionString Report management;" }
|
||||||
|
7 { $permissionString = "$permissionString Event Rule Admin [$($permission.SiteName)];" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$AdminAccounts += New-Object psobject -Property @{
|
||||||
|
Login = $admin.Login;
|
||||||
|
Permissions = $permissionString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$report.AdminAccounts = $AdminAccounts;
|
||||||
|
|
||||||
|
$sslmask = [Convert]::ToString($script:EFTServer.SSLVersionMask, 2)
|
||||||
|
|
||||||
|
While ($SSlmask.length -lt 5) {
|
||||||
|
$sslmask = "0" + $sslmask
|
||||||
|
}
|
||||||
|
# Write-output " TLS 1.2 Enabled : $(($sslmask.substring(0,1) -eq 1))"
|
||||||
|
# Write-output " TLS 1.1 Enabled : $(($sslmask.substring(1,1) -eq 1))"
|
||||||
|
# Write-output " TLS 1.0 Enabled : $(($sslmask.substring(4,1) -eq 1))"
|
||||||
|
# Write-output " SSL 3.0 Enabled : $(($sslmask.substring(3,1) -eq 1))"
|
||||||
|
# Write-output " SSL 2.0 Enabled : $(($sslmask.substring(2,1) -eq 1))"
|
||||||
|
$report.Security = New-Object psobject -Property @{
|
||||||
|
SSHFIPSEnabled = $script:EftServer.SSHFIPSEnabled;
|
||||||
|
SSLFIPSEnabled = $script:EftServer.SSLFIPSEnabled;
|
||||||
|
AllowClearCommandChannel = $script:EftServer.AllowClearCommandChannel;
|
||||||
|
AllowUnprotectedDataChannel = $script:EftServer.AllowUnprotectedDataChannel;
|
||||||
|
TLS12Enabled = $(($sslmask.substring(0, 1) -eq 1)) ;
|
||||||
|
TLS11Enabled = $(($sslmask.substring(1, 1) -eq 1));
|
||||||
|
TLS10Enabled = $(($sslmask.substring(4, 1) -eq 1));
|
||||||
|
SSL30Enabled = $(($sslmask.substring(3, 1) -eq 1));
|
||||||
|
SSL20Enabled = $(($sslmask.substring(2, 1) -eq 1));
|
||||||
|
}
|
||||||
|
if ($script:EftServer.LogMode -eq 0){
|
||||||
|
$LogMode = "Standard"
|
||||||
|
} else {
|
||||||
|
$LogMode = "Verbose"
|
||||||
|
}
|
||||||
|
switch ($script:EFtServer.LogType ) {
|
||||||
|
2 { $LogType = "W3C Extended Log File Format "}
|
||||||
|
3 { $LogType = "Microsoft IIS Log File Format"}
|
||||||
|
4 { $LogType = "NCSA Common Log File Format"}
|
||||||
|
5 { $LogType = "None"}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($script:EFtServer.LogRotation) {
|
||||||
|
0 {$LogRotation ="Never"}
|
||||||
|
1 {$LogRotation ="Daily"}
|
||||||
|
2 {$LogRotation ="Weekly"}
|
||||||
|
3 {$LogRotation ="Monthly"}
|
||||||
|
}
|
||||||
|
$report.LogFileSettings = New-Object psobject -Property @{
|
||||||
|
LogPath = $script:EftServer.LogPath;
|
||||||
|
LogFormat = $LogType;
|
||||||
|
LogType = $LogMode;
|
||||||
|
LogRotation = $LogRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $script:EftServer.ARMDatabaseType -eq 0) {
|
||||||
|
$ARMDatabaseType = "Oracle"
|
||||||
|
} else {
|
||||||
|
$ARMDatabaseType = "SQL Server"
|
||||||
|
}
|
||||||
|
if ( $script:EftServer.ARMAuthenticationType -eq 0) {
|
||||||
|
$ARMAuthenticationType = "Windows Authentication"
|
||||||
|
} else {
|
||||||
|
$ARMAuthenticationType = "SQL Authentication"
|
||||||
|
}
|
||||||
|
if ($script:EftServer.ARMStopAuditingOnError) {
|
||||||
|
$ARMWhenError ="Stop Auditing"
|
||||||
|
} else {
|
||||||
|
$ARMWhenError = "Audit to folder"
|
||||||
|
}
|
||||||
|
if ($script:EftServer.ARMConnectionStatus) {
|
||||||
|
$ARMConnectionStatus ="CONNECTED"
|
||||||
|
} else {
|
||||||
|
$ARMConnectionStatus = "ERROR"
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if ( $script:EftServer.ARMCommitEventRuleTransferLog -eq 0) {
|
||||||
|
$ARMCommitEventRuleTransferLog = "None"
|
||||||
|
} else {
|
||||||
|
$ARMCommitEventRuleTransferLog = "Failures only"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$ARMCommitEventRuleTransferLog = "N/A"
|
||||||
|
}
|
||||||
|
|
||||||
|
$report.ARMSettings = New-Object psobject -Property @{
|
||||||
|
ARMConnectionStatus = $ARMConnectionStatus;
|
||||||
|
EnableARM = $script:EftServer.EnableARM;
|
||||||
|
ARMDatabaseType = $ARMDatabaseType;
|
||||||
|
ARMServerName = $script:EftServer.ARMServerName;
|
||||||
|
ARMDatabaseName = $script:EftServer.ARMDatabaseName;
|
||||||
|
ARMAuthenticationType = $ARMAuthenticationType;
|
||||||
|
ARMUserName = $script:EftServer.ARMUserName ;
|
||||||
|
ARMDiagnosticLogging = $ARMCommitEventRuleTransferLog;
|
||||||
|
ARMWhenError = $ARMWhenError ;
|
||||||
|
ARMFailureAuditFolder = $script:EftServer.ARMFailureAuditFolder ;
|
||||||
|
ARMAttemptToReconnect = $script:EftServer.ARMHealConnection;
|
||||||
|
ARMReconnectPeriod = $script:EftServer.ARMReconnectPeriod;
|
||||||
|
ARMNotifyOnDisconnect = $script:EftServer.ARMNotifyOnDisconnect ;
|
||||||
|
ARMNotifyOnReconnect = $script:EftServer.ARMNotifyOnReconnect ;
|
||||||
|
ARMFailureEmailList = $script:EftServer.ARMFailureEmailList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$report.SMTP = New-Object psobject -Property @{
|
||||||
|
SMTPServer = $script:EftServer.SMTPServer;
|
||||||
|
SMTPPort = $script:EftServer.SMTPPort;
|
||||||
|
SMTPSenderAddr = $script:EftServer.SMTPSenderAddr;
|
||||||
|
SMTPSenderName = $script:EftServer.SMTPSenderName;
|
||||||
|
SMTPUseAuthentication = $script:EftServer.SMTPUseAuthentication;
|
||||||
|
SMTPLogin = $script:EftServer.SMTPLogin;
|
||||||
|
SMTPPassword = "*****"
|
||||||
|
SMTPUseImplicitTLS = $script:EftServer.SMTPUseImplicitTLS;
|
||||||
|
SMTPAddressBook = $script:EftServer.SMTPAddressBook;
|
||||||
|
SMTPRecipientAddr = $script:EftServer.SMTPRecipientAddr;
|
||||||
|
SMTPRecipientName = $script:EftServer.SMTPRecipientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($script:EftServer.HAEnabled) {
|
||||||
|
$report.HighAvailability = New-Object psobject -Property @{
|
||||||
|
HAEnabled = $script:EftServer.HAEnabled;
|
||||||
|
HAEventQueue = $script:EftServer.HAEventQueue;
|
||||||
|
HAMulticastAddress = $script:EftServer.HAMulticastAddress;
|
||||||
|
HAMulticastPort = $script:EftServer.HAMulticastPort;
|
||||||
|
HACoherenceQueue = $script:EftServer.HACoherenceQueue;
|
||||||
|
HAConfigurationFilePath = $script:EftServer.HAConfigurationFilePath;
|
||||||
|
DefaultNodeList = $script:EftServer.HAConfigurationDefaultNodeList -join ",";
|
||||||
|
BackupNodeList = $script:EftServer.HAConfigurationBackupNodeList -join ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$report.HighAvailability = New-Object psobject -Property @{
|
||||||
|
HAEnabled = $script:EftServer.HAEnabled;
|
||||||
|
HAEventQueue = "NA";
|
||||||
|
HAMulticastAddress = "NA";
|
||||||
|
HAMulticastPort = "NA";
|
||||||
|
HACoherenceQueue = "NA";
|
||||||
|
HAConfigurationFilePath = "NA";
|
||||||
|
DefaultNodeList = "NA";
|
||||||
|
BackupNodeList = "NA";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
write-Verbose "[$(Get-Date -f $df)] ICIServer.Sites() $($sw.ElapsedMilliseconds )ms"
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
$count = $script:EftSites.Count()
|
||||||
|
|
||||||
|
|
||||||
|
$sites = @()
|
||||||
|
for ($i = 0; $i -le $count - 1; $i++ ) {
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $script:EftSites.Item($i)
|
||||||
|
$SiteGuid = $null
|
||||||
|
try {
|
||||||
|
$SiteGuid = $script:EftSite.GUID
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
|
||||||
|
}
|
||||||
|
$SiteId = $script:EftSite.ID
|
||||||
|
$siteName = $script:EftSite.Name
|
||||||
|
|
||||||
|
$general = @()
|
||||||
|
$GSParams = @()
|
||||||
|
$ODBCParams = @()
|
||||||
|
$ADParams = @()
|
||||||
|
$LDAPParams = @()
|
||||||
|
$statistics = @()
|
||||||
|
$connections = @()
|
||||||
|
$complexPasswordSettings = @()
|
||||||
|
$resetPasswordSettings = @()
|
||||||
|
$LoginInvalidSettings = @()
|
||||||
|
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $i/$Count" -percentComplete ($i / $Count * 100)
|
||||||
|
$AuthManagerID = $script:EftSite.GetAuthManagerID()
|
||||||
|
Switch ($AuthManagerID) {
|
||||||
|
0 { $SiteAuthType = "GS Authentication" }
|
||||||
|
1 { $SiteAuthType = "Active Directory/NTLM" }
|
||||||
|
2 { $SiteAuthType = "ODBC" }
|
||||||
|
3 { $SiteAuthType = "LDAP Authentication" }
|
||||||
|
}
|
||||||
|
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="SiteID" ; Value = $SiteID }} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="SiteGUID" ; Value = $SiteGUID;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RootFolder" ; Value = $script:EftSite.GetRootFolder();}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="SiteAuthType" ; Value = $SiteAuthType;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="ODBCSettings" ; Value = $script:EftSite.ODBCSettings;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RadiusServerName" ; Value = $script:EftSite.RadiusServerName;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RadiusServerPort" ; Value = $script:EftSite.RadiusServerPort;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RadiusNasIdentifier" ; Value = $script:EftSite.RadiusNasIdentifier;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RadiusSharedSecret" ; Value = $script:EftSite.RadiusSharedSecret;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RadiusConnectionRetriesCount" ; Value = $script:EftSite.RadiusConnectionRetriesCount;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RadiusTimeout" ; Value = $script:EftSite.RadiusTimeout;}} catch { }
|
||||||
|
try { $general += new-object psobject -Property @{ Setting ="RSAConfigurationPath" ; Value = $script:EftSite.RSAConfigurationPath;}} catch { }
|
||||||
|
|
||||||
|
$AMParam = $script:EftSite.GetAMParams()
|
||||||
|
if( $AMParam.Domain -eq 0 ){
|
||||||
|
$ADType = "Active Directory"
|
||||||
|
} else {
|
||||||
|
$ADType = "NTLM"
|
||||||
|
}
|
||||||
|
switch ($AMParam.LogonAttribute) {
|
||||||
|
0 { $ADLogonAttribute = "NT4AccountName" }
|
||||||
|
1 { $ADLogonAttribute = "DisplayName"}
|
||||||
|
2 { $ADLogonAttribute = "UserPrincipalName"}
|
||||||
|
3 { $ADLogonAttribute = "CommonName"}
|
||||||
|
Default { $ADLogonAttribute = "Unknown"}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$UseWindowsAccessPermissions = $AMParams.UseWindowsAccessPermissions
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$UseWindowsAccessPermissions= ""
|
||||||
|
}
|
||||||
|
switch ($AMParam.SearchScope ) {
|
||||||
|
0 { $LDAPSearchScope= "Base" }
|
||||||
|
1 { $LDAPSearchScope= "One Level" }
|
||||||
|
2 { $LDAPSearchScope= "Subtree" }
|
||||||
|
Default {$LDAPSearchScope = "Unknown"}
|
||||||
|
}
|
||||||
|
switch ($AMParam.LDAPVersion) {
|
||||||
|
2 { $LDAPVersion = "Version2" }
|
||||||
|
3 { $LDAPVersion = "Version3" }
|
||||||
|
Default { $LDAPVersion= "Unknown"}
|
||||||
|
}
|
||||||
|
|
||||||
|
try { $GSParams += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $GSParams += new-object psobject -Property @{ Setting ="SiteAuthType" ; Value = $SiteAuthType }} catch { }
|
||||||
|
try { $GSParams += new-object psobject -Property @{ Setting ="RefreshIntervalMinutes" ; Value = $AMParam.RefreshIntervalMinutes }} catch { }
|
||||||
|
|
||||||
|
try { $GSParams += new-object psobject -Property @{ Setting ="GSUserDatabasePath" ; Value = $AMParam.UserDatabasePath }} catch { }
|
||||||
|
|
||||||
|
try { $ODBCParams += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $ODBCParams += new-object psobject -Property @{ Setting ="SiteAuthType" ; Value = $SiteAuthType }} catch { }
|
||||||
|
try { $ODBCParams += new-object psobject -Property @{ Setting ="RefreshIntervalMinutes" ; Value = $AMParam.RefreshIntervalMinutes }} catch { }
|
||||||
|
try { $ODBCParams += new-object psobject -Property @{ Setting ="ODBCUserDatabaseConnectionString" ; Value = $AMParam.UserDatabaseConnectionString }} catch { }
|
||||||
|
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="SiteAuthType" ; Value = $SiteAuthType }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADType" ; Value = $ADType }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADDomain" ; Value = $AMParam.Domain }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADGroup" ; Value = $AMParam.Group }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADLogonAttribute" ; Value = $ADLogonAttribute }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADCreateUsersOnlyByLogin" ; Value = $AMParams.CreateUsersOnlyByLogin }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADAssignHomeFolderFromUserProfile" ; Value = $AMParam.AssignHomeFolderFromUserProfile }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADKeepHomeFoldersInSync" ; Value = $AMParams.KeepHomeFoldersInSync }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADSkipDomainPrefix" ; Value = $AMParam.SkipDomainPrefix }} catch { }
|
||||||
|
try { $ADParams += new-object psobject -Property @{ Setting ="ADUseWindowsAccessPermissions" ; Value = $UseWindowsAccessPermissions }} catch { }
|
||||||
|
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPCreateUsersOnlyByLogin" ; Value = $AMParam.CreateUsersOnlyByLogin }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPServer" ; Value = $AMParam.Server }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPPort" ; Value = $AMParam.Port }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPBaseDN" ; Value = $AMParam.BaseDN }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPUserFilter" ; Value = $AMParam.UserFilter }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPSearchAttributes" ; Value = $AMParam.SearchAttributes }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPUseSSL" ; Value = $AMParam.UseSSL }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPServerUserName" ; Value = $AMParam.ServerUserName }} catch { }
|
||||||
|
#try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPServerPassword" ; Value = Value = $AMParam.ServerPassword }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPServerPassword" ; Value = "*****" }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPAdditionalUserSettingsPath" ; Value = $AMParam.AdditionalUserSettingsPath }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPTimeoutSeconds" ; Value = $AMParam.TimeoutSeconds }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPSearchScope" ; Value = $LDAPSearchScope }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPChaseReferrals" ; Value = $AMParam.ChaseReferrals }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPLDAPVersion" ; Value = $LDAPVersion }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPUsePageControl" ; Value = $AMParam.UsePageControl }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPPageSizeEntries" ; Value = $AMParam.PageSizeEntries }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPUseSearchAttributes" ; Value = $AMParam.UseSearchAttributes }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPSettingsTemplateAttributes" ; Value = $AMParams.SettingsTemplateAttributes }} catch { }
|
||||||
|
try { $LDAPParams += new-object psobject -Property @{ Setting ="LDAPAutoCreateSettingsTemplate" ; Value = $AMParams.AutoCreateSettingsTemplate }} catch { }
|
||||||
|
|
||||||
|
$IsStarted = $script:EftSite.IsStarted
|
||||||
|
$AverageSpeed = $script:EftSite.AverageSpeed
|
||||||
|
$UsersDefined = $script:EftSite.UsersDefined
|
||||||
|
$WTCSessionsActive = $script:EftSite.WTCSessionsActive
|
||||||
|
$WTCSessionsRemaining = $script:EftSite.WTCSessionsRemaining
|
||||||
|
$Users = $script:EftSite.GetUsers()
|
||||||
|
$SettingsLevels = $script:EftSite.GetSettingsLevels()
|
||||||
|
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="IsStarted" ; Value = $IsStarted }} catch { }
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="AverageSpeed" ; Value = $AverageSpeed }} catch { }
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="UserCount" ; Value = $Users.Count }} catch { }
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="UsersDefined" ; Value = $UsersDefined }} catch { }
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="SettingsLevelsCount" ; Value = $SettingsLevels.Count }} catch { }
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="WTCSessionsRemaining" ; Value = $WTCSessionsRemaining }} catch { }
|
||||||
|
try { $statistics += new-object psobject -Property @{ Setting ="WTCSessionsActive" ; Value = $WTCSessionsActive }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SiteIPaddr" ; Value = $script:EftSite.GetIP() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="FTPAccess" ; Value = $script:EftSite.GetFTPAccess() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="FTPPort" ; Value = $script:EftSite.GetPort() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="FTPEncoding" ; Value = $script:EftSite.FTPEncoding }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="AllowFXP" ; Value = $script:EftSite.GetAllowFXP() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="AllowCOMB" ; Value = $script:EftSite.GetAllowCOMB() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="AllowXCRC" ; Value = $script:EftSite.GetAllowXCRC() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="FTPSExp" ; Value = $script:EftSite.GetSSLAuth() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="FTPSExplicitPort" ; Value = $script:EftSite.FTPSExplicitPort }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="FTPSImplicitPort" ; Value = $script:EftSite.FTPSImplicitPort }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SSLImp" ; Value = $script:EftSite.GetSSLImp() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="BlockAntiTimeOut" ; Value = $script:EftSite.BlockAntiTimeOut }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="PASVListenIP" ; Value = $script:EftSite.PASVListenIP }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="PASVPortMax" ; Value = $script:EftSite.PASVPortMax }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="PASVPortMin" ; Value = $script:EftSite.PASVPortMin }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="ConnectMessage" ; Value = $script:EftSite.ConnectMessage }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="ExitMessage" ; Value = $script:EftSite.ExitMessage }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="UserLimitMessage" ; Value = $script:EftSite.UserLimitMessage }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPAccess" ; Value = $script:EftSite.GetSFTPAccess() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPPort" ; Value = $script:EftSite.SFTPPort }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPEncoding" ; Value = $script:EftSite.SFTPEncoding }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPKeyFile" ; Value = $script:EftSite.SFTPKeyFile }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPKeyPassphrase" ; Value = "*****" }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPEncodingAlgorithms" ; Value = $script:EftSite.SFTPEncodingAlgorithms }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPMacAlgorithms" ; Value = $script:EftSite.SFTPMacAlgorithms }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPSoftwareVersion" ; Value = $script:EftSite.SFTPSoftwareVersion }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SFTPIdentificationComment" ; Value = $script:EftSite.SFTPIdentificationComment }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HTTPAccess" ; Value = $script:EftSite.GetHTTPAccess() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HTTPPort" ; Value = $script:EftSite.GetHTTPPort() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HTTPSAccess" ; Value = $script:EftSite.GetHTTPSAccess() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HTTPSPort" ; Value = $script:EftSite.GetHTTPSPort() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HTTPDomain" ; Value = $script:EftSite.HTTPDomain }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="EnableWebServices" ; Value = $script:EftSite.EnableWebServices}} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="RedirectHTTPtoHTTPS" ; Value = $script:EftSite.RedirectHTTPtoHTTPS }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="EnableAccountManagementOverHTTPS" ; Value = $script:EftSite.EnableAccountManagementOverHTTPS }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="AccountManagementPath" ; Value = $script:EftSite.AccountManagementPath}} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SSLCertPath" ; Value = $script:EftSite.GetCertFilePath() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SSLKeyFilePath" ; Value = $script:EftSite.GetKeyFilePath() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SSLPassPhrase" ; Value = "*****" }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="SSLCheckClientCert" ; Value = $script:EftSite.GetHTTPAccess() }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HasMaxSpeed" ; Value = $script:EftSite.HasMaxSpeed}} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HasMaxUsers" ; Value = $script:EftSite.HasMaxUsers }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HasMaxConcurrentLogins" ; Value = $script:EftSite.HasMaxConcurrentLogins}} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HasMaxConnectionsPerAccount" ; Value = $script:EftSite.HasMaxConnectionsPerAccount }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="HasMaxIPPerAccount" ; Value = $script:EftSite.HasMaxIPPerAccount }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MaxTransferSpeed" ; Value = $script:EftSite.MaxTransferSpeed }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MaxConcurrentConnections" ; Value = $script:EftSite.MaxConcurrentConnections }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MaxConcurrentLogins" ; Value = $script:EftSite.MaxConcurrentLogins }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MaxConnectionsPerUser" ; Value = $script:EftSite.MaxConnectionsPerUser}} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MaxConnectionsFromSameIP" ; Value = $script:EftSite.MaxConnectionsFromSameIP }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="IPAccessAllowedDefault" ; Value = $script:EftSite.IPAccessAllowedDefault }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="DisconnectOnDOS" ; Value = $script:EftSite.DisconnectOnDOS }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="DOSLimit" ; Value = $script:EftSite.DOSLimit }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="BanIPOnDOS" ; Value = $script:EftSite.BanIPOnDOS }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="AutobanSensitivity" ; Value = $script:EftSite.AutobanSensitivity }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="AutoBanIPsPermanently" ; Value = $script:EftSite.AutoBanIPsPermanently }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="EnableMTC" ; Value = $script:EftSite.EnableMTC }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MTCAllowFileCaching" ; Value = $script:EftSite.MTCAllowFileCaching }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MTCAllowFileOpening" ; Value = $script:EftSite.MTCAllowFileOpening }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MTCAllowFileSharing" ; Value = $script:EftSite.MTCAllowFileSharing }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MTCAllowSavingOffline" ; Value = $script:EftSite.MTCAllowSavingOffline }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="MTCAllowSavingPasswords" ; Value = $script:EftSite.MTCAllowSavingPasswords }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="DefaultSettingsLevel" ; Value = $script:EftSite.DefaultSettingsLevel }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="EnableWorkspaces" ; Value = $script:EftSite.EnableWorkspaces }} catch { }
|
||||||
|
try { $connections += new-object psobject -Property @{ Setting ="EnableWorkspacesExternalUsers" ; Value = $script:EftSite.EnableWorkspacesExternalUsers }} catch { }
|
||||||
|
|
||||||
|
$complexPassword = $script:EftSite.GetComplexPasswordSettings()
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="MaxRepeatingCharacters" ; Value = $complexPassword.MaxRepeatingCharacters }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="MaxUsernameCharactersInPassword" ; Value = $complexPassword.MaxUsernameCharactersInPassword }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="MinCharCategoriesInPassword" ; Value = $complexPassword.MinCharCategoriesInPassword }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="MinPasswordLength" ; Value = $complexPassword.MinPasswordLength }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="PasswordDictionaryPath" ; Value = $complexPassword.PasswordDictionaryPath }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="ProhibitDictionaryWordsInPassword" ; Value = $complexPassword.ProhibitDictionaryWordsInPassword }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="ProhibitReverseDictionaryWordsInPassword" ; Value = $complexPassword.ProhibitReverseDictionaryWordsInPassword }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="RequireDigitsInPassword" ; Value = $complexPassword.RequireDigitsInPassword }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="RequireLowerCaseInPassword" ; Value = $complexPassword.RequireLowerCaseInPassword }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="RequireNonAlphaNumericInPassword" ; Value = $complexPassword.RequireNonAlphaNumericInPassword }} catch { }
|
||||||
|
try { $complexPasswordSettings += new-object psobject -Property @{ Setting ="RequireUpperCaseInPassword" ; Value = $complexPassword.RequireUpperCaseInPassword }} catch { }
|
||||||
|
|
||||||
|
$resetPassword = $script:EftSite.GetResetPasswordSettings()
|
||||||
|
try { $resetPasswordSettings += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $resetPasswordSettings += new-object psobject -Property @{ Setting ="DaysPriorPasswordExpirationToRemindUser" ; Value = $resetPassword.DaysPriorPasswordExpirationToRemindUser }} catch { }
|
||||||
|
try { $resetPasswordSettings += new-object psobject -Property @{ Setting ="MaxPasswordAgeDays" ; Value = $resetPassword.MaxPasswordAgeDays }} catch { }
|
||||||
|
try { $resetPasswordSettings += new-object psobject -Property @{ Setting ="SendEMailBeforeExpiration" ; Value = $resetPassword.SendEMailBeforeExpiration }} catch { }
|
||||||
|
try { $resetPasswordSettings += new-object psobject -Property @{ Setting ="SendEMailUponExpiration" ; Value = $resetPassword.SendEMailUponExpiration }} catch { }
|
||||||
|
|
||||||
|
try { $LoginInvalidSettings += new-object psobject -Property @{ Setting ="SiteName" ; Value = $siteName }} catch { }
|
||||||
|
try { $LoginInvalidSettings += new-object psobject -Property @{ Setting ="LimitLoginAttempts" ; Value = $script:EftSite.LimitLoginAttempts }} catch { }
|
||||||
|
try { $LoginInvalidSettings += new-object psobject -Property @{ Setting ="LockoutNotDisable" ; Value = $script:EftSite.LockoutNotDisable }} catch { }
|
||||||
|
try { $LoginInvalidSettings += new-object psobject -Property @{ Setting ="SendEMailBeforeExpiration" ; Value = $script:EftSite.SendEMailBeforeExpiration }} catch { }
|
||||||
|
try { $LoginInvalidSettings += new-object psobject -Property @{ Setting ="SendEMailUponExpiration" ; Value = $script:EftSite.SendEMailUponExpiration }} catch { }
|
||||||
|
|
||||||
|
$site = New-Object psobject -Property @{
|
||||||
|
SiteName = $siteName
|
||||||
|
SiteGeneralSettings = $general;
|
||||||
|
SiteGSAuthSettings = $GSParams;
|
||||||
|
SiteODBCAuthSettings = $ODBCParams;
|
||||||
|
SiteADAuthSettings = $ADParams;
|
||||||
|
SiteLDAPAuthSettings = $LDAPParams;
|
||||||
|
SiteStatistics = $statistics;
|
||||||
|
SiteConnections = $connections;
|
||||||
|
SiteSecurityComplexity = $complexPasswordSettings;
|
||||||
|
SiteSecurityResetPassword = $resetPasswordSettings;
|
||||||
|
SiteLoginInvalidSettings = $LoginInvalidSettings;
|
||||||
|
}
|
||||||
|
$sites += $site
|
||||||
|
}
|
||||||
|
$report.Sites = $sites
|
||||||
|
|
||||||
|
#Add modified WTC Customized files
|
||||||
|
|
||||||
|
#EFT Node Metadata
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " EFT Services"
|
||||||
|
$EftServicePath = Get-WmiObject win32_service | Where-Object { $_.name -Like "EFT*" } | Select-Object pathname -ExpandProperty pathname
|
||||||
|
$EftServicePath = $EftServicePath -replace """", ""
|
||||||
|
$EftServiceName = Get-WmiObject win32_service | Where-Object { $_.name -Like "EFT*" } | Select-Object name -ExpandProperty name
|
||||||
|
$EftServiceType = if ($EftserviceName -like "*Enterprise*") { "EFT Enterprise" } else { "SMB" }
|
||||||
|
$EftServiceIdentity = Get-WmiObject win32_service | Where-Object { $_.name -Like "EFT*" } | Select-Object startname -ExpandProperty startname
|
||||||
|
$EftFileVersion = Get-ItemProperty $EftServicePath -name "VersionInfo" | Select-Object VersionInfo -ExpandProperty VersionInfo
|
||||||
|
|
||||||
|
$report.EFTService = new-object psobject -Property @{ EftServicePath = $EftServicePath -join "|"; EftServiceName = $EftServiceName -join "|"; EftServiceType = $EftServiceType; EftServiceIdentity = $EftServiceIdentity -join "|"; }
|
||||||
|
$report.EFTFileVersion = $EftFileVersion
|
||||||
|
|
||||||
|
$report.EFTServices = Get-WmiObject win32_service | Where-Object { ($_.name -Like "EFT*" ) -or ($_.name -Like "MSMQ*" ) }
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " SFTPCOMInterface COM API"
|
||||||
|
# EFT SFTPCOMInterface COM API
|
||||||
|
#[EFT SFTPCOMInterface Registered]
|
||||||
|
$EFTSFTPCOMInterfaceAppID = Get-ItemProperty -Path 'Registry::HKEY_CLASSES_ROOT\AppId\SFTPCOMInterface.dll' | Select-Object AppId -ExpandProperty AppId
|
||||||
|
$EFTSFTPCOMInterfacePath = Get-ItemProperty -Path 'Registry::HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{A59E7747-3284-435B-8947-4E004361A6AC}\InprocServer32' | Select-Object '(default)' -ExpandProperty '(default)'
|
||||||
|
$report.EFTSFTPCOMInterfaceFileVersion = Get-ItemProperty $EFTSFTPCOMInterfacePath -name "VersionInfo" | Select-Object VersionInfo -ExpandProperty VersionInfo
|
||||||
|
$report.EFTSFTPCOMInterfaceObject = new-object psobject -Property @{ EFTSFTPCOMInterfaceAppID = $EFTSFTPCOMInterfaceAppID; EFTSFTPCOMInterfacePath = $EFTSFTPCOMInterfacePath; }
|
||||||
|
|
||||||
|
$RegItems = @()
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " EFT Registry Settings"
|
||||||
|
# EFT Registry Settings
|
||||||
|
$EFTServer30RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 3.0'
|
||||||
|
$EFTServer40RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 4.0'
|
||||||
|
$EFTServer70RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.0'
|
||||||
|
$EFTServer71RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.1'
|
||||||
|
$EFTServer73RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.3'
|
||||||
|
$EFTServer74RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.4'
|
||||||
|
$EFTServerEnterpriseRegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server Enterprise'
|
||||||
|
|
||||||
|
if (test-path -Path $EFTServer30RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer30RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath }
|
||||||
|
if (test-path -Path $EFTServer40RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer40RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer70RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer70RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer71RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer71RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer73RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer73RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer74RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer74RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServerEnterpriseRegLoc) { $RegItems += Get-ItemProperty -Path $EFTServerEnterpriseRegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
|
||||||
|
$report.EFTRegistry = $RegItems
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " Computer Info"
|
||||||
|
# Computer Info
|
||||||
|
$report.ServerInfo = Get-ComputerInfo
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " HotFixes"
|
||||||
|
# HotFixes
|
||||||
|
$report.HotFixes = $report.ServerInfo | Select-Object -ExpandProperty OsHotFixes
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " Disk(s) Info "
|
||||||
|
# Disk(s) Info
|
||||||
|
$report.DiskInfo = Get-WmiObject -Class Win32_logicaldisk | Select-Object -Property DeviceID, @{L = 'Drive Type'; E = { GetDiskType($_.DriveType) } } , VolumeName, @{L = 'FreeSpace GB'; E = { "{0:N2}" -f ($_.FreeSpace / 1GB) } }, @{L = "Capacity GB"; E = { "{0:N2}" -f ($_.Size / 1GB) } }
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " Windows Services"
|
||||||
|
#Windows Services
|
||||||
|
$report.WindowsServices = Get-WmiObject win32_service
|
||||||
|
|
||||||
|
# Report output
|
||||||
|
if (!$FormatToHTML) {
|
||||||
|
$report
|
||||||
|
} else {
|
||||||
|
|
||||||
|
GenerateHTMLReport $report
|
||||||
|
}
|
||||||
|
|
230
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Report.Node.ps1
Normal file
230
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Report.Node.ps1
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
<#
|
||||||
|
|
||||||
|
.SYNOPSIS
|
||||||
|
This Script generates a useful configuration information used as report after a Globalscape Quick Start service is completed
|
||||||
|
.DESCRIPTION
|
||||||
|
This script will connect to you EFT Server using EFT SFTPCOMInterface API and extract configuration information and it will be output into a TXT file (-ReportFile)
|
||||||
|
Some cases depending on the EFT version some information won't be available by EFT SFPTCOMInterface API, in such case values will be apperead as ERROR.
|
||||||
|
.EXAMPLE
|
||||||
|
.\EFT.Report.ps1 | Tee-Object Executive_Config_Report.txt
|
||||||
|
.\EFT.Report.ps1 > report.txt
|
||||||
|
.NOTES
|
||||||
|
Globalscape Inc.
|
||||||
|
Version: 1.0
|
||||||
|
Last Modified Date: 09/24/2017
|
||||||
|
This script is intended to be run safetly without impacting or changing any EFT configuration, so you can use it any time as many times you would like.
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $False, HelpMessage = "HTML Format")]
|
||||||
|
[switch] $FormatToHTML
|
||||||
|
|
||||||
|
)
|
||||||
|
function GetDiskType ($value) {
|
||||||
|
switch ($value) {
|
||||||
|
0 { return "$value Unknown" }
|
||||||
|
1 { return "$value No Root Directory" }
|
||||||
|
2 { return "$value Removable Disk" }
|
||||||
|
3 { return "$value Local Drive" }
|
||||||
|
4 { return "$value Network Drive" }
|
||||||
|
5 { return "$value Compact Disc" }
|
||||||
|
6 { return "$value RAM Disk" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function GetSerials() {
|
||||||
|
$serials = @()
|
||||||
|
|
||||||
|
$DMZGateway = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source2"
|
||||||
|
$EFTAS2 = "Registry::HKEY_CLASSES_ROOT\HIERCOJ\GREEN"
|
||||||
|
$AWE = "Registry::HKEY_CLASSES_ROOT\NL.wga.wGm.B2008"
|
||||||
|
$EFT6Baseline = "Registry::HKEY_CLASSES_ROOT\RDK"
|
||||||
|
$EFT7Baseline = "Registry::HKEY_CLASSES_ROOT\R2D2"
|
||||||
|
$EFT6Enterprise = "Registry::HKEY_CLASSES_ROOT\Win64.compat/wow64 "
|
||||||
|
$EFT7Enterprise = "Registry::HKEY_CLASSES_ROOT\SMB.cluster\availability"
|
||||||
|
$HighSecurity = "Registry::HKEY_CLASSES_ROOT\GRR\TRIAM"
|
||||||
|
$DMZ3SingleSite = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source3"
|
||||||
|
$DMZ3MultiSite = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source4"
|
||||||
|
$Workspaces = "Registry::HKEY_CLASSES_ROOT\IOleVariance.Source7"
|
||||||
|
$ARM = "Registry::HKEY_CLASSES_ROOT\ARM_RANdl.1"
|
||||||
|
$PGP = "Registry::HKEY_CLASSES_ROOT\SPLehP\dlog8"
|
||||||
|
$CIC = "Registry::HKEY_CLASSES_ROOT\HKEY_CLASSES_ROOT\IOleVariance.Source6"
|
||||||
|
$EFT73WTCCAL = "Registry::HKEY_CLASSES_ROOT\NNIF\NAMUH "
|
||||||
|
$EFT73WTCCAL = "Registry::HKEY_CLASSES_ROOT\DTI\EWB"
|
||||||
|
$EFT73SMBFileTransferClient = "Registry::HKEY_CLASSES_ROOT\SCL"
|
||||||
|
$EFT73SMBFolderMonitorEventRule = "Registry::HKEY_CLASSES_ROOT\SFM"
|
||||||
|
$EFT73SMBTimerEventModule = "Registry::HKEY_CLASSES_ROOT\STM"
|
||||||
|
|
||||||
|
if (test-path -Path $DMZGateway) { $serials += new-object psobject -Property @{ Name = "DMZGateway" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $DMZGateway).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFTAS2) { $serials += new-object psobject -Property @{ Name = "EFTAS2" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFTAS2).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $AWE) { $serials += new-object psobject -Property @{ Name = "AWE" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $AWE).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT6Baseline) { $serials += new-object psobject -Property @{ Name = "EFT6Baseline" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT6Baseline).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT7Baseline) { $serials += new-object psobject -Property @{ Name = "EFT7Baseline" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT7Baseline).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT6Enterprise) { $serials += new-object psobject -Property @{ Name = "EFT6Enterprise" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT6Enterprise).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT7Enterprise) { $serials += new-object psobject -Property @{ Name = "EFT7Enterprise" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT7Enterprise).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $HighSecurity) { $serials += new-object psobject -Property @{ Name = "HighSecurity" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $HighSecurity).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $DMZ3SingleSite) { $serials += new-object psobject -Property @{ Name = "DMZ3SingleSite" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $DMZ3SingleSite).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $DMZ3MultiSite) { $serials += new-object psobject -Property @{ Name = "DMZ3MultiSite" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $DMZ3MultiSite).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $Workspaces) { $serials += new-object psobject -Property @{ Name = "Workspaces" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $Workspaces).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $ARM) { $serials += new-object psobject -Property @{ Name = "ARM" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $ARM).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $PGP) { $serials += new-object psobject -Property @{ Name = "PGP" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $PGP).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $CIC) { $serials += new-object psobject -Property @{ Name = "CIC" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $CIC).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73WTCCAL) { $serials += new-object psobject -Property @{ Name = "EFT73WTCCAL" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73WTCCAL).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73WTCCAL) { $serials += new-object psobject -Property @{ Name = "EFT73WTCCAL" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73WTCCAL).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73SMBFileTransferClient) { $serials += new-object psobject -Property @{ Name = "EFT73SMBFileTransferClient" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73SMBFileTransferClient).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73SMBFolderMonitorEventRule) { $serials += new-object psobject -Property @{ Name = "EFT73SMBFolderMonitorEventRule" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73SMBFolderMonitorEventRule).1) }
|
||||||
|
}
|
||||||
|
if (test-path -Path $EFT73SMBTimerEventModule) { $serials += new-object psobject -Property @{ Name = "EFT73SMBTimerEventModule" ; Serial = [System.Text.Encoding]::ASCII.GetString((Get-ItemProperty -Path $EFT73SMBTimerEventModule).1) }
|
||||||
|
}
|
||||||
|
|
||||||
|
return $serials
|
||||||
|
}
|
||||||
|
|
||||||
|
function GenerateHTMLReport ($report){
|
||||||
|
$Header = @"
|
||||||
|
<title>EFT Configuration Report - $($env:computername)</title>
|
||||||
|
<style>
|
||||||
|
table {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
|
||||||
|
th {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED; color: white}
|
||||||
|
td {border-width: 1px; padding: 3px; border-style: solid; border-color: black; vertical-align: top; }
|
||||||
|
</style>
|
||||||
|
"@
|
||||||
|
|
||||||
|
$fragements = "<h1>EFT Node Configuration Report</h1>"
|
||||||
|
$fragements += "Creation Date : $($report.CreationDate) <br/>"
|
||||||
|
$fragements += "Computer Name : $($report.ComputerName) <br/>"
|
||||||
|
|
||||||
|
$fragements += $report.SerialKeys | convertto-html -Fragment -PreContent "<h2>Serial Keys </h2>"
|
||||||
|
|
||||||
|
$fragements += "<h2>EFT Node Settings </h2>"
|
||||||
|
|
||||||
|
$fragements += $report.EFTFileVersion | convertto-html -Fragment -As List -PreContent "<h3>EFT File Version </h3>"
|
||||||
|
$fragements += $report.EFTServices |Select-Object Name, Displayname, StartMode, State, Status, Startname, Pathname | convertto-html -Fragment -PreContent "<h3>EFT Services </h3>"
|
||||||
|
$fragements += $report.EFTSFTPCOMInterfaceFileVersion | convertto-html -Fragment -As List -PreContent "<h3>EFT SFTPCOMInterface File Version </h3>"
|
||||||
|
$fragements += $report.EFTSFTPCOMInterfaceObject | convertto-html -Fragment -As List -PreContent "<h3>EFT SFTPCOMInterface Object </h3>"
|
||||||
|
|
||||||
|
$fragements += $report.EFTRegistry | Select-Object -ExcludeProperty PSProvider, PSParentPath | convertto-html -Fragment -as list -PreContent "<h3>EFT Registry </h3>"
|
||||||
|
$fragements += $report.ServerInfo | convertto-html -Fragment -as list -PreContent "<h3>EFT Server Info </h3>"
|
||||||
|
$fragements += $report.HotFixes | convertto-html -Fragment -PreContent "<h3>OS HotFixes </h3>"
|
||||||
|
$fragements += $report.DiskInfo | convertto-html -Fragment -PreContent "<h3>Disk Info </h3>"
|
||||||
|
$fragements += $report.WindowsServices |Select-Object Name, Displayname, StartMode, State, Status, Startname, Pathname| convertto-html -Fragment -PreContent "<h3>Windows Services</h3>"
|
||||||
|
convertto-html -Head $Header -body $fragements | Out-File EFT.Report.Node.html ; invoke-item EFT.Report.Node.html
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$report = new-object psobject -Property @{
|
||||||
|
CreationDate = (Get-Date -f $df);
|
||||||
|
ComputerName = $env:computername;
|
||||||
|
SerialKeys = $null;
|
||||||
|
EFTService = $null;
|
||||||
|
EFTFileVersion = $null;
|
||||||
|
EFTServices = $null;
|
||||||
|
EFTSFTPCOMInterfaceFileVersion = $null;
|
||||||
|
EFTSFTPCOMInterfaceObject = $null;
|
||||||
|
EFTRegistry = $null;
|
||||||
|
ServerInfo = $null;
|
||||||
|
HotFixes = $null;
|
||||||
|
DiskInfo = $null;
|
||||||
|
WindowsServices = $null;
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "EFT Config" -status "Server Settings"
|
||||||
|
|
||||||
|
$report.SerialKeys = GetSerials
|
||||||
|
|
||||||
|
#Add modified WTC Customized files
|
||||||
|
|
||||||
|
#EFT Node Metadata
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " EFT Services"
|
||||||
|
$EftServicePath = Get-WmiObject win32_service | Where-Object { $_.name -Like "EFT*" } | Select-Object pathname -ExpandProperty pathname
|
||||||
|
$EftServicePath = $EftServicePath -replace """", ""
|
||||||
|
$EftServiceName = Get-WmiObject win32_service | Where-Object { $_.name -Like "EFT*" } | Select-Object name -ExpandProperty name
|
||||||
|
$EftServiceType = if ($EftserviceName -like "*Enterprise*") { "EFT Enterprise" } else { "SMB" }
|
||||||
|
$EftServiceIdentity = Get-WmiObject win32_service | Where-Object { $_.name -Like "EFT*" } | Select-Object startname -ExpandProperty startname
|
||||||
|
$EftFileVersion = Get-ItemProperty $EftServicePath -name "VersionInfo" | Select-Object VersionInfo -ExpandProperty VersionInfo
|
||||||
|
|
||||||
|
$report.EFTService = new-object psobject -Property @{ EftServicePath = $EftServicePath -join "|"; EftServiceName = $EftServiceName -join "|"; EftServiceType = $EftServiceType; EftServiceIdentity = $EftServiceIdentity -join "|"; }
|
||||||
|
$report.EFTFileVersion = $EftFileVersion
|
||||||
|
|
||||||
|
$report.EFTServices = Get-WmiObject win32_service | Where-Object { ($_.name -Like "EFT*" ) -or ($_.name -Like "MSMQ*" ) }
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " SFTPCOMInterface COM API"
|
||||||
|
# EFT SFTPCOMInterface COM API
|
||||||
|
#[EFT SFTPCOMInterface Registered]
|
||||||
|
$EFTSFTPCOMInterfaceAppID = Get-ItemProperty -Path 'Registry::HKEY_CLASSES_ROOT\AppId\SFTPCOMInterface.dll' | Select-Object AppId -ExpandProperty AppId
|
||||||
|
$EFTSFTPCOMInterfacePath = Get-ItemProperty -Path 'Registry::HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{A59E7747-3284-435B-8947-4E004361A6AC}\InprocServer32' | Select-Object '(default)' -ExpandProperty '(default)'
|
||||||
|
$report.EFTSFTPCOMInterfaceFileVersion = Get-ItemProperty $EFTSFTPCOMInterfacePath -name "VersionInfo" | Select-Object VersionInfo -ExpandProperty VersionInfo
|
||||||
|
$report.EFTSFTPCOMInterfaceObject = new-object psobject -Property @{ EFTSFTPCOMInterfaceAppID = $EFTSFTPCOMInterfaceAppID; EFTSFTPCOMInterfacePath = $EFTSFTPCOMInterfacePath; }
|
||||||
|
|
||||||
|
$RegItems = @()
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " EFT Registry Settings"
|
||||||
|
# EFT Registry Settings
|
||||||
|
$EFTServer30RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 3.0'
|
||||||
|
$EFTServer40RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 4.0'
|
||||||
|
$EFTServer70RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.0'
|
||||||
|
$EFTServer71RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.1'
|
||||||
|
$EFTServer73RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.3'
|
||||||
|
$EFTServer74RegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server 7.4'
|
||||||
|
$EFTServerEnterpriseRegLoc = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Globalscape Inc.\EFT Server Enterprise'
|
||||||
|
|
||||||
|
if (test-path -Path $EFTServer30RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer30RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath }
|
||||||
|
if (test-path -Path $EFTServer40RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer40RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer70RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer70RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer71RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer71RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer73RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer73RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServer74RegLoc) { $RegItems += Get-ItemProperty -Path $EFTServer74RegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
if (test-path -Path $EFTServerEnterpriseRegLoc) { $RegItems += Get-ItemProperty -Path $EFTServerEnterpriseRegLoc |Select-Object * -ExcludeProperty PSProvider, PSParentPath}
|
||||||
|
|
||||||
|
$report.EFTRegistry = $RegItems
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " Computer Info"
|
||||||
|
# Computer Info
|
||||||
|
$report.ServerInfo = Get-ComputerInfo
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " HotFixes"
|
||||||
|
# HotFixes
|
||||||
|
$report.HotFixes = $report.ServerInfo | Select-Object -ExpandProperty OsHotFixes
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " Disk(s) Info "
|
||||||
|
# Disk(s) Info
|
||||||
|
$report.DiskInfo = Get-WmiObject -Class Win32_logicaldisk | Select-Object -Property DeviceID, @{L = 'Drive Type'; E = { GetDiskType($_.DriveType) } } , VolumeName, @{L = 'FreeSpace GB'; E = { "{0:N2}" -f ($_.FreeSpace / 1GB) } }, @{L = "Capacity GB"; E = { "{0:N2}" -f ($_.Size / 1GB) } }
|
||||||
|
|
||||||
|
Write-Progress -Activity "EFT Node Metadata" -status " Windows Services"
|
||||||
|
#Windows Services
|
||||||
|
$report.WindowsServices = Get-WmiObject win32_service
|
||||||
|
|
||||||
|
# Report output
|
||||||
|
if (!$FormatToHTML) {
|
||||||
|
$report
|
||||||
|
} else {
|
||||||
|
|
||||||
|
GenerateHTMLReport $report
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
$hostname = "localhost"
|
||||||
|
$port = 4450
|
||||||
|
$username = "admin"
|
||||||
|
$password = "Super2003"
|
||||||
|
$AuthenticationUrl = "http://$($hostname):$port/admin/v1/authentication"
|
||||||
|
$ServerUrl = "http://$($hostname):$port/admin/v1/server"
|
||||||
|
$response = ""
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = Invoke-WebRequest -Method POST -Uri $AuthenticationUrl -Body "{""userName"": ""$($username)"", ""password"": ""$($password)"", ""authType"": ""EFT""}"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "[!!!] Connection to $($AuthenticationUrl) Failed! $($_.Exception.Message)"
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$AuthContent = $response.Content | ConvertFrom-Json
|
||||||
|
|
||||||
|
Write-Host "Auth Token: $($AuthContent.AuthToken)"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = Invoke-WebRequest -Method GET -Uri $ServerUrl -Headers @{"Authorization" = "EFTAdminAuthToken $($AuthContent.AuthToken)"}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "[!!!] Connection to $($ServerUrl) Failed! $($_.Exception.Message)"
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
Write-Host "Response "
|
||||||
|
Write-Host "$($response.Content)"
|
@ -0,0 +1,46 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true, HelpMessage = "SQL Instance")]
|
||||||
|
[String]$dataSource ="GS",
|
||||||
|
[Parameter(Mandatory = $true, HelpMessage = "SQL Database")]
|
||||||
|
[String]$database,
|
||||||
|
[Parameter(Mandatory = $false, HelpMessage = "SQL Connection String (Optional connection string)")]
|
||||||
|
[String]$connectionString,
|
||||||
|
[Parameter(Mandatory = $false, HelpMessage = "SQL User Name (Optional)")]
|
||||||
|
[String]$userName,
|
||||||
|
[Parameter(Mandatory = $false, HelpMessage = "SQL Password (Optional)")]
|
||||||
|
[String]$password,
|
||||||
|
[Parameter(Mandatory = $true, HelpMessage = "SQL Query")]
|
||||||
|
[String]$query
|
||||||
|
)
|
||||||
|
|
||||||
|
## Create connection string
|
||||||
|
|
||||||
|
$cnxString = "Data Source=$dataSource; " + "Initial Catalog=$database" + "; Integrated Security=SSPI"
|
||||||
|
|
||||||
|
if ($userName -ne $null -and $userName.Length -gt 0) {
|
||||||
|
$cnxString += "; User ID=$userName; Password=$password"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($connectionString -ne $null -and $connectionString.Length -gt 0) {
|
||||||
|
$cnxString = $connectionString
|
||||||
|
}
|
||||||
|
|
||||||
|
## Open connection to SQL.
|
||||||
|
$connection = new-object system.data.SqlClient.SQLConnection($cnxString)
|
||||||
|
$command = new-object system.data.sqlclient.sqlcommand($query, $connection)
|
||||||
|
$connection.Open()
|
||||||
|
|
||||||
|
$reader = $command.ExecuteReader()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
while ($reader.Read()) {
|
||||||
|
$row = @{}
|
||||||
|
for ($i = 0; $i -lt $reader.FieldCount; $i++) {
|
||||||
|
$row[$reader.GetName($i)] = $reader.GetValue($i)
|
||||||
|
}
|
||||||
|
$results += new-object psobject -property $row
|
||||||
|
}
|
||||||
|
$connection.Close()
|
||||||
|
|
||||||
|
$results
|
126
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Server.Backup.ps1
Normal file
126
powershell/EFTPowerToolsPS/EFTPowerToolsPS/EFT.Server.Backup.ps1
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $False, HelpMessage = "Enter the file where the EFT configuration will be backup")]
|
||||||
|
[String] $EFTBackupFile = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 10, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||||
|
|
||||||
|
|
||||||
|
Write-host "******* EFT Backup SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " EFT backup can be a several minutes or hours time to complete:" -ForegroundColor Yellow
|
||||||
|
Write-host " > Test by running this script first against to a non-production environment " -ForegroundColor Yellow
|
||||||
|
Write-host " > Inform other EFT Admins that a backup will be in progress and some perfromance on the UI can be degradate" -ForegroundColor Yellow
|
||||||
|
Write-host " > Communicate end users about the process" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
$EFTServer = $null
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$MXE_BACKUP_NOT_FOUND = "MX Error: 66 (00000042)"
|
||||||
|
$MXE_BACKUP_INVALID_CREDENTIALS = "MX Error: 67 (00000043)"
|
||||||
|
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject SFTPCOMInterface.CIServer
|
||||||
|
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
if ($EFTBackupAuthType -eq 1) {
|
||||||
|
$EFTBackupAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {
|
||||||
|
Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($EFTBackupFile -eq "") {
|
||||||
|
$timestamp = $(Get-date -f 'yyyy_MM_dd-hh_mm_ss')
|
||||||
|
$EFTBackupFile = "$here\EFT_Backup_$timestamp.bak"
|
||||||
|
}
|
||||||
|
$EFTBackupFileName = Split-Path $EFTBackupFile -Leaf
|
||||||
|
$EFTBackupFilePath = Split-Path $EFTBackupFile -parent
|
||||||
|
|
||||||
|
if ($EFTBackupFilePath -eq "") {
|
||||||
|
$EFTBackupFilePath = "$here"
|
||||||
|
}
|
||||||
|
$EFTBackupFullPath = Join-Path $here $EFTBackupFileName
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Creating Backup '$EFTBackupFileName'".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.BackupServerConfiguration($EFTBackupFullPath)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
Write-host "Backup saved: $EFTBackupFullPath"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_BACKUP_NOT_FOUND { Write-host "MXE_BACKUP_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_BACKUP_INVALID_CREDENTIALS { Write-host "MXE_BACKUP_INVALID_CREDENTIALS : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
exit
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Physical Path ")]
|
||||||
|
[switch] $ValidatePath = $false
|
||||||
|
)
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
if ($script:EftSite.IsStarted) {$status = "Started"} else {$status = "Stopped"}
|
||||||
|
try {$siteguid = $script:EftSite.GUID} catch {}
|
||||||
|
$starttime = $script:EftSite.GetStartTime()
|
||||||
|
$ActiveSessions = $script:EftSite.GetConnectedCount();
|
||||||
|
$UsersDefined = $script:EftSite.UsersDefined;
|
||||||
|
$ActiveUploads = $script:EftSite.GetUploadCount();
|
||||||
|
$ActiveDownloads = $script:EftSite.GetDownloadCount();
|
||||||
|
$AverageSpeed = $script:EftSite.AverageSpeed;
|
||||||
|
|
||||||
|
try {$WTCSessionsRemaining = $script:EftSite.WTCSessionsRemaining } catch {}
|
||||||
|
try {$WTCSessionsActive = $script:EftSite.WTCSessionsActive } catch {}
|
||||||
|
try {$WSSeatsUsed = $script:EftSite.WSSeatsUsed } catch {}
|
||||||
|
try {$WSSeatsRemaining = $script:EftSite.WSSeatsRemaining } catch {}
|
||||||
|
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
ID = $script:EftSite.Id;
|
||||||
|
Guid = $siteguid;
|
||||||
|
StartedOn = $starttime;
|
||||||
|
Status = $status;
|
||||||
|
ActiveSessions = $ActiveSessions;
|
||||||
|
UsersDefined = $UsersDefined;
|
||||||
|
WTCSessionsRemaining = $WTCSessionsRemaining;
|
||||||
|
WTCSessionsActive = $WTCSessionsActive;
|
||||||
|
WSSeatsUsed = $WSSeatsUsed
|
||||||
|
WSSeatsRemaining = $WSSeatsRemaining
|
||||||
|
ActiveUploads = $ActiveUploads;
|
||||||
|
ActiveDownloads = $ActiveDownloads;
|
||||||
|
AverageSpeed = $AverageSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$results | Sort-Object SiteName, VirtualFolder
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,336 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $True, HelpMessage = "Enter the Backup file that will be restored")]
|
||||||
|
[String] $EFTBackupFile = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $false, HelpMessage = "Enter the Backup paramaters Csv file to be use during the restore process")]
|
||||||
|
[string] $EFTBackupParamsCsvFile = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter a Authentication Type for the EFT backup . 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTBackupAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 8, Mandatory = $False, HelpMessage = "Enter login for the backup")]
|
||||||
|
[String] $EFTBackupAdminUsername = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 9, Mandatory = $False, HelpMessage = "Enter password for the backup")]
|
||||||
|
[String] $BackupPassword,
|
||||||
|
|
||||||
|
[Parameter(Position = 10, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($EFTBackupParamsCsvFile -eq "") {
|
||||||
|
# Uncomment the following to enter paramters for each site
|
||||||
|
# Leaving empty values will cause to ignore the new values
|
||||||
|
# Properties: SiteName, RestoreSite, NewListenIPs, AuthManagerDataBase, RestoreVFS, RootFolder, DMZEnabled, DMZAddress, DMZPort
|
||||||
|
$EFTBackupParams = @(
|
||||||
|
# @{ SiteName = "MySite"; RootFolder = ""; }
|
||||||
|
# @{ SiteName = "MySite1"; RootFolder = ""; }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EFTBackupParams = Import-Csv $EFTBackupParamsCsvFile
|
||||||
|
# SiteName, RestoreSite, NewListenIPs, AuthManagerDataBase, RestoreVFS, RootFolder, DMZEnabled, DMZAddress, DMZPort
|
||||||
|
}
|
||||||
|
function Get-FriendlySize {
|
||||||
|
param($Bytes)
|
||||||
|
$sizes = 'Bytes,KB,MB,GB,TB,PB,EB,ZB' -split ','
|
||||||
|
for ($i = 0; ($Bytes -ge 1kb) -and
|
||||||
|
($i -lt $sizes.Count); $i++) {$Bytes /= 1kb}
|
||||||
|
$N = 2; if ($i -eq 0) {$N = 0}
|
||||||
|
"{0:N$($N)} {1}" -f $Bytes, $sizes[$i]
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "******* EFT Restore SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " Restoring EFT from a backup will cause DOWNTIME of your EFT service, it is recommended:" -ForegroundColor Yellow
|
||||||
|
Write-host " > Test the backup file by running this script first against to a non-production environment " -ForegroundColor Yellow
|
||||||
|
Write-host " > Drain connections and file transfer to avoid possible user data integrity issues" -ForegroundColor Yellow
|
||||||
|
Write-host " > Communicate end users about the outage" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
$EFTServer = $null
|
||||||
|
$archiveInfo = $null
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$MXE_BACKUP_NOT_FOUND = "MX Error: 66 (00000042)"
|
||||||
|
$MXE_BACKUP_INVALID_CREDENTIALS = "MX Error: 67 (00000043)"
|
||||||
|
$MXE_SERVER_RESTORATION_FAILED = "MX Error: 74 (0000004A)"
|
||||||
|
$MXE_BACKUP_NOT_COMPATIBLE = "MX Error: 122 (0000007A)"
|
||||||
|
|
||||||
|
$EFTBackupFileFullPath = Convert-Path $EFTBackupFile
|
||||||
|
$EFTBackupFileItem = Get-Item $EFTBackupFileFullPath
|
||||||
|
|
||||||
|
# Check if the Service is Started
|
||||||
|
$EFTServer = new-object -ComObject SFTPCOMInterface.CIServer
|
||||||
|
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
if ($EFTBackupAuthType -eq 1) {
|
||||||
|
$EFTBackupAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
|
||||||
|
if ($OriginalEFTServiceState -eq "Stopping") {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
Write-host "Waiting EFT Service to be Stopped ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$EftService.WaitForStatus("Stopped", '00:00:30')
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " TIMEOUT ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red}
|
||||||
|
Write-host "Backup administrator type : $EFTBackupAuthType"
|
||||||
|
Write-host "Backup administrator login : $EFTBackupAdminUsername"
|
||||||
|
Write-host "Backup File Name : $EFTBackupFile"
|
||||||
|
Write-host "Backup File Size : $(Get-FriendlySize $EFTBackupFileItem.Length )"
|
||||||
|
Write-host "Backup File Created On : $($EFTBackupFileItem.CreationTime) "
|
||||||
|
Write-host "Backup File Modify On : $($EFTBackupFileItem.LastWriteTime)"
|
||||||
|
Write-host "EFT Backup Params Csv File : $EFTBackupParamsCsvFile"
|
||||||
|
Write-host ""
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$EFTLogPath = $EFTServer.LogPath
|
||||||
|
$EFTConfigurationFilePath = $EFTServer.ConfigurationFilePath
|
||||||
|
try {
|
||||||
|
Write-host "Loading backup archive. Please wait this might take several minutes".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$archiveInfo = $EFTServer.GetBackupArchiveInfo($EFTBackupFileFullPath, $EFTBackupAuthType, $EFTBackupAdminUsername, $BackupPassword)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_BACKUP_NOT_FOUND { Write-host "MXE_BACKUP_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_BACKUP_INVALID_CREDENTIALS { Write-host "MXE_BACKUP_INVALID_CREDENTIALS : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
Write-host "EFT Server Backup Details"
|
||||||
|
Write-host "BackupArchivePath : $($archiveInfo.BackupArchivePath)"
|
||||||
|
Write-host "Date Created : $($archiveInfo.CreationTime)"
|
||||||
|
Write-host "Created By : $($archiveInfo.CreatedBy)"
|
||||||
|
Write-host "Backup Type : $($archiveInfo.type)"
|
||||||
|
Write-host "Total Sites : $($archiveInfo.SitesCount)"
|
||||||
|
|
||||||
|
|
||||||
|
$siteCount = $archiveInfo.SitesCount
|
||||||
|
$SiteInfo = @()
|
||||||
|
|
||||||
|
for ($i = 0 ; $i -lt $siteCount ; $i++) {
|
||||||
|
$siteBackupInfo = $archiveInfo.GetSiteBackupInfo($i)
|
||||||
|
$EFTBackupParam = $null
|
||||||
|
$backupParamFound = $false
|
||||||
|
for ($j = 0; $j -le $EFTBackupParams.Count - 1; $j++) {
|
||||||
|
$EFTBackupParam = $EFTBackupParams[$j]
|
||||||
|
if ($siteBackupInfo.SiteName -eq $EFTBackupParam.SiteName ) {
|
||||||
|
$backupParamFound = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Assigning New paramaters to the BackupInfo
|
||||||
|
if ($backupParamFound) {
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["NewListenIPs"]) -ne $true) {$siteBackupInfo.NewListenIPs = $EFTBackupParam["NewListenIPs"]}
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["RestoreSite"]) -ne $true) {$siteBackupInfo.RestoreSite = $EFTBackupParam["RestoreSite"]}
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["AuthManagerDataBase"]) -ne $true) {$siteBackupInfo.AuthManagerDataBase = $EFTBackupParam["AuthManagerDataBase"]}
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["RestoreVFS"]) -ne $true) {$siteBackupInfo.RestoreVFS = $EFTBackupParam["RestoreVFS"]}
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["RootFolder"]) -ne $true) {$siteBackupInfo.RootFolder = $EFTBackupParam["RootFolder"]}
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["DMZEnabled"]) -ne $true) {$siteBackupInfo.DMZEnabled = $EFTBackupParam["DMZEnabled"]}
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["DMZAddress"]) -ne $true) {$siteBackupInfo.DMZAddress = $EFTBackupParam["DMZAddress"]}
|
||||||
|
if ([string]::IsNullOrEmpty($EFTBackupParam["DMZPort"]) -ne $true) { $siteBackupInfo.DMZPort = $EFTBackupParam["DMZPort"]}
|
||||||
|
}
|
||||||
|
|
||||||
|
$SiteInfo += new-object psobject -Property @{
|
||||||
|
SiteName = $siteBackupInfo.SiteName;
|
||||||
|
RestoreSite = $siteBackupInfo.RestoreSite;
|
||||||
|
ListenIPs = $siteBackupInfo.ListenIPs;
|
||||||
|
NewListenIPs = $siteBackupInfo.NewListenIPs;
|
||||||
|
AuthManagerDataBase = $siteBackupInfo.AuthManagerDataBase;
|
||||||
|
AuthManagerID = $siteBackupInfo.AuthManagerID;
|
||||||
|
RestoreVFS = $siteBackupInfo.RestoreVFS;
|
||||||
|
RootFolder = $siteBackupInfo.RootFolder;
|
||||||
|
DMZEnabled = $siteBackupInfo.DMZEnabled;
|
||||||
|
DMZAddress = $siteBackupInfo.DMZAddress;
|
||||||
|
DMZPort = $siteBackupInfo.DMZPort;
|
||||||
|
}
|
||||||
|
$archiveInfo.SetSiteBackupInfo($siteBackupInfo)
|
||||||
|
}
|
||||||
|
$SiteInfo | Format-Table RestoreSite, SiteName, ListenIPs, NewListenIPs
|
||||||
|
$SiteInfo | Format-Table SiteName, AuthManagerID, AuthManagerDataBase
|
||||||
|
$SiteInfo | Format-Table SiteName, RestoreVFS, RootFolder
|
||||||
|
$SiteInfo | Format-Table SiteName, DMZEnabled, DMZAddress, DMZPort
|
||||||
|
|
||||||
|
Write-host "EnableARM : $($archiveInfo.EnableARM)"
|
||||||
|
Write-host "ARMServerName : $($archiveInfo.ARMServerName)"
|
||||||
|
Write-host "ARMUserName : $($archiveInfo.ARMUserName)"
|
||||||
|
Write-host "ARMAuthenticationType : $($archiveInfo.ARMAuthenticationType)"
|
||||||
|
Write-host "ARMDatabaseName : $($archiveInfo.ARMDatabaseName)"
|
||||||
|
Write-host "ARMDatabaseType : $($archiveInfo.ARMDatabaseType)"
|
||||||
|
Write-host "ARMFailureAuditFolder : $($archiveInfo.ARMFailureAuditFolder)"
|
||||||
|
Write-host "ARMFailureEmailList : $($archiveInfo.ARMFailureEmailList)"
|
||||||
|
Write-host "ARMHealConnection : $($archiveInfo.ARMHealConnection)"
|
||||||
|
Write-host "ARMNotifyOnDisconnect : $($archiveInfo.ARMNotifyOnDisconnect)"
|
||||||
|
Write-host "ARMNotifyOnReconnect : $($archiveInfo.ARMNotifyOnReconnect)"
|
||||||
|
#Write-host "ARMPassword : $($archiveInfo.ARMPassword)"
|
||||||
|
Write-host "ARMReconnectPeriod : $($archiveInfo.ARMReconnectPeriod)"
|
||||||
|
Write-host "ARMStopAuditingOnError : $($archiveInfo.ARMStopAuditingOnError)"
|
||||||
|
|
||||||
|
|
||||||
|
#SiteName, AuthManagerDataBase, DMZAddress, DMZEnabled, DMZPort, ListenIPs, NewListenIPs, RestoreSite, RestoreVFS, RootFolder
|
||||||
|
#SetSiteBackupInfo : $EFTBackupArchiveInfo.SetSiteBackupInfo
|
||||||
|
Write-host ""
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host "The script is ready to perform the restore process. " -ForegroundColor Yellow
|
||||||
|
Write-host "The restore process will cause the EFT Service to be stopped and start causing *DONWTIME*" -ForegroundColor Yellow
|
||||||
|
$continue = Read-Host -Prompt "Are you sure you want to continue wtih the Restore (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Write-host "Restoring $EFTBackupFile".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.RestoreServerConfigurationEx($archiveInfo)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_SERVER_RESTORATION_FAILED { Write-host "MXE_SERVER_RESTORATION_FAILED : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_BACKUP_NOT_COMPATIBLE { Write-host "MXE_BACKUP_NOT_COMPATIBLE : $_ " -ForegroundColor Red}
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
## Start Service if is not Started
|
||||||
|
if ($adminPrivileges) {
|
||||||
|
$EftService = get-service "EFT*"
|
||||||
|
if ($EftService.Status -eq "Running") {
|
||||||
|
Write-host "Stopping EFT Service ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EftService.Stop()
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
$EftService = get-service "EFT*"
|
||||||
|
if ($EftService.Status -eq "StopPending") {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
Write-host "Waiting EFT Service to be Stopped ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$EftService.WaitForStatus("Stopped", '00:00:30')
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " TIMEOUT ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$EftService = get-service "EFT*"
|
||||||
|
Write-host "Starting EFT Service ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EftService.Start()
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$EftService = get-service "EFT*"
|
||||||
|
if ($EftService.Status -eq "StartPending") {
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
Write-host "Waiting EFT Service to be Started ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$EftService.WaitForStatus("Running", '00:00:30')
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " TIMEOUT ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
Write-host "Restore Process Completed"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
$EftService = get-service "EFT*"
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($EftService.Status)" -ForegroundColor Green} else {Write-host "$($EftService.Status)" -ForegroundColor Red}
|
||||||
|
|
||||||
|
$TimeStamp = $(Get-Date -f "yyyy.MM.dd_hh.mm.ss")
|
||||||
|
$RestorationLog = "logs\Restoration_$TimeStamp.log"
|
||||||
|
$EFTLog = "logs\EFT_$TimeStamp.log"
|
||||||
|
|
||||||
|
$scriptlogPath = "logs"
|
||||||
|
If ( (Test-Path $scriptlogPath) -eq $false) {
|
||||||
|
Write-Verbose "Creating $scriptlogPath"
|
||||||
|
new-item $scriptlogPath -ItemType directory
|
||||||
|
}
|
||||||
|
Copy-Item -Path "$($EFTLogPath)last_restoration.log" -Destination $RestorationLog
|
||||||
|
Copy-Item -Path "$($EFTConfigurationFilePath)\EFT.log" -Destination $EFTLog
|
||||||
|
|
||||||
|
Write-host "EFT Restore Log Path : $($RestorationLog)"
|
||||||
|
Write-host "EFT Log Path : $($EFTLog)"
|
@ -0,0 +1,122 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 10, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-host "******* EFT Start Sites SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " > Starting an EFT site will cause EFT server to:" -ForegroundColor Yellow
|
||||||
|
Write-host " > Start listening on IP Inerfaces for protocols on inbound connections" -ForegroundColor Yellow
|
||||||
|
Write-host " > Trigger Event rules, process automation (if any) and perform outbound file transfers " -ForegroundColor Yellow
|
||||||
|
Write-host " > Test by running this script first against to a non-production environment " -ForegroundColor Yellow
|
||||||
|
Write-host " > Inform other EFT Admins that a site will be started " -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
$EFTServer = $null
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject SFTPCOMInterface.CIServer
|
||||||
|
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {
|
||||||
|
Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($script:EftSite.IsStarted) { $currentState = "Started"; $color = "Green" } else {$currentState = "Stopped" ; $color = "Red"}
|
||||||
|
Write-host "$SiteName ".PadRight(25," ") -NoNewline
|
||||||
|
Write-host "$currentState" -ForegroundColor $color -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
if ($script:EftSite.IsStarted -eq $false) {
|
||||||
|
Write-host " Starting site... " -NoNewline
|
||||||
|
$script:EftSite.Start()
|
||||||
|
Write-host "Started" -ForegroundColor Green -NoNewline
|
||||||
|
}
|
||||||
|
Write-host " ($($sw.ElapsedMilliseconds)ms)"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 10, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-host "******* EFT Stop Sites SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
Write-host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-host " > Stopping an EFT site will cause EFT server site to:" -ForegroundColor Yellow
|
||||||
|
Write-host " > Stop listening on IP Inerfaces for protocols on inbound connections" -ForegroundColor Yellow
|
||||||
|
Write-host " > Stop Event rules to trigger or process Automation and outbound transfers " -ForegroundColor Yellow
|
||||||
|
Write-host " > Test by running this script first against to a non-production environment " -ForegroundColor Yellow
|
||||||
|
Write-host " > Inform other EFT Admins that a site will be stopped or started " -ForegroundColor Yellow
|
||||||
|
Write-host " > Communicate end users about the process" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
$EFTServer = $null
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject SFTPCOMInterface.CIServer
|
||||||
|
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {
|
||||||
|
Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the warning notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($script:EftSite.IsStarted) { $currentState = "Started"; $color = "Green" } else {$currentState = "Stopped" ; $color = "Red"}
|
||||||
|
Write-host "$SiteName ".PadRight(25," ") -NoNewline
|
||||||
|
Write-host "$currentState" -ForegroundColor $color -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
if ($script:EftSite.IsStarted -eq $true) {
|
||||||
|
Write-host " Stopping site... " -NoNewline
|
||||||
|
$script:EftSite.Stop()
|
||||||
|
Write-host "Stopped" -ForegroundColor red -NoNewline
|
||||||
|
}
|
||||||
|
Write-host " ($($sw.ElapsedMilliseconds)ms)"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter login")]
|
||||||
|
[int] $NumTemplates = 10,
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
)
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$siteFound = $false
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
if ($EFTSiteName -eq $script:EftSite.Name) {
|
||||||
|
$siteFound = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$siteFound){
|
||||||
|
write-host "Site $EFTSiteName Not found"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EftServer.AutoSave = $false
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i= 0 ; $i -le $NumTemplates;$i++ ) {
|
||||||
|
try{
|
||||||
|
$settingsTemplateName = "test_$i"
|
||||||
|
Write-Host "Adding '$settingsTemplateName' ... " -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EftSite.CreateSettingsLevel($settingsTemplateName,"test",$false)
|
||||||
|
Write-Host "OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter login")]
|
||||||
|
[String] $SiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $true, HelpMessage = "Enter login")]
|
||||||
|
[int] $NumTemplates = 10,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
)
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$siteFound = $false
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
if ($Sitename -eq $script:EftSite.Name) {
|
||||||
|
$siteFound = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$siteFound){
|
||||||
|
write-host "Site $Sitename Not found"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i= 0 ; $i -le $NumTemplates;$i++ ) {
|
||||||
|
try{
|
||||||
|
$settingsTemplateName = "test_$i"
|
||||||
|
Write-Host "Removing '$settingsTemplateName' ... " -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EftSite.RemoveSettingsLevel($settingsTemplateName)
|
||||||
|
Write-Host "OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,342 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
###
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $true, HelpMessage = "Enter the name of the Site")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter the new site root path")]
|
||||||
|
[String] $NewSiteRoot = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $true, HelpMessage = "Enter the folder permissions CSV file")]
|
||||||
|
[String] $FolderPermissionsCsv = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $true, HelpMessage = "Enter the virtual folder CSV file")]
|
||||||
|
[String] $VirtualFolderCsv = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 8, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 9, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||||
|
|
||||||
|
Write-host "******* EFT Change storage Wizard 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
Write-host " > This wizard will guide you to perform operations that will change a new EFT site root folder" -ForegroundColor Yellow
|
||||||
|
Write-host " > This script can also copy your files to the new site root" -ForegroundColor Yellow
|
||||||
|
Write-host " > It is recommend you test this script in a non-production environment before " -ForegroundColor Yellow
|
||||||
|
Write-host " using in production to validate its functionality" -ForegroundColor Yellow
|
||||||
|
Write-host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
|
||||||
|
$CurrentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
if ($EFTAdminAuthType -eq 1) {
|
||||||
|
$EFTAdminUsername = $CurrentUserName
|
||||||
|
}
|
||||||
|
$EftService = Get-Service "EFT *"
|
||||||
|
$adminPrivileges = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
$transactionId = [guid]::NewGuid() -Replace "-", ""
|
||||||
|
#Output parameters
|
||||||
|
Write-Host "Current datetime : $(Get-Date -f $df)"
|
||||||
|
Write-Host "Current User : $CurrentUserName"
|
||||||
|
Write-Host "Admin Privileges : $adminPrivileges"
|
||||||
|
Write-host "EFT Server Service : " -NoNewline
|
||||||
|
$OriginalEFTServiceState = $EftService.Status
|
||||||
|
if ($EftService.Status -eq "Running") {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Green} else {Write-host "$($OriginalEFTServiceState)" -ForegroundColor Red}
|
||||||
|
Write-host "TransactionId : $transactionId"
|
||||||
|
Write-host "New Site Root : $NewSiteRoot"
|
||||||
|
Write-host "Folder Permissions CSV File : $FolderPermissionsCsv"
|
||||||
|
Write-host "Virtual Folders CSV file : $VirtualFolderCsv"
|
||||||
|
Write-host "EFT Admin Hostname : $EFTAdminHostname"
|
||||||
|
Write-host "EFT Admin Port : $EFTAdminPort"
|
||||||
|
Write-host "EFT Site Name : $EFTSiteName"
|
||||||
|
Write-host "EFT Admin Auth Type : $EFTAdminAuthType"
|
||||||
|
Write-host "EFT Admin Username : $EFTAdminUsername"
|
||||||
|
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||||
|
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
$continue = Read-Host -Prompt "Have you read and understand the notes (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
$EFTServer = $null
|
||||||
|
$EFTSites = $null
|
||||||
|
$EFTSite = $null
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
if ($OutputFolder -notmatch '.+?\\$') {
|
||||||
|
$OutputFolder += '\'
|
||||||
|
}
|
||||||
|
|
||||||
|
$transactionFolder = Join-Path $here $transactionId
|
||||||
|
New-Item -ItemType "directory" -path "$transactionFolder" |Out-Null
|
||||||
|
Write-host "Transaction folder : $transactionFolder"
|
||||||
|
|
||||||
|
$OutputFolder = Convert-Path $OutputFolder
|
||||||
|
Write-host "Pre-Validations:"
|
||||||
|
$FolderPermissionsImportScript = ".\EFT.FolderPermissions.Import.ps1"
|
||||||
|
$VirtualFoldersRemapScript = ".\EFT.VirtualFolders.Remap.ps1"
|
||||||
|
$StartSiteScript = ".\EFT.Server.Start-Site.ps1"
|
||||||
|
$StopSiteScript = ".\EFT.Server.Stop-Site.ps1"
|
||||||
|
$UtilsRoboCopyScript = ".\Utils.RoboCopy.ps1"
|
||||||
|
|
||||||
|
write-host "Checking $FolderPermissionsImportScript".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
if (!(test-path $FolderPermissionsImportScript)) { write-host " FAILED" -ForegroundColor red; exit } else {write-host " PASSED" -ForegroundColor green}
|
||||||
|
|
||||||
|
write-host "Checking $VirtualFoldersRemapScript".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
if (!(test-path $VirtualFoldersRemapScript)) { write-host " FAILED" -ForegroundColor red; exit } else {write-host " PASSED" -ForegroundColor green}
|
||||||
|
|
||||||
|
write-host "Checking $StartSiteScript".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
if (!(test-path $StartSiteScript)) { write-host " FAILED" -ForegroundColor red; exit } else {write-host " PASSED" -ForegroundColor green}
|
||||||
|
|
||||||
|
write-host "Checking $StopSiteScript".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
if (!(test-path $StopSiteScript)) { write-host " FAILED" -ForegroundColor red; exit } else {write-host " PASSED" -ForegroundColor green}
|
||||||
|
|
||||||
|
write-host "Checking $UtilsRoboCopyScript".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
if (!(test-path $UtilsRoboCopyScript)) { write-host " FAILED" -ForegroundColor red; exit } else {write-host " PASSED" -ForegroundColor green}
|
||||||
|
|
||||||
|
write-host "Checking $FolderPermissionsCsv".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
if (!(test-path $FolderPermissionsCsv)) { write-host " FAILED" -ForegroundColor red; exit } else {write-host " PASSED" -ForegroundColor green}
|
||||||
|
|
||||||
|
write-host "Checking $VirtualFolderCsv".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
if (!(test-path $VirtualFolderCsv)) { write-host " FAILED" -ForegroundColor red; exit } else {write-host " PASSED" -ForegroundColor green}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteGuid = $null
|
||||||
|
$siteName = $script:EftSite.Name
|
||||||
|
try {
|
||||||
|
$SiteGuid = $script:EftSite.GUID
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Verbose "Can't get GUID for Site $siteName"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$originalSiteRoot = $script:EftSite.GetRootFolder()
|
||||||
|
Write-host " "
|
||||||
|
Write-host " $siteName [$SiteGuid] ".PadRight(65, "*").Padleft(100, "*")
|
||||||
|
Write-host "Current Site Root: $originalSiteRoot"
|
||||||
|
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
$createBackup = Read-Host -Prompt "Do you want to perform a EFT configuration backup (y/n)?"
|
||||||
|
if ($createBackup.ToUpper() -eq "Y") {
|
||||||
|
try {
|
||||||
|
$EFTBackupFileFullPath = "$transactionFolder\EFT_Server_Backup.bak"
|
||||||
|
Write-host ""
|
||||||
|
Write-host "Backing up EFT configuration:"
|
||||||
|
$sw.Restart()
|
||||||
|
.\EFT.Server.Backup.ps1 -EFTBackupFile $EFTBackupFileFullPath -Quiet -EFTAdminHostname $EFTAdminHostname -EFTAdminPort $EFTAdminPort -EFTAdminAuthType $EFTAdminAuthType -EFTAdminUsername $EFTAdminUsername -Password $Password
|
||||||
|
Write-host "Backup " -NoNewline
|
||||||
|
Write-host " Completed ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host "Backup "-NoNewline
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
# Stop Site
|
||||||
|
$continue = Read-Host -Prompt "[1] Stop EFT site, do you want to stop $siteName site (y/n)?"
|
||||||
|
if ($continue.ToUpper() -eq "Y") {
|
||||||
|
try {
|
||||||
|
Write-Host ""
|
||||||
|
Write-host "Stopping $siteName site:"
|
||||||
|
$sw.Restart()
|
||||||
|
.\EFT.Server.Stop-Site.ps1 -EFTSiteName $siteName -Quiet -EFTAdminHostname $EFTAdminHostname -EFTAdminPort $EFTAdminPort -EFTAdminAuthType $EFTAdminAuthType -EFTAdminUsername $EFTAdminUsername -Password $Password
|
||||||
|
Write-host "Site Stop " -NoNewline
|
||||||
|
Write-host " Completed ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host "Site Stop " -NoNewline
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
$continue = Read-Host -Prompt "[2] Robocopy data files, do you want to robocopy site root (y/n)?"
|
||||||
|
if ($continue.ToUpper() -eq "Y") {
|
||||||
|
try {
|
||||||
|
$robocopyLogFile = "$transactionFolder\Robocopy_Site.log"
|
||||||
|
Write-Host ""
|
||||||
|
Write-host "RoboCopy $originalSiteRoot to $NewSiteRoot :"
|
||||||
|
$sw.Restart()
|
||||||
|
.\Utils.RoboCopy.ps1 -sourcePath $originalSiteRoot -destinationPath $NewSiteRoot -Logfile $robocopyLogFile
|
||||||
|
Write-host "RoboCopy " -NoNewline
|
||||||
|
Write-host " Completed ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host "RoboCopy " -NoNewline
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
$continue = Read-Host -Prompt "[3] Robocopy data files from virtual folders, do you want to robocopy virtual folders (y/n)?"
|
||||||
|
if ($continue.ToUpper() -eq "Y") {
|
||||||
|
try {
|
||||||
|
$EFTVirtualFolders = Import-Csv $VirtualFolderCsv
|
||||||
|
foreach ($EFTVirtualFolder in $EFTVirtualFolders) {
|
||||||
|
if($EFTVirtualFolder.SiteName -ne $sitename){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$virtualFolder = $EFTVirtualFolder.VirtualFolder
|
||||||
|
$originalPhysicalPath = $script:EftSite.GetPhysicalPath($virtualFolder)
|
||||||
|
$newPhysicalPath = $EFTVirtualFolder.PhysicalPath
|
||||||
|
|
||||||
|
$robocopyLogFile = "$transactionFolder\Robocopy_VirtualFolders.log"
|
||||||
|
Write-Host ""
|
||||||
|
Write-host "RoboCopy $originalPhysicalPath to $newPhysicalPath :"
|
||||||
|
$sw.Restart()
|
||||||
|
.\Utils.RoboCopy.ps1 -sourcePath $originalPhysicalPath -destinationPath $newPhysicalPath -Logfile $robocopyLogFile
|
||||||
|
Write-host "RoboCopy " -NoNewline
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host "RoboCopy " -NoNewline
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
$continue = Read-Host -Prompt "[4] Change Site root, do you want to continue (y/n)?"
|
||||||
|
if ($continue.ToUpper() -ne "Y") {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Write-Host ""
|
||||||
|
Write-host "Changing site root".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EftSite.SetRootFolder($NewSiteRoot)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
Write-host ""
|
||||||
|
$continue = Read-Host -Prompt "[5] Import/remap virtual folders, do you want to continue (y/n)?"
|
||||||
|
if ($continue.ToUpper() -eq "Y") {
|
||||||
|
try {
|
||||||
|
Write-host ""
|
||||||
|
Write-host "Importing/Ramap virtual folders $VirtualFolderCsv"
|
||||||
|
$sw.Restart()
|
||||||
|
.\EFT.VirtualFolders.Remap.ps1 -VirtualFolderCsvFile $VirtualFolderCsv -Quiet -EFTAdminHostname $EFTAdminHostname -EFTAdminPort $EFTAdminPort -EFTAdminAuthType $EFTAdminAuthType -EFTAdminUsername $EFTAdminUsername -Password $Password
|
||||||
|
Write-host "Import/Ramap virtual folders" -NoNewline
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host "Import/Ramap virtual folders" -NoNewline
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host ""
|
||||||
|
$continue = Read-Host -Prompt "[6] Import folder permissions, do you want to continue (y/n)?"
|
||||||
|
if ($continue.ToUpper() -eq "Y") {
|
||||||
|
try {
|
||||||
|
Write-Host ""
|
||||||
|
Write-host "Importing EFT folder permissions $FolderPermissionsCsv"
|
||||||
|
$sw.Restart()
|
||||||
|
.\EFT.FolderPermissions.Import.ps1 -PermissionsCsvFile $FolderPermissionsCsv -Quiet -EFTAdminHostname $EFTAdminHostname -EFTAdminPort $EFTAdminPort -EFTAdminAuthType $EFTAdminAuthType -EFTAdminUsername $EFTAdminUsername -Password $Password
|
||||||
|
Write-host "Import EFT folder permissions" -NoNewline
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host "Import EFT folder permissions" -NoNewline
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stop Site
|
||||||
|
Write-host ""
|
||||||
|
$continue = Read-Host -Prompt "[7] Start EFT site, do you want to start $siteName site (y/n)?"
|
||||||
|
if ($continue.ToUpper() -eq "Y") {
|
||||||
|
try {
|
||||||
|
Write-Host ""
|
||||||
|
Write-host "Stopping $siteName site: "
|
||||||
|
$sw.Restart()
|
||||||
|
.\EFT.Server.Start-Site.ps1 -EFTSiteName $siteName -Quiet -EFTAdminHostname $EFTAdminHostname -EFTAdminPort $EFTAdminPort -EFTAdminAuthType $EFTAdminAuthType -EFTAdminUsername $EFTAdminUsername -Password $Password
|
||||||
|
Write-host "Stop site" -NoNewline
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host "Start site" -NoNewline
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Physical Path exists ")]
|
||||||
|
[switch] $Validate = $false
|
||||||
|
)
|
||||||
|
## .\EFT.Site.Get-Sites.ps1 -Validate
|
||||||
|
## Find SiteGuid for EFT site names :
|
||||||
|
## .\EFT.Site.Get-SiteID.ps1 | select-object SiteGuid, SiteName
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteGuid = $null
|
||||||
|
$siteName = $script:EftSite.Name
|
||||||
|
try {
|
||||||
|
$SiteGuid = $script:EftSite.GUID
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
}
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
try {
|
||||||
|
$SiteRootFolder = $script:EftSite.GetRootFolder()
|
||||||
|
if ($Validate) {
|
||||||
|
if (Test-Path $SiteRootFolder) { $ValidSiteRoot = "OK"} else {$ValidSiteRoot = "FOLDER_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$ValidSiteRoot = "ERROR: $_"
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$AMParams = $script:EftSite.GetAMParams()
|
||||||
|
$UserDatabasePath = $AMParams.UserDatabasePath
|
||||||
|
|
||||||
|
if ($Validate -and $null -ne $UserDatabasePath) {
|
||||||
|
if (Test-Path $UserDatabasePath) { $ValidSiteRoot = "OK"} else {$ValidSiteRoot = "FOLDER_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$UserDatabasePath = "ERROR: $_"
|
||||||
|
}
|
||||||
|
|
||||||
|
$results += new-object PSObject -Property @{
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
SiteGuid = $SiteGuid;
|
||||||
|
SiteRootFolder = $SiteRootFolder;
|
||||||
|
ValidSiteRoot = $ValidSiteRoot;
|
||||||
|
DBFile = $UserDatabasePath
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$results | Sort-Object SiteName
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,246 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Physical Path exists and Client (user or group exists) ")]
|
||||||
|
[switch] $Validate = $false
|
||||||
|
)
|
||||||
|
## To Export to CSV use:
|
||||||
|
## .\EFT.SiteSettingsPaths.Export.ps1 |Format-Table
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 | Export-csv permissions.csv -NoTypeInformation
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -EFTSiteName "MySite"
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -FolderFilter "/usr/*"
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -FolderFilter "/usr/*" -client "Guest"
|
||||||
|
## .\EFT.FolderPermissions.Export.ps1 -EFTSiteName "MySite" | Where-Object {$_.Permissions -gt 1152} | format-table
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteGuid = $null
|
||||||
|
$siteName = $script:EftSite.Name
|
||||||
|
try {
|
||||||
|
$SiteGuid = $script:EftSite.GUID
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
}
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
# Retrieve all the paths
|
||||||
|
$setting = "SiteRootFolder"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.GetRootFolder()
|
||||||
|
if ($Validate) {
|
||||||
|
if (Test-Path $value) { $ValidPath = "OK"} else {$ValidPath = "FOLDER_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
# Retrieve all the paths
|
||||||
|
$setting = "SiteAudFilePath"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$AMParam = $script:EftSite.GetAMParams()
|
||||||
|
$value = $AMParam.UserDatabasePath
|
||||||
|
if ($Validate) {
|
||||||
|
if (Test-Path $value) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
if ($null -ne $SiteGuid) {
|
||||||
|
$setting = "SiteDBFilePath"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
$HAConfigurationFilePath = $null
|
||||||
|
$ConfigurationFilePath = $null
|
||||||
|
try {$HAConfigurationFilePath = $script:EftServer.HAConfigurationFilePath } catch{}
|
||||||
|
try {$ConfigurationFilePath = $script:EftServer.ConfigurationFilePath } catch{}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($null -ne $HAConfigurationFilePath){
|
||||||
|
$value = Join-Path $HAConfigurationFilePath "$SiteGuid.Clients.db"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$value = Join-Path $ConfigurationFilePath "$SiteGuid.Clients.db"
|
||||||
|
}
|
||||||
|
if ($Validate) {
|
||||||
|
if (Test-Path $value) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
}
|
||||||
|
|
||||||
|
$setting = "RSAConfigurationPath"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.RSAConfigurationPath
|
||||||
|
if ($Validate -and [string]::IsNullOrEmpty($value) -ne $true) {
|
||||||
|
if (Test-Path $value -PathType Leaf) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
$setting = "WebSSOIdpPublicKeyPath"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.WebSSOIdpPublicKeyPath
|
||||||
|
if ($Validate -and [string]::IsNullOrEmpty($value) -ne $true) {
|
||||||
|
if (Test-Path $value -PathType Leaf) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
$setting = "SFTPKeyFile"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.SFTPKeyFile
|
||||||
|
if ($Validate -and [string]::IsNullOrEmpty($value) -ne $true) {
|
||||||
|
if (Test-Path $value -PathType Leaf) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
|
||||||
|
if ($ValidPath -eq "OK") {
|
||||||
|
if ($script:EftSite.SFTPPublicKeyBlob -eq "") {
|
||||||
|
$ValidPath = "INVALID_KEY"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
$setting = "AS2Certificate"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.AS2Certificate
|
||||||
|
if ($Validate -and [string]::IsNullOrEmpty($value) -ne $true) {
|
||||||
|
if (Test-Path $value -PathType Leaf) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
$setting = "AS2PrivateKey"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.AS2PrivateKey
|
||||||
|
if ($Validate -and [string]::IsNullOrEmpty($value) -ne $true) {
|
||||||
|
if (Test-Path $value -PathType Leaf) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
$setting = "SSLCertPath"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.GetCertFilePath()
|
||||||
|
if ($Validate -and [string]::IsNullOrEmpty($value) -ne $true) {
|
||||||
|
if (Test-Path $value -PathType Leaf) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
$setting = "SSLKeyFilePath"
|
||||||
|
$value = ""
|
||||||
|
$ValidPath = ""
|
||||||
|
try {
|
||||||
|
$value = $script:EftSite.GetKeyFilePath()
|
||||||
|
if ($Validate -and [string]::IsNullOrEmpty($value) -ne $true) {
|
||||||
|
if (Test-Path $value -PathType Leaf) { $ValidPath = "OK"} else {$ValidPath = "FILE_NOT_FOUND: $value" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$value = "ERROR: $_"
|
||||||
|
}
|
||||||
|
$results += new-object PSObject -Property @{ SiteName = $script:EftSite.Name; Setting = $setting; Path = $value; ValidPath = $ValidPath; }
|
||||||
|
|
||||||
|
}
|
||||||
|
$results | Sort-Object SiteName
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,34 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter a workspace db file")]
|
||||||
|
[String] $WorkspacesDbFile = "Workspaces.db",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter a table name")]
|
||||||
|
[String] $query = "select * from Site",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $false, HelpMessage = "Enter a table name")]
|
||||||
|
[hashtable] $params = $null
|
||||||
|
|
||||||
|
)
|
||||||
|
# Get all Ids to Text
|
||||||
|
|
||||||
|
|
||||||
|
#.\EFT.Sqlite.Invoke-NoQuery.ps1 -query "insert into site (id, ws_enabled, ws_allowSharingToExistingUsersOnly) Values (@id, 1,0)" -params @{"@id" = [guid]::new("edbda119-46e7-4ad5-b143-a1806955d7d5") ;}
|
||||||
|
Add-Type -Path "System.Data.SQLite.dll"
|
||||||
|
$DbFile = Resolve-Path $DbFile
|
||||||
|
$conn = New-Object -TypeName System.Data.SQLite.SQLiteConnection
|
||||||
|
$conn.ConnectionString = "Data Source=$DbFile"
|
||||||
|
$conn.Open()
|
||||||
|
$command = $conn.CreateCommand()
|
||||||
|
$command.CommandText = $query
|
||||||
|
|
||||||
|
if ($null -ne $params) {
|
||||||
|
foreach ($key in $params.keys ){
|
||||||
|
Write-Verbose "$($key) = $($params[$key])"
|
||||||
|
$null = $command.Parameters.AddWithValue($key, $params[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Int32]$command.ExecuteNonQuery()
|
||||||
|
|
||||||
|
$conn.Close()
|
@ -0,0 +1,39 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter a workspace db file")]
|
||||||
|
[String] $DBFile = "Workspaces.db",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter a table name")]
|
||||||
|
[String] $Query = "select * from Site",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $false, HelpMessage = "Enter a table name")]
|
||||||
|
[hashtable] $params = $null
|
||||||
|
|
||||||
|
)
|
||||||
|
# Get all Ids to Text
|
||||||
|
#.\EFT.Sqlite.Invoke-Query.ps1 -query "select id from Site" -dbfile workspaces.db | foreach {[guid]::new( ($_.id|ForEach-Object ToString X2) -join '')}
|
||||||
|
#.\EFT.Sqlite.Invoke-Query.ps1 -query "select hex(id) from Site" -dbfile workspaces.db
|
||||||
|
#.\EFT.Sqlite.Invoke-Query.ps1 -query "select id from Site where lower(hex(id))=@id" -params @{"@id" = [guid]::new("e9dac990-1c04-4663-9394-307bcfe014e7").toString('N'); "@Name" = "myname"}
|
||||||
|
#.\EFT.Sqlite.Invoke-Query.ps1 -query "select * from Workspace where lower(hex(site)) = @id" -params @{"@id" = [guid]::new("e9dac990-1c04-4663-9394-307bcfe014e7").toString('N')}
|
||||||
|
|
||||||
|
Add-Type -Path "System.Data.SQLite.dll"
|
||||||
|
$DbFile = Resolve-Path $DbFile
|
||||||
|
$conn = New-Object -TypeName System.Data.SQLite.SQLiteConnection
|
||||||
|
$conn.ConnectionString = "Data Source=$DbFile"
|
||||||
|
$conn.Open()
|
||||||
|
$command = $conn.CreateCommand()
|
||||||
|
$command.CommandText = $query
|
||||||
|
|
||||||
|
if ($null -ne $params) {
|
||||||
|
foreach ($key in $params.keys ){
|
||||||
|
Write-Verbose "$($key) = $($params[$key])"
|
||||||
|
$null = $command.Parameters.AddWithValue($key, $params[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$adapter = New-Object -TypeName System.Data.SQLite.SQLiteDataAdapter $command
|
||||||
|
$dataset = New-Object System.Data.DataSet
|
||||||
|
[void]$adapter.Fill($dataset)
|
||||||
|
$dataset.Tables[0]
|
||||||
|
$conn.Close()
|
||||||
|
$conn.Dispose()
|
||||||
|
$command.Dispose()
|
Binary file not shown.
@ -0,0 +1,226 @@
|
|||||||
|
Dim objFSO, sFile, siteCount
|
||||||
|
Dim vbsExport, vbsImport
|
||||||
|
Dim synctExport, synctImport, AuthType
|
||||||
|
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||||
|
Set sFile = objFSO.OpenTextFile( "Site.TXT", 8, true, 0 )
|
||||||
|
Set vbsExport = objFSO.OpenTextFile( "Export_Perm-VFS.bat", 8, true, 0 )
|
||||||
|
Set vbsImport = objFSO.OpenTextFile( "Import_Perm-VFS.bat", 8, true, 0 )
|
||||||
|
Set synctExport = objFSO.OpenTextFile( "Export_synctool.bat", 8, true, 0 )
|
||||||
|
Set synctImport = objFSO.OpenTextFile( "Import_synctool.bat", 8, true, 0 )
|
||||||
|
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
|
||||||
|
|
||||||
|
CRLF = (Chr(13)& Chr(10))
|
||||||
|
txtServer = "localhost"
|
||||||
|
txtPort = "1100"
|
||||||
|
txtAdminUserName = "eftadmin"
|
||||||
|
txtPassword = "!@#$T3st"
|
||||||
|
|
||||||
|
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
|
||||||
|
msgbox Connect
|
||||||
|
WScript.Quit(0)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim chkeftSiteName, eftSiteName
|
||||||
|
|
||||||
|
'siteName = "MySite"
|
||||||
|
set siteToRemove = Nothing
|
||||||
|
set sites = SFTPServer.Sites()
|
||||||
|
siteCount = 0
|
||||||
|
For i = 0 To sites.Count -1
|
||||||
|
set site = sites.Item(i)
|
||||||
|
|
||||||
|
siteCount = siteCount + 1
|
||||||
|
|
||||||
|
chkeftSiteName = site.Name
|
||||||
|
|
||||||
|
spaces = Ubound(Split(chkeftSiteName, " "))
|
||||||
|
|
||||||
|
if (spaces = 0) then
|
||||||
|
eftSiteName = site.Name
|
||||||
|
else
|
||||||
|
eftSiteName = chr(34) & site.Name & chr(34)
|
||||||
|
end If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If site.GetAuthManagerID() = 0 Then
|
||||||
|
AuthType = "GS_Site"
|
||||||
|
ElseIf site.GetAuthManagerID() = 1 Then
|
||||||
|
AuthType = "AD_Site"
|
||||||
|
ElseIf site.GetAuthManagerID() = 2 Then
|
||||||
|
AuthType = "ODBC_Site"
|
||||||
|
ElseIf site.GetAuthManagerID() = 3 Then
|
||||||
|
AuthType = "LDAP_Site"
|
||||||
|
End If
|
||||||
|
|
||||||
|
'WScript.Echo eftSiteName & " " & AuthType
|
||||||
|
|
||||||
|
|
||||||
|
If AuthType = "AD_Site" Then
|
||||||
|
|
||||||
|
If siteCount > 1 Then
|
||||||
|
' WScript.Echo siteCount
|
||||||
|
|
||||||
|
sFile.Write(site.Name & " : " & site.GUID & vbCrLf)
|
||||||
|
vbsExport.Write("cscript.exe 1ExportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_Permissions.txt" & chr(34) & vbCrLf & "cscript.exe 2ExportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_vFolders.txt" & chr(34) & vbCrLf & vbCrLf)
|
||||||
|
vbsImport.Write("cscript.exe 3ImportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "__vFolders.txt" & chr(34) & vbCrLf & "cscript.exe 4ImportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_Permissions.txt" & chr(34) & vbCrLf & vbCrLf)
|
||||||
|
|
||||||
|
'synctExport.Write("REN EFTUtils.exe.config EFTUtils.exe.config_Orig.txt" & vbCrLf)
|
||||||
|
synctExport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctExport.Write("eftutils.exe export " & chr(34) & "CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctExport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
|
||||||
|
'synctImport.Write("REN EFTUtils.exe.config EFTUtils.exe.config_Orig.txt" & vbCrLf)
|
||||||
|
synctImport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctImport.Write("eftutils.exe import " & chr(34) & "CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctImport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
Else
|
||||||
|
|
||||||
|
sFile.Write(site.Name & " : " & site.GUID & vbCrLf)
|
||||||
|
vbsExport.Write("cscript.exe 1ExportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & site.Name & "_Permissions.txt" & vbCrLf & "cscript.exe 2ExportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & site.Name & "_vFolders.txt" & vbCrLf & vbCrLf)
|
||||||
|
vbsImport.Write("cscript.exe 3ImportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & site.Name & "__vFolders.txt" & vbCrLf & "cscript.exe 4ImportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & site.Name & "_Permissions.txt" & vbCrLf & vbCrLf)
|
||||||
|
|
||||||
|
synctExport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctExport.Write("eftutils.exe export " & chr(34) & "SSHKEYRING,PGPKEYRING,SSLTRUSTEDCERTIFICATES,CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctExport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
|
||||||
|
synctImport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctImport.Write("eftutils.exe import " & chr(34) & "SSHKEYRING,PGPKEYRING,SSLTRUSTEDCERTIFICATES,CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctImport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
If AuthType = "GS_Site" Then
|
||||||
|
|
||||||
|
'WScript.Echo "Other"
|
||||||
|
|
||||||
|
If siteCount > 1 Then
|
||||||
|
' WScript.Echo siteCount
|
||||||
|
|
||||||
|
sFile.Write(site.Name & " : " & site.GUID & vbCrLf)
|
||||||
|
vbsExport.Write("cscript.exe 1ExportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_Permissions.txt" & chr(34) & vbCrLf & "cscript.exe 2ExportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_vFolders.txt" & chr(34) & vbCrLf & vbCrLf)
|
||||||
|
vbsImport.Write("cscript.exe 3ImportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "__vFolders.txt" & chr(34) & vbCrLf & "cscript.exe 4ImportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_Permissions.txt" & chr(34) & vbCrLf & vbCrLf)
|
||||||
|
|
||||||
|
'synctExport.Write("REN EFTUtils.exe.config EFTUtils.exe.config_Orig.txt" & vbCrLf)
|
||||||
|
synctExport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctExport.Write("eftutils.exe export " & chr(34) & "CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERS,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctExport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
|
||||||
|
'synctImport.Write("REN EFTUtils.exe.config EFTUtils.exe.config_Orig.txt" & vbCrLf)
|
||||||
|
synctImport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctImport.Write("eftutils.exe import " & chr(34) & "CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERS,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctImport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
Else
|
||||||
|
|
||||||
|
sFile.Write(site.Name & " : " & site.GUID & vbCrLf)
|
||||||
|
vbsExport.Write("cscript.exe 1ExportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_Permissions.txt" & chr(34) & vbCrLf & "cscript.exe 2ExportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_vFolders.txt" & chr(34) & vbCrLf & vbCrLf)
|
||||||
|
vbsImport.Write("cscript.exe 3ImportVirtualFolders.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "__vFolders.txt" & chr(34) & vbCrLf & "cscript.exe 4ImportPermissions.vbs -s " & txtServer & " -port " & txtPort & " -u " & txtAdminUserName & " -p " & txtPassword & " -site " & eftSiteName & " -f " & chr(34) & site.Name & "_Permissions.txt" & chr(34) & vbCrLf & vbCrLf)
|
||||||
|
|
||||||
|
synctExport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctExport.Write("eftutils.exe export " & chr(34) & "SSHKEYRING,PGPKEYRING,SSLTRUSTEDCERTIFICATES,CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERS,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctExport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
|
||||||
|
|
||||||
|
synctImport.Write("REN " & Chr(34) & "EFTUtils.exe.config_" & site.Name & ".txt" & Chr(34) & " EFTUtils.exe.config" & vbCrLf)
|
||||||
|
synctImport.Write("eftutils.exe import " & chr(34) & "SSHKEYRING,PGPKEYRING,SSLTRUSTEDCERTIFICATES,CONNECTIONPROFILES,ADVANCEDWORKFLOWS,COMMANDS,SITESETTINGS,SITEIPACCESSRESTRICTIONS,SITESECURITYSETTINGS,LOGSETTINGS,DMZGATEWAY,USERTEMPLATES,USERS,USERSTATS,USERTEMPLATEMEMBERSHIP,GROUPS,USERSIPACCESSRESTRICTIONS,USERTEMPLATESIPACCESSRESTRICTIONS,EVENTS,VIRTUALFOLDERS" & chr(34) & " " & eftSiteName & " /xml" & vbCrLf)
|
||||||
|
synctImport.Write("REN EFTUtils.exe.config " & Chr(34) & "EFTUtils.exe.config_" & site.Name & "_DONE.TXT" & Chr(34) & vbCrLf & vbCrLF)
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Function Connect (serverOrIpAddress, port, username, password)
|
||||||
|
|
||||||
|
On Error Resume Next
|
||||||
|
Err.Clear
|
||||||
|
|
||||||
|
SFTPServer.Connect serverOrIpAddress, port, username, password
|
||||||
|
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
|
||||||
|
Connect = False
|
||||||
|
Exit Function
|
||||||
|
End If
|
||||||
|
|
||||||
|
Connect = True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Const ForReading = 1
|
||||||
|
|
||||||
|
Const ForWriting = 2
|
||||||
|
|
||||||
|
|
||||||
|
'Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||||
|
|
||||||
|
Dim strSITEName, strGUID, strConfigFile
|
||||||
|
Set objShell = CreateObject("WScript.Shell")
|
||||||
|
currDir = objShell.CurrentDirectory
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'Read Site.TXT file
|
||||||
|
Const strInFile = "SITE.TXT"
|
||||||
|
Set objInFile = objFSO.OpenTextFile(strInFile, ForReading)
|
||||||
|
|
||||||
|
Do Until objInFile.AtEndOfStream
|
||||||
|
strLine = objInFile.Readline
|
||||||
|
arrField = Split(strLine, " : ")
|
||||||
|
|
||||||
|
strSITEName = arrField(0)
|
||||||
|
strGUID = arrField(1) & ".Client.db"
|
||||||
|
|
||||||
|
'WScript.Echo "SiteName= " & strSITEName & " GUID= " & strGUID
|
||||||
|
|
||||||
|
Set objFile = objFSO.OpenTextFile("EFTUtils.exe.config_Template.txt", ForReading)
|
||||||
|
|
||||||
|
|
||||||
|
strText = objFile.ReadAll
|
||||||
|
|
||||||
|
objFile.Close
|
||||||
|
|
||||||
|
|
||||||
|
strNewText1 = Replace(strText, "GUIDSTRING.Clients.db", strGUID) ' GUID change
|
||||||
|
strNewText2 = Replace(strNewText1, "chgadmin", txtAdminUserName) ' admin change
|
||||||
|
strNewText3 = Replace(strNewText2, "chgP@$$", txtPassword) ' Password chg
|
||||||
|
strNewText4 = Replace(strNewText3, "chgToCurrDir", currDir) ' SiteDir Change
|
||||||
|
|
||||||
|
strConfigFile = "EFTUtils.exe.config_" & strSITEName & ".txt"
|
||||||
|
|
||||||
|
Set objFile = objFSO.CreateTextFile(strConfigFile, ForWriting)
|
||||||
|
|
||||||
|
objFile.WriteLine strNewText4
|
||||||
|
|
||||||
|
objFile.Close
|
||||||
|
|
||||||
|
Loop
|
||||||
|
|
||||||
|
objFSO.MoveFile "EFTUtils.exe.config", "EFTUtils.exe.config_orig_keep.txt"
|
||||||
|
wscript.echo "Done!"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,144 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the user list CSV file ")]
|
||||||
|
[string] $UserCsvlist = "userlist.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($UserCsvlist -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
# $EFTPermissions = @(
|
||||||
|
# @{ SiteName = "MySite"; SettingsTemplate= ""; IsEnabled=""; Username = "\"; }
|
||||||
|
# @{ SiteName = "MySite"; SettingsTemplate= ""; IsEnabled=""; Username = "\"; }
|
||||||
|
#)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EFTUsers = Import-Csv $UserCsvlist
|
||||||
|
# "SiteName","SettingsTemplate", "IsEnabled","Username"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$MXE_FOLDER_NOT_EMPTY = "MX Error: 117 (00000075)"
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Write-host "Updating Users:"
|
||||||
|
$Imported = 0
|
||||||
|
$errorCount = 0
|
||||||
|
foreach ($EFTUser in $EFTUsers) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EFTUser.SiteName])
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Failed adding user '$($EFTUser.Username)'" -ForegroundColor Red
|
||||||
|
Write-Host "Exception : $($_.Exception.Message)" -ForegroundColor Red
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Write-Verbose "User '$($EFTUser.Username)' already exists."
|
||||||
|
$detail = $script:EftSite.GetUserSettings($EFTUser.Username)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Failed setting '$($EFTUser.Username)' user enabled state" -ForegroundColor Red
|
||||||
|
Write-Host "Exception : $($_.Exception.Message)" -ForegroundColor Red
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$userSettings = $script:EftSite.GetUserSettings($EFTUser.Username);
|
||||||
|
|
||||||
|
if (-not [string]::IsNullOrEmpty($EFTUser.IsEnabled)) {
|
||||||
|
Write-Host "Update: [$($EFTUser.SiteName)] [$($EFTUser.Username)] $IsEnable-> $($EFTUser.IsEnabled)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess($EFTUser.Username, "IsEnable=$($EFTUser.IsEnabled)")) {
|
||||||
|
$userSettings.SetEnableAccount($EFTUser.IsEnabled)
|
||||||
|
}
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
$Updated++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Updated: " -NoNewline
|
||||||
|
Write-host "$Updated " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,262 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
)
|
||||||
|
## To Export to CSV use:
|
||||||
|
## .\EFT.UserSettings.ps1 |Export-csv foo.csv -NoTypeInformation
|
||||||
|
## .\EFT.UserSettings.ps1 |Where-Object {$_.Username -eq "rguzman"} | format-table
|
||||||
|
## .\EFT.UserSettings.ps1 | where-object {$_.Username -eq "rguzman" } |export-csv foo.csv -NoTypeInformation
|
||||||
|
## .\EFT.UserSettings.Export.ps1 -EFTSiteName MySite | Select-object ExpirationDate, username, IsInactivityPeriodLimited, InactivityPeriodLimited, IsPasswordAgeLimited, PasswordAgeLimited
|
||||||
|
function Get-AdvancedBool($value, $inherited) {
|
||||||
|
if ($inherited ) {
|
||||||
|
#abInherited
|
||||||
|
return -2
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if($value) {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$SiteGuid = $null
|
||||||
|
try {
|
||||||
|
$SiteGuid = $script:EftSite.GUID
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
|
||||||
|
}
|
||||||
|
$users = $script:EftSite.GetUsers()
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $users.length; $i++ ) {
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' User '$($users[$i])' $i/$($users.length)" -percentComplete ($i / $users.length * 100)
|
||||||
|
$detail = $script:EftSite.GetUserSettings($users[$i])
|
||||||
|
|
||||||
|
# Check creation time to as LastConnectTime is not set to a value (defaults to
|
||||||
|
# 11/30/1999) until user accessed site.
|
||||||
|
#$LastConnectTimeSpan = [System.DateTime]::Now - [datetime]$detail.LastConnectionTime;
|
||||||
|
$o = ""
|
||||||
|
$inherited = $null
|
||||||
|
#Get-AdvancedBool $value $inherited
|
||||||
|
|
||||||
|
$inherited = $null; $IsUserExpired = Get-AdvancedBool $($detail.GetExpirationDate( [ref] $inherited )) $inherited
|
||||||
|
$ExpirationDate = $inherited
|
||||||
|
|
||||||
|
$inherited = $null; $IsEnabled = Get-AdvancedBool $($detail.GetEnableAccount( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $Homefolder = Get-AdvancedBool $($detail.GetHomeDir( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HomefolderIsRoot = Get-AdvancedBool $($detail.GetHomeDirIsRoot( [ref] $inherited )) $inherited
|
||||||
|
|
||||||
|
$inherited = $null; $EnableDiskQuota = Get-AdvancedBool $($detail.GetEnableDiskQuota( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $MaxSpace = Get-AdvancedBool $($detail.GetMaxSpace( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $TwoFactorAuthentication = Get-AdvancedBool $($detail.GetTwoFactorAuthentication( [ref] $inherited )) $inherited
|
||||||
|
|
||||||
|
$inherited = $null; $FTP = Get-AdvancedBool $($detail.GetClearFTP( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $FTPS = Get-AdvancedBool $($detail.GetFTPS( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AllowFXP = Get-AdvancedBool $($detail.GetAllowFXP( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AllowNoop = Get-AdvancedBool $($detail.GetAllowNoop( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AllowCOMB = Get-AdvancedBool $($detail.GetAllowCOMB( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AllowXCRC = Get-AdvancedBool $($detail.GetAllowXCRC( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AllowMODEZ = Get-AdvancedBool $($detail.GetAllowMODEZ( [ref] $inherited )) $inherited
|
||||||
|
#$inherited = $null; $LoginMsg = Get-AdvancedBool $($detail.GetLoginMsg( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $SSLAuthenticationType = Get-AdvancedBool $($detail.GetSSLAuthenticationType( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $SFTP = Get-AdvancedBool $($detail.GetSFTP( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $ClearHTTP = Get-AdvancedBool $($detail.GetClearHTTP( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HTTPS = Get-AdvancedBool $($detail.GetHTTPS( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AppletEnabled = Get-AdvancedBool $($detail.GetAppletEnabled( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AS2Inbound = Get-AdvancedBool $($detail.GetAS2Inbound( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AS2Outbound = Get-AdvancedBool $($detail.GetAS2Outbound( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HasMaxSpeed = Get-AdvancedBool $($detail.GetHasMaxSpeed( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $EnableTimeOut = Get-AdvancedBool $($detail.GetEnableTimeOut( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HasMaxUsers = Get-AdvancedBool $($detail.GetHasMaxUsers( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HasMaxIPs = Get-AdvancedBool $($detail.GetHasMaxIPs( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $MaxSpeed = Get-AdvancedBool $($detail.GetMaxSpeed( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $TimeOut = Get-AdvancedBool $($detail.GetTimeOut( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $MaxUsers = Get-AdvancedBool $($detail.GetMaxUsers( [ref] $inherited )) $inherited
|
||||||
|
#$inherited = $null; $MaxIPs = Get-AdvancedBool $($detail.GetMaxIPs( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HasUploadsPerSession = Get-AdvancedBool $($detail.GetHasUploadsPerSession( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HasDownloadsPerSession = Get-AdvancedBool $($detail.GetHasDownloadsPerSession( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HasMaxUploadSize = Get-AdvancedBool $($detail.GetHasMaxUploadSize( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $HasMaxDownloadSize = Get-AdvancedBool $($detail.GetHasMaxDownloadSize( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $UploadsPerSession = Get-AdvancedBool $($detail.GetUploadsPerSession( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $DownloadsPerSession = Get-AdvancedBool $($detail.GetDownloadsPerSession( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $MaxUploadSize = Get-AdvancedBool $($detail.GetMaxUploadSize( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $MaxDownloadSize = Get-AdvancedBool $($detail.GetMaxDownloadSize( [ref] $inherited )) $inherited
|
||||||
|
#$inherited = $null; $IPAccessAllowedDefault = Get-AdvancedBool $($detail.IPAccessAllowedDefault( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $LimitAccessByIP = Get-AdvancedBool $($detail.GetLimitAccessByIP( [ref] $inherited )) $inherited
|
||||||
|
|
||||||
|
$inherited = $null; $SftpAuthenticationType = Get-AdvancedBool $($detail.GetSftpAuthenticationType( [ref] $inherited )) $inherited
|
||||||
|
|
||||||
|
$inherited = $null; $IsInactivityPeriodLimited = Get-AdvancedBool $($detail.IsInactivityPeriodLimited( [ref] $inherited )) $inherited
|
||||||
|
$InactivityPeriodLimited = $inherited
|
||||||
|
try {
|
||||||
|
$inherited = $null; $AllowWorkspaces = Get-AdvancedBool $($detail.GetAllowWorkspaces( [ref] $inherited )) $inherited
|
||||||
|
$inherited = $null; $AllowWorkspacesOAI = Get-AdvancedBool $($detail.GetAllowWorkspacesOAI( [ref] $inherited )) $inherited
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
|
||||||
|
}
|
||||||
|
$inherited = $null; $IsPasswordAgeLimited = Get-AdvancedBool $($detail.IsPasswordAgeLimited( [ref] $inherited )) $inherited
|
||||||
|
$PasswordAgeLimited = $inherited
|
||||||
|
|
||||||
|
$id = $detail.id
|
||||||
|
#IsInactivityPeriodLimited
|
||||||
|
#IsPasswordAgeLimited
|
||||||
|
#properties that ends with '_n' won't be used for checksum
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
id = $id;
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
SiteGuid = $SiteGuid;
|
||||||
|
SettingsTemplate = [String]$script:EftSite.GetUserSettingsLevel($users[$i]);
|
||||||
|
IsEnabled = $IsEnabled;
|
||||||
|
Username = $users[$i];
|
||||||
|
Email = $detail.Email;
|
||||||
|
IsUserExpired = $IsUserExpired
|
||||||
|
ExpirationDate = $ExpirationDate;
|
||||||
|
IsInactivityPeriodLimited = $IsInactivityPeriodLimited;
|
||||||
|
InactivityPeriodLimited = $InactivityPeriodLimited;
|
||||||
|
IsPasswordAgeLimited = $IsPasswordAgeLimited;
|
||||||
|
PasswordAgeLimited = $PasswordAgeLimited;
|
||||||
|
HomefolderPath = $detail.GetHomeDirString();
|
||||||
|
HomefolderIsRoot = $HomefolderIsRoot;
|
||||||
|
Homefolder = $Homefolder;
|
||||||
|
Description = $detail.Description;
|
||||||
|
FullName = $detail.FullName;
|
||||||
|
Phone = $detail.Phone;
|
||||||
|
Fax = $detail.Fax;
|
||||||
|
Pager = $detail.Pager;
|
||||||
|
Custom1 = $detail.Custom1;
|
||||||
|
Custom2 = $detail.Custom2;
|
||||||
|
Custom3 = $detail.Custom3;
|
||||||
|
Comments = $detail.Comments;
|
||||||
|
EnableDiskQuota = $EnableDiskQuota;
|
||||||
|
MaxSpace = $MaxSpace;
|
||||||
|
TwoFactorAuthentication = $TwoFactorAuthentication;
|
||||||
|
IsLocked = $detail.IsLocked ;
|
||||||
|
|
||||||
|
#Connection Settings
|
||||||
|
FTP = $FTP;
|
||||||
|
FTPS = $FTPS;
|
||||||
|
AllowFXP = $AllowFXP;
|
||||||
|
SftpAuthenticationType = $SftpAuthenticationType;
|
||||||
|
AllowNoop = $AllowNoop
|
||||||
|
AllowCOMB = $AllowCOMB ;
|
||||||
|
AllowXCRC = $AllowXCRC ;
|
||||||
|
AllowMODEZ = $AllowMODEZ;
|
||||||
|
LoginMsg = $detail.GetLoginMsg() ;
|
||||||
|
SSLAuthenticationType = $SSLAuthenticationType;
|
||||||
|
SFTP = $SFTP ;
|
||||||
|
ClearHTTP = $ClearHTTP ;
|
||||||
|
HTTPS = $HTTPS;
|
||||||
|
AppletEnabled = $AppletEnabled;
|
||||||
|
AS2Inbound = $AS2Inbound ;
|
||||||
|
AS2Outbound = $AS2Outbound;
|
||||||
|
HasMaxSpeed = $HasMaxSpeed;
|
||||||
|
EnableTimeOut = $EnableTimeOut ;
|
||||||
|
HasMaxUsers = $HasMaxUsers;
|
||||||
|
HasMaxIPs = $HasMaxIPs ;
|
||||||
|
MaxSpeed = $MaxSpeed ;
|
||||||
|
TimeOut = $TimeOut ;
|
||||||
|
MaxUsers = $MaxUsers;
|
||||||
|
MaxIPs = $MaxIPs ;
|
||||||
|
HasUploadsPerSession = $HasUploadsPerSession;
|
||||||
|
HasDownloadsPerSession = $HasDownloadsPerSession;
|
||||||
|
HasMaxUploadSize = $HasMaxUploadSize;
|
||||||
|
HasMaxDownloadSize = $HasMaxDownloadSize ;
|
||||||
|
UploadsPerSession = $UploadsPerSession ;
|
||||||
|
DownloadsPerSession = $DownloadsPerSession ;
|
||||||
|
MaxUploadSize = $MaxUploadSize ;
|
||||||
|
MaxDownloadSize = $MaxDownloadSize ;
|
||||||
|
IPAccessAllowedDefault = $IPAccessAllowedDefault ;
|
||||||
|
LimitAccessByIP = $LimitAccessByIP ;
|
||||||
|
|
||||||
|
LoginMsgString = $detail.GetLoginMsgString();
|
||||||
|
|
||||||
|
IsConnected = $details.IsConnected;
|
||||||
|
UsedSpace = $detail.GetUsedSpace();
|
||||||
|
PhysicalHomefolder = [String]$script:EftSite.GetPhysicalPath([String]$detail.GetHomeDirString());
|
||||||
|
LastTimeConnected = $detail.LastConnectionTime;
|
||||||
|
CreationDate = $detail.AccountCreationTime;
|
||||||
|
LastModification = $detail.LastModificationTime;
|
||||||
|
AllowWorkspaces = $AllowWorkspaces;
|
||||||
|
AllowWorkspacesOAI = $AllowWorkspacesOAI;
|
||||||
|
CheckSum = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $results |Sort-Object Username | Format-Table CheckSum, IsUserEnabled, Username, Email, LastTimeConnected, CreationDate, ExpirationDate, LastModification, Homefolder, PhysicalHomefolder
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for ($i = 0 ; $i -le $results.count - 1; $i++) {
|
||||||
|
$u = $results[$i]
|
||||||
|
#Concatenate all columns except the mentioned in the ExcludedProperty
|
||||||
|
$userHash = -join ( $u | Select-Object * -ExcludeProperty SiteName, IsConnected, UsedSpace, PhysicalHomefolder, LastTimeConnected, CreationDate , LastModification, CheckSum)
|
||||||
|
$userHash = get-filehash -Algorithm SHA1 -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($userHash))) | Select-Object -ExpandProperty Hash
|
||||||
|
$results[$i].CheckSum = $userHash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$results[$i].CheckSum = "NA"
|
||||||
|
}
|
||||||
|
$results | Sort-Object Username
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,99 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "ODBCSite",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$SiteParameters = $script:EftSite.GetAMParams()
|
||||||
|
$UserDatabaseConnectionString = $SiteParameters.UserDatabaseConnectionString
|
||||||
|
if ($UserDatabaseConnectionString -eq "" ) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = New-Object System.Data.Odbc.OdbcConnection
|
||||||
|
$conn.ConnectionString = $UserDatabaseConnectionString
|
||||||
|
$conn.Open()
|
||||||
|
|
||||||
|
$sql = 'SELECT [ID] ,[NAME] ,[PASSWORD] ,[DESCRIPTION] ,[TYPE],[PASSWORD_TYPE] ,[MD_ITER],[OTP_SEED] ,[ANONYMOUS],[ANONYMOUS_EMAIL],[FULLNAME],[EMAIL],[PHONE],[PAGER],[FAX],[COMMENTS],[ENABLED],[HOMEDIRECTORY],[SETTINGSLEVEL] FROM [FTPSERVER_USERS]'
|
||||||
|
$cmd = New-Object System.Data.Odbc.OdbcCommand($sql, $conn)
|
||||||
|
|
||||||
|
$reader = $cmd.ExecuteReader()
|
||||||
|
while ($reader.Read()) {
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $siteName;
|
||||||
|
Name = $reader[1];
|
||||||
|
Password = $reader[2];
|
||||||
|
Description = $reader[3];
|
||||||
|
type = $reader[4];
|
||||||
|
Password_Type = $reader[5];
|
||||||
|
FullName = $reader[10];
|
||||||
|
Email = $reader[11];
|
||||||
|
Phone = $reader[12];
|
||||||
|
Pager = $reader[13];
|
||||||
|
Fax = $reader[14];
|
||||||
|
Comments = $reader[15];
|
||||||
|
Enabled = $reader[16];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$reader.Close()
|
||||||
|
$conn.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$results
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
@ -0,0 +1,201 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password
|
||||||
|
|
||||||
|
)
|
||||||
|
function Get-FriendlySize {
|
||||||
|
param($Bytes)
|
||||||
|
$sizes = 'Bytes,KB,MB,GB,TB,PB,EB,ZB' -split ','
|
||||||
|
for ($i = 0; ($Bytes -ge 1kb) -and
|
||||||
|
($i -lt $sizes.Count); $i++) {$Bytes /= 1kb}
|
||||||
|
$N = 2; if ($i -eq 0) {$N = 0}
|
||||||
|
"{0:N$($N)} {1}" -f $Bytes, $sizes[$i]
|
||||||
|
}
|
||||||
|
function Get-CountFiles {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true, HelpMessage = "Enter a path")] [string]$path,
|
||||||
|
[Parameter(Mandatory = $false, HelpMessage = "Search Options: (AllDirectories (default), TopDirectoryOnly)")] [ValidateSet("AllDirectories", "TopDirectoryOnly")] [string]$searchOptions = 'AllDirectories'
|
||||||
|
)
|
||||||
|
$foldersize = 0
|
||||||
|
$filecount = 0
|
||||||
|
$LastException = ""
|
||||||
|
|
||||||
|
if ((Test-Path $path) -eq $false) {
|
||||||
|
$LastException = "'$path' not found"
|
||||||
|
return $foldersize, $filecount, $LastException
|
||||||
|
}
|
||||||
|
$directory = Get-item $path -Force
|
||||||
|
|
||||||
|
Write-Progress -Activity "Calculating Stats" -Status "Reading '$($directory.FullName)'"
|
||||||
|
|
||||||
|
$files = $directory | Get-ChildItem -Force -Recurse:$recurse | Where-Object { -not $_.PSIsContainer }
|
||||||
|
if ( $files ) {
|
||||||
|
Write-Progress -Activity "Calculating Stats" -Status "Calculating '$($directory.FullName)'"
|
||||||
|
$output = $files | Measure-Object -Sum -Property Length | Select-Object `
|
||||||
|
@{Name = "Path"; Expression = {$directory.FullName}},
|
||||||
|
@{Name = "Files"; Expression = {$_.Count; $script:totalcount += $_.Count}},
|
||||||
|
@{Name = "Size"; Expression = {$_.Sum; $script:totalbytes += $_.Sum}}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$output = "" | Select-Object `
|
||||||
|
@{Name = "Path"; Expression = {$directory.FullName}},
|
||||||
|
@{Name = "Files"; Expression = {0}},
|
||||||
|
@{Name = "Size"; Expression = {0}}
|
||||||
|
}
|
||||||
|
return $output.Size, $output.Files, $LastException
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
$users = $script:EftSite.GetUsers()
|
||||||
|
$virtualFolders = $script:EftSite.GetVirtualFolderList("") -split "`r`n"
|
||||||
|
#Removing empty and root path
|
||||||
|
$virtualFolders = $virtualFolders | Where-Object {$_ -ne "" -and $_ -ne "/"}
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $users.length; $i++ ) {
|
||||||
|
Write-Progress -Activity "Processing Users" -status "User '$($users[$i])' $i/$($users.length)" -percentComplete ($i / $users.length * 100)
|
||||||
|
$FolderSize = 0
|
||||||
|
$FileCount = 0
|
||||||
|
$virtualFoldersPerUser = 0
|
||||||
|
$LastException = ""
|
||||||
|
$InvalidvirtualFoldersPerUser = 0
|
||||||
|
|
||||||
|
$detail = $script:EftSite.GetUserSettings($users[$i])
|
||||||
|
$expirationDate = New-Object DateTime
|
||||||
|
$inherited = $null
|
||||||
|
$detail.GetExpirationDate($expirationDate) | Out-Null
|
||||||
|
|
||||||
|
if ($expirationDate -eq $(New-Object DateTime)) {
|
||||||
|
$expirationDate = ""
|
||||||
|
}
|
||||||
|
$homeFolder = [String]$detail.GetHomeDirString()
|
||||||
|
$SettingsTemplate = [String]$script:EftSite.GetUserSettingsLevel($users[$i])
|
||||||
|
$Email = $detail.Email
|
||||||
|
$fullName = $detail.FullName
|
||||||
|
$inherited = $null
|
||||||
|
$IsUserEnabled = [bool]$detail.GetEnableAccount([ref] $inherited)
|
||||||
|
$LastConnectionTime = $detail.LastConnectionTime
|
||||||
|
$physicalHomefolder = ""
|
||||||
|
|
||||||
|
try {
|
||||||
|
$physicalHomefolder = [String]$script:EftSite.GetPhysicalPath($homeFolder)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { $LastException = "MXE_FOLDER_NOT_FOUND : $_ " }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { $LastException = "MXE_INVALID_FOLDER_NAME : $_ "}
|
||||||
|
Default { $LastException = "Exception** : $_"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$countResults = Get-CountFiles $physicalHomefolder
|
||||||
|
|
||||||
|
if ($null -ne $countResults) {
|
||||||
|
$FolderSizeFormated = $(Get-FriendlySize $countResults[0] )
|
||||||
|
$FolderSize = $countResults[0]
|
||||||
|
$FileCount = $countResults[1]
|
||||||
|
if ($countResults[2] -ne "") {
|
||||||
|
$LastException = "PhysicalHomefolder:" + $countResults[2] + ";"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$subFoldersVirtual = $virtualFolders | Where-Object {$_ -like "$($homeFolder)*"}
|
||||||
|
foreach ($virtualFolder in $subFoldersVirtual ) {
|
||||||
|
$virtualFoldersPerUser++
|
||||||
|
try {
|
||||||
|
$physicalHomefolder = [String]$script:EftSite.GetPhysicalPath($virtualFolder)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
$InvalidvirtualFoldersPerUser++
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { $LastException = $LastException + "MXE_FOLDER_NOT_FOUND : $_ " }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { $LastException = $LastException + "MXE_INVALID_FOLDER_NAME : $_ "}
|
||||||
|
Default { $LastException = $LastException + "Exception : $_"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$countResultVirtual = Get-CountFiles $physicalHomefolder
|
||||||
|
if ($null -ne $countResults -and $null -ne $countResultVirtual) {
|
||||||
|
$FolderSize = $FolderSize + $countResultVirtual[0]
|
||||||
|
$FolderSizeFormated = $(Get-FriendlySize $FolderSize )
|
||||||
|
$FileCount = $FileCount + $countResultVirtual[1]
|
||||||
|
if ($countResultVirtual[2] -ne "") {
|
||||||
|
$LastException = $LastException + "Virtual Folder:" + $countResultVirtual[2] + ";"
|
||||||
|
$InvalidvirtualFoldersPerUser++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$obj = new-object PSObject
|
||||||
|
|
||||||
|
$obj | add-member -membertype NoteProperty -name "SiteName" -value $SiteName
|
||||||
|
$obj | add-member -membertype NoteProperty -name "SettingsTemplate" -value $SettingsTemplate
|
||||||
|
$obj | add-member -membertype NoteProperty -name "Username" -value $users[$i]
|
||||||
|
$obj | add-member -membertype NoteProperty -name "Email" -value $Email
|
||||||
|
$obj | add-member -membertype NoteProperty -name "IsEnabled" -value $IsUserEnabled
|
||||||
|
$obj | add-member -membertype NoteProperty -name "ExpirationDate" -value $ExpirationDate
|
||||||
|
$obj | add-member -membertype NoteProperty -name "FullName" -value $fullName
|
||||||
|
$obj | add-member -membertype NoteProperty -name "Homefolder" -value $homefolder
|
||||||
|
$obj | add-member -membertype NoteProperty -name "LastConnectionTime" -value $LastConnectionTime
|
||||||
|
$obj | add-member -membertype NoteProperty -name "PhysicalHomefolder" -value $physicalHomefolder
|
||||||
|
$obj | add-member -membertype NoteProperty -name "Size" -value $FolderSize
|
||||||
|
$obj | add-member -membertype NoteProperty -name "SizeFormated" -value $FolderSizeFormated
|
||||||
|
$obj | add-member -membertype NoteProperty -name "Files" -value $FileCount
|
||||||
|
$obj | add-member -membertype NoteProperty -name "VirtualFolders" -value $virtualFoldersPerUser
|
||||||
|
$obj | add-member -membertype NoteProperty -name "InvalidVirtualFolders" -value $InvalidvirtualFoldersPerUser
|
||||||
|
$obj | add-member -membertype NoteProperty -name "Errors" -value $LastException
|
||||||
|
$results += $obj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$results
|
@ -0,0 +1,119 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Physical Path ")]
|
||||||
|
[switch] $ValidatePath = $false
|
||||||
|
)
|
||||||
|
## To Export to CSV use:
|
||||||
|
## .\EFT.VirtualFolders.Export.ps1 | Export-csv foo.csv -NoTypeInformation
|
||||||
|
## .\EFT.VirtualFolders.Export.ps1 | Where-Object {$_.Username -eq "rguzman"} | format-table
|
||||||
|
## .\EFT.VirtualFolders.Export.ps1 | where-object {$_.Username -eq "rguzman" } | export-csv foo.csv -NoTypeInformation
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
$virtualFolders = $script:EftSite.GetVirtualFolderList("") -split "`r`n"
|
||||||
|
#Removing empty and root path
|
||||||
|
$virtualFolders = $virtualFolders #| Where-Object {$_ -ne "" -and $_ -ne "/"}
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $virtualFolders.length; $i++ ) {
|
||||||
|
if ($virtualFolders[$i] -ne "" -and $virtualFolders[$i] -ne "/") {
|
||||||
|
|
||||||
|
|
||||||
|
Write-Progress -Activity "Processing Virtual Folders" -status "Virtual folder $i/$($virtualFolders.length)" -percentComplete ($i / $virtualFolders.length * 100)
|
||||||
|
$Validpath = ""
|
||||||
|
try {
|
||||||
|
$physicalPath = $script:EftSite.GetPhysicalPath($virtualFolders[$i])
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { $physicalPath = "**MXE_FOLDER_NOT_FOUND** : $_ " }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { $physicalPath = "**MXE_INVALID_FOLDER_NAME** : $_ "}
|
||||||
|
Default { $physicalPath = "**Exception** : $_"}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ValidatePath) {
|
||||||
|
try {
|
||||||
|
if (Test-Path $physicalPath) {
|
||||||
|
$Validpath = "OK"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$Validpath = "FOLDER_NOT_FOUND"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$Validpath = "ERROR: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#properties that ends with '_n' won't be used for checksum
|
||||||
|
$results += new-object psobject -Property @{
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
VirtualFolder = $virtualFolders[$i];
|
||||||
|
PhysicalPath = $physicalPath;
|
||||||
|
ValidPath = $Validpath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$results | Sort-Object SiteName, VirtualFolder
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,122 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the virtual folder CSV file ")]
|
||||||
|
[string] $VirtualFolderCsvFile = "VirtualFolders.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
if ($VirtualFolderCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
$EFTVirtualFolders = @(
|
||||||
|
# @{ SiteName = "MySite"; VirtualFolder = "\"; PhysicalPath = "" }
|
||||||
|
# @{ SiteName = "MySite1"; VirtualFolder = "\"; PhysicalPath = ""}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EFTVirtualFolders = Import-Csv $VirtualFolderCsvFile
|
||||||
|
# "SiteName","VirtualFolder", "PhysicalPath"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$MXE_FOLDER_NOT_EMPTY = "MX Error: 117 (00000075)"
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Remapping Virtual Folders:"
|
||||||
|
$RemapCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
foreach ($EFTVirtualFolder in $EFTVirtualFolders) {
|
||||||
|
try {
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EFTVirtualFolder.SiteName])
|
||||||
|
Write-host "Update: [$($EFTVirtualFolder.SiteName)] $($EFTVirtualFolder.VirtualFolder) -> $($EFTVirtualFolder.PhysicalPath)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
if ($PSCmdlet.ShouldProcess($EFTVirtualFolder.VirtualFolder, 'Remap')) {
|
||||||
|
$script:EftSite.RemapVirtualFolder($EFTVirtualFolder.VirtualFolder, $EFTVirtualFolder.PhysicalPath)
|
||||||
|
}
|
||||||
|
write-Verbose "[$(Get-Date -f $df)] ICISites.RemapVirtualFolder() $($sw.ElapsedMilliseconds )ms"
|
||||||
|
|
||||||
|
$RemapCount++
|
||||||
|
Write-host " OK $($sw.ElapsedMilliseconds )ms" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Updated: " -NoNewline
|
||||||
|
Write-host "$RemapCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,126 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the virtual folder CSV file ")]
|
||||||
|
[string] $VirtualFolderCsvFile = "VirtualFolders.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
if ($VirtualFolderCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
$EFTVirtualFolders = @(
|
||||||
|
# @{ SiteName = "MySite"; VirtualFolder = "\"; PhysicalPath = "" }
|
||||||
|
# @{ SiteName = "MySite1"; VirtualFolder = "\"; PhysicalPath = ""}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EFTVirtualFolders = Import-Csv $VirtualFolderCsvFile
|
||||||
|
# "CheckSum", "SiteName",PhysicalPath", "VirtualFolder", "NewVirtualFolder"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$MXE_FOLDER_NOT_EMPTY = "MX Error: 117 (00000075)"
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
Write-host "Connecting EFT Server TCP://$EFTAdminUsername@$EFTAdminHostname : $EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
Write-host " OK" -ForegroundColor Green
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Update Virtual Folders:"
|
||||||
|
$RemoveCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
|
||||||
|
foreach ($EFTVirtualFolder in $EFTVirtualFolders) {
|
||||||
|
try {
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EFTVirtualFolder.SiteName])
|
||||||
|
if ([string]::IsNullOrEmpty($EFTVirtualFolder.VirtualFolder) -eq $false) {
|
||||||
|
# Rename and Remap
|
||||||
|
Write-host "Remove: [$($EFTVirtualFolder.SiteName)] $($EFTVirtualFolder.VirtualFolder) ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
if ($PSCmdlet.ShouldProcess($EFTVirtualFolder.VirtualFolder, 'RemoveFolder')) {
|
||||||
|
$script:EftSite.RemoveFolder($EFTVirtualFolder.VirtualFolder)
|
||||||
|
}
|
||||||
|
write-Verbose "[$(Get-Date -f $df)] ICISites.RemoveFolder() $($swv.ElapsedMilliseconds )ms"
|
||||||
|
|
||||||
|
$RemoveCount++
|
||||||
|
Write-host " OK $($sw.ElapsedMilliseconds )ms" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#Ignore
|
||||||
|
Write-host "Ignore: $($EFTVirtualFolder.VirtualFolder)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
Write-host " OK $($sw.ElapsedMilliseconds )ms" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host " Removed: " -NoNewline
|
||||||
|
Write-host "$RemoveCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,135 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the virtual folder CSV file ")]
|
||||||
|
[string] $VirtualFolderCsvFile = "VirtualFolders.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
if ($VirtualFolderCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
$EFTVirtualFolders = @(
|
||||||
|
# @{ SiteName = "MySite"; VirtualFolder = "\"; PhysicalPath = "" }
|
||||||
|
# @{ SiteName = "MySite1"; VirtualFolder = "\"; PhysicalPath = ""}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EFTVirtualFolders = Import-Csv $VirtualFolderCsvFile
|
||||||
|
# "CheckSum", "SiteName",PhysicalPath", "VirtualFolder", "NewVirtualFolder"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$swv = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$MXE_FOLDER_NOT_EMPTY = "MX Error: 117 (00000075)"
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
Write-host "Connecting EFT Server TCP://$EFTAdminUsername@$EFTAdminHostname : $EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
Write-host " OK" -ForegroundColor Green
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Update Virtual Folders:"
|
||||||
|
$RenameCount = 0
|
||||||
|
$errorCount = 0
|
||||||
|
|
||||||
|
foreach ($EFTVirtualFolder in $EFTVirtualFolders) {
|
||||||
|
try {
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EFTVirtualFolder.SiteName])
|
||||||
|
if ([string]::IsNullOrEmpty($EFTVirtualFolder.NewVirtualFolder) -eq $false -and [string]::IsNullOrEmpty($EFTVirtualFolder.PhysicalPath) -eq $false) {
|
||||||
|
# Rename and Remap
|
||||||
|
Write-host "Rename: [$($EFTVirtualFolder.SiteName)] $($EFTVirtualFolder.VirtualFolder) -> $($EFTVirtualFolder.NewVirtualFolder)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
|
||||||
|
$swv.Restart()
|
||||||
|
if ($PSCmdlet.ShouldProcess($EFTVirtualFolder.VirtualFolder, 'RemoveFolder')) {
|
||||||
|
$script:EftSite.RemoveFolder($EFTVirtualFolder.VirtualFolder)
|
||||||
|
}
|
||||||
|
write-Verbose "[$(Get-Date -f $df)] ICISites.RemoveFolder() $($swv.ElapsedMilliseconds )ms"
|
||||||
|
|
||||||
|
$swv.Restart()
|
||||||
|
if ($PSCmdlet.ShouldProcess($EFTVirtualFolder.VirtualFolder, 'RemapVirtualFolder')) {
|
||||||
|
$script:EftSite.RemapVirtualFolder($EFTVirtualFolder.NewVirtualFolder, $EFTVirtualFolder.PhysicalPath)
|
||||||
|
}
|
||||||
|
write-Verbose "[$(Get-Date -f $df)] ICISites.RemoveFolder() $($swv.ElapsedMilliseconds )ms"
|
||||||
|
|
||||||
|
$RenameCount++
|
||||||
|
Write-host " OK $($sw.ElapsedMilliseconds )ms" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#Ignore
|
||||||
|
Write-host "Ignore: $($EFTVirtualFolder.VirtualFolder)".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
Write-host " OK $($sw.ElapsedMilliseconds )ms" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-host " Renamed: " -NoNewline
|
||||||
|
Write-host "$RenameCount " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
$EFTAdminHostname = "localhost"
|
||||||
|
$EFTAdminPort = 1100
|
||||||
|
$EFTAdminAuthType = 0 # 0: EFT Login, 1: Windows Login, 2: Network Logon
|
||||||
|
$EFTAdminUsername = "admin"
|
||||||
|
$Password = "Super2003"
|
||||||
|
$EFTSiteName = "MySite"
|
||||||
|
$VirtualPath = "/*" # Use * as wild card
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting to EFT"
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " Connected " -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sw.Restart()
|
||||||
|
Write-host "[$(Get-Date -f $df)] Calling ICISites.GetVirtualFolderList() $($sw.ElapsedMilliseconds )ms" -ForegroundColor Yellow
|
||||||
|
$virtualFolders = $script:EftSite.GetVirtualFolderList("") -split "`r`n"
|
||||||
|
Write-host "[$(Get-Date -f $df)] ICISites.GetVirtualFolderList() $($sw.ElapsedMilliseconds )ms" -ForegroundColor Yellow
|
||||||
|
Write-host " $($virtualFolders.length) virtual folders found." -ForegroundColor Green
|
||||||
|
|
||||||
|
#Removing empty and root path
|
||||||
|
$virtualFolders = $virtualFolders #| Where-Object {$_ -ne "" -and $_ -ne "/"}
|
||||||
|
|
||||||
|
$sw.Restart()
|
||||||
|
$count = 0
|
||||||
|
Write-host "[$(Get-Date -f $df)] Calling ICISites.GetPhysicalPath() $($sw.ElapsedMilliseconds )ms" -ForegroundColor Yellow
|
||||||
|
for ($i = 0; $i -lt $virtualFolders.length; $i++ ) {
|
||||||
|
if ($virtualFolders[$i] -ne "" -and $virtualFolders[$i] -ne "/") {
|
||||||
|
if ($virtualFolders[$i] -like $VirtualPath){
|
||||||
|
$count += 1
|
||||||
|
try {
|
||||||
|
$physicalPath = $script:EftSite.GetPhysicalPath($virtualFolders[$i])
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sw.Restart()
|
||||||
|
Write-host "[$(Get-Date -f $df)] ICISites.GetPhysicalPath() $($sw.ElapsedMilliseconds )ms" -ForegroundColor Yellow
|
||||||
|
Write-host " called GetPhysicalPath() for $count virtual folders under '$VirtualPath' ." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
Dim WshShell, currDir, oFSO
|
||||||
|
Set WshShell = WScript.CreateObject("WScript.Shell")
|
||||||
|
'WScript.Echo WshShell.CurrentDirectory
|
||||||
|
currDir = WshShell.CurrentDirectory
|
||||||
|
|
||||||
|
Set oFSO = CreateObject("Scripting.FileSystemObject")
|
||||||
|
' Create a new folders
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\Account"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\Shared"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\Shared\images"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\jument"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\jument\ng-views"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\jument\images"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\jument\styles"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\jument\styles\defaults"
|
||||||
|
oFSO.CreateFolder currDir & "\EFTClient\jument\styles\defaults\styles"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
' Copy a file into the new folder
|
||||||
|
' Note that the destination folder path must end with a path separator (\)
|
||||||
|
oFSO.CopyFile currDir & "\public\EFTClient\Account\Log*n.htm", currDir & "\EFTClient\Account"
|
||||||
|
oFSO.CopyFile currDir & "\public\EFTClient\jument\styles\*.css", currDir & "\EFTClient\jument\styles"
|
||||||
|
oFSO.CopyFile currDir & "\public\EFTClient\jument\styles\defaults\styles\*.css", currDir & "\EFTClient\jument\styles\defaults\styles"
|
||||||
|
oFSO.CopyFile currDir & "\public\EFTClient\jument\ng-views\v.head*.html", currDir & "\EFTClient\jument\ng-views"
|
||||||
|
oFSO.CopyFile currDir & "\public\EFTClient\Shared\*.css", currDir & "\EFTClient\Shared"
|
||||||
|
|
||||||
|
wscript.echo "Script Completed"
|
@ -0,0 +1,29 @@
|
|||||||
|
Dim varPSCmd, varPSAct, varPS
|
||||||
|
Dim strOldValue, strNewValue, exclude
|
||||||
|
Dim currDir, dirEFTClient
|
||||||
|
Set objShell = CreateObject("WScript.Shell")
|
||||||
|
currDir = objShell.CurrentDirectory
|
||||||
|
dirEFTClient = currDir & "\EFTClient"
|
||||||
|
|
||||||
|
'MsgBox dirEFTClient
|
||||||
|
|
||||||
|
' WTC Option Default Main Three colors
|
||||||
|
'---------------------------------------
|
||||||
|
'WTC Main Layout: #00A8D4
|
||||||
|
'On click Button: #0B76BB
|
||||||
|
'Gray button: #485156
|
||||||
|
|
||||||
|
' Use URL to verify HTML colors https://html-color-codes.info
|
||||||
|
|
||||||
|
|
||||||
|
'Find and Replace Values
|
||||||
|
strOldValue = "#0B76BB"
|
||||||
|
strNewValue = "#0DA308"
|
||||||
|
|
||||||
|
'Vbscript is using Powershell's engine to search and replace multiple files
|
||||||
|
varPSCmd = "powershell -noexit -command"
|
||||||
|
varPSAct = "Get-ChildItem " & dirEFTClient & "\*.* -Recurse | ForEach {(Get-Content $_ | ForEach { $_ -replace '" & strOldValue & "', '" & strNewValue& "' }) | Set-Content $_}"
|
||||||
|
varPS = varPSCmd & " " & varPSAct
|
||||||
|
objShell.run(varPS)
|
||||||
|
|
||||||
|
wscript.echo "Script Completed"
|
@ -0,0 +1,32 @@
|
|||||||
|
Const ForReading = 1
|
||||||
|
|
||||||
|
Const ForWriting = 2
|
||||||
|
|
||||||
|
Dim WshShell, objFSO, objFile
|
||||||
|
Dim strText, strNewText
|
||||||
|
|
||||||
|
Set WshShell = WScript.CreateObject("WScript.Shell")
|
||||||
|
WScript.Echo WshShell.CurrentDirectory
|
||||||
|
currDir = WshShell.CurrentDirectory
|
||||||
|
|
||||||
|
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||||
|
|
||||||
|
Set objFile = objFSO.OpenTextFile(currDir & "\EFTClient\jument\styles\theme_override.css", ForReading)
|
||||||
|
|
||||||
|
|
||||||
|
strText = objFile.ReadAll
|
||||||
|
|
||||||
|
objFile.Close
|
||||||
|
|
||||||
|
strNewText = Replace(strText, "../images/GSB-Logo.png", "")
|
||||||
|
|
||||||
|
|
||||||
|
Set objFile = objFSO.OpenTextFile(currDir & "\EFTClient\jument\styles\theme_override.css", ForWriting)
|
||||||
|
|
||||||
|
objFile.WriteLine strNewText
|
||||||
|
|
||||||
|
msgbox "Done!"
|
||||||
|
|
||||||
|
objFile.Close
|
||||||
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
|||||||
|
Const ForReading = 1
|
||||||
|
|
||||||
|
Const ForWriting = 2
|
||||||
|
|
||||||
|
Dim WshShell, objFSO, objFile
|
||||||
|
Dim strText, strNewText, objFile2
|
||||||
|
|
||||||
|
Set WshShell = WScript.CreateObject("WScript.Shell")
|
||||||
|
|
||||||
|
currDir = WshShell.CurrentDirectory
|
||||||
|
|
||||||
|
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||||
|
|
||||||
|
Set objFile = objFSO.OpenTextFile(currDir & "\EFTClient\Account\Login.htm", ForReading)
|
||||||
|
|
||||||
|
strText = objFile.ReadAll
|
||||||
|
|
||||||
|
objFile.Close
|
||||||
|
|
||||||
|
Dim strFind
|
||||||
|
strFindA1 = "<a href=" & Chr(34) & "/EFTClient/shadowfax/"
|
||||||
|
|
||||||
|
strReplaceA1 = "<!--" & strFindA1
|
||||||
|
|
||||||
|
strFindB1 = "Forgot Username</a>"
|
||||||
|
strReplaceB1 = strFindB1 & "-->"
|
||||||
|
|
||||||
|
strFindB2 = "Forgot Password</a>"
|
||||||
|
strReplaceB2 = strFindB2 & "-->"
|
||||||
|
|
||||||
|
strNewText1 = Replace(strText, strFindA1, strReplaceA1)
|
||||||
|
strNewText2 = Replace(strNewText1, strFindB1, strReplaceB1)
|
||||||
|
strNewText3 = Replace(strNewText2, strFindB2, strReplaceB2)
|
||||||
|
|
||||||
|
Set objFile = objFSO.OpenTextFile(currDir & "\EFTClient\Account\Login.htm", ForWriting)
|
||||||
|
|
||||||
|
objFile.WriteLine strNewText3
|
||||||
|
objFile.Close
|
||||||
|
|
||||||
|
'-----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Dim strTextP, strNewText4
|
||||||
|
|
||||||
|
set objFile = objFSO.OpenTextFile(currDir & "\EFTClient\jument\ng-views\v.header.html", ForReading)
|
||||||
|
|
||||||
|
strTextP = objFile.ReadAll
|
||||||
|
|
||||||
|
objFile.Close
|
||||||
|
|
||||||
|
Dim strFindP, strReplaceP
|
||||||
|
strFindP = "<li><a onclick=gsb.v.password.show()><span data-i18n=password>"
|
||||||
|
|
||||||
|
strNewText4 = Replace(strTextP, strFindP,"")
|
||||||
|
|
||||||
|
Set objFile = objFSO.OpenTextFile(currDir & "\EFTClient\jument\ng-views\v.header.html", ForWriting)
|
||||||
|
|
||||||
|
objFile.WriteLine strNewText4
|
||||||
|
|
||||||
|
msgbox "Done!"
|
||||||
|
|
||||||
|
objFile.Close
|
Binary file not shown.
@ -0,0 +1,28 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $false, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTHost = "https://localhost:4450",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $false, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername = "admin",
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $false, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password = "Super2003"
|
||||||
|
)
|
||||||
|
$url = "$EFTHost/admin/v1/authentication"
|
||||||
|
$webclient = New-Object "System.Net.WebClient"
|
||||||
|
$payload = "{""userName"":""$($EFTAdminUsername)"", ""password"":""$($Password)"",""authType"":""EFT""}"
|
||||||
|
$webclient.Headers.Add("Accept", "application/json");
|
||||||
|
write-host "POST $url"
|
||||||
|
write-host "BODY:"
|
||||||
|
$payload
|
||||||
|
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
|
||||||
|
try {
|
||||||
|
$output = $webclient.Uploadstring($url,$payload)
|
||||||
|
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "Error Calling EFT Web Service $_"
|
||||||
|
}
|
||||||
|
write-host "Result: "
|
||||||
|
$output
|
@ -0,0 +1,153 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $False, HelpMessage = "Enter a Folder Path")]
|
||||||
|
[String] $Path = "/",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter the name of the Site, leave empty to process all sites")]
|
||||||
|
[String] $EFTSiteName = "",
|
||||||
|
|
||||||
|
[Parameter(Position = 4, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False, HelpMessage = "Validate Physical Path ")]
|
||||||
|
[switch] $ValidatePath = $false
|
||||||
|
)
|
||||||
|
## To Export to CSV use:
|
||||||
|
## .\EFT.Workspaces.Export.ps1 | Export-csv foo.csv -NoTypeInformation
|
||||||
|
## .\EFT.Workspaces.Export.ps1 | Where-Object {$_.Username -eq "rguzman"} | format-table
|
||||||
|
## .\EFT.Workspaces.Export.ps1 | where-object {$_.Username -eq "rguzman" } | export-csv foo.csv -NoTypeInformation
|
||||||
|
Function PermissionsToInt($permission) {
|
||||||
|
|
||||||
|
$permissionAsInt = 0
|
||||||
|
|
||||||
|
if ($null -ne $permission) {
|
||||||
|
if ($permission.DownloadFile -eq $true) { $permissionAsInt += 1 }
|
||||||
|
if ($permission.UploadFile -eq $true) { $permissionAsInt += 2 }
|
||||||
|
if ($permission.DeleteFile -eq $true) { $permissionAsInt += 4 }
|
||||||
|
if ($permission.RenameFileFolder -eq $true) { $permissionAsInt += 8 }
|
||||||
|
if ($permission.CreateFolder -eq $true) { $permissionAsInt += 16 }
|
||||||
|
if ($permission.DeleteFolder -eq $true) { $permissionAsInt += 32 }
|
||||||
|
}
|
||||||
|
return $permissionAsInt
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetWorkspace ($path){
|
||||||
|
$results = @()
|
||||||
|
Write-Progress -Activity "Scanning virtual folders for Workspaces" -status " $path "
|
||||||
|
$paths = $script:EftSite.GetFolderList($path)
|
||||||
|
$folderList = $paths.Split([string[]]"`r`n", "RemoveEmptyEntries")
|
||||||
|
foreach ($subFolder in $folderList) {
|
||||||
|
$results += GetWorkspace "$path$subFolder/"
|
||||||
|
}
|
||||||
|
|
||||||
|
$TimeCreated = ""
|
||||||
|
$Owner = ""
|
||||||
|
$Name = ""
|
||||||
|
$ExpireTime = ""
|
||||||
|
$isTransactional = $false
|
||||||
|
$isPrivate = $false
|
||||||
|
|
||||||
|
$Participants = @()
|
||||||
|
try {
|
||||||
|
|
||||||
|
$WorkspaceGUID = $script:EftSite.GetWorkspaceGUID($path)
|
||||||
|
$Workspace = $script:EftSite.GetWorkspace($WorkspaceGUID)
|
||||||
|
|
||||||
|
foreach ($participant in $Workspace.ParticipantList ) {
|
||||||
|
|
||||||
|
$permision = $Workspace.GetParticipantPermissions($participant)
|
||||||
|
$permisionValue = PermissionsToInt $permision
|
||||||
|
#$perm = [PSCustomObject] @{
|
||||||
|
# Participant = $participant;
|
||||||
|
# PermisionValue = $permisionValue
|
||||||
|
#}
|
||||||
|
|
||||||
|
$Participants += "$participant=$permisionValue"
|
||||||
|
}
|
||||||
|
$TimeCreated = $Workspace.TimeCreated
|
||||||
|
$Owner = $Workspace.Owner
|
||||||
|
$Name = $Workspace.Name
|
||||||
|
$IsTransactional = $Workspace.isTransactional
|
||||||
|
$IsPrivate = $Workspace.isPrivate
|
||||||
|
$ExpireTime = $Workspace.ExpireTime
|
||||||
|
$ParticipantList = ($Participants -join ";")
|
||||||
|
return New-Object psobject -Property @{
|
||||||
|
SiteName = $script:EftSite.Name;
|
||||||
|
WorkspaceGUID = $WorkspaceGUID;
|
||||||
|
Path = $path;
|
||||||
|
ExpireTime = $ExpireTime;
|
||||||
|
IsPrivate = $IsPrivate ;
|
||||||
|
IsTransactional = $IsTransactional ;
|
||||||
|
Name = $Name ;
|
||||||
|
Owner = $Owner ;
|
||||||
|
ParticipantList = $ParticipantList;
|
||||||
|
TimeCreated = $TimeCreated ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Verbose "Exception: $_"
|
||||||
|
}
|
||||||
|
return $results
|
||||||
|
|
||||||
|
}
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$script:EftServer = New-Object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$script:EftServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-Host "Fail to connect to EFT '$($hostname)'. Exception : $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$results = @()
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteName = $script:EftSite.Name
|
||||||
|
if ($EFTSiteName -ne "") {
|
||||||
|
if ( $EFTSiteName -ne $siteName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Progress -Activity "Processing Sites" -status "Site '$SiteName' $j/$sitesCount" -percentComplete ($j / $sitesCount * 100)
|
||||||
|
|
||||||
|
|
||||||
|
$results += GetWorkspace $Path
|
||||||
|
|
||||||
|
}
|
||||||
|
$results | Sort-Object SiteName, Path
|
||||||
|
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,152 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, HelpMessage = "Enter the workspaces CSV file ")]
|
||||||
|
[string] $WorkspacesCsvFile = "ws.csv",
|
||||||
|
|
||||||
|
[Parameter(Position = 1, Mandatory = $False, HelpMessage = "Enter a host name or IP address")]
|
||||||
|
[String] $EFTAdminHostname = "localhost",
|
||||||
|
|
||||||
|
[Parameter(Position = 2, Mandatory = $False, HelpMessage = "Enter a port where EFT Server is listening for admin connections")]
|
||||||
|
[int] [ValidateRange(0, 65535)] $EFTAdminPort = 1100,
|
||||||
|
|
||||||
|
[Parameter(Position = 3, Mandatory = $False, HelpMessage = "Enter a Authentication Type to connect to EFT Server. 0: EFT Login, 1: Windows Login, 2: Network Logon")]
|
||||||
|
[int] [ValidateSet(0, 1, 2)] $EFTAdminAuthType = 1,
|
||||||
|
|
||||||
|
[Parameter(Position = 5, Mandatory = $False, HelpMessage = "Enter login")]
|
||||||
|
[String] $EFTAdminUsername,
|
||||||
|
|
||||||
|
[Parameter(Position = 6, Mandatory = $False, HelpMessage = "Enter password")]
|
||||||
|
[String] $Password,
|
||||||
|
|
||||||
|
[Parameter(Position = 7, Mandatory = $False )]
|
||||||
|
[switch]$Quiet = $false
|
||||||
|
)
|
||||||
|
Function IntToPermissions($permissionAsInt, $permission) {
|
||||||
|
|
||||||
|
if ($null -ne $permission ) {
|
||||||
|
$permission.DownloadFile = [bool](($permissionAsInt -band 1) -eq 1)
|
||||||
|
$permission.UploadFile = [bool](($permissionAsInt -band 2) -eq 2)
|
||||||
|
$permission.DeleteFile = [bool](($permissionAsInt -band 4) -eq 4)
|
||||||
|
$permission.RenameFileFolder = [bool](($permissionAsInt -band 8) -eq 8)
|
||||||
|
$permission.CreateFolder = [bool](($permissionAsInt -band 16) -eq 16)
|
||||||
|
$permission.DeleteFolder = [bool](($permissionAsInt -band 32) -eq 32)
|
||||||
|
}
|
||||||
|
return $permission
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($WorkspacesCsvFile -eq "") {
|
||||||
|
#Uncomment the following to enter paramters for each site
|
||||||
|
# $EFTWorkspaces = @(
|
||||||
|
# @{ SiteName = "MySite"; Path = "\"; Client= "" IsInherited = "" ; InheritedFrom =""; Permissions = "" }
|
||||||
|
# @{ SiteName = "MySite"; Path = "\"; Client= "" IsInherited = "" ; InheritedFrom =""; Permissions = "" }
|
||||||
|
#)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$EFTWorkspaces = Import-Csv $WorkspacesCsvFile
|
||||||
|
# "SiteName","Path", "Client","Permissions",IsInherited","InheritedFrom"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftServer = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftSite = $null
|
||||||
|
|
||||||
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$df = 'yyyy-MM-dd hh:mm:ss.fff'
|
||||||
|
$MXE_FOLDER_NOT_FOUND = "MX Error: 82 (00000052)"
|
||||||
|
$MXE_INVALID_FOLDER_NAME = "MX Error: 97 (00000061)"
|
||||||
|
$MXE_FOLDER_NOT_EMPTY = "MX Error: 117 (00000075)"
|
||||||
|
|
||||||
|
$MAX_PAD = 100
|
||||||
|
$PAD_CHR = "."
|
||||||
|
|
||||||
|
$EFTServer = new-object -ComObject "SFTPCOMInterface.CIServer"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-host "Connecting EFT Server : $EFTAdminUsername@$($EFTAdminHostname):$EFTAdminPort ".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$script:EFTServer.ConnectEx($EFTAdminHostname, $EFTAdminPort, $EFTAdminAuthType, $EFTAdminUsername, $Password)
|
||||||
|
Write-host " OK ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
Write-host "Exception : $_" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:EftSites = $script:EftServer.Sites()
|
||||||
|
$sitesCount = $script:EftSites.Count()
|
||||||
|
|
||||||
|
$SiteList = @{}
|
||||||
|
for ($j = 0; $j -le $sitesCount - 1; $j++ ) {
|
||||||
|
$script:EftSite = $script:EftSites.Item($j)
|
||||||
|
$SiteList.Add($script:EftSite.Name, $script:EftSite.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-host "Importing Workspaces:"
|
||||||
|
$Imported = 0
|
||||||
|
$errorCount = 0
|
||||||
|
foreach ($EFTWorkspace in $EFTWorkspaces) {
|
||||||
|
try {
|
||||||
|
$script:EftSite = $script:EftSites.SiteByID($SiteList[$EFTWorkspace.SiteName])
|
||||||
|
$workspace = New-Object -ComObject "SFTPCOMInterface.CIWorkspace"
|
||||||
|
|
||||||
|
$ParticipantList = $EFTWorkspace.ParticipantList -split ";"
|
||||||
|
|
||||||
|
$workspace.SetWorkspace
|
||||||
|
|
||||||
|
foreach ($Participant in $ParticipantList) {
|
||||||
|
$participantRow = $Participant -split "="
|
||||||
|
$workspace.AddParticipant($participantRow[0])
|
||||||
|
|
||||||
|
$permission = New-Object -ComObject "SFTPCOMInterface.CIWorkspacePermissions"
|
||||||
|
IntToPermissions $permission $participantRow[1]
|
||||||
|
$workspace.SetParticipantPermissions($participantRow[0], $permission )
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$folderPath = $EFTWorkspace.Path
|
||||||
|
$permissionsInherited = [bool]::Parse($EFTWorkspace.IsInherited)
|
||||||
|
if (!$permissionsInherited) {
|
||||||
|
Write-host "Importing: [$($EFTWorkspace.Name)] $($EFTWorkspace.Path) on $folderPath ->$requestedPermissionsAsInt".PadRight($MAX_PAD, $PAD_CHR) -NoNewline
|
||||||
|
$sw.Restart()
|
||||||
|
$permission = IntToPermissions $requestedPermissionsAsInt $script:EftSite.GetBlankPermission($folderPath, $EFTWorkspace.Client)
|
||||||
|
$script:EftSite.SetPermission($permission, $false)
|
||||||
|
$Imported++
|
||||||
|
Write-host " OK $($sw.ElapsedMilliseconds )ms" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch [System.Runtime.InteropServices.COMException] {
|
||||||
|
Write-host " ERROR ($($sw.ElapsedMilliseconds)ms)" -ForegroundColor Red
|
||||||
|
switch ($_) {
|
||||||
|
$MXE_FOLDER_NOT_FOUND { Write-host "MXE_FOLDER_NOT_FOUND : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_INVALID_FOLDER_NAME { Write-host "MXE_INVALID_FOLDER_NAME : $_ " -ForegroundColor Red }
|
||||||
|
$MXE_FOLDER_NOT_EMPTY { Write-host "MXE_FOLDER_NOT_EMPTY : $_ " -ForegroundColor Red }
|
||||||
|
Default { Write-host "Exception : $_" -ForegroundColor Red}
|
||||||
|
}
|
||||||
|
$errorCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$script:EftServer.close()
|
||||||
|
|
||||||
|
Write-host " Imported: " -NoNewline
|
||||||
|
Write-host "$Imported " -NoNewline -ForegroundColor green
|
||||||
|
Write-host "Errors: "-NoNewline
|
||||||
|
Write-host "$errorCount " -ForegroundColor red
|
||||||
|
Write-host " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$script:EftSite = $null
|
||||||
|
$script:EftSites = $null
|
||||||
|
$script:EftServer = $null
|
||||||
|
|
@ -0,0 +1,153 @@
|
|||||||
|
##
|
||||||
|
## Copyright (C) 2018 GlobalSCAPE, Inc.
|
||||||
|
##
|
||||||
|
## The copyright to the computer program(s) herein is the property of
|
||||||
|
## GlobalSCAPE, Inc. The program(s) may be used and/or copied only with
|
||||||
|
## the written permission of GlobalSCAPE, Inc. or in accordance with the
|
||||||
|
## terms and conditions stipulated in the agreement/contract under which
|
||||||
|
## the program(s) have been supplied.
|
||||||
|
## Must be run as PowerShell 32 bits
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Enter a workspace db file")]
|
||||||
|
[String] $WorkspacesDbFile = "Workspaces.db",
|
||||||
|
|
||||||
|
[Parameter(Position = 8, Mandatory = $true, HelpMessage = "Old Site GUID")]
|
||||||
|
[String] $OldSiteGUID = "47c4205a-2c8a-4b85-b7ee-b3979c89ffcd",
|
||||||
|
|
||||||
|
[Parameter(Position = 9, Mandatory = $true, HelpMessage = "New Site GUID")]
|
||||||
|
[String] $NewSiteGUID = "2f28c3ea-5875-4ebc-af9a-83ba4c0c9b6c"
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host "******* EFT EFT.Workspaces.Set-SiteID.ps1 SCRIPT 1.0 *************************************************" -ForegroundColor Yellow
|
||||||
|
if ($Quiet -eq $false) {
|
||||||
|
|
||||||
|
Write-Host " WARNING NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-Host " Patch Workspaces.db script will update all site Id references from workspaces.db to the new site Id" -ForegroundColor Yellow
|
||||||
|
Write-Host " this process MUST be used with a offline copy of Workspaces.db, DON'T patch an online Workspaces.db used by EFT. EFT mantains a lock on the db file" -ForegroundColor Yellow
|
||||||
|
Write-Host " NOTES:" -ForegroundColor Yellow
|
||||||
|
Write-Host " > Test this process first against to a non-production environment or a copy of Workspaces.db " -ForegroundColor Yellow
|
||||||
|
Write-Host " > Backup your EFT Server configuration and original Workspaces DB files " -ForegroundColor Yellow
|
||||||
|
Write-Host " > Stop and Start EFT before and after replacing Workspaces.db file" -ForegroundColor Yellow
|
||||||
|
Write-Host " > Communicate end users about the outage" -ForegroundColor Yellow
|
||||||
|
Write-Host "******************************************************************************" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
# OldSiteGUID: 47c4205a-2c8a-4b85-b7ee-b3979c89ffcd
|
||||||
|
# NewSiteGUID: 2f28c3ea-5875-4ebc-af9a-83ba4c0c9b6c
|
||||||
|
|
||||||
|
|
||||||
|
# .\EFT.Workspaces.Set-SiteID.ps1 -WorkspacesDbFile .\workspaces.db -OldSiteGUID 'e9dac990-1c04-4663-9394-307bcfe014e7' -NewSiteGUID '3f3381a9-a6bb-4f8c-94c6-8fd3e705e1aa'
|
||||||
|
Add-Type -Path "System.Data.SQLite.dll"
|
||||||
|
$WorkspacesDbFile = Resolve-Path $WorkspacesDbFile
|
||||||
|
|
||||||
|
$tempdbFile = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName())
|
||||||
|
$tempdbFile = "$tempdbFile.db"
|
||||||
|
|
||||||
|
if ((Test-Path -Path $tempdbFile )) {
|
||||||
|
Remove-Item $tempdbFile | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Copy-Item $WorkspacesDbFile $tempdbFile | Out-Null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "ERROR: $_" -ForegroundColor red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
$tempdbFile = Resolve-Path $tempdbFile
|
||||||
|
$conn = New-Object -TypeName System.Data.SQLite.SQLiteConnection
|
||||||
|
$conn.ConnectionString = "Data Source=$tempdbFile"
|
||||||
|
$conn.Open()
|
||||||
|
$command = $conn.CreateCommand()
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$NewSiteGUIDLiteral = [guid]::new($NewSiteGUID).ToString('N').ToUpper()
|
||||||
|
$OldSiteGUIDLiteral = [guid]::new($OldSiteGUID).ToString('N').ToUpper()
|
||||||
|
try {
|
||||||
|
Write-Host "Validating:"
|
||||||
|
#Make sure new site guid doesn't exist already
|
||||||
|
$command.CommandText = "Select count(*) from site where hex(id) = @id"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$null = $command.Parameters.AddWithValue("@id", $NewSiteGUIDLiteral);
|
||||||
|
$Count = [Int32]$command.ExecuteScalar()
|
||||||
|
if ($Count -ne 0 ) {
|
||||||
|
Write-Host " Error new site id '$OldSiteGUID' was found already in '$WorkspacesDbFile. perhaps patch has been already applied." -ForegroundColor red
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
Write-Host " > $NewSiteGUID not found in site table"
|
||||||
|
|
||||||
|
#Make sure old site guid exist
|
||||||
|
$command.CommandText = "Select count(*) from site where hex(id) = @id"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$null = $command.Parameters.AddWithValue("@id", $OldSiteGUIDLiteral);
|
||||||
|
$Count = [Int32]$command.ExecuteScalar()
|
||||||
|
if ($Count -ne 1 ) {
|
||||||
|
Write-Host " Error old site id '$OldSiteGUID' not found in '$WorkspacesDbFile." -ForegroundColor red
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
Write-Host " > $OldSiteGUID found in site table"
|
||||||
|
|
||||||
|
Write-Host "Clonning old site id to new site id:"
|
||||||
|
$command.CommandText = "CREATE TABLE site_temp AS SELECT * FROM site"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > site_Temp created from site table "
|
||||||
|
|
||||||
|
$command.CommandText = "DELETE FROM site_temp where hex(id) <> @id"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$null = $command.Parameters.AddWithValue("@id", $OldSiteGUIDLiteral)
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > $Count rows deleted from site_temp "
|
||||||
|
|
||||||
|
$command.CommandText = "UPDATE site_temp set id = x'$NewSiteGUIDLiteral'"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > $Count rows updated from site_temp "
|
||||||
|
|
||||||
|
$command.CommandText = "INSERT INTO site SELECT * FROM site_temp"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > $Count rows inserted from site_temp "
|
||||||
|
|
||||||
|
$command.CommandText = "DROP TABLE site_temp"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > site_temp table removed"
|
||||||
|
|
||||||
|
Write-Host "Site id '$OldSiteGUID' clonned to '$NewSiteGUID' successfuly."
|
||||||
|
|
||||||
|
|
||||||
|
Write-Host "Updating tables references to site id to new site id:"
|
||||||
|
# Updating Emails table to the new site id
|
||||||
|
$command.CommandText = "Update Email Set site = x'$NewSiteGUIDLiteral' where hex(site) = @OldSiteGuid"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$null = $command.Parameters.AddWithValue("@OldSiteGuid", $OldSiteGUIDLiteral)
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > Email: '$count' rows has been updated "
|
||||||
|
|
||||||
|
#Updating Workspace table to the new site id
|
||||||
|
$command.CommandText = "Update Workspace Set site = x'$NewSiteGUIDLiteral' where hex(site) = @OldSiteGuid"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$null = $command.Parameters.AddWithValue("@OldSiteGuid", $OldSiteGUIDLiteral);
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > Workspaces: '$count' rows has been updated"
|
||||||
|
|
||||||
|
Write-Host "Removing old site id:"
|
||||||
|
$command.CommandText = "delete from site where hex(id) = @id"
|
||||||
|
$command.Parameters.Clear()
|
||||||
|
$null = $command.Parameters.AddWithValue("@id",$OldSiteGUIDLiteral);
|
||||||
|
$Count = [Int32]$command.ExecuteNonQuery()
|
||||||
|
Write-Host " > Site: '$count' rows has been deleted"
|
||||||
|
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "ERROR: $_" -ForegroundColor red
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
# Release all objects used by sqlite, so the file is closed propertly and deleted
|
||||||
|
$conn.Close()
|
||||||
|
$conn.Dispose()
|
||||||
|
$command.Dispose()
|
||||||
|
mv $tempdbFile $WorkspacesDbFile -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
## Folders Paths in event rules
|
||||||
|
easy to migrate storage:
|
||||||
|
* use relative Paths or virtual paths instead Phisycal paths
|
||||||
|
* Don't use local drive use FQD instead
|
||||||
|
* don't hard code physical paths in the parameters on custom commands.
|
||||||
|
|
||||||
|
* Warning, limit the root access to accounts, use "Treat home folder as user's default root folder"
|
||||||
|
n
|
@ -0,0 +1,30 @@
|
|||||||
|
Run the following reports for hand off to customers after migrations, health checks or Assestments:
|
||||||
|
|
||||||
|
``` powershell
|
||||||
|
.\EFT.ConnectionProfiles.Export.ps1 | Export-Csv Connection_Profiles.csv
|
||||||
|
.\EFT.EventRules.Export-ConnectionProfilesInActions.ps1 | Export-Csv Connection_Profiles_EventRules.csv
|
||||||
|
.\EFT.EventRules.Export-HostNamesInActions.ps1 | Export-Csv EventRules_HostnameInActions.csv
|
||||||
|
.\EFT.EventRules.Export-Params.ps1 -ValidatePath | Export-csv EventRules.csv
|
||||||
|
.\EFT.EventRules.Export-PathsInActions.ps1 -ValidatePath | Export-csv
|
||||||
|
.\EFT.EventRules.Export-PGPKeysUsed.ps1 | Export-csv EventRules_PGPUsed.csv
|
||||||
|
.\EFT.FolderPermissions.Export-OrphanPaths.ps1 | Export-csv FolderPermissions_OrphanPaths.csv
|
||||||
|
.\EFT.Report.ps1 > EFT_Report.txt
|
||||||
|
.\EFT.SiteSettingsPaths.Export.ps1 -Validate | Export-csv SiteSettings_Paths.csv
|
||||||
|
.\EFT.Users.StorageStats.ps1 | Export-csv UsersStats.csv
|
||||||
|
.\EFT.VirtualFolders.Export.ps1 -ValidatePath | Export-csv VirtualFolders.csv
|
||||||
|
.\EFT.Build.ps1 -Quiet -BuildFolder eftconfig | .\Utils.ScanPaths.ps1 eftconfig -ValidatePath | Export-csv AutomationPaths.csv
|
||||||
|
.\Utils.PathLength.ps1 -SourcePath 'C:\Inetpub\EFTRoot\' | export-csv SiteRootFolders.csv
|
||||||
|
```
|
||||||
|
|
||||||
|
| script | Description |
|
||||||
|
|------------------------------------|-----------------------------------------------------|
|
||||||
|
| EFT.ConnectionProfiles.Export.ps1 | Connection Profile report: This report will output all settings from connection profiles. Execute after migrations and health checks to review all connections settings are migrated correctly and validate hostnames are reachables and accessible.|
|
||||||
|
|EFT.EventRules.Export-ConnectionProfilesInActions.ps1|Connection profiles used in Event Rules: This report output all the connection profiles used in actions from event rules, showing their dependancy. |
|
||||||
|
|EFT.EventRules.Export-HostNamesInActions.ps1| Host names used in event rules actions: Outputs all the hostnames used inside of all Event rules actions.
|
||||||
|
| EFT.EventRules.Export-Params.ps1 | Event Rules Parameters: Output all event rules parameters. Idetify all paths being monitored by folder monitor, including subfolders, help to identify overlap and avoid duplication. Identify schedule event rules and its schedule.
|
||||||
|
|EFT.EventRules.Export-PathsInActions.ps1 | Folder paths used in event rules in actions: Output all folder paths used in event rules, using the ValidatePath paramter the script will verify that the paths exist and the service account have access (read) to them (make sure you run the script as the EFT service account)|
|
||||||
|
|EFT.EventRules.Export-PGPKeysUsed.ps1 | paths used in PGP actions in event rules |
|
||||||
|
|EFT.SiteSettingsPaths.Export.ps1 | Display all Paths associated to Site Settings. HA installations should have all paths to the share. Validate before and after migrations paths are migrated correctly.|
|
||||||
|
| EFT.Users.StorageStats.ps1 | |
|
||||||
|
| EFT.VirtualFolders.Export.ps1 | |
|
||||||
|
| EFT.Build.ps1 | |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user