Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:44:23+00:00 2026-06-15T14:44:23+00:00

so i have this lovely script that will make folders and driver packs in

  • 0

so i have this lovely script that will make folders and driver packs in SCCM 2012, it created the folder and driver packages, but i can’t work out how to put them in the correct folders. I thought that PkgFlags would do it but that seems to do nothing and i can’t find a function to move the package.

i have worked on this for several days and have gotten nowhere

please help

$SCCMSiteCode = Read-Host "SCCM Site Code"
$PackageNamePath = Read-Host "Driver Package Original Path"
$PackageSourcePath = Read-Host "Driver Package Source Path"
$FolderArray1 = Get-ChildItem -Path "$PackageNamePath"

foreach ($FolderList1 in $FolderArray1)
{
if (($FolderList1.name -Like "Server*") -or ($FolderList1.name -Like "Windows*"))
    {
    $Argument1 = @{Name = "$FolderList1"; ObjectType = 23; ParentContainerNodeId = 0}
    Set-WmiInstance -Namespace "root\sms\site_$SCCMSiteCode" -Class "SMS_ObjectContainerNode" -Arguments $Argument1
    $GetID1 = Get-wmiObject -Namespace root\SMS\site_$SCCMSiteCode -Query "Select name,containernodeid from SMS_ObjectContainerNode" | select name,ContainerNodeID | Where-Object {$_.Name -eq $FolderList1}
    $FolderArray2 = Get-ChildItem -Path "$PackageNamePath\$FolderList1"
    foreach ($FolderList2 in $FolderArray2)
        {
        if (($FolderList2.name -NotLike "Server*") -or ($FolderList2.name -NotLike "Windows*"))
            {
            $DateTime = get-date -Format yyyy.MM.dd-hh.mm.ss
            $Milliseconds = (get-date).millisecond
            $FullDateTime = "$DateTime.$Milliseconds"
            New-Item -ItemType Directory -Path "$PackageSourcePath\$FullDateTime" 
            $PackageName = "$FolderList2 - $FolderList1"
            $Argument2 = @{Name = "$PackageName"; PkgSourcePath = "$PackageSourcePath\$FullDateTime"; PkgSourceFlag = 2; PkgFlags = $GetID1.ContainerNodeID}
            Set-WmiInstance -Namespace "root\sms\site_$SCCMSiteCode" -Class "SMS_DriverPackage" -Arguments $Argument2
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:44:24+00:00Added an answer on June 15, 2026 at 2:44 pm

    If you are talking about folder in SCCM itself, there is another wmi class you need called SMS_ObjectContainerItem. It basically tells the driver which folder to go in.

    I haven’t actually scripted it in 2012, but in a script I wrote that creates advertisements, I had code that looked like this:

    #This gets the folder from wmi. $advContName is the name of the folder I want the ADV to end up in
    $advContainer = gwmi -name root\sms\site_ia1 -computer itsnt353 -query "Select * from SMS_ObjectContainerNode WHERE Name='$advContName' AND ObjectType='3'"
    
    $moveADV = ([WMIClass]\\itsnt353\root\sms\site_ia1:SMS_ObjectContainerItem").CreateInstance()
    $moveADV.InstanceKey = $advID
    $moveADV.ObjectType = 2;
    $moveADV.ContainerNodeID = $advContainer.ContainerNodeID
    $moveADV.Put()
    

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this string 2012-06-27 16:17:06 and I want to convert it to GMT
Let's pretend (since it's true) that I have a Python (3) script that needs
I have (well had) a bit of code that would get me my lovely
I have a service that returns a lovely svg gradient for use in IE,
I have this lovely javascript bookmarklet... javascript:var nam=blablabla&name; var els=document.getElementsByName(nam); if(els.length == 0) alert(nam);
So I have this grid. It's a very nice grid. Lovely, really. Except when
I have a string! NSString *myString=[NSString stringWithFormat:@This is my lovely string]; What I want
I have a lovely little Java client that sends signed email messages. We have
Perl has a lovely little utility called find2perl that will translate (quite faithfully) a
I am trying to add a footer in HTML, and I have this lovely

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.