# How to start a simulation using RobotStudio API

**URL:** <https://tech-community.robotics.abb.com/t/how-to-start-a-simulation-using-robotstudio-api/11669>\
**Category:** Developer Tools\
**Created:** [October 28, 2024, 12:37pm UTC](https://tech-community.robotics.abb.com/t/how-to-start-a-simulation-using-robotstudio-api/11669 "2024-10-28T12:37:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davare](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@davare](https://tech-community.robotics.abb.com/u/davare)\
**Post date:** [October 28, 2024, 12:37pm UTC](https://tech-community.robotics.abb.com/t/how-to-start-a-simulation-using-robotstudio-api/11669/1 "2024-10-28T12:37:44Z")

</div>

Hello,  
Using RobotStudio Api I would like to open an existing station and Start a smiluation. Ideally with RobotStudio UI visible, and recording.  
I am using the following powershell script:

Add-Type -Path “C:\Program Files (x86)\ABB\RobotStudio 2024\bin\ABB.Robotics.RobotStudio.dll”  
Add-Type -Path “C:\Program Files (x86)\ABB\RobotStudio 2024\bin\ABB.Robotics.RobotStudio.Stations.dll”

[ABB.Robotics.RobotStudio.RobotStudioAPI]::Initialize(“C:\Program Files (x86)\ABB\RobotStudio 2024\Bin”)

$station = [ABB.Robotics.RobotStudio.Stations.Station]::Load(“D:\01\_Projects\digital-twin\Station\Station.rsstnx”,$false)  
[ABB.Robotics.RobotStudio.Project]::ActiveProject =$station

[ABB.Robotics.RobotStudio.Stations.Simulator]::ActiveConfiguration #To check there is an active sim config  
[ABB.Robotics.RobotStudio.Stations.Simulator]::StartAsync()

But in this last line i receive the following error:

Id : 22051  
Exception : System.AggregateException: One or more errors occurred. —\> System.NullReferenceException: Object reference not set to an instance of an object.  
at ABB.Robotics.RobotStudio.Stations.Simulator.d\_\_59.MoveNext()  
— End of inner exception stack trace —  
—\> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.  
at ABB.Robotics.RobotStudio.Stations.Simulator.d\_\_59.MoveNext()\<—

I guess probably my approach is incorrect. So I would really appreciate if you could please provide me some tips.

Thank you!
