Quantcast
Channel: SCSM PowerShell Cmdlets
Viewing all 306 articles
Browse latest View live

New Post: issue using -filter switch on get-scsmobject

$
0
0
BAH!!! I fixed it...
$MAobj = Get-SCSMObject -Class $MAClass -Filter "ID -eq $MAID"
[string]$CRID = (Get-SCSMRelationshipObject -ByTarget $MAobj).sourceobject.name
$CRobj = Get-SCSMObject -Class $CRClass -Filter "Id -eq $CRID"

Commented Issue: Unable to import module after upgrading to SCSM 2012 SP1 [10764]

$
0
0
After upgrading to SCSM 2012 SP1, the following exception is thrown when attempting to import the SMlets module. I suspect they will need a recompile against the the SP1 bits.

Command execution stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot load Windows PowerShell snap-in C:\Program Files\Common Files\SMLets\SMLets.Module.dll because of the following error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Loader Exceptions:

Could not load file or assembly 'Microsoft.EnterpriseManagement.Core, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.EnterpriseManagement.Core, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.EnterpriseManagement.Core, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Comments: ** Comment from web user: radtravis **

I am able to use SMLets Beta 4 with SCSM 2012 SP1 without any errors. I did a clean install of SCSM though not an upgrade from SCSM 2012. Can you please try uninstalling and reinstalling SMLets?

Closed Issue: Trouble with object types returned using SMlets [10670]

$
0
0
I am trying to use set-scsmobjecttemplate$CMN11 = Get-SCSMObjectTemplate -DisplayName "CMN11 - Request for Results Notification"$CRClassProjection = get-SCSMTypeProjection System.WorkItem.ChangeRequestProjection$$CRP = Get-SCSMObjectProjection -Projection $CRClassProjection -Filter "Id -eq $CR_ID"Set-SCSMObjectTemplate -Projection $CRP -Template $CMN11PS C:\>>> Set-SCSMObjectTemplate -Projection $CRP -Template $CMN11Set-SCSMObjectTemplate : The template cannot be applied to the instance because the instance is not of the template targets type.At line:1 char:23+ Set-SCSMObjectTemplate <<<< -Projection $CRP -Template $CMN11 + CategoryInfo : InvalidOperation: (Template_ae893e...2e7f27753abdbe3:ManagementPackObject Template) [Set-SCSMObjectTemplate], InvalidOperationException + FullyQualifiedErrorId : ApplyTemplate,SMLets.SetSCSMObjectTemplateCommand And I think this is the cause, PS C:\>>> $CRP = Get-SCSMObjectProjection -Projection $CRClassProjection -Filter "Id -eq $CR_ID"PS C:\>>> $CRP.GetType()IsPublic IsSerial Name BaseType-------- -------- ---- --------True False PSCustomObject System.Object PS C:\>>> $CRClassProjection.GetType()IsPublic IsSerial Name BaseType-------- -------- ---- --------True False PSCustomObject System.ObjectAnd according to the cmdlet help, we are looking for a specific type of object, PS C:\>>> help Set-SCSMObjectTemplateNAME Set-SCSMObjectTemplateSYNTAX Set-SCSMObjectTemplate [-Projection] [-Name ] [-Tem plate ] [-ComputerName ] [-Credential ] [-SCSMSe ssion ] [-Verbose] [-Debug] [-ErrorAction ] [-WarningAc tion ] [-ErrorVariable ] [-WarningVariable ] [-OutVariable ] [-OutBuffer ] [-WhatIf] [-Confirm] Set-SCSMObjectTemplate [-Object] [-Name ] [-Template ] [-ComputerName ] [-Credential ] [-SCSMSession ] [-Verbose] [-Debug] [-ErrorAction ] [-WarningAction ] [-ErrorVariable ] [-WarningVariable ] [-OutVariable ] [-OutBuffer ] [-WhatIf] [-Confirm]
Comments: Incorrect usage of cmdlet

Commented Issue: Incident Title is not being set property in New-SCSMIncident [8942]

$
0
0
if you create a new incident using New-SCSMIncident the title is not searchable when the incident is created.
 
The work around is to manually go in to the ticket and click OK. At that point the ticket title is searchable using the standard console functionality
Comments: ** Comment from web user: radtravis **

We need to set the .DisplayString property to be equal to String.Format({0}{1} - {2}, strIncidnetIDPrefix, {0}, strTitle).

New Post: smlets error: "The requested name is valid, but no data of the requested type was found"

$
0
0
Hi,

We are facing this error in our preproduction environnement (SCSM 2010 SP1, smlets Béta4).
Everything is working fine on the production environnement, which is the same version for all components.

Every cmdlet that need to access SCSM server return this error (example with get-SCSMClass) :
PS C:> Get-SCSMClass
Get-SCSMClass : The requested name is valid, but no data of the requested type was found
At line:1 char:14
  • Get-SCSMClass <<<<
    • CategoryInfo : InvalidOperation: (localhost:String) [Get-SCSMClass], SocketException
    • FullyQualifiedErrorId : GenericMessage,SMLets.GetSMClassCommand
