Jump to content


Search the Community

Showing results for tags 'vbscript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Cloud
    • Azure
    • Microsoft Intune
    • Office 365
  • General Stuff
    • General Chat
    • Events
    • Site News
    • Windows News
    • Suggestion box
    • Jobs
  • MDT, SMS, SCCM, Current Branch &Technical Preview
    • How do I ?
    • Microsoft Deployment Toolkit (MDT)
    • Official Forum Supporters
    • 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
    • Active Directory
    • Microsoft SQL Server
    • System Center Operations Manager
    • KMS
    • Windows Deployment Services
    • NAP
    • Failover Clustering
    • PKI
    • Windows Server 2008
    • Windows Server 2012
    • Windows Server 2016
    • Windows Server 2019
    • 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


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 10 results

  1. I want to know if anyone has a script or tutorial on creating a script to "enable enterprise mode" and to allow enterprise mode to use a "website list" to manage certain sites. I know this should be fairly simple to do but I am new to scripting so I felt after several hours of looking and obviously creating the wrong searches, it time to ask the pros. Would prefer vbscript, but will not refuse powershell.
  2. Just thought I'd share a script I wrote this morning. I currently have a task sequence that builds various devices and takes the OSDComputerName variable from the Asset Tag BIOS field. The Surface Pro 3 works a little different, in that you can't set this field directly from the BIOS, you need to set it using a CLI utility (available here - http://www.microsoft.com/en-us/download/details.aspx?id=44076).This usually means booting a brand new device, going through the OOBE stuff, running the CLI utility, then restarting into PXE and continuing with imaging as normal. The below .vbs script first checks if there is an existing asset tag entered, and if not prompts the user to enter a machine name, which it then uses in the Task Sequence and sets the tag locally using the utility, so the next time the device is built it just takes the tag straight from the BIOS. Dim objWMIService Dim colItems Dim objSMSEnv Dim strNewName Dim WshShell Dim strCurDir Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure") 'Get the current Asset Tag For Each objItem In colItems 'Remove all beginning, trailing and containing spaces and switch to uppercase strNewName = objItem.SMBIOSAssetTag Next wscript.echo "Currently using " & strNewName & " as OSDComputerName" If left(strNewName,4) <> "SomeString" Then Do While X = 0 strNewName = InputBox ("Please enter a machine name i.e. HP-XXXXXX","Enter Machine Name...") If strNewName = "" Then Wscript.Echo "You must enter a machine name." Else Set WshShell = WScript.CreateObject("WScript.Shell") strCurDir = WshShell.CurrentDirectory WshShell.Run strCurDir & "\AssetTag -s " & UCase(strNewName), 0 wscript.echo "Currently using " & strNewName & " as OSDComputerName Set objSMSEnv = CreateObject("Microsoft.SMS.TSEnvironment") wscript.echo "Set Task Sequence variable OSDComputerName to: " & strNewName objSMSEnv("OSDComputerName") = UCase(strNewName) Exit Do End If Loop Else Wscript.Echo strNewName Set objSMSEnv = CreateObject("Microsoft.SMS.TSEnvironment") wscript.echo "Set Task Sequence variable OSDComputerName to: " & strNewName objSMSEnv("OSDComputerName") = UCase(strNewName) End If Set WshShell = Nothing I deployed it by having AssetTag.exe and script file in a folder on my SCCM OSD scripts directory, then created a simple package without program and pointed at this location. After distributing to my local DPs I then created a Run Command Line task sequence item and added the name of the script file into the Command Line area, making sure to reference the package containing the script.
  3. One of the things we have implemented with our in-place refresh is re-installing printers with a powershell script...yes, I know there are ways to do this with GPO...I'm not going into the details, but suffice to say that GPO printer installs are not an option right now (unfortunately). But here's what I have run into...in my powershell, I'm executing the rundll32 printui.dll command. The script loops through and collects info on the printers which were installed and then choses the appropriate printer from that list to set as default, again using the rundll32 printui command. I have to use the rundll32 method because the prnmngr.vbs requires elevation to install a printer, which I can't get through a TS (at least not easily). If I simply run the script by itself then things work perfectly...all printers install and the default is set at the end. However, when running it from a TS, the only thing which doesn't work is setting the default printer. Since it wasn't working in my PS TS step, I figured I would hard-code it in with a Run Command Line step, passing a TS variable in my PS code. That didn't work either. I even setup a VBScript to set the default printer, but that did not work. I'm out of ideas at this point, and I don't know why it wouldn't be working from a TS other than it might be because it is running under a system context instead of a user? I don't know...I'm just stumped right now, and I'm too close to the project right now to think outside of the box at the moment. Any input would be appreciated. thanks.
  4. Hi! I'm having some issues with a .vbscript made for renaming computer during a task sequence. The issue is that it works for renaming virtual machines, but also a physical HP, the way it's supposed to (name of choosing + last 6 digits of serialnumber). However it fails on a customers physical Lenovo machine. The Lenovo machine sets the first part of name correctly, but completely ignores the fact that it's supposed to cut the serialnumber to the last 6 digits, meaning sometimes the machinename goes above 15 characters. The vbscript is run right after formating the disk, as seen on this pic: The script is: ----------------------------------------------------------- Set env = CreateObject("Microsoft.SMS.TSEnvironment") Name = inputbox("Description here", "Title here",env("_SMSTSMachineName"),400,0) Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Bios") strComputer = "." Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS") For each objBIOS in colBIOS serial = objBIOS.SerialNumber Next serial = Replace(serial," ","",1,-1) strNewName = Left(Name,9) & Right(serial,6) env("OSDComputerName") = strNewName -------------------------------------------------------------- Picture from successfull rename (log) virtual machine: Text from logs: From the logs you can see the virtual machine successfully set the machinename during the MDT Gather-process. The task sequence execution engine successfully completed the action (Gather) in the group (Initialization) with exit code 0 Action output: Finished remapping variables. ZTIGather processing completed successfully. Property UserDomain is now = ADMIN Property UserID is now = ConfigMgr-NeXXXX <Message containing password has been suppressed> Process completed with exit code 0 Error executing web service http:/ /OPPXXXXXXXXXXXX/MDTMonitorEvent/PostEvent?uniqueID=&computerName=TEST-d7ea46&messageID=41001&severity=1&stepName=Gather&currentStep=16&totalSteps=156&id=C6FB2A42-B79B-E2AC-BB0C-1A2F2ED7EA46,00:50:56:AA:69:1E&messageZTIGather processing completed successfully.&dartIP=&dartPort=&dartTicket=&vmHost=&vmName=: The operation timed out (-2147012894) Event 41001 sent: ZTIGather processing completed successfully. Command line returned 0 Entering ReleaseSource() for D:\_SMSTaskSequence\Packages\OPS0001A reference count 1 for the source D:\_SMSTaskSequence\Packages\OPS0001A before releasing Delete source directory D:\_SMSTaskSequence\Packages\OPS0001A Released the resolved source D:\_SMSTaskSequence\Packages\OPS0001A. Picture from "failed" (log) rename Lenovo: as you can see, there are 11 characters in the serial number The task sequence execution engine successfully completed the action (Gather) in the group (Initialization) with exit code 0 Action output: shed remapping variables. ZTIGather processing completed successfully. Property UserDomain is now = ADMIN Property UserID is now = ConfigMgr-NeXXXXX <Message containing password has been suppressed> Process completed with exit code 0 Error executing web service http:/ /OPPXXXXXXXXXXXXXX/MDTMonitorEvent/PostEvent?uniqueID=&computerName=USK-COAIN013GYT&messageID=41001&severity=1&stepName=Gather&currentStep=16&totalSteps=156&id=F449XXXXX-XXXX-11E0-9DC4-0XX07F19C838,E4:XX:XX:33:XX:80&messageZTIGather processing completed successfully.&dartIP=&dartPort=&dartTicket=&vmHost=&vmName=: The operation timed out (-2147012894) Event 41001 sent: ZTIGather processing completed successfully. Command line returned 0 Entering ReleaseSource() for D:\_SMSTaskSequence\Packages\OPS0001A reference count 1 for the source D:\_SMSTaskSequence\Packages\OPS0001A before releasing Delete source directory D:\_SMSTaskSequence\Packages\OPS0001A Released the resolved source D:\_SMSTaskSequence\Packages\OPS0001A. Anyone got any idea what might be wrong? Thanks in advance!
  5. Hello at all, I’m working on a script which creates a SCCM collection and appends a collection rule. The function createCollection creates and moves the collection without any problems. The collection rule object is also created without any error codes, but at adding the collection rule (newCollection.AddMembershipRule newCollectionRule) I get a “general error”. Has anybody an idea how to fix this problem? Function createCollection(collectionName)     Dim validQuery, queryExpr ' creates the collection.     Set newCollection = objSccm.Get("SMS_Collection").SpawnInstance_()     newCollection.Name = collectionName     newCollection.OwnedByThisSite = True     newCollection.Comment = "Comment"               Set collectionPath = newCollection.Put_ ' Attempts to obtain the collection ID of the newly created collection. Set Collection = objSccm.ExecQuery ("select * from SMS_Collection where Name='" & collectionName & "'") For each objCollection in Collection     strCollectionID=objCollection.CollectionID Next If strCollectionID = "" Then     Wscript.Echo "Unable to obtian a collection ID for the newly created collection."     WScript.Quit Else     ' Attempts to move the newly created collection into the desired parent collection.     Set newCollectionRelation = objSccm.Get("SMS_CollectToSubCollect").SpawnInstance_()     newCollectionRelation.parentCollectionID = strParentCollectionID     newCollectionRelation.subCollectionID = strCollectionID     newCollectionRelation.Put_ End If      'Attempts to create and add the query rule group to the collection!     Set stdQuery = objSccm.Get("SMS_CollectionRuleQuery")     validQuery = stdQuery.ValidateQuery(queryExpr)          If validQuery Then          Set newCollectionRule = stdQuery.SpawnInstance_     newCollectionRule.QueryExpression = queryExpr     newCollectionRule.RuleName = "Rulename"          Set newCollection = objSccm.Get(collectionPath.RelPath)     newCollection.AddMembershipRule newCollectionRule     newCollection.RequestRefresh False       End If End Function
  6. Hi All, Can any "Scripting-Rockstar" here help me out ??? I need a VBSscript which can perform "Disk Cleanup" action without any user interaction on user machines. I will later wrap it using WISE Re-packaging tool and then deploy it thorugh SCCM 2007. Its really urgent...!!!!! Please help out.
  7. This is mostly for people familiar with MDT scripting/integration... I've been working on this non-stop today trying all sorts of methods to try and accomplish a prompt for computer name at a specific point...I'm certain that it can be done, but I'm losing hope! Here's the scenario...I'm using Maik Koster's web service (v7.3), as well as his custom boot image for OSD, with MDT 2012 integration. With the custom boot image, the pre-execution mediahook runs and performs a series of webservice calls to populate a wizard that allows for TS selection. After the selection is made, it adds the computer to the appropriate collection with the OSD TS and off you go! This works GREAT for known computers...unknown computers are a little different. I can boot unknown computers to the custom boot wizard, and they get added to whichever collection and are added to the server at the same time. HERE IS THE ODDITY: the computers get added with their MAC address as the computer name, as opposed to MININT-###### I've added a successful check in the pre-execution hook to test if the computer is known or not...if it is unknown, then a simple prompt comes up and we can put in the computer name. THE PROBLEM is that I have NO IDEA what variable I'm supposed to set with the input. The pre-execution hook calls ZTIGather and ZTIUtlity...I've tried setting oEnvironment.Item("OSDComputerName")/("HostName") to the input gathered previously...but it didn't change anything (the webservice call is SUPPOSED to use OSDComputerName as the name)...I'm honestly stumped as to what variable I need to set (since it is using the MAC address for the name), OR would be more viable to try and set a (environmental?) variable that the SCCM_Bootstrap.ini/Customsettings.ini uses? For instance the existing webservice call in the ini file looks like this: ----------------------------------------- [AddComputerToCollection] WebService=http://YourWebServer/Deployment/SCCM.asmx/AddComputerToCollection Parameters=MACAddress,UUID,CollectionID,ComputerName MACAddress=macAddress UUID=UUID CollectionID=collectionID ComputerName=Computername <-- THIS IS NOT POPULATED FOR SOME REASON ------------------------------------------ would it be possible to do something such as: ------------------------------------------- MyNewCustomVariable=%SetByScript% [AddComputerToCollection] WebService=http://YourWebServer/Deployment/SCCM.asmx/AddComputerToCollection Parameters=MACAddress,UUID,CollectionID,ComputerName MACAddress=macAddress UUID=UUID CollectionID=collectionID MyNewCustomVariable=Computername -------------------------------------------- I guess that it might be possible that SCCM is inserting the MAC address to use as the computer name since/if it isn't being provided...but that thought just occurred to me, and I haven't had a chance to look into that possibility. This is all very new to me, as I'm not super familiar with the workings of MDT scripting/customizations. When I get back to work in the morning, I'm going to go through the logs again and see if/where I missed the section that is using the MAC address for the computer name. Hopefully, if I can get this working, then I'll have a very handy method for imaging bare metal workstations with a computer name prompt tied in
  8. Hi, I'm having issue using custom detection scripts. More specifically how to exit the detection script to say detected or not. My application is a script that will delete two desktop icons. My detection script checks if and icon exists and if it does increment a count. If the count is 0 that is no icons exist then I want to exit the script and have the application detected as installed. This is what I ran with ... Set objFSO = CreateObject("Scripting.FileSystemObject") File1="C:\Users\Public\Desktop\HP TRIM Desktop.lnk" File2="C:\Users\Public\Desktop\HP TRIM Queue Processor.lnk" Dim count count = 0 If objFSO.FileExists(File1) then count= count + 1 End If If objFSO.FileExists(File2) then count = count + 1 End If If count = 0 then WScript.Quit(0) End If The logs showed the application not detected so ran my Script correctly. Then when it checked after the install it still showed as undetected. Can anyone explain how I can exist my scripts correctly to show presence of an application? Cheers,
  9. Hello everyone, Here is my situation. I have a Windows XP in DOM A and SCCM A on which I am advertising a task sequence to deploy W7 and join DOM B with SCCM B. The migration/deployment scenario works great, no problem on that. My first steps that are done online (not in WinPE) are the following on the XP machine: -Backup of user settings with USMT -Backup of user data with Robocopy -Change the name of the computer locally/AD with a vbscript that also set the OSDComputerName variable with the new value -Restart on Windows (to validate the renaming) -Restart in WinPE and go on with the classic deployment (Format, dl of the .wim ...) The thing is that everytime, once the machine is in the new AD and SCCM it still has its old computername. Even though the script changed successfully the name of the computer in the AD and locally of the XP. So I am wondering if this is possible to set the OSDComputerName out of WinPE? And if yes am I doing it right? Here is the part of my script where I set the variable: dim env SET env = CreateObject("Microsoft.SMS.TSEnvironment") env("OSDComputerName") = NewComputerName Where the variable NewComputerName is a variable set before with the new computer name (and it works as it changes the value in the AD). The script is run with an account that as domain admin privileges in DOM A and full access on a DFS in DOM B where the script and a csv file containing all the new values are stored. So, what is wrong?? THank you a lot, I have been trying to fix this for days !!
  10. Hi everyone, Well, I've been a member of this forum for a short period of time, and I've asked way too many questions and gotten some good feedback from here and around the SCCM community. So, it's time for me to give back to the SCCM community. I modified a script that prompts for computer name as an OSD task is being performed. I've tested this script on a SCCM 2012 Beta 2 lab, and it's been working properly so far. Here's the link that explains how the script works as well as it shows the original owner and my modifications.
×
×
  • Create New...