Made a script to find share paths; How do I exclude with certain criteria

I have a few file server clusters with a bunch of shares on them and I need to add permissions for a security group to all the shares. The first step is getting all the shares. I can do this with gwmi -class win32_share so I wrote a powershell script to
do this across all the file servers. It works as expected with one issue, it gives me the share paths plus the path to the drive letters (i.e. \\FileServer\J$). I am thinking I can put some kind of IF statement to exclude anything with *$* but I don't know
how to go about this. Any thoughts?
Import-Module activedirectory
$ErrorActionPreference = "SilentlyContinue"
$ComputerName=Get-ADComputer -Filter {name -like "FS*"} | %{$_.dnshostName}
$Computers=gwmi -class win32_share -computername $ComputerName
ForEach ($Computer in $Computers){
Write-Host $Computer.Name

gwmi -class win32_share  -filter 'type=0 and name <> "print$"'
This ignores all admin shares.
¯\_(ツ)_/¯

Similar Messages

  • System cannot find the path specified when sending emails with attachments

    I've had an on going issue for some time on one of my clients whereby users will intermittently get this error "The System cannot find the path specified." when they try to send an email with an attachment.
    The issue seems to arise generally (though reportedly not only when) when someone creates an email and attaches a file but leaves it for some time before finishing and sending.
    The staff run in a Windows 2008 R2 full Terminal Server desktop environment on Office 2010 (32-bit 14.0.7140.5002) and several staff have reported the same issue.
    I have been able to replicate the issue in their environment by creating an email and leaving it for some time.
    After a fair bit of scouting around I found that if I monitor the temp directory that the attachments get placed into (content.outlook under Temporary Internet Files on user profile) and found that the directory with the attachments would disappear after
    a period of time which would then cause the error where obviously Outlook could not find the file that had now gone.
    I don't know of any Outlook settings that would cause this and the issue isn't related to temporary Internet files filling up as I've recreated the error on a user account where there is nothing else stored in the Temporary Internet Files.
    To work around the issue I have changed the reg file that tells Outlook where to place these files (HKCU/Sofware/Microsoft/office/14.0/outlook/security - OutlookSecureTempFolder) to a location in the users home drive.
    This appears to resolve the problem however I am noticing 1 issue with this.  Unlike the temp folder which gets purged after a file is no longer required, the location I've changed it to does not clear out old files.
    While it shouldn't be too difficult to add a script that can clear the files at log off it would be good to see if anyone may know what the cause of the problem in the first place is.  I would rather it work as it should than have to bodge around changing
    the folder and scripting file deletes.
    Does anyone know of what maybe causing the attachments and content.outlook folder to disappear?
    thanks

    Do you have any redirected folder in your environment? Is the original Temporary Internet Files folder stored on a server?
    Basically, the attachments remain in the Outlook Secure Temporary File folder if we exit Microsoft Outlook while email attachments are open. See:
    http://support.microsoft.com/kb/817878
    Flynn

  • Need to find the instruction how to set up with messages

    I need messages (former iChat) manual.

    Hi,
    Messages is iChat+  (Templeton Peck wrote iCal...)
    It still has the Buddy Lists with the AIM  and Jabber Buddies you might have.
    However at first start up the App does tend to require an Apple ID to "register" it for iMessages (the new bit to the app).
    This adds the Apple ID as an Account labled as iMessages in the Messages Menu > Preferences > Accounts
    You can also add other Accounts (Screen Names that are valid with AIM and various Jabber IDs)
    Once you have added your AIM Screen Name then the Buddy list is in the Window Menu > Buddies with the CMD + 1 keystrokes.
    At this point it is a combined list  (Bonjour if Enabled, AIM and Jabber Buddies all in one list)
    GO to the General section of the Preferences and untick the line about gathering all accounts in to one List.
    If you have several Buddy Lists logged in they will now appear separately like they did in iChat.
    A Buddy list can then chat AIM Valid Name to AIM Valid Name.
    AIM valid names can be those Registered at AIM
    Or they can be certain types of Apple ID  (those ending @mac.com and @me.com)
    Obviously this means that your Apple ID may be the iMessages ID and the AIM name you use.
    This will mean entering the ID twice. (As Templeton Peck implies.)
    10:32 PM      Wednesday; October 31, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How to select records with certain fields unique while others not

    Hi,
    For example, I have table with 6 columns, called 'A', 'B', 'C', 'D', 'E', 'F'. There's no unique constraint built-in, and I would like to select records that have both column 'A' and 'B' unique. What should the sql statement look like?
    Columns 'C', 'D', 'E', 'F' can have same data in different records or null, not a concern.
    Thanks.

    select A, B, max(C), max(D), max(E), max(F) from <your_tab>
    group by A, B
    select * from (select t.*, row_number() over (partition by A,B order by null) rn from <your_tab> t)
    where rn=1they are not the same, but seem to meet your needs both.

  • Find a text frame on the page with script label

    hello to all
    I need to create a script to
    find a text frame on the page with script label "xxx"
    and read its contents into a variable.
    The content of the text frame is a number.
    thanks

    Hi Roberto,
    Welcome to the forum,
    This will find the labeled textFrame on the active page.
    var myLabel = "Foo", // change to label
          myPage = app.properties.activeWindow && app.activeWindow.activePage,
          myTextFrames = myPage.textFrames.everyItem().getElements().slice(0),
          l = myTextFrames.length,
          myVariable
    while (l--) {
        if (myTextFrames[l].label != myLabel) continue;
        myVariable = myTextFrames[l].contents;
        break; // presuming there's only one "Foo" labeled frame on the page
        // Otherwise you'll nead an array
    alert(myVariable)
    Trevor

  • Script to find duplicate index and how can we tell if an index is REALLY a duplicate?

    Does any one have script to find duplicate index? and how can we tell if an index is REALLY a duplicate?
    Rahul

    One more written by Itzik Ben-Gan
    The first query finds exact matches. The indexes must have 
    the same key columns in the same order, and the same included columns but in any order. 
    These indexes are sure targets for elimination. The only caution would be to check for index hints. 
    -- exact duplicates
    with indexcols as
    select object_id as id, index_id as indid, name,
    (select case keyno when 0 then NULL else colid end as [data()]
    from sys.sysindexkeys as k
    where k.id = i.object_id
    and k.indid = i.index_id
    order by keyno, colid
    for xml path('')) as cols,
    (select case keyno when 0 then colid else NULL end as [data()]
    from sys.sysindexkeys as k
    where k.id = i.object_id
    and k.indid = i.index_id
    order by colid
    for xml path('')) as inc
    from sys.indexes as i
    select
    object_schema_name(c1.id) + '.' + object_name(c1.id) as 'table',
    c1.name as 'index',
    c2.name as 'exactduplicate'
    from indexcols as c1
    join indexcols as c2
    on c1.id = c2.id
    and c1.indid < c2.indid
    and c1.cols = c2.cols
    and c1.inc = c2.inc;
    The second variation of this query finds partial, or duplicate, indexes 
    that share leading key columns, e.g. Ix1(col1, col2, col3) and Ix2(col1, col2) 
    would be considered duplicate indexes. This query only examines key columns and does not consider included columns. 
    These types of indexes are probable dead indexes walking. 
    -- Overlapping indxes
    with indexcols as
    select object_id as id, index_id as indid, name,
    (select case keyno when 0 then NULL else colid end as [data()]
    from sys.sysindexkeys as k
    where k.id = i.object_id
    and k.indid = i.index_id
    order by keyno, colid
    for xml path('')) as cols
    from sys.indexes as i
    select
    object_schema_name(c1.id) + '.' + object_name(c1.id) as 'table',
    c1.name as 'index',
    c2.name as 'partialduplicate'
    from indexcols as c1
    join indexcols as c2
    on c1.id = c2.id
    and c1.indid < c2.indid
    and (c1.cols like c2.cols + '%' 
    or c2.cols like c1.cols + '%') ;
    Be careful when dropping a partial duplicate index if the two indexes differ greatly in width. 
    For example, if Ix1 is a very wide index with 12 columns, and Ix2 is a narrow two-column index 
    that shares the first two columns, you may want to leave Ix2 as a faster, tighter, narrower index.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • HOW TO FIND MENU PATH FOR A TCODE

    PLZ TELL ME HOW TO FIND MENU PATH FOR A TCODE .
    I HAVE MADE A MENU ENHANCEMENT  WITH TCODE +DW2.
    IT MENU PATH IS NOT TRACEABLE.

    Hi Madan,
    It is in the transaction code <b>S001</b>.
    Check my previous post on this.
    It is not listed on the SAP Menu. Thats why SEARCH_SAP_MENU returns nothing...
    <b>Go to the Initial Screen and then type /n in the TCODE.
    From there now type S001 to go to transaction S001.</b>
    The other ways do not work. Like combining both in a single step : "/ns001".

  • How do I find the path (source) of a document in mavericks?

    how do I find the path (source) of a document in mavericks?

    See if you can find the file using this program
    EasyFind – Spotlight Replacement

  • How do I find the path to a TestStand sequence file using LabVIEW

    My LabVIEW application launches a bunch of teststand sequences, provided it has the complete path to each of them. I want to make it more flexible by providing it just the name of the TestStand sequence so that it will go and find the path to the sequence by searching a directory structure. TestStand has a neat FindFile() function that can do this, but I need to do this from within LabVIEW. Is there a way to do it?

    There are a few ways to do this depending on how you are getting the sequence files.  If you are calling the GetSequenceFileEx method, you can just pass the GetSeqFile_FindFile (0x20) flag in the SequenceFileFlags property.  If you are using the ApplicationMgr.OpenSequenceFile method, this is automatically done for you.
    If you want to use the FindFile function in general, you can use the Engine.FindFile method.
    Allen P.
    NI

  • How to find a path in Application server?

    Hi,
    I have a reqirement that i need to download the original document which is attached in the DIR links for each line item in the PO.
    Say for Eg. user is uploading the original document in CV03n.
    Through program i have to download it and save it in local desktop.
    But as per my concern when user uploads that document in CV03N,  it should get updated in application server.
    I wants to know how can i find that path through the document got updated in AL11.
    Please let me know if you have any idea on this.
    Also please let me know if my question is not clear.
    Regards,
    Prabu

    Hi Prabu,
    It depends on how DMS is implemented in your place.
    If DMS is implemented along with CONTENT SERVER, then the actual document uploaded is stored in CONTENT SERVER and only a link is saved in SAP DB and whenever you refer to this link the image is being retrieved and displayed.
    If you dont have content server then the uploaded documents are stored in your application server only. Generally the big companies which implement DMS do have a content server otherwise DB size will grow enormously in no time.
    Once you check out the basics of ur requirement, then search through FM's available related to DMS.
    Hope this answer helps.
    Regards,
    Lakshmi Narayana

  • I made a path how can I select it

    i made a path how can I select it

    You'd be better off Googling some proper Pen Tool tutorials rather than learning it in dribs and drabs via this forum.
    Even the Help might be an OK option, but a good tutorial probably makes for a more engaging read.

  • Hello - does anyone now how to place a complain for an over charged invoice over a in-purchase game? Apple is charging 10 times more the purchase we made and I cannot find anyplace in the App store to complain online or via email? Please help if you know

    Hello - does anyone now how to place a complain for an over charged invoice over a in-purchase game? Apple is charging 10 times more the purchase we made and I cannot find anyplace in the App store to complain online or via email? Please help if you know

    Use the Report a Problem link in the iTunes email receipt you received. Also in-app purchases can be made without the password if you bought the app within the last 15min. You should enable the in-app restriction in Settings.

  • How do I complete uninstalling itunes? when I try installing i get an error message saying it can't find the path ,itunes64.msi missing.

    How do I complete uninstalling itunes? when I try installing i get an error message saying it can't find the path ,itunes64.msi missing

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it, which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    The section Install missing components has advice on breaking down the iTunes installer into the individual .msi files which might prove useful if one component won't install normally.
    tt2

  • Iphone 6 airdrop problem can't find or connect to my iPhone 5s to share pic, how i can fix this ? at the same time my iPhone 5s no problem with airdrop to share.

    Iphone 6 airdrop probleme can't find or connect to my iPhone 5s to share pic, how i can fix this ? at the same time my iPhone 5s no problem with airdrop to share.

    hi raz, i don't have problem how to use airdrop , but the iPhone  6 can not find other contact so i can share pic , and i have iOS 8.0.2 on both iphone.and i have the same network .
    with iPhone 5s i can share with airdrop and he find my iPhone 6 name so i share and accept pic, but from iPhone 6 i can't do the same.

  • I have made my iphone 4s restore by accident. how can i find my messages?

    i have made my iphone 4s restore by accident. how can i find my messages?

    Do you have a backup?  If you restored as new, your messages were deleted.  Unless you have a backup to restore from, they are gone permanently.  Do you regularly backup in iTunes or to iCloud?

Maybe you are looking for

  • What Type Of Hard Drive Do I Have & Backing Up.

    I just got an email from Apple that says I have a Seagate Hard Drive that my fail and it is on recall.  Call them to set up for a hard drive replacement.  This raises questions for me I hope I can get answers here for. 1.  How can I check to see if I

  • Windows crashing - random BSOD on Windows 7 64-bit

    Hello I tried reading this forum and tried IMO everything but computer still gets BSOD. I'm including Dump File. I don't know how to read it. Any advice? http://sdrv.ms/1gwJEKq What I did: memtest86 - passed ccleaner regcleaner antivirus scan reinsta

  • Steps to create another domain on WLS6?

    Hi, I am trying to create another domain in weblogic6.0, which by default have three domain already in there. 1. I startup example server and open weblogic admin console. http://localhost:7001/console/ 2. I select 'Create or edit other Domains' item

  • Ni 5112 soft front panel

    Hi: Can you tell me how to mesuare a voltage of 5.1V on soft front panel? Because I got 5.1 volts on soft front panel, but it stop there and it did not go back to 0V in a horizontal line. When I used the real osciloscope, I can get that and it will r

  • Space between portlets

    Using top HTML portlets for banner and left side HTML portlet for menu how I can make it look seamless? Currently I have 2 pix spacing between portlets.