Jump to content


walter_white

PowerShell script to create deployments for multiple software update groups to multiple collections

Recommended Posts

Hi.. I don't know what happened but I was using this script for months.. Recently upgraded to 1806, not sure if that's when it broke or not.. But now I get the following when I run it..

PS C:\Windows\system32> C:\Scripts\Create SUDG\Create_SoftwareUpdateDeploymentgroups.ps1
[ERROR]     SCCM Module couldn't be loaded. Script will stop!

PS C:\Windows\system32> import-module (Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) ConfigurationManager.psd1)

PS C:\Windows\system32> $SiteCode=Get-PSDrive -PSProvider CMSITE

PS C:\Windows\system32> cd ((Get-PSDrive -PSProvider CMSite).Name + ':')
Set-Location : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
At line:1 char:4
+ cd ((Get-PSDrive -PSProvider CMSite).Name + ':')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-Location], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.SetLocationCommand


Any ideas? Thanks

Share this post


Link to post
Share on other sites


Try this line to set the PS Drive.

Set-Location "$($SiteCode.Name):" -ErrorAction Stop

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...