To create an IAM service role for Windows PowerShell, follow the steps:
- Create a text file with the following trust policy. Save the file with the .json file extension.
 
{ 
"Version": "2012-10-17", 
"Statement": { 
"Effect": "Allow", 
"Principal": {
"Service": "ssm.amazonaws.com"}, 
"Action": "sts:AssumeRole" } 
}
- Use new IAM role to create a service
 
New-IAMRole -RoleName SSMServiceRole -AssumeRolePolicyDocument (Get-Content -raw SSMService-Trust.json)
- Use register-IAMRolePolicy to create a session token
 
Register-IAMRolePolicy -RoleName SSMServiceRole -PolicyArn arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM
And you're done:)