Objective. This study aimed to explore whether astragalus polysaccharides (APS) could treat herpes simplex by increasing tissue-resident memory CD8+ T cells (CD8+ TRM cells) and analyze its potential mechanism using the network pharmacologic approach. Methods. C57BL/6J male mice aged 6–8 weeks were divided into a model group with HSV-1 infection treated by saline, a control group without HSV-1 infection but treated by saline, and an APS group with HSV-1 infection treated by APS. Clinical signs were observed, and the disease score was recorded every day. The skin lesions on day 9 after infection were taken for flow cytometric analysis to evaluate CD8+ TRM cells. Network pharmacologic analysis was performed to select the potential protein targets of astragalus associated with herpes simplex. Besides, Gene Ontology (GO) analysis and Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway analysis were performed. The peripheral blood from the retroorbital venous plexus was collected to evaluate the levels of serum interferon-γ (IFN-γ) and interleukin 12 (IL-12). The comparisons of clinical signs, the disease score, CD8+ TRM cells, the serum IFN-γ, and IL-12 levels were performed among the three groups. Results. Compared with the model group, the disease score in the APS group was significantly lower (
p
<
0.05
). On the day 9 after HSV-1 infection, there was no significant difference in the body weight of mice among the three groups. However, compared with the control group or model group, the spleen weight in the APS group increased significantly (
p
<
0.05
). The surface antigens of CD8+ TRM cells had no significant difference between the control group and the model group, while compared with the model group, the surface antigens of CD8 (
p
<
0.05
), CD69 (
p
<
0.05
), and CD103 (
p
<
0.05
) in the APS group increased significantly. Moreover, the serum IL-12 (
p
<
0.05
) and IFN-γ (
p
<
0.01
) levels in the APS group increased significantly compared with the model group. Conclusion. Our study suggested that APS could alleviate the symptoms of the mice infected with HSV-1, and CD8+ TRM cells in the skin lesions and the levels of IL-12 and IFN-γ in the serum of mice with HSV-1 infection increased after the APS treatment, of which the specific underlying mechanism requires further experiments to clarify. In addition, the antiviral effect of APS might be worthy of further development and utilization.