Does anybody know where it come from ?

Regards,
C.

New Post: smlets error: "The requested name is valid, but no data of the requested type was found"

$
0
0
Is it possible that you've created some new classes? Or are trying to use the wrong version of the cmdlets against the service?
it's hard to tell from this message, but you should be able to get more detail via $error. Immediately following this error, try looking at the contents of $error

$error[0]|fl -force
$error[0].Exception|fl -force
$error[0].Exception.InnerException|fl -force

New Post: smlets error: "The requested name is valid, but no data of the requested type was found"

$
0
0
Thanks for your hint.

To answer your questions, we created some new custom classes, but not recently.
The smlets has worked fine I think for a while on this environnement, or at least, they work on the production environnement which is all the same versions as this one. I can't say exactly when it start malfunctionning...

To be sure that it was not a version problem, I juste re-install the smlets this morning before posting this problem (with need to build as our SCSM has been patched). But I have the same error after that.

The $error[0].Exception show an error number (11004) that gave more information about the problem.
PS C:\ > $error[0].Exception|fl -force
ErrorCode       : 11004
Message         : The requested name is valid, but no data of the requested type was found
SocketErrorCode : NoData
NativeErrorCode : 11004
Data            : {}
InnerException  :
TargetSite    : System.Net.IPHostEntry GetAddrInfo(System.String)
StackTrace   :  at System.Net.Dns.GetAddrInfo(String name)
                     at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
                     at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
                     at Microsoft.EnterpriseManagement.Common.Internal.ServerDefinition..ctor(EnterpriseManagementConnectionSettings connectionSettings, Type groupType, Type coreType)
                     at Microsoft.EnterpriseManagement.Common.Internal.SdkDataLayerProxyCore.RetrieveEnterpriseManagementGroupInternal[T,P](EnterpriseManagementConnectionSettings connectionSettings, ClientDataAccessCorecallbackDispatcherService)
                     at Microsoft.EnterpriseManagement.Common.Internal.SdkDataLayerProxyCore.Connect[T,P](EnterpriseManagementConnectionSettings connectionSettings, ClientDataAccessCore callbackDispatcherService)
                     at Microsoft.EnterpriseManagement.EnterpriseManagementGroup.InternalInitialize(EnterpriseManagementConnectionSettings connectionSettings, EnterpriseManagementGroupInternal internalsProxy)
                     at SMLets.ConnectionHelper.GetMG(String computerName, PSCredential credential)
                     at SMLets.SMCmdletBase.BeginProcessing()
HelpLink        :
Source          : System
I found this interesting link about Windows Sockets Error Codes :
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668%28v=vs.85%29.aspx

Including my error :
WSANO_DATA (11004)
Valid name, no data record of requested type.
The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for. The usual example for this is a host name-to-address translation attempt (using gethostbyname or WSAAsyncGetHostByName) which uses the DNS (Domain Name Server). An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable.

--> Nevertheless, I still don't understand the problem I have as DNS server seems to be configured the same as previously, SCSM server is well registered (A record), and is indeed reachable.
Do you know which port does smlets try to use to connect SCSM service ?

I tried too to launch the Get-SCSMClass with -ComputerName argument :
PS C:\> Get-SCSMClass -ComputerName <hostname>
PS C:\> Get-SCSMClass -ComputerName <hostname.fqdn>
PS C:\> Get-SCSMClass -ComputerName localhost
They all have the same result (error 11004).

Any Idéa ?

Thanks

New Post: smlets error: "The requested name is valid, but no data of the requested type was found"

$
0
0
I'm out of ideas, sorry.

