Jump to content

Falcor

Member
  • Posts

    13
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About Falcor

Profile Information

  • OS
    Windows 8 x64

Falcor's Achievements

0

Reputation

  1. So far what I've come up with on my own...which does NOT work is: Get-Mailbox | Foreach-Object{ $username = Select-Object Alias Remove-MailboxPermission -user $username -AccessRight FullAccess}This is the error I get, which doesn't help me in the least: Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently. + CategoryInfo : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [], PSInvalidOperationException + FullyQualifiedErrorId : RemotePipelineExecutionFailedCannot bind argument to parameter 'User' because it is null. + CategoryInfo : InvalidData: ( [Remove-MailboxPermission], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Remove-MailboxPermissionAny ideas?
  2. Hi All, We had a little bug go through our Exchange Server that really hosed our permissions on all mailboxes. I have everything working now, but am looking for a way to systematically clean up permissions. For instance: NT Authority\Self is allowed FullAccess on all mailboxes...this is good. This allows each user full access to their own mailbox. On top of this, each user is listed ALSO with FullAccess permissions on their own mailboxes. This is unnecessary due to the NT Authority\Self permission. If I were to use the Exchange Management Console to remove each user from their mailbox, EMC would actually remove their access entirely by stipulating a DENY - not good. What I am looking to do is use PowerShell to run a loop. So that you may better understand what I am trying to do: 1. Get-Mailbox2. Enumerate username associated with mailbox and assign $username variable3. Remove-MailboxPermission –user $username –AccessRight FullAccessOnce the entire command is piped: Get-Mailbox | $username = user | Remove-MailboxPermission -user $username -AccessRight FullAccess Thus, it would remove the users' full-access permissions only from their own mailbox. Can anyone help me accomplish this? I have searched and searched, but still come up empty. Thanks!
  3. Consider it done! Dim EXT, EDIDir, EDILog, EDICount, ErrorCount, EDIHeadCount, objFolder, objLogFile, objFile, strFileName Dim objRegEx, intConc, objRead, objWrite, strFile, intLength, strEnd, ObjOutputFile Dim sContents, sContents2, sContents3, sDir, sFile, nFile, iMatch, colMatches, colMatches2 Dim Char_Date, Char_DateTime Const ForAppending = 8 Const ForReading = 1 Const ForWriting = 2 '# Set log variable, count variables to 0, and paths. EXT = "edi" EDIDir = "C:\Users\Mike\Google Drive\- Projects\Test Scripts\HTA\TEST EDI FILES" EDILog = EDIDir & "\EDILog.log" EDICount = 0 ErrorCount = 0 EDIHeadCount = 0 sContents = Null sContents2 = Null sContents3 = Null '# Delete EDILog.log if it exists. Set objFolder = objFileSys.GetFolder(EDIDir) If (objFileSys.FileExists("C:\Users\Mike\Google Drive\- Projects\Test Scripts\HTA\TEST EDI FILES\EDILog.log")) Then objFileSys.DeleteFile "C:\Users\Mike\Google Drive\- Projects\Test Scripts\HTA\TEST EDI FILES\EDILog.log" Else End If '# Create new EDILog.log file. Set objLogFile = objFileSys.OpenTextFile(EDILog, ForAppending, TRUE) '# Count number of EDI files, display results, and add to log. For Each objFile In objFolder.Files If LCase((objFileSys.GetExtensionName(objFile))) = EXT Then EDICount = EDICount + 1 End If Next Msgbox "Detected EDI Files: " & EDICount objLogFile.WriteLine "Detected EDI Files: " & EDICount '# Error check EDI files, display results if errors found, and output to log file. (!! means error | X means OK) For Each objFile In objFolder.Files If LCase((objFileSys.GetExtensionName(objFile))) = EXT Then strFileName = objFile.Name Set objFile = objFileSys.OpenTextFile(objFile) sContents = objFile.ReadAll objFile.Close Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.IgnoreCase = False objRegEx.Global = True objRegEx.Pattern = "19\*\*" Set colMatches = objRegEx.Execute(sContents) If colMatches.Count >= 1 Then Msgbox colMatches.Count & " errors in " & strFileName & "!" ErrorCount = ErrorCount + 1 objLogFile.WriteLine "!!" & vbTab & colMatches.Count & " errors in " & strFileName Else objLogFile.WriteLine "X " & vbTab & colMatches.Count & " errors in " & strFileName End If End If Next objLogFile.WriteLine vbCRLF & "Error checking complete." objLogFile.Close '# If there are errors display the log file and quit further action. If ErrorCount >= 1 Then Msgbox "Errors were detected. Please review the log file and correct these errors to continue." objShell.run chr(34) & EDILog & chr(34),1,FALSE Else '# If there are no errors prompt to concatenate. intConc = Msgbox("No errors detected." & vbCRLF & vbCRLF & "Do you want to concatenate?", vbYesNo, "Concatenate?") End If And then it goes on to my concat script section...
  4. I am such an id***... I just tried a different method and it worked without issue. Sorry for the hassle. Note to Self: There is a big difference between Set VARIABLE = VALUE and VARIABLE = VALUE
  5. So what you saying is that you would not remember that your variable was all lower case, what you said might of made sense if it was some kind of user input and case sensitivity. You already have 2 loops in your script, you should only need one. Loop 1 For Each objFile In objFolder.Files If LCase((objFileSys.GetExtensionName(objFile))) = LCase(EXT) Then EDICount = EDICount + 1 End If Next Msgbox "Detected EDI Files: " & EDICount Loop 2 For Each objFile In objFolder.Files If LCase((objFileSys.GetExtensionName(objFile))) = LCase(EXT) Then Set strFileName = objFileSys.GetFileName(objFile) Set objFile = objFileSys.OpenTextFile(objFile) sContents = objFile.ReadAll objFile.Close Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.IgnoreCase = False objRegEx.Global = True objRegEx.Pattern = "19\*\*" Set colMatches = objRegEx.Execute(sContents) If colMatches.Count >= 1 Then Msgbox colMatches.Count & " errors in " & strFileName & "." Else Msgbox "0 errors found in " & strFileName & "." End If End If Next This is why I said to rewrite your second loop to just show what files are being process, but it your script so it must work. OK - I tried it your way, but I still get an error: "Object doesn't support this property or method: 'Path'" I'm not too sure what the issue is at this point.
  6. This is in case of typos. I dont want to get an error simply because of case-sensitivity. See these lines: If colMatches.Count >= 1 Then Msgbox colMatches.Count & " errors in " & strFileName & "." Else Msgbox "0 errors found in " & strFileName & "." End If These are used after the error checking is completed by a concatenation script. Why would I need a second loop? All of the examples I have seen should allow for the script to report which file is currently being worked on, but it simply isn't working for me. Ideally, I would combine both sections of the script and have it count and error check with the same loop. I'll get to that after the entire script is finished. Keeping them separated allows me to error check the script more easily.
  7. For some reason, I can't get this to work. Basically, I am building in error checking prior to running other functions in an HTA app. I have managed to overcome all odds and have automated an extremely arduous process (processing EDI), but I would also like to error check each EDI file for specific errors. If an error is detected, I want it to tell me which file has the error(s) and how many there are. What I have: Dim Char_Date, Char_DateTime, objFileSys, objFolder, objFile, objRead, objWrite, objRegEx, strFile, intLength, strEnd Dim sContents, sDir, sFile, nFile, iMatch, colMatches, strFileName Dim EDIDir, EDICount, EXT EXT = "edi" EDIDir = "C:\Users\Mike\Google Drive\- Projects\Test Scripts\HTA\TEST EDI FILES" EDICount = 0 Set objFileSys = CreateObject("Scripting.FileSystemObject") Set objFolder = objFileSys.GetFolder(EDIDir) For Each objFile In objFolder.Files If LCase((objFileSys.GetExtensionName(objFile))) = LCase(EXT) Then EDICount = EDICount + 1 End If Next Msgbox "Detected EDI Files: " & EDICount '# Error check EDI files. Const ForAppending = 8 Const ForReading = 1 Const ForWriting = 2 For Each objFile In objFolder.Files If LCase((objFileSys.GetExtensionName(objFile))) = LCase(EXT) Then Set strFileName = objFileSys.GetFileName(objFile) Set objFile = objFileSys.OpenTextFile(objFile) sContents = objFile.ReadAll objFile.Close Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.IgnoreCase = False objRegEx.Global = True objRegEx.Pattern = "19\*\*" Set colMatches = objRegEx.Execute(sContents) If colMatches.Count >= 1 Then Msgbox colMatches.Count & " errors in " & strFileName & "." Else Msgbox "0 errors found in " & strFileName & "." End If End If Next Msgbox "Error checking complete." The first part of the script runs just fine. It tells me how many EDI files I have in a specific directory. When it gets to the error checking, though, it doesn't work. From all the examples I have seen...it should. I keep getting an error that states: "Object required: '[string: MYFILENAME.EDI"]' Any ideas?
  8. Thanks for all your help, people. I am not too worried about how the code looks until after I have gotten everything working. Once that is taken care of I will clean it up. On to the next problem...
  9. Hey guys. Looks like I solved my own problem. It appears as though the arguments I was passing with the run command have to be in a separate entity (Really MS??). Here is the code I tested - It works without fail: Dim objFileSys, OSBit, objShell, PathTIE, PathTLW, TIEArgs, TLWArgs TIEArgs = " -s 192.168.1.204 -u root" TLWArgs = " -s 192.168.1.201 -u root" Set objFileSys = CreateObject("Scripting.FileSystemObject") If (objFileSys.FolderExists("C:\Program Files (x86)")) Then OSBit = "64" Else OSBit = "32" End If If OSBit = "64" Then Set objShell = CreateObject("WScript.Shell") PathTIE = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34) If (objFileSys.FileExists(PathTIE)) Then Msgbox PathTIE & TIEArgs Else Msgbox PathTIE End If PathTLW = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34) If (objFileSys.FileExists(PathTLW)) Then Msgbox PathTLW & TLWArgs Else Msgbox PathTLW End If objShell.run PathTIE & TIEArgs,1,False objShell.run PathTLW & TLWArgs,1,False ElseIf OSBit = "32" Then Set objShell = CreateObject("WScript.Shell") PathTIE = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34) If (objFileSys.FileExists(PathTIE)) Then Msgbox PathTIE & TIEArgs Else Msgbox PathTIE End If PathTLW = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34) If (objFileSys.FileExists(PathTLW)) Then Msgbox PathTLW & TLWArgs Else Msgbox PathTLW End If objShell.run PathTIE & TIEArgs,1,False objShell.run PathTLW & TLWArgs,1,False Else Msgbox "Error! No OS bit-level detected." End If Strange, huh?
  10. This doesn't seem to apply. I can run Msgbox commands out the whazzoo and it will return the correct path every single time, regardless of being run on a 32/64-bit machine. Here is another test I ran where I hard coded the direct path to the executable: Dim objFileSys, OSBit, objShell, PathTIE, PathTLW Set objFileSys = CreateObject("Scripting.FileSystemObject") If (objFileSys.FolderExists("C:\Program Files (x86)")) Then OSBit = "64" Else OSBit = "32" End If If OSBit = "64" Then Set objShell = CreateObject("WScript.Shell") PathTIE = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.204 -u root" & chr(34) PathTLW = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.201 -u root" & chr(34) objShell.run PathTIE,1,False objShell.run PathTLW,1,False ElseIf OSBit = "32" Then Set objShell = CreateObject("WScript.Shell") PathTIE = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.204 -u root" & chr(34) PathTLW = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.201 -u root" & chr(34) objShell.run chr(34) & PathTIE & chr(34),1,False objShell.run chr(34) & PathTLW & chr(34),1,False Else Msgbox "Error! No OS bit-level detected." End If This is simply strict VBScript...there is no HTA involved here...and it STILL says "Cannot find the file specified". Again, with the code above, I have tried just about every permutation of chr(34), """, "", ", etc. to try to see what the heck the issue is. Thanks again for your replies.
  11. Sorry, I should have mentioned that this will be running as part of a sub. Thus, I cannot use parentheses.
  12. Hey guys/gals! At work, I do a lot of EDI processing. In order to cut down on the time it takes to locate each Excel spreadsheet, application, virtual machine, etc. I need to access while processing EDI, I have created an HTA utility that pretty much does everything I need: For each type of client EDI being processed, it executes specific applications, websites, yatta yatta. Here's the rub: I have incorporated a check for the "Program Files (x86)" folder (a kind of 64-bit OS check). Since I have done this, I cannot get VMWare Infrastructure Client to run! When I create a test snippet with the same code and remove the objShell.Run command and replace it with a simple message box telling me what variables it has stored, everything is accurate. So, I simply cannot figure out how this is wrong... Program Files check: Set objShell = CreateObject("WScript.Shell") ProgFilesPath = objShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") This works wonderfully - on 64-bit machines, it returns C:\Program Files (x86) On 32-bit machines, it returns C:\Program Files However, when I try to pass any of the following, I get a Path not found error... objShell.run ProgFilesPath & "\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.201 -u root -p " & RootPassword.Value,1,False PathTIE = chr(34) & objShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") & "\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.204 -u root -p " & RootPassword.Value & chr(34) objShell.run PathTIE,1,False I have tried different permutations of quotes, both with and without and I simply can't get it to work! Can someone tell me what I am doing wrong? Thanks, in advance, for your help!
×
×
  • Create New...