PowerShell code snippet to get the path of the Apache Tomcat folder.
The PowerShell code snippet will get the Apache Tomcat folder based on the service path.
So, if the Apache Tomcat is not installed on a specific folder or path. Code snippet below, will check where the folder is located.
$varDirectory=""
$apacheServiceName=((Get-WmiObject win32_service | ?{$_.Name -like '*tomcat*'} | select Name, State, PathName).Name)
$apacheServicePath=((Get-WmiObject win32_service | ?{$_.Name -eq $apacheServiceName} | select Name, State, PathName).PathName)
$apacheHome = $apacheServicePath.Substring(0, $apacheServicePath.IndexOf('\bin'))
#set the folder path for the SSL cert
#or set any path to teh Apache Home Folder
$varDirectory = "$apacheHome\key\"
#Check the Path if okay or not
write-host $varDirectory
#Force OverWrite and supress prompting
#Copy files to the Apache Tomcat folder
Copy-Item -Path "C:\Temp\star_007_com.jks" -Destination $varDirectory -Force -Confirm:$false
Cheers. Till next time.
================================
Free Android Apps:
Click links below to find out more:
Excel Keyboard guide:
https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide
Heaven's Dew Fall Prayer app for Android :
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide for Android:
Pray the Rosary every day, countless blessings will be showered upon your life if you recite the Rosary faithfully.
https://play.google.com/store/apps/details?id=com.myrosaryapp
Divine Mercy Chaplet Guide (A Powerful prayer) BFF = Be Filled Faith:
https://play.google.com/store/apps/details?id=com.dmercyapp
I truly appreciate the time and work you put into sharing your knowledge. I found this topic to be quite effective and beneficial to me. Thank you very much for sharing. Continue to blog.
ReplyDeleteData Engineering Services
AI & ML Solutions
Data Analytics Services
Data Modernization Services