I left the Service Manager team about 14 months ago, so I'm also out of touch with changes. I would start looking at whether you've patched the system (perhaps there's a new version or SP for SM). You might try creating an EnterpriseManagementGroup object and seeing if you can directly access the service endpoint. This is all from memory, so you might have to try some other things:

$EMG = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup <computername>
$EMG.Classes.GetClasses()

or something like that

good luck!

New Post: smlets error: "The requested name is valid, but no data of the requested type was found"

$
0
0
Hi,

When I create an EntrepriseManagementGroup, it works :

$EMG = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup <computername>
$EMG.EntityTypes.GetClasses()
--> get the class list OK

Don't know why it's not working with smlets...

Regards,
C.

New Post: smlets error: "The requested name is valid, but no data of the requested type was found"

$
0
0
It may be that you have installed an SM update which has new libraries.
This is the reason that the SMLets package has the sources, which you should rebuild and use the rebuilt binaries

New Post: smlets error: "The requested name is valid, but no data of the requested type was found"

$
0
0
I did rebuild already, just before posting, because smlets seems to be compiled for RTM version and we installed an update. This update was long time ago.

Anyway : I found the problem (or at least a solution) in our environnement : I had to comment the setting of the global variable $smdefaultserver in the smlets module conf file (C:\Program Files\Common Files\SMLets\SMLets.psm1)
#$GLOBAL:smdefaultcomputer = "SCSMSERVERNAME"
Don't know why it wasn't working before I reinstall the smlets, but, anyway, it works now, that's OK.

By the way, I notice that 1 have 2 differents versions on our environnement (Get-SMLetsVersion) :
-preproduction :
TargetProduct       : Microsoft System Center Service Manager SP1
Revision            : unknown
LastChangedRev      : unknown
Changes             : {}
SMCoreVersion       : 7.0.6555.128
SM2012              : False
-production :
TargetProduct       : Microsoft System Center 2012 - Service Manager
Revision            : 74609
LastChangedRev      : 70086
Changes             : {M       WiX/SMLets.X86.msi, M       WiX/SMLets.msi}
SMCompiledVersion   : 7.5.1561.0    
SMInstalledVersion  : 7.0.6555.0
SM2012              : True
As our SCSM serveur is 2010 SP1, I guess this is better to use the version on the preproduction environnement.
Both versions seem to work, but do you think there could be an impact to use 2012 version of smlets to access a 2010 SP1 SCSM server ?

Thanks
C.

New Post: Import-Module SmLets Error

$
0
0
So i installed the SMLets.SP1.X86 for my SCSM 2010 SP1, when i open my windows powershell prompt and type "Import-Module SmLets" i get;

"ImportModule : Cannot load Windows Powershell ..... Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information"

New Post: Running SMlets without being in the main server of SCSM 2010?

$
0
0
Is there a way to "import-module smlets" without being on the main server of SCSM 2010. I'm Trying to script for my company, but the version of SCSM 2010 installed on my computer is slightly different of that in the main server. (My version doesn't have SDK Library folders)

New Post: What are the values available for the -impact, -urgency and -classification ?

$
0
0
What are the values available for the -impact, -urgency and -classification ?

I know for impact and urgency there is low medium and high, is there a way we can add other fields ... ?

New Post: New-SCSMIncident and affected user

$
0
0
How do you know what the ID of the incident you created, using new-scsmincident ?

New Post: SCSM SMLets Assinged to Field

$
0
0
I wrestled with this for a while too, managed in the end and have finally come back to the discussion hoping this helps someone

i believe the big difference of it working or not working is where you run the powershell, the "set-incidentuser" script above works fine if running from the SCSM server but won't work for me from a client machine, I think its down to this line $EMG = new-object ${EMGType} localhost

I stole bits of the script above between begin and function and changed this line

$EMG = new-object ${EMGType} $ourSCSMServer

this code then worked a treat (in my case its just using the logged in user $env:username as the assigned to user as this is a small part of a quick incident logging tool)

$AssignedToUser = Get-SCSMObject $UserClass -computer $ourSCSMServer -Filter "UserName -eq $env:username"

$incident = $TheIncident.__base

$Incident.Add(($AssignedToUser -as $EMOT) ,$ASSIGNEDTORELATIONSHIP.Target)

New Post: Adding comments to SRs

$
0
0
Hi Jim,

I'm looking into a way of adding a comment for a Service Request through PowerShell... and getting the membership error.

I've reviewed the example that Travis posted regarding creating an incident and including one comment by using a projection, but what's the alternative when you already have a work item and you just want to add a new comment to the action log via PowerShell?

Thanks!

German

New Post: Adding comments to SRs

$
0
0
I've been out of the SM team for about 16 months, so I'm totally out of the loop here. I'm going off of some pretty old memories, but you should be able to create a new instance of a comment and then create a new relationship which connects the work item with the comment (I thought there was a script which helped with this, but I could be wrong about that - or it could be about incidents. Which means you need to track down the right relationship object.

sorry i'm not more help

jim

New Post: Adding comments to SRs

$
0
0
Thanks, Jim! You gave me some hints...
Sorry to hear you're out of the SM team... :(

I'll share my findings with the rest in case you're looking for this:
function Add-SRComment {
    param (
            [parameter(Mandatory=$true,Position=0)][Alias('SRObject')]$pSRObject,
            [parameter(Mandatory=$true,Position=1)][Alias('Comment')][String]$pComment,
            [parameter(Mandatory=$true,Position=2)][Alias('EnteredBy')][String]$pEnteredBy
          )
    $NewGUID = ([guid]::NewGuid()).ToString()
    $Projection = @{__CLASS = "System.WorkItem.ServiceRequest";
                    __SEED = $pSRObject;
                    AnalystCommentLog = @{__CLASS = "System.WorkItem.TroubleTicket.AnalystCommentLog";
                                          __OBJECT = @{Id = $NewGUID;
                                                       DisplayName = $NewGUID;
                                                       Comment = $pComment;
                                                       EnteredBy  = $pEnteredBy;
                                                       EnteredDate = (Get-Date).ToUniversalTime();
                                                       IsPrivate = $false
                                                      }
                                         }
                   }
    New-SCSMObjectProjection -Type "System.WorkItem.ServiceRequestProjection" -Projection $Projection
}


Add-SRComment -SRObject $SR -Comment "This is a test" -EnteredBy "Doe, John"

New Post: Adding comments to SRs

$
0
0
from what I can remember :) that looks good. I am a little surprised by the need to create a new projection rather than just create a new relationship
Viewing all 306 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>