skippynz Posted March 31, 2009 Posted March 31, 2009 here is the vbscript im trying to convert expandcollapse popup'=============================================================================== ' ' This script demonstrates the retrieval of BitLocker Drive Encryption (BDE) ' recovery information from Active Directory for a particular computer. ' ' It returns all recovery passwords and associated GUIDs for a particular ' computer object. ' ' Change History: ' 1/30/2006 - Initial release ' 5/15/2006 - Added ConvertOctetGuidToHexString to remove dependency to ADs.DLL ' and converted GUID to correct byte order before printing. ' - Updated GetStrPathToComputer to search the global catalog. ' ' Microsoft Corporation ' ' Disclaimer ' ' The sample scripts are not supported under any Microsoft standard support program ' or service. The sample scripts are provided AS IS without warranty of any kind. ' Microsoft further disclaims all implied warranties including, without limitation, ' any implied warranties of merchantability or of fitness for a particular purpose. ' The entire risk arising out of the use or performance of the sample scripts and ' documentation remains with you. In no event shall Microsoft, its authors, or ' anyone else involved in the creation, production, or delivery of the scripts be ' liable for any damages whatsoever (including, without limitation, damages for loss ' of business profits, business interruption, loss of business information, or ' other pecuniary loss) arising out of the use of or inability to use the sample ' scripts or documentation, even if Microsoft has been advised of the possibility ' of such damages. ' '=============================================================================== ' -------------------------------------------------------------------------------- ' Usage ' -------------------------------------------------------------------------------- Sub ShowUsage Wscript.Echo "USAGE: Get-BitLockerRecoveryInfo [Optional Computer Name]" Wscript.Echo "If no computer name is specified, the local computer is assumed." WScript.Quit End Sub ' -------------------------------------------------------------------------------- ' Parse Arguments ' -------------------------------------------------------------------------------- Set args = WScript.Arguments Select Case args.Count Case 0 ' Get the name of the local computer Set objNetwork = CreateObject("WScript.Network") strComputerName = objNetwork.ComputerName Case 1 If args(0) = "/?" Or args(0) = "-?" Then ShowUsage Else strComputerName = args(0) End If Case Else ShowUsage End Select ' -------------------------------------------------------------------------------- ' Helper function: Convert the octet GUID string (byte array) to a hex string ' -------------------------------------------------------------------------------- 'Reference: http://blogs.msdn.com/ericlippert/archive/2004/05/25/141525.aspx Function HexByte(B) HexByte = Right("0" & Hex(B), 2) End Function Function ConvertOctetGuidToHexString(ByteArray) Dim Binary, S Binary = CStr(ByteArray) On Error Resume Next S = "{" S = S & HexByte(AscB(MidB(Binary, 4, 1))) S = S & HexByte(AscB(MidB(Binary, 3, 1))) S = S & HexByte(AscB(MidB(Binary, 2, 1))) S = S & HexByte(AscB(MidB(Binary, 1, 1))) S = S & "-" S = S & HexByte(AscB(MidB(Binary, 6, 1))) S = S & HexByte(AscB(MidB(Binary, 5, 1))) S = S & "-" S = S & HexByte(AscB(MidB(Binary, 8, 1))) S = S & HexByte(AscB(MidB(Binary, 7, 1))) S = S & "-" S = S & HexByte(AscB(MidB(Binary, 9, 1))) S = S & HexByte(AscB(MidB(Binary, 10, 1))) S = S & "-" S = S & HexByte(AscB(MidB(Binary, 11, 1))) S = S & HexByte(AscB(MidB(Binary, 12, 1))) S = S & HexByte(AscB(MidB(Binary, 13, 1))) S = S & HexByte(AscB(MidB(Binary, 14, 1))) S = S & HexByte(AscB(MidB(Binary, 15, 1))) S = S & HexByte(AscB(MidB(Binary, 16, 1))) S = S & "}" On Error GoTo 0 ConvertOctetGuidToHexString = S End Function ' -------------------------------------------------------------------------------- ' Get path to Active Directory computer object associated with the computer name ' -------------------------------------------------------------------------------- Function GetStrPathToComputer(strComputerName) ' Uses the global catalog to find the computer in the forest ' Search also includes deleted computers in the tombstone Set objRootLDAP = GetObject("LDAP://rootDSE") namingContext = objRootLDAP.Get("defaultNamingContext") ' e.g. string dc=fabrikam,dc=com strBase = "<GC://" & namingContext & ">" Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOOBject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection strFilter = "(&(objectCategory=Computer)(cn=" & strComputerName & "))" strQuery = strBase & ";" & strFilter & ";distinguishedName;subtree" objCommand.CommandText = strQuery objCommand.Properties("Page Size") = 100 objCommand.Properties("Timeout") = 100 objCommand.Properties("Cache Results") = False ' Enumerate all objects found. Set objRecordSet = objCommand.Execute If objRecordSet.EOF Then WScript.echo "The computer name '" & strComputerName & "' cannot be found." WScript.Quit 1 End If ' Found object matching name Do Until objRecordSet.EOF dnFound = objRecordSet.Fields("distinguishedName") GetStrPathToComputer = "LDAP://" & dnFound objRecordSet.MoveNext Loop ' Clean up. Set objConnection = Nothing Set objCommand = Nothing Set objRecordSet = Nothing End Function ' -------------------------------------------------------------------------------- ' Securely access the Active Directory computer object using Kerberos ' -------------------------------------------------------------------------------- Set objDSO = GetObject("LDAP:") strPathToComputer = GetStrPathToComputer(strComputerName) WScript.Echo "Accessing object: " + strPathToComputer Const ADS_SECURE_AUTHENTICATION = 1 Const ADS_USE_SEALING = 64 '0x40 Const ADS_USE_SIGNING = 128 '0x80 ' -------------------------------------------------------------------------------- ' Get all BitLocker recovery information from the Active Directory computer object ' -------------------------------------------------------------------------------- ' Get all the recovery information child objects of the computer object Set objFveInfos = objDSO.OpenDSObject(strPathToComputer, vbNullString, vbNullString, _ ADS_SECURE_AUTHENTICATION + ADS_USE_SEALING + ADS_USE_SIGNING) objFveInfos.Filter = Array("msFVE-RecoveryInformation") ' Iterate through each recovery information object For Each objFveInfo in objFveInfos strName = objFveInfo.Get("name") strRecoveryGuidOctet = objFveInfo.Get("msFVE-RecoveryGuid") strRecoveryGuid = ConvertOctetGuidToHexString(strRecoveryGuidOctet) strRecoveryPassword = objFveInfo.Get("msFVE-RecoveryPassword") WScript.echo WScript.echo "name: " + strName WScript.echo "msFVE-RecoveryGuid: " + strRecoveryGuid WScript.echo "msFVE-RecoveryPassword: " + strRecoveryPassword If len(strRecoveryGuid) <> 38 Then WScript.echo "WARNING: '" & strRecoveryGuid & "' does not appear to be a valid GUID." End If Next WScript.QuitoÝ÷ Ù©ÝêÞÌ!jÖ¬jz.¶o+¬x/iÊ'½êíÓ®¶sb6æ6ÇVFRfÇC´3¢b3#µW6W'2b3#¶7&vÆÂb3#´FW6·F÷b3#µd6öçfW'BãBb3#¶&²ÖÆövfÆRæS2fwC°¢6æ6ÇVFRfÇC¶'&æS2fwC° ¤gVæ26÷uW6vR õw&FTÆörgV÷CµU4tS¢vWBÔ&DÆö6¶W%&V6÷fW'æfò´÷FöæÂ6ö×WFW"æÖUÒgV÷C² õw&FTÆörgV÷C´bæò6ö×WFW"æÖR27V6fVBÂFRÆö6Â6ö×WFW"277VÖVBâgV÷C² µdu67&BåV@¤VæDgVæ2³ÓÒfwCµ6÷uW6vP ¤FÒb33c·7G$6ö×WFW$æÖRÂb33c¶ö&¥&ö÷DÄDÂb33c¶æÖæt6öçFWBÂb33c·7G$&6RÂb33c¶ö&¤6öææV7FöâÂb33c¶ö&¤6öÖÖæBÂb33c·7G$fÇFW"Âb33c·7G%VW'Âb33c¶ö&¥&V6÷&E6WBÂb33c¶Fäf÷VæBÂb33c¶ö&¤E4ð¤FÒb33c·7G%FFô6ö×WFW"Âb33c¶ö&¤gfTæf÷2Âb33c·7G$æÖRÂb33c·7G%&V6÷fW'wVDö7FWBÂb33c·7G%&V6÷fW'wVBÂb33c·7G%&V6÷fW'77v÷&@£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²'6R&wVÖVçG0£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÐ £·âb33c¶&w2Òb33c´6ÖDÆæU³Ð £·â6VÆV7@£·à£·â66Rb33c¶&w2ä6÷VçBÓ£·â²vWBFRæÖRöbFRÆö6Â6ö×WFW £·âb33c¶ö&¤æWGv÷&²Òö&¤7&VFRgV÷Cµu67&BäæWGv÷&²gV÷C²£·âb33c·7G$6ö×WFW$æÖRÒb33c¶ö&¤æWGv÷&²ä6ö×WFW$æÖP¢b33c·7G$6ö×WFW$æÖRÒ6ö×WFW$æÖP£·à£·â66Rb33c¶&w2ä6÷VçBÓ£·âbb33c¶&w2ÒgV÷C²óògV÷C²÷"b33c¶&w2ÒgV÷C²ÓògV÷C²FVࣷâ6÷uW6vR£·âVÇ6P£·âb33c·7G$6ö×WFW$æÖRÒb33c¶&w2£·âVæD`£·à£·â66RVÇ6P£·â6÷uW6vR £·âVæE6VÆV7@ £²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²VÇW"gVæ7Föã¢6öçfW'BFRö7FWBuTB7G&ær'FR'&FòW7G&æp£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÐ £µ&VfW&Væ6S¢GG¢òö&Æöw2æ×6Fâæ6öÒöW&6ÆW'Bö&6fRó#BóRó#RóCS#Ræ7 ¤gVæ2W'FRb33c¶" Æö6Âb33cµ&WGW&à b33cµ&WGW&âÒ7G&æu&vBgV÷C³gV÷C²fײWb33c¶"Â" &WGW&âb33cµ&WGW&à¤VæDgVæ2³ÓÒfwC´W'FP ¤gVæ26öçfW'Dö7FWDwVEFôW7G&ærb33c¶'FV'& Æö6Âb33cµ&WGW&à FÒb33c´&æ'Âb33cµ0 b33c´&æ'Ò7G&ærb33c¶'FV'& µdöâW'&÷"&W7VÖRæW@ b33cµ2ÒgV÷C·²gV÷C° b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'ÂB b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'Â2 b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'Â" b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ' b33cµ2Òb33cµ2fײgV÷C²ÒgV÷C° b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'Âb b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'ÂR b33cµ2Òb33cµ2fײgV÷C²ÒgV÷C° b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ' b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'Âr b33cµ2Òb33cµ2fײgV÷C²ÒgV÷C° b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ' b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ' b33cµ2Òb33cµ2fײgV÷C²ÒgV÷C° b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ' b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'Â" b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'Â2 b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'ÂB b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'ÂR b33cµ2Òb33cµ2fײW'FR627G&ætÖBb33c´&æ'Âb b33cµ2Òb33cµ2fײgV÷C·ÒgV÷C° µdöâW'&÷"võFò b33cµ&WGW&âÒb33cµ0 &WGW&âb33cµ&WGW&à¤VæDgVæ2³ÓÒfwC´6öçfW'Dö7FWDwVEFôW7G&æp £²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²vWBFFò7FfRF&V7F÷'6ö×WFW"ö&¦V7B76ö6FVBvFFR6ö×WFW"æÖP£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÐ ¤gVæ2vWE7G%FFô6ö×WFW"b33c·7G$6ö×WFW$æÖR Æö6Âb33cµ&WGW&à ²W6W2FRvÆö&Â6FÆörFòfæBFR6ö×WFW"âFRf÷&W7@ ²6V&6Ç6òæ6ÇVFW2FVÆWFVB6ö×WFW'2âFRFöÖ'7FöæP b33c¶ö&¥&ö÷DÄDÒö&¤vWBgV÷C´ÄD¢ò÷&ö÷DE4RgV÷C² b33c¶æÖæt6öçFWBÒb33c¶ö&¥&ö÷DÄDävWBgV÷C¶FVfVÇDæÖæt6öçFWBgV÷C²²Rærâ7G&ærF3Öf'&¶ÒÆF3Ö6öÐ b33c·7G$&6RÒgV÷C²fÇC´t3¢òògV÷C²fײb33c¶æÖæt6öçFWBfײgV÷C²fwC²gV÷C° b33c¶ö&¤6öææV7FöâÒö&¤7&VFRgV÷C´DôD"ä6öææV7FöâgV÷C² b33c¶ö&¤6öÖÖæBÒö&¤7&VFRgV÷C´DôD"ä6öÖÖæBgV÷C² b33c¶ö&¤6öææV7Föâå&÷fFW"ÒgV÷C´G4E4ôô&¦V7BgV÷C° b33c¶ö&¤6öææV7Föâä÷VâgV÷C´7FfRF&V7F÷'&÷fFW"gV÷C² b33c¶ö&¤6öÖÖæBä7FfT6öææV7FöâÒb33c¶ö&¤6öææV7Föà b33c·7G$fÇFW"ÒgV÷C²fײö&¦V7D6FVv÷'Ô6ö×WFW"6ãÒgV÷C²fײb33c·7G$6ö×WFW$æÖRfײgV÷C²gV÷C° b33c·7G%VW'Òb33c·7G$&6RfײgV÷C³²gV÷C²fײb33c·7G$fÇFW"fײgV÷C³¶F7FæwV6VDæÖS·7V'G&VRgV÷C° b33c¶ö&¤6öÖÖæBä6öÖÖæEFWBÒb33c·7G%VW' b33c¶ö&¤6öÖÖæBå&÷W'FW2gV÷CµvR6¦RgV÷C²Ò b33c¶ö&¤6öÖÖæBå&÷W'FW2gV÷CµFÖV÷WBgV÷C²Ò b33c¶ö&¤6öÖÖæBå&÷W'FW2gV÷C´66R&W7VÇG2gV÷C²Ò ²VçVÖW&FRÆÂö&¦V7G2f÷VæBà b33c¶ö&¥&V6÷&E6WBÒb33c¶ö&¤6öÖÖæBäWV7WFP bb33c¶ö&¥&V6÷&E6WBäTôbFVà õw&FTÆörgV÷CµFR6ö×WFW"æÖRb33²gV÷C²fײb33c·7G$6ö×WFW$æÖRfײgV÷C²b33²6ææ÷B&Rf÷VæBâgV÷C² µdu67&BåVB VæD` ²f÷VæBö&¦V7BÖF6æræÖP Fð b33c¶Fäf÷VæBÒb33c¶ö&¥&V6÷&E6WBäfVÆG2gV÷C¶F7FæwV6VDæÖRgV÷C² b33cµ&WGW&âÒgV÷C´ÄD¢òògV÷C²fײb33c¶Fäf÷Væ@ b33c¶ö&¥&V6÷&E6WBäÖ÷fTæWB VçFÂb33c¶ö&¥&V6÷&E6WBäTôb ²6ÆVâWà µd6WBb33c¶ö&¤6öææV7FöâÒæ÷Fæp µd6WBb33c¶ö&¤6öÖÖæBÒæ÷Fæp µd6WBb33c¶ö&¥&V6÷&E6WBÒæ÷Fæp &WGW&âb33cµ&WGW&à¤VæDgVæ2³ÓÒfwC´vWE7G%FFô6ö×WFW £²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²6V7W&VÇ66W2b33cµ2FR7FfRF&V7F÷'6ö×WFW"ö&¦V7BW6ær¶W&&W&÷0£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÐ ¢b33c¶ö&¤E4òÒö&¤vWBgV÷C´ÄD¢gV÷C²¢b33c·7G%FFô6ö×WFW"ÒvWE7G%FFô6ö×WFW"b33c·7G$6ö×WFW$æÖR ¥õw&FTÆörgV÷C´66W76ærö&¦V7C¢gV÷C²²b33c·7G%FFô6ö×WFW" ¤6öç7Bb33c´E5õ4T5U$UôUDTåD4DôâÒ¤6öç7Bb33c´E5õU4Uõ4TÄärÒcB³C¤6öç7Bb33c´E5õU4Uõ4täärÒ#³ £²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²vWBÆÂ&DÆö6¶W"&V6÷fW'æf÷&ÖFöâg&öÒFR7FfRF&V7F÷'6ö×WFW"ö&¦V7@£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÐ £²vWBÆÂFR&V6÷fW'æf÷&ÖFöâ6ÆBö&¦V7G2öbFR6ö×WFW"ö&¦V7@ ¢b33c¶ö&¤gfTæf÷2Òb33c¶ö&¤E4òä÷VäE4ö&¦V7Bb33c·7G%FFô6ö×WFW"ÂgV÷C²gV÷C²ÂgV÷C²gV÷C²Âð b33c´E5õ4T5U$UôUDTåD4Dôâ²b33c´E5õU4Uõ4TÄär²b33c´E5õU4Uõ4täär ¢b33c¶ö&¤gfTæf÷2äfÇFW"Òô'&7&VFRgV÷C¶×4edRÕ&V6÷fW'æf÷&ÖFöâgV÷C² £²FW&FRF&÷VvV6&V6÷fW'æf÷&ÖFöâö&¦V7@ ¤f÷"b33c¶ö&¤gfTæfòâb33c¶ö&¤gfTæf÷0 b33c·7G$æÖRÒb33c¶ö&¤gfTæfòävWBgV÷C¶æÖRgV÷C² b33c·7G%&V6÷fW'wVDö7FWBÒb33c¶ö&¤gfTæfòävWBgV÷C¶×4edRÕ&V6÷fW'wVBgV÷C² b33c·7G%&V6÷fW'wVBÒ6öçfW'Dö7FWDwVEFôW7G&ærb33c·7G%&V6÷fW'wVDö7FWB b33c·7G%&V6÷fW'77v÷&BÒb33c¶ö&¤gfTæfòävWBgV÷C¶×4edRÕ&V6÷fW'77v÷&BgV÷C² £·âu67&BæV6ð õw&FTÆörgV÷C¶æÖS¢gV÷C²²b33c·7G$æÖR õw&FTÆörgV÷C¶×4edRÕ&V6÷fW'wVC¢gV÷C²²b33c·7G%&V6÷fW'wVB õw&FTÆörgV÷C¶×4edRÕ&V6÷fW'77v÷&C¢gV÷C²²b33c·7G%&V6÷fW'77v÷&B b7G&ætÆVâb33c·7G%&V6÷fW'wVBfÇC²fwC²3FVà õw&FTÆörgV÷Cµt$ääs¢b33²gV÷C²fײb33c·7G%&V6÷fW'wVBfײgV÷C²b33²FöW2æ÷BV"Fò&RfÆBuTBâgV÷C² VæD` ¤æW@ £µdu67&BåVoÝ÷ Ú) zÛb§zºè«m+)j»[zZ0jwbë-víz0ÂwvÚ¢Új|¡zZp¢é]m橦·«^t-=Ù7¦§Ovµë-jíõë
skippynz Posted March 31, 2009 Author Posted March 31, 2009 I just noticed i had som + in the script so have changed them for & but still stuck at the same place....i so hate VBS
BlackDragonBE Posted March 31, 2009 Posted March 31, 2009 ; -------------------------------------------------------------------------------- ; Parse Arguments ; -------------------------------------------------------------------------------- ;~ $args = $CmdLine[0] ;~ Select ;~ ;~ Case $args.Count()=0 ;~ ; Get the name of the local computer ;~ $objNetwork = ObjCreate("WScript.Network") ;~ $strComputerName = $objNetwork.ComputerName $strComputerName = @ComputerName ;~ ;~ Case $args.Count()=1 ;~ If $args(0) = "/?" Or $args(0) = "-?" Then ;~ ShowUsage() ;~ Else ;~ $strComputerName = $args(0) ;~ EndIf ;~ ;~ Case Else ;~ ShowUsage() ;~ EndSelect Should be: ; -------------------------------------------------------------------------------- ; Parse Arguments ; -------------------------------------------------------------------------------- $args = $CmdLine[0] Select Case $args.Count()=0 ; Get the name of the local computer $objNetwork = ObjCreate("WScript.Network") $strComputerName = $objNetwork.ComputerName $strComputerName = @ComputerName Case $args.Count()=1 If $args(0) = "/?" Or $args(0) = "-?" Then ShowUsage() Else $strComputerName = $args(0) EndIf Case Else ShowUsage() EndSelect That's all I see with my little knowledge of VBS
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now