I have a shellscript and need to convert to powershell..can someone help me on this?
here is the script
-------------------
echo "[{" > data.txt
for i in `cat pending.txt`
do
timeout 2 telnet $i 22 > test.txt 2>&1
cat test.txt |grep "Connected to" >/dev/null 2>&1
if [[ $? == 0 ]]; then
echo $i >> completed.txt
echo " \"status\" : \"Completed\", " >> data.txt
echo " \"comments\" : \"Server is reachable at $(date +"%m/%d/%Y %T") EST\", " >> data.txt
echo " \"assignee\" : \"WebServices\", " >> data.txt
echo " \"serverName\" : \"$i\" " >> data.txt
echo "}, { " >> data.txt
fi
done
head -n -1 data.txt > data.txt.tmp
mv data.txt.tmp data.txt
echo "}" >> data.txt
echo "]" >> data.txt
diff -a --suppress-common-lines -y pending.txt completed.txt | awk {'print $1'} |grep -v ">" > test1.txt
mv test1.txt pending.txt
need to convert Shellscript to powershell
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
-
- Posts: 1
- Last visit: Tue Dec 28, 2021 8:53 pm