Jump to content


Search the Community

Showing results for tags 'vbscript hta sccm'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Cloud
    • Azure
    • Microsoft Intune
    • Office 365
    • Windows 365
  • General Stuff
    • General Chat
    • Events
    • Site News
    • Official Forum Supporters
    • Windows News
    • Suggestion box
    • Jobs
  • MDT, SMS, SCCM, Current Branch &Technical Preview
    • How do I ?
    • Microsoft Deployment Toolkit (MDT)
    • SMS 2003
    • Configuration Manager 2007
    • Configuration Manager 2012
    • System Center Configuration Manager (Current Branch)
    • Packaging
    • scripting
    • Endpoint Protection
  • Windows Client
    • how do I ?
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows Vista
    • Windows XP
    • windows screenshots
  • Windows Server
    • Windows Server General
    • Active Directory
    • Microsoft SQL Server
    • System Center Operations Manager
    • KMS
    • Windows Deployment Services
    • NAP
    • Failover Clustering
    • PKI
    • Hyper V
    • Exchange
    • IIS/apache/web server
    • System Center Data Protection Manager
    • System Center Service Manager
    • System Center App Controller
    • System Center Virtual Machine Manager
    • System Center Orchestrator
    • Lync
    • Application Virtualization
    • Sharepoint
    • WSUS

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests

