I need a powershell developer for a basic read/write project
Budget: $30 – $250 USD
Hello: We are looking for a powershell script that can communicate with (connect to) a monitor system via a serial port (i.e. COM1), issue ascii text commands asking the monitor to report back certain information, read the multi-line responses from each such request and write those responses to a text file.
More specifically, a script that can do something like this:
Open a configuration text file (i.e. C:\LOsys\Script\Site_Config.txt) and read in the info for each variable…this file can look like this:
SiteID:1234
ComPort:COM1
BaudRate:9600
Parity:Odd
DataBits:7
StopBits:1
(The powershell script would reside in and be run from the same folder that contains the “Site_Config.txt” file… C:\LOsys\Script\ )
Variables read into the script from the config file could be “$SiteID”, “$ComPort”, etc.
Once the site-specific variables are read into the script, we want to create and open an “output file” called “C:\LOsys\Output\TM_1234_20211114120101.txt” where “1234” would be equal to the $SiteID variable and the rest of the filename is the then current year, month, day, hour, minute, second etc.
The first line in the newly created output file should be set to its filename (i.e. the first line of the new output file would look like “TM_1234_20211114120101.txt” and then insert a new blank line as line two of the output file.
Next, open the serial port (i.e. COM1 or whatever COM Port is defined) using the parameters (such as Baud=9600, Parity=Odd, DataBits=7, StopBits=One) as found and defined in the Site_Config file.
Once serial port is verified to be open…
Write ASCII characters “ <CTRL>+A200” to the serial port (if typing, the command would be <CONTROL>+A then 200 without any spaces)
Then, immediately read the response from the serial port (which can be several lines to several dozen lines of ascii text) and append all such output out to the output file created above.
Next, write ASCII characters “ <CTRL>+A250” and read response (one to several dozen lines of ascii characters) and append same out to the output file
Next, write ASCII characters “ <CTRL>+A240” and read response (one to several dozen lines of ascii characters) and append same out to the output file
Once the above tasks are completed, we want to append the "end date time" (i.e. "End 2021-11-14_12-34-56") to the last line of the output file and then close both the serial port and close the output file.
More specifically, a script that can do something like this:
Open a configuration text file (i.e. C:\LOsys\Script\Site_Config.txt) and read in the info for each variable…this file can look like this:
SiteID:1234
ComPort:COM1
BaudRate:9600
Parity:Odd
DataBits:7
StopBits:1
(The powershell script would reside in and be run from the same folder that contains the “Site_Config.txt” file… C:\LOsys\Script\ )
Variables read into the script from the config file could be “$SiteID”, “$ComPort”, etc.
Once the site-specific variables are read into the script, we want to create and open an “output file” called “C:\LOsys\Output\TM_1234_20211114120101.txt” where “1234” would be equal to the $SiteID variable and the rest of the filename is the then current year, month, day, hour, minute, second etc.
The first line in the newly created output file should be set to its filename (i.e. the first line of the new output file would look like “TM_1234_20211114120101.txt” and then insert a new blank line as line two of the output file.
Next, open the serial port (i.e. COM1 or whatever COM Port is defined) using the parameters (such as Baud=9600, Parity=Odd, DataBits=7, StopBits=One) as found and defined in the Site_Config file.
Once serial port is verified to be open…
Write ASCII characters “ <CTRL>+A200” to the serial port (if typing, the command would be <CONTROL>+A then 200 without any spaces)
Then, immediately read the response from the serial port (which can be several lines to several dozen lines of ascii text) and append all such output out to the output file created above.
Next, write ASCII characters “ <CTRL>+A250” and read response (one to several dozen lines of ascii characters) and append same out to the output file
Next, write ASCII characters “ <CTRL>+A240” and read response (one to several dozen lines of ascii characters) and append same out to the output file
Once the above tasks are completed, we want to append the "end date time" (i.e. "End 2021-11-14_12-34-56") to the last line of the output file and then close both the serial port and close the output file.