Multisite – Get current post id

try this

$sites = get_sites();
global $switched;

/** @var WP_Site $site */
foreach ($sites as $site) {
if ( $site->archived || $site->spam || $site->deleted ) {
    continue;
}

switch_to_blog( $site->blog_id );
$all_posts = get_posts('category=-3&numberposts=6&orderby=post_name&order=DSC');
?>
<ul>
<?php foreach($all_posts as $post) : setup_postdata($post);?>
    <li>
        <a href="https://wordpress.stackexchange.com/questions/354427/<?php echo get_page_link($post->ID); ?>" title="<?php echo 
         $post->post_title; ?>"><?php echo $post->post_title; ?></a>
    </li>                                
<?php endforeach ; ?>
</ul>
<?php
}
restore_current_blog();
die;