Found 1 result

  1. Hello everyone! Use IIS Pool for Authentication and not have Userid and Password in clear text. (Thank you Niall!) My goal is to allow a third party company to Migrate user state from XP to Windows 7 during our Windows 7 Migration project. Doing this tasks through SCCM console isn't worth it when the 3rd party staff will be changing during the project. I need to have the Source Computer and the Destination computer do the following when the "Create Computer Associatation" button is pushed. 1. Add Source and Destination computer to the Computer Association in SCCM OSD 2. Add Source Computer to the Collection I called Scanstate 3. Add Destination Computer to the Collection I called Loadstate The Computer Association Script that does work perfectly! ( I took this script from some ones blog and I added a little changes) <html> <head> <title>USMT | Windows 7 Image</title> <script language="VBScript">Window.ResizeTo 913,810</script> <script language="VBScript">Window.MoveTo ((Screen.AvailWidth -913) / 2), 10</script> <HTA:APPLICATION ID="objOSDReg" APPLICATIONNAME="OSD_Registration" SINGLEINSTANCE="yes" BORDER="thin" ICON="Deploy.ico" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="yes" NAVIGABLE="yes" > </head> <script LANGUAGE="VBScript"> 'Set Variables: Site Server, Username and Password Server = "sccm server name" userName = "userid" userPassword = "password" Sub AssociateCompAandCompB Dim computera, computerb, ResIDA, ResIDB strcomputera = document.getElementById("computera").value strcomputerb = document.getElementById("computerb").value Set connection = Connect(Server, userName, userPassword) ResIDA = GetResourceIDFromName (connection, strcomputera) ResIDB = GetResourceIDFromNameB (Connection, strcomputerb) AssociateComputer Connection, ResIDA, ResIDB', ResIDA, ResIDB End Sub ' ------------------------------------------------------------------------------------------------------------------- ' Associate Computers in SCCM Computer Association ' ------------------------------------------------------------------------------------------------------------------- Sub AssociateComputer(connection, referenceComputerResourceId, destinationComputerResourceId) Dim stateMigrationClass Dim inParams Dim outParams 'On Error Resume Next ' Get the state migration class. Set stateMigrationClass = connection.Get("SMS_StateMigration") ' Set up the parameters. Set inParams = _ stateMigrationClass.Methods_("AddAssociation").InParameters.SpawnInstance_ inParams.SourceClientResourceID = referenceComputerResourceId inParams.RestoreClientResourceID = destinationComputerResourceId ' Call the method Set outParams = connection.ExecMethod( "SMS_StateMigration","AddAssociation",inParams) 'connection.ExecMethod stateMigrationClass.AddAssociation,inParams ' MsgBox Err if Err.number <> 0 Then MsgBox "Failed to create a Computer Association, please try again or contact the GOC" Exit Sub Else General_OnClick() End If End Sub ' ------------------------------------------------------------------------------------------------------------------- ' Utility function to search for the site code ' ------------------------------------------------------------------------------------------------------------------- Function Connect(server, userName, userPassword) 'On Error Resume Next Dim net Dim localConnection Dim swbemLocator Dim swbemServices Dim providerLoc Dim location Set swbemLocator = CreateObject("WbemScripting.SWbemLocator")' swbemLocator.Security_.AuthenticationLevel = 6 'Packet Privacy. ' If the server is local, don't supply credentials. Set net = CreateObject("WScript.NetWork") If UCase(net.ComputerName) = UCase(server) Then localConnection = True userName = "" userPassword = "" server = "." End If ' Connect to the server. Set swbemServices= swbemLocator.ConnectServer _ (server, "root\sms",userName,userPassword) If Err.Number<>0 Then ' Wscript.Echo "Couldn't connect: " + Err.Description Connect = Null Exit Function End If ' Determine where the provider is and connect. Set providerLoc = swbemServices.InstancesOf("SMS_ProviderLocation") For Each location In providerLoc If location.ProviderForLocalSite = True Then Set swbemServices = swbemLocator.ConnectServer _ (location.Machine, "root\sms\site_" + _ location.SiteCode,userName,userPassword) If Err.Number<>0 Then ' Wscript.Echo "Couldn't connect:" + Err.Description Connect = Null Exit Function Else 'Wscript.Echo "Yay, we connected!!" End If Set Connect = swbemServices Exit Function End If Next Set Connect = null ' Failed to connect. End Function ' ------------------------------------------------------------------------------------------------------------------- ' ------------------------------------------------------------------------------------------------------------------- Function GetResourceIDFromName(connection, strcomputera) 'On Error Resume Next ' Build Query string. query = "SELECT ResourceId FROM SMS_R_System WHERE NetbiosName = """ & strcomputera & """" ' Execute the query Set result = connection.ExecQuery(query) If Err then CheckError 'MsgBox "error on a" Exit Function End If ' Walk through the elements of the enumerator. ' Assume there will only be 1 computer with the requested name, if any. resourceID = 0 ' Assume the worst For each r in result GetResourceIDFromName = r.ResourceID 'MsgBox r.resourceID Next End Function ' ------------------------------------------------------------------------------------------------------------------- ' ------------------------------------------------------------------------------------------------------------------- Function GetResourceIDFromNameB(connection, strcomputerb) On Error Resume Next ' Build Query string. query = "SELECT ResourceId FROM SMS_R_System WHERE NetbiosName = """ & strComputerB & """" ' Execute the query Set result = connection.ExecQuery(query) If Err then CheckError Exit Function End If ' Walk through the elements of the enumerator. ' Assume there will only be 1 computer with the requested name, if any. resourceID = 0 ' Assume the worst For each b in result GetResourceIDFromNameB = b.ResourceID 'MsgBox b.resourceID Next End Function ' ------------------------------------------------------------------------------------------------------------------- ' ------------------------------------------------------------------------------------------------------------------- Sub General_OnClick() strHtm = "<table class=""tbl"">" strHtm = strHtm & "<tr><td>_________________________</td><td>_________________</td></tr>" strHtm = strHtm & "<tr><td>Source Computer </td><td>" & document.getElementById("computera").value & "</td></tr><tr></tr>" strHtm = strHtm & "<tr><td>_________________________</td><td>_________________</td></tr>" strHtm = strHtm & "<tr><td>Destination Computer </td><td>" & document.getElementById("computerb").value & "</td></tr>" strHtm = strHtm & "</table>" 'Next dataarea.innerhtml = strHtm End Sub </SCRIPT> <!-- ------------------------------------------------------------------------------------------------------------------- --> <!-- HTML Starts --> <!-- ------------------------------------------------------------------------------------------------------------------- --> <body style="font-family: Arial; background-image: url('Win7_wallpaper-blue2.jpg'); background-repeat: no-repeat; background-color: black; color: white;"> <!--OSD Registration Header--> <table style="text-align: left; width: 100px;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td><big><big><big><big><span> OSD</span></big></big></big></big></td> <td style="text-align: right;"><span> powered<br> by</span></td> <td><span><img style="width: 301px; height: 64px;" alt="System Center" src="file:logo-system-center.gif"></span></td> </tr> </tbody> </table> <!--Line Break--> <hr style="color:#00B2EE"> <!--Deployment Scenario Selection--> <table align="center" width="90%"> <tr><td> <h3> Computer Association</h3> <!-- HTA Text Input Box for Computer A (Source)--><!-- HTA Text Input Box for Computer B (Destination)--> <p> Source Computer = <input type="text" id="ComputerA" size="18"> Destination Computer = <input type="text" id="ComputerB" size="18"></p> <!-- A - AssociateCompAandCompB --> <!-- Resets Page --> <p> <input id=runbutton type="button" value="Create Computer Association" name="run_button" onClick="AssociateCompAandCompB"> <input type="button" value="Reset Page" onClick="window.location.reload()"></p><BR> </td></tr> </table> <!-- Display Data on HTA screen --> <table align="center" width="85%"> <tr><td> <!--Line Break--> <div style="margin: 200px 130px 0px 0px; background-color: transparent; padding: 10px;"> <div> <hr style="color:#00B2EE"> <div> <h4>Computer Association Output<h4> <div id="dataarea"></div> </div> </td></tr> </table> <br><br> <!--Version #--> <small style="color: rgb(100,100,100)"> #1v1.0</small> <table align="center" valign="center" width="100%"> <tr><big><big><span id="msgTXT"> </span></big></big><br></tr> <tr style="color:red;"><big><big><span id="msgERR"> </span></big></big><br></tr> </table> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.