The German Navy was, at no point in the war, mothballed. While it spent a lot of time in its ports of Wilhelmshaven and Kiel, it still played an active part in the war. It made a considerable number of sorties throughout the war, mainly aimed to draw out and destroy a small portion of the Royal Navy. By doing so, it could challenge the British blockade of Germany. The German fleet also had an important role in protecting the German coast against British attack (the RN had a number of plans for amphibious operations against the German coast), and blockading the Russian coast. This is part of the reason why no such operation was planned until 1918. The Russian Navy, while small, could still do sufficient damage to the German High Seas Fleet to prevent it carrying out its primary missions, against the Royal Navy. Equally, the time taken to successfully assault St Petersburg would have given the Royal Navy a chance to operate against the German coast.
Another reason why no such operation was planned was because an attack on St Petersburg would be open to attacks from the flanks. The Russian Navy had a number of bases along the Baltic coast, from which sorties could be made against any German attempt against St Petersburg, a factor redoubled because of the distance St Petersburg was from the main German naval bases. To make a successful attack on St Petersburg would require these bases to be neutralised or captured; doing so would also make the logistical aspect of such an assault easier. Two such attacks on these bases was planned. In August 1915, a small German squadron attempted to attack the Russian bases on the Gulf of Riga. This attempt failed, partly because of Russian minefields, and partly because of the need to occupy the islands at the mouth of the gulf. In October 1917, another attack against these bases was made. Named Operation Albion, it led to the German capture of the islands of Saaremaa, Hiiumaa and Muhu. On the 17th October, a major battle was fought, with the Germans sinking the Russian battleship Slava and destroyer Grom. However, many German ships were damaged by mines, including the battleships Bayern and Grosser Kurfurst, while a destroyer and three torpedo boats were sunk. This attack put the Germans in a good position to make an assault on St Petersburg. However, the Russians were aware of this, and it can certainly be argued that the success of Operation Albion contributed to the Russian signing of the Treaty of Brest Litovsk. The war ended before any further operations against St Petersburg could be made.