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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×