User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

This procedure can be used to run scripts on Remote SCSM Management Server

Run $cred = Get-Credential to get the Username/Password

$cred = Get-Credential

  • $cred variable will hold the required username and password, could be from a user who has admin rights on the SCSM Management Server
  • Use the below method to write the Credential to a File

Read-Host  -AsSecureString  $cred  | ConvertFrom-SecureString | Out-File c:\Temp\cred.txt

  • Read from the file and store the Password to a variable as follows

$password = get-content  C:\temp\cred.txt | convertto-securestring

  • Pass the credential as follows

$cred =  New-Object System.Management.Automation.PSCredential ("domain\username", $password)

Invoke-Command  -ComputerName ServerName {

 Get-SCSMObject  -Class (Get-SCSMClass  -Name  System.WorkItem.Incident$) | ?{$_.ID  -eq "IRXXXX"}

} -Credential $Cred

 

Requirements :

  • SMlets Powershell Library should be loaded in the Remote Management Server

Notes :

  • ServerName = SCSM Management Server
  • Tests should be done on non-productive environment
    • Not responsible for loss of any data with the usage of this script/function
  • Can be used to carry out various functions as applicable to variable classes within SCSM
  • The cred.txt is an encrypted file containing the password of the associated user used to create the password