One of the hottest new technologies that allows users to handle a broad range of resources and massive amounts of data in the cloud is green computing resource management. One of the biggest obstacles is task scheduling, and poor management leads to a decrease in productivity. The task must be efficiently scheduled to ensure optimal resource utilisation and minimal execution time. Given this, this study suggests a fresh method for efficient task scheduling in a green computing environment that also offers improved security. There is a development of an enhanced spotted hyena optimizer (ISHO). Finding the ideal or almost ideal subset with a straightforward structure to minimise the specified fitness function is a strong point of the SHO. It enhances a switch strategy in the spotted hyena's position updating mechanism and generates random positions in place of the violated spotted hyenas in order to support the proposed ISHO's exploration characteristics. Second, the data is encrypted using the ChaCha20–Poly1305 authenticated encryption algorithm, ensuring secure data transmission.