Just a thought: If all that futzing doesn't produce fruit, you may want to
wrap the legacy "NET SHARE" command. In your script if you detect an error
on get-smbshare then fall back to NET SHARE to gather the info get-smbshare
would have gathered.

 

From: listsadmin@lists.myitforum.com [mailto:listsadmin@lists.myitforum.com]
On Behalf Of Kelley, Matthew
Sent: Wednesday, May 4, 2016 8:18 am
To: 'powersh...@lists.myitforum.com' <powersh...@lists.myitforum.com>
Subject: [powershell] RE: Server 2008 R2

 

Looks like the wmi class doesn't exist on server 2008. You can look through
the MOF files (on server 2012) to see where the new namespace/classes get
their data from to see if you can easily pull the info from somewhere else
in WMI. Another option would be to identify any dlls and/or mof files
necessary for the new WMI namespace/classes and import/compile those, but
there likely are many other related components required that would not exist
on server 2008. There is some generic share info in server 2008. I don't see
anything referencing SMB though. 

 

gwmi -Namespace root\cimv2 -Class Win32_Share

 

 

From: listsadmin@lists.myitforum.com <mailto:listsadmin@lists.myitforum.com>
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Lemmiksoo, Todd
Sent: Wednesday, May 04, 2016 10:20 AM
To: 'powersh...@lists.myitforum.com'
Subject: [powershell] RE: Server 2008 R2

 

I copied the modules\smbshare folder to the 2008R2 server and now get
"Invalid namespace" error.

 



Will try the WMI command.

Still get the invalid namespace error.

 

Todd Lemmiksoo

225-237-1836

 

From: listsadmin@lists.myitforum.com <mailto:listsadmin@lists.myitforum.com>
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Kelley, Matthew
Sent: Wednesday, May 4, 2016 8:53 AM
To: powersh...@lists.myitforum.com <mailto:powersh...@lists.myitforum.com> 
Subject: [powershell] RE: Server 2008 R2

 

I would try to copy the folder over and see if it works, or just read
through the script and see if you can pull out the part you need.

 

C:\Windows\System32\WindowsPowerShell\v1.0\Modules\SmbShare

 

I opened up the cmdlet definition. It is querying this WMI namespace/class:

 

gwmi -Namespace "ROOT/Microsoft/Windows/SMB" -Class msft_smbshare | select *

 

Maybe  you can just use that somehow to get what you need?

 

From: listsadmin@lists.myitforum.com <mailto:listsadmin@lists.myitforum.com>
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Lemmiksoo, Todd
Sent: Wednesday, May 04, 2016 9:38 AM
To: powersh...@lists.myitforum.com <mailto:powersh...@lists.myitforum.com> 
Subject: [powershell] Server 2008 R2

 

I am trying to run a script the has "Get-SmbShare" in it. Is this command
not available on Server 2008 R2.

I have upgraded the PowerShell version on the server to ver 5.

 

Todd Lemmiksoo

System Engineer

225-237-1836

 

General Health System IS

8490 Picardy Ave Suite 500B

Baton Rouge, LA  70809

 

Confidentiality Notice: This email and its attachments may contain
privileged and confidential information and/or protected health information
(PHI) intended solely for the use of the recipient(s) named above. If you
are not the recipient, or the employee or agent responsible for delivering
this message to the intended recipient, you are hereby notified that any
review, dissemination, distribution, printing or copying of this email
message and/or any attachments is strictly prohibited. If you have received
this transmission in error, please notify the sender immediately by phone or
notify the Compliance Hotline at 1-866-737-4448 and permanently delete this
email and any attachments. 

 

**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be
used for urgent or sensitive issues 

 

Confidentiality Notice: This email and its attachments may contain
privileged and confidential information and/or protected health information
(PHI) intended solely for the use of the recipient(s) named above. If you
are not the recipient, or the employee or agent responsible for delivering
this message to the intended recipient, you are hereby notified that any
review, dissemination, distribution, printing or copying of this email
message and/or any attachments is strictly prohibited. If you have received
this transmission in error, please notify the sender immediately by phone or
notify the Compliance Hotline at 1-866-737-4448 and permanently delete this
email and any attachments. 

 

**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be
used for urgent or sensitive issues 

 



Reply via email to