We have to use startframeIndex and EndframeIndex as below. Below is the code which will save first 11 frames(0-10) to capture.pcap file: # Save captured frames to a file. stc::perform CaptureDataSave -captureProxyId $hCaptureRx -FileName "capture.pcap" -FileNameFormat PCAP -IsScap FALSE -EndFrameIndex 10 -StartFrameIndex 0