/smsclictr.automation/SMSClient.cs

# · C# · 2523 lines · 903 code · 119 blank · 1501 comment · 52 complexity · 336bbab2d69dab737ea07272ba1e927a MD5 · raw file

Large files are truncated click here to view the full file

  1. //SCCM Client Center Automation Library (SMSCliCtr.automation)
  2. //Copyright (c) 2008 by Roger Zander
  3. //This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version.
  4. //This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
  5. //GNU General Public License: http://www.gnu.org/licenses/lgpl.html
  6. using System;
  7. using System.Collections;
  8. using System.Management;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. [assembly: CLSCompliant(false)]
  12. namespace smsclictr.automation
  13. {
  14. /// <summary>
  15. /// SMSClient automation main class
  16. /// </summary>
  17. public class SMSClient : IDisposable
  18. {
  19. #region Internal Settings
  20. private WMIProvider oWMIProvider;
  21. private ManagementObject mo_SMS_Authority;
  22. private string sSiteCode;
  23. private string sMP;
  24. private SMSSchedules oSMSSchedules;
  25. private WMIRegistry oWMIRegistry;
  26. private WMIService oWMIService;
  27. private CCMSoftwareDistribution oCCMSoftwareDistribution;
  28. private WindowsInstaller oMSI;
  29. private WMIFileIO oWMIFileIO;
  30. private WMIComputerSystem oCompSys;
  31. private SMSComponents oSMSComponents;
  32. private SCCMDCM oDCM;
  33. private ManagementObject oSMS_Client;
  34. private ManagementObject oCCM_Client;
  35. private ManagementObject oCacheConfig;
  36. internal string pHostname;
  37. internal string pUsername;
  38. internal string pPassword;
  39. internal string sSMSVersion = "";
  40. internal string sLocalSMSPath = "";
  41. #endregion
  42. #region Constructors
  43. /// <summary>
  44. /// SMSClient Constructor
  45. /// </summary>
  46. /// <param name="hostname">Hostname or IP-Address of the remote host</param>
  47. /// <example>
  48. /// C#:
  49. /// <code>
  50. /// using System;
  51. /// using System.Collections.Generic;
  52. /// using System.Text;
  53. /// using smsclictr.automation;
  54. /// using System.Management;
  55. ///
  56. /// namespace ConsoleApplication1
  57. /// {
  58. /// class Program
  59. /// {
  60. /// static void Main(string[] args)
  61. /// {
  62. /// SMSClient oClient = new SMSClient("workstation01");
  63. /// }
  64. /// }
  65. /// }
  66. /// </code>
  67. /// PowerShell:
  68. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  69. /// <code>
  70. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  71. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  72. /// </code>
  73. /// </example>
  74. public SMSClient(string hostname)
  75. {
  76. connect(hostname, null, null);
  77. }
  78. /// <summary>
  79. /// SMSClient Constructor
  80. /// </summary>
  81. /// <param name="hostname">Hostname or IP-Address of the remote host</param>
  82. /// <param name="username">Username to Logon (Domain\User)</param>
  83. /// <param name="password">Password of the specified Username</param>
  84. /// <example>
  85. /// C#:
  86. /// <code>
  87. /// using System;
  88. /// using System.Collections.Generic;
  89. /// using System.Text;
  90. /// using smsclictr.automation;
  91. /// using System.Management;
  92. ///
  93. /// namespace ConsoleApplication1
  94. /// {
  95. /// class Program
  96. /// {
  97. /// static void Main(string[] args)
  98. /// {
  99. /// SMSClient oClient = new SMSClient("workstation01", "Domain\SMSAdmin", "password");
  100. /// }
  101. /// }
  102. /// }
  103. /// </code>
  104. /// PowerShell:
  105. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  106. /// <code>
  107. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  108. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01", "Domain\SMSAdmin", "password")
  109. /// </code>
  110. /// </example>
  111. public SMSClient(string hostname, string username, string password)
  112. {
  113. connect(hostname, username, password);
  114. }
  115. /// <summary>
  116. /// SMSClient Constructor
  117. /// </summary>
  118. /// <param name="wmiProvider">WMIProvider</param>
  119. public SMSClient(WMIProvider wmiProvider)
  120. {
  121. connect(wmiProvider);
  122. }
  123. /// <summary>
  124. /// Connect the WMI Namespace root\cimv2 on a remote system
  125. /// </summary>
  126. /// <param name="sHostname">Hostname</param>
  127. protected void connect(string sHostname)
  128. {
  129. connect(sHostname, null, null);
  130. }
  131. /// <summary>
  132. /// Connect the WMI Namespace root\cimv2 on a remote system
  133. /// </summary>
  134. /// <param name="sHostname"></param>
  135. /// <param name="username"></param>
  136. /// <param name="password"></param>
  137. protected void connect(string sHostname, string username, string password)
  138. {
  139. oWMIProvider = new WMIProvider(@"\\" + sHostname + @"\ROOT\cimv2", username, password);
  140. connect(oWMIProvider);
  141. pHostname = sHostname;
  142. pUsername = username;
  143. pPassword = password;
  144. }
  145. /// <summary>
  146. /// Connect the WMI Namespace root\cimv2 on a remote system
  147. /// </summary>
  148. /// <param name="oProvider">WMI Provider</param>
  149. protected void connect(WMIProvider oProvider)
  150. {
  151. oWMIProvider = oProvider;
  152. oSMSSchedules = new SMSSchedules(oWMIProvider);
  153. oWMIRegistry = new WMIRegistry(oWMIProvider);
  154. oWMIService = new WMIService(oWMIProvider);
  155. oCCMSoftwareDistribution = new CCMSoftwareDistribution(oWMIProvider);
  156. oMSI = new WindowsInstaller(oWMIProvider);
  157. oWMIFileIO = new WMIFileIO(oWMIProvider);
  158. oCompSys = new WMIComputerSystem(oWMIProvider);
  159. oSMSComponents = new SMSComponents(oWMIProvider);
  160. oDCM = new SCCMDCM(oWMIProvider);
  161. }
  162. /// <summary>
  163. /// SMSSchedules Class
  164. /// </summary>
  165. public SMSSchedules Schedules { get { return oSMSSchedules; } }
  166. /// <summary>
  167. /// CCM_SoftwareDistribution Class
  168. /// </summary>
  169. public CCMSoftwareDistribution SoftwareDistribution { get { return oCCMSoftwareDistribution; } }
  170. /// <summary>
  171. /// WindowsInstaller Class
  172. /// </summary>
  173. public WindowsInstaller MSI { get { return oMSI; } }
  174. /// <summary>
  175. /// WMIFileIO Class
  176. /// </summary>
  177. public WMIFileIO FileIO { get { return oWMIFileIO; } }
  178. /// <summary>
  179. /// WMIComputerSystem Class
  180. /// </summary>
  181. public WMIComputerSystem ComputerSystem { get { return oCompSys; } }
  182. /// <summary>
  183. /// SMSComponents Class
  184. /// </summary>
  185. public SMSComponents Components { get { return oSMSComponents; } }
  186. /// <summary>
  187. /// SCCMDCM Class
  188. /// </summary>
  189. public SCCMDCM DCM { get { return oDCM; } }
  190. /// <summary>
  191. /// Cache the Object "root\ccm:SMS_Client"
  192. /// </summary>
  193. internal ManagementObject mSMS_Client
  194. {
  195. get
  196. {
  197. if ((oSMS_Client == null) | Reload)
  198. {
  199. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  200. oProv.mScope.Path.NamespacePath = @"ROOT\CCM";
  201. Reload = false;
  202. return oProv.GetObject("SMS_Client=@");
  203. }
  204. else
  205. return oSMS_Client;
  206. }
  207. set
  208. {
  209. oSMS_Client = value;
  210. }
  211. }
  212. /// <summary>
  213. /// Cache the Object "root\ccm:CCM_Client"
  214. /// </summary>
  215. internal ManagementObject mCCM_Client
  216. {
  217. get
  218. {
  219. if ((oCCM_Client == null) | Reload)
  220. {
  221. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  222. oProv.mScope.Path.NamespacePath = @"ROOT\CCM";
  223. Reload = false;
  224. return oProv.GetObject("CCM_Client=@");
  225. }
  226. else
  227. return oCCM_Client;
  228. }
  229. set
  230. {
  231. oCCM_Client = value;
  232. }
  233. }
  234. /// <summary>
  235. /// Cache the Object "root\ccm\SoftMgmtAgent:CacheConfig"
  236. /// </summary>
  237. internal ManagementObject mCacheConfig
  238. {
  239. get
  240. {
  241. if ((oCacheConfig == null) | Reload)
  242. {
  243. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  244. oProv.mScope.Path.NamespacePath = @"root\ccm\SoftMgmtAgent";
  245. Reload = false;
  246. return oProv.GetObject("CacheConfig.ConfigKey='Cache'");
  247. }
  248. else
  249. return oCacheConfig;
  250. }
  251. set
  252. {
  253. oCacheConfig = value;
  254. }
  255. }
  256. /// <summary>
  257. /// Do not use cached Object. Reload the Object (Once!)
  258. /// </summary>
  259. public bool Reload
  260. {
  261. get;set;
  262. }
  263. #endregion
  264. #region Puplic Properties
  265. /// <summary>
  266. /// Dispose
  267. /// </summary>
  268. public void Dispose()
  269. {
  270. oWMIProvider = null;
  271. GC.Collect();
  272. }
  273. /// <summary>
  274. /// Get or Set the assigned SMS SiteCode
  275. /// </summary>
  276. /// <example>
  277. /// C#:
  278. /// <code>
  279. /// using System;
  280. /// using System.Collections.Generic;
  281. /// using System.Text;
  282. /// using smsclictr.automation;
  283. /// using System.Management;
  284. ///
  285. /// namespace ConsoleApplication1
  286. /// {
  287. /// class Program
  288. /// {
  289. /// static void Main(string[] args)
  290. /// {
  291. /// SMSClient oClient = new SMSClient("workstation01");
  292. /// Console.WriteLine(oClient.SiteCode);
  293. /// }
  294. /// }
  295. /// }
  296. /// </code>
  297. /// PowerShell:
  298. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  299. /// <code>
  300. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  301. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  302. /// $SMSClient.SiteCode
  303. /// </code>
  304. /// </example>
  305. public string SiteCode
  306. {
  307. get
  308. {
  309. if (sSiteCode != null)
  310. return sSiteCode;
  311. else
  312. {
  313. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  314. oProv.mScope.Path.NamespacePath = @"ROOT\CCM";
  315. sSiteCode = oProv.ExecuteMethod("SMS_Client", "GetAssignedSite").GetPropertyValue("sSiteCode").ToString();
  316. return sSiteCode;
  317. }
  318. }
  319. set
  320. {
  321. if (string.IsNullOrEmpty(value))
  322. sSiteCode = null;
  323. else
  324. {
  325. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  326. oProv.mScope.Path.NamespacePath = @"ROOT\CCM";
  327. ManagementBaseObject inParams = oProv.GetClass("SMS_Client").GetMethodParameters("SetAssignedSite");
  328. inParams["sSiteCode"] = value;
  329. oProv.ExecuteMethod("SMS_Client", "SetAssignedSite", inParams);
  330. //sSiteCode = value;
  331. sSiteCode = null; //to clear the cached code...
  332. }
  333. }
  334. }
  335. /// <summary>
  336. /// Get the assigned Management Point
  337. /// </summary>
  338. /// <example>
  339. /// C#:
  340. /// <code>
  341. /// using System;
  342. /// using System.Collections.Generic;
  343. /// using System.Text;
  344. /// using smsclictr.automation;
  345. /// using System.Management;
  346. ///
  347. /// namespace ConsoleApplication1
  348. /// {
  349. /// class Program
  350. /// {
  351. /// static void Main(string[] args)
  352. /// {
  353. /// SMSClient oClient = new SMSClient("workstation01");
  354. /// Console.WriteLine(oClient.ManagementPoint);
  355. /// }
  356. /// }
  357. /// }
  358. /// </code>
  359. /// PowerShell:
  360. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  361. /// <code>
  362. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  363. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  364. /// $SMSClient.ManagementPoint
  365. /// </code>
  366. /// </example>
  367. public string ManagementPoint
  368. {
  369. get
  370. {
  371. if (!string.IsNullOrEmpty(sMP))
  372. return sMP;
  373. else
  374. {
  375. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  376. oProv.mScope.Path.NamespacePath = @"ROOT\CCM";
  377. mo_SMS_Authority = oProv.GetObject("SMS_Authority.Name='SMS:" + SiteCode + "'");
  378. return mo_SMS_Authority.GetPropertyValue("CurrentManagementPoint").ToString();
  379. }
  380. }
  381. set
  382. {
  383. if (string.IsNullOrEmpty(value))
  384. sMP = null;
  385. }
  386. }
  387. /// <summary>
  388. /// Get the assigned proxy Management Point (if the client belongs to a secondary site)
  389. /// </summary>
  390. /// <example>
  391. /// C#:
  392. /// <code>
  393. /// using System;
  394. /// using System.Collections.Generic;
  395. /// using System.Text;
  396. /// using smsclictr.automation;
  397. /// using System.Management;
  398. ///
  399. /// namespace ConsoleApplication1
  400. /// {
  401. /// class Program
  402. /// {
  403. /// static void Main(string[] args)
  404. /// {
  405. /// SMSClient oClient = new SMSClient("workstation01");
  406. /// Console.WriteLine(oClient.ProxyManagementPoint);
  407. /// }
  408. /// }
  409. /// }
  410. /// </code>
  411. /// PowerShell:
  412. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  413. /// <code>
  414. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  415. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  416. /// $SMSClient.ProxyManagementPoint
  417. /// </code>
  418. /// </example>
  419. public string ProxyManagementPoint
  420. {
  421. get
  422. {
  423. ManagementObjectCollection MPProxies;
  424. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  425. oProv.mScope.Path.NamespacePath = @"ROOT\CCM";
  426. MPProxies = oProv.ExecuteQuery("SELECT * FROM SMS_MPProxyInformation Where State = 'Active'");
  427. foreach (ManagementObject MPProxy in MPProxies)
  428. {
  429. return MPProxy.GetPropertyValue("Name").ToString();
  430. }
  431. return null;
  432. }
  433. }
  434. /// <summary>
  435. /// Get the assigned Internet Management Point
  436. /// </summary>
  437. /// <example>
  438. /// C#:
  439. /// <code>
  440. /// using System;
  441. /// using System.Collections.Generic;
  442. /// using System.Text;
  443. /// using smsclictr.automation;
  444. /// using System.Management;
  445. ///
  446. /// namespace ConsoleApplication1
  447. /// {
  448. /// class Program
  449. /// {
  450. /// static void Main(string[] args)
  451. /// {
  452. /// SMSClient oClient = new SMSClient("workstation01");
  453. /// Console.WriteLine(oClient.InternetMP);
  454. /// }
  455. /// }
  456. /// }
  457. /// </code>
  458. /// PowerShell:
  459. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  460. /// <code>
  461. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  462. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  463. /// $SMSClient.InternetMP
  464. /// </code>
  465. /// </example>
  466. public string InternetMP
  467. {
  468. get
  469. {
  470. string sPort = oWMIRegistry.GetString(2147483650, @"SOFTWARE\Microsoft\SMS\Client\Internet Facing", "Internet MP Hostname", "");
  471. if (string.IsNullOrEmpty(sPort))
  472. {
  473. if (this.ComputerSystem.Win32_ComputerSystem["SystemType"].ToString().ToLower().Contains("x64"))
  474. {
  475. sPort = oWMIRegistry.GetString(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\SMS\Client\Internet Facing", "Internet MP Hostname", "");
  476. }
  477. }
  478. return sPort;
  479. }
  480. set
  481. {
  482. if (!this.ComputerSystem.Win32_ComputerSystem["SystemType"].ToString().ToLower().Contains("x64"))
  483. {
  484. oWMIRegistry.SetStringValue(2147483650, @"SOFTWARE\Microsoft\SMS\Client\Internet Facing", "Internet MP Hostname", value);
  485. }
  486. else
  487. {
  488. oWMIRegistry.SetStringValue(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\SMS\Client\Internet Facing", "Internet MP Hostname", value);
  489. }
  490. }
  491. }
  492. /// <summary>
  493. /// Get the assigned DNS Suffix
  494. /// </summary>
  495. /// <example>
  496. /// C#:
  497. /// <code>
  498. /// using System;
  499. /// using System.Collections.Generic;
  500. /// using System.Text;
  501. /// using smsclictr.automation;
  502. /// using System.Management;
  503. ///
  504. /// namespace ConsoleApplication1
  505. /// {
  506. /// class Program
  507. /// {
  508. /// static void Main(string[] args)
  509. /// {
  510. /// SMSClient oClient = new SMSClient("workstation01");
  511. /// Console.WriteLine(oClient.DNSSuffix);
  512. /// }
  513. /// }
  514. /// }
  515. /// </code>
  516. /// PowerShell:
  517. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  518. /// <code>
  519. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  520. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  521. /// $SMSClient.DNSSuffix
  522. /// </code>
  523. /// </example>
  524. public string DNSSuffix
  525. {
  526. get
  527. {
  528. string sPort = oWMIRegistry.GetString(2147483650, @"SOFTWARE\Microsoft\CCM\LocationServices", "DnsSuffix", "");
  529. if (string.IsNullOrEmpty(sPort))
  530. {
  531. if (this.ComputerSystem.Win32_ComputerSystem["SystemType"].ToString().ToLower().Contains("x64"))
  532. {
  533. sPort = oWMIRegistry.GetString(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\CCM\LocationServices", "DnsSuffix", "");
  534. }
  535. }
  536. return sPort;
  537. }
  538. set
  539. {
  540. if (this.ComputerSystem.Win32_ComputerSystem["SystemType"].ToString().ToLower().Contains("x64"))
  541. {
  542. oWMIRegistry.SetStringValue(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\CCM\LocationServices", "DnsSuffix", value);
  543. }
  544. else
  545. {
  546. oWMIRegistry.SetStringValue(2147483650, @"SOFTWARE\Microsoft\CCM\LocationServices", "DnsSuffix", value);
  547. }
  548. }
  549. }
  550. /// <summary>
  551. /// Get or Set the HTTP port for Client-Server communication
  552. /// </summary>
  553. /// <example>
  554. /// C#:
  555. /// <code>
  556. /// using System;
  557. /// using System.Collections.Generic;
  558. /// using System.Text;
  559. /// using smsclictr.automation;
  560. /// using System.Management;
  561. ///
  562. /// namespace ConsoleApplication1
  563. /// {
  564. /// class Program
  565. /// {
  566. /// static void Main(string[] args)
  567. /// {
  568. /// SMSClient oClient = new SMSClient("workstation01");
  569. /// Console.WriteLine(oClient.HttpPort);
  570. /// }
  571. /// }
  572. /// }
  573. /// </code>
  574. /// PowerShell:
  575. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  576. /// <code>
  577. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  578. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  579. /// $SMSClient.HttpPort
  580. /// </code>
  581. /// </example>
  582. public string HttpPort
  583. {
  584. get
  585. {
  586. string sPort = oWMIRegistry.GetDWord(2147483650, @"SOFTWARE\Microsoft\CCM", "HttpPort", "");
  587. if (string.IsNullOrEmpty(sPort))
  588. {
  589. if (this.ComputerSystem.Win32_ComputerSystem["SystemType"].ToString().ToLower().Contains("x64"))
  590. {
  591. sPort = oWMIRegistry.GetDWord(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\CCM", "HttpPort", "");
  592. }
  593. }
  594. return sPort;
  595. }
  596. set
  597. {
  598. if (this.ComputerSystem.Win32_ComputerSystem["SystemType"].ToString().ToLower().Contains("x64"))
  599. {
  600. oWMIRegistry.SetDWord(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\CCM", "HttpPort", value);
  601. }
  602. else
  603. {
  604. oWMIRegistry.SetDWord(2147483650, @"SOFTWARE\Microsoft\CCM", "HttpPort", value);
  605. }
  606. }
  607. }
  608. /// <summary>
  609. /// Get or Set the SCCM Server Locator Point
  610. /// </summary>
  611. /// <example>
  612. /// C#:
  613. /// <code>
  614. /// using System;
  615. /// using System.Collections.Generic;
  616. /// using System.Text;
  617. /// using smsclictr.automation;
  618. /// using System.Management;
  619. ///
  620. /// namespace ConsoleApplication1
  621. /// {
  622. /// class Program
  623. /// {
  624. /// static void Main(string[] args)
  625. /// {
  626. /// SMSClient oClient = new SMSClient("workstation01");
  627. /// Console.WriteLine(oClient.ServerLocatorPoint);
  628. /// }
  629. /// }
  630. /// }
  631. /// </code>
  632. /// PowerShell:
  633. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  634. /// <code>
  635. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  636. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  637. /// $SMSClient.ServerLocatorPoint
  638. /// </code>
  639. /// </example>
  640. public string ServerLocatorPoint
  641. {
  642. get
  643. {
  644. if (!this.oWMIProvider.isX86)
  645. {
  646. return oWMIRegistry.GetString(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\CCM", "SMSSLP");
  647. }
  648. else
  649. {
  650. return oWMIRegistry.GetString(2147483650, @"SOFTWARE\Microsoft\CCM", "SMSSLP");
  651. }
  652. }
  653. set
  654. {
  655. if (!this.oWMIProvider.isX86)
  656. {
  657. oWMIRegistry.SetStringValue(2147483650, @"SOFTWARE\Wow6432Node\Microsoft\CCM", "SMSSLP", value);
  658. }
  659. else
  660. {
  661. oWMIRegistry.SetStringValue(2147483650, @"SOFTWARE\Microsoft\CCM", "SMSSLP", value);
  662. }
  663. }
  664. }
  665. /// <summary>
  666. /// Get or Set the SMS Cache Path
  667. /// </summary>
  668. /// <example>
  669. /// C#:
  670. /// <code>
  671. /// using System;
  672. /// using System.Collections.Generic;
  673. /// using System.Text;
  674. /// using smsclictr.automation;
  675. /// using System.Management;
  676. ///
  677. /// namespace ConsoleApplication1
  678. /// {
  679. /// class Program
  680. /// {
  681. /// static void Main(string[] args)
  682. /// {
  683. /// SMSClient oClient = new SMSClient("workstation01");
  684. /// Console.WriteLine(oClient.CachePath);
  685. /// }
  686. /// }
  687. /// }
  688. /// </code>
  689. /// PowerShell:
  690. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  691. /// <code>
  692. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  693. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  694. /// $SMSClient.CachePath
  695. /// </code>
  696. /// </example>
  697. public string CachePath
  698. {
  699. get
  700. {
  701. return mCacheConfig.GetPropertyValue("Location").ToString();
  702. }
  703. set
  704. {
  705. string CachePath = value;
  706. if (CachePath.Length > 3)
  707. {
  708. ManagementObject MO = mCacheConfig;
  709. MO.SetPropertyValue("Location", CachePath);
  710. MO.Put();
  711. mCacheConfig = MO;
  712. }
  713. }
  714. }
  715. /// <summary>
  716. /// Get or Set the SMS Cache Size in Megabyte (MB)
  717. /// </summary>
  718. /// <example>
  719. /// C#:
  720. /// <code>
  721. /// using System;
  722. /// using System.Collections.Generic;
  723. /// using System.Text;
  724. /// using smsclictr.automation;
  725. /// using System.Management;
  726. ///
  727. /// namespace ConsoleApplication1
  728. /// {
  729. /// class Program
  730. /// {
  731. /// static void Main(string[] args)
  732. /// {
  733. /// SMSClient oClient = new SMSClient("workstation01");
  734. /// UInt32 CacheSize = UInt32.Parse(oClient.CacheSize);
  735. /// if (CacheSize != 600)
  736. /// {
  737. /// //Set the CacheSize to 600MB
  738. /// oClient.CacheSize = "600";
  739. /// }
  740. /// }
  741. /// }
  742. /// }
  743. /// </code>
  744. /// PowerShell:
  745. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  746. /// <code>
  747. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  748. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  749. /// $SMSClient.CacheSize = "600"
  750. /// </code>
  751. /// </example>
  752. public string CacheSize
  753. {
  754. get
  755. {
  756. return mCacheConfig.GetPropertyValue("Size").ToString();
  757. }
  758. set
  759. {
  760. UInt32 CacheSize = System.Convert.ToUInt32(value);
  761. if (CacheSize > 0)
  762. {
  763. ManagementObject MO = mCacheConfig;
  764. MO.SetPropertyValue("Size", CacheSize);
  765. MO.Put();
  766. mCacheConfig = MO;
  767. }
  768. }
  769. }
  770. /// <summary>
  771. /// Size of the downloaded packages in cache
  772. /// </summary>
  773. public Int32 CacheContentSize
  774. {
  775. get
  776. {
  777. ManagementObjectCollection MOC;
  778. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  779. oProv.mScope.Path.NamespacePath = @"root\ccm\SoftMgmtAgent";
  780. if (this.SMSVersion.StartsWith("4"))
  781. {
  782. MOC = oProv.ExecuteQuery("SELECT * FROM CacheInfoEx");
  783. }
  784. else
  785. {
  786. MOC = oProv.ExecuteQuery("SELECT * FROM CacheInfo");
  787. }
  788. Int32 uSize = 0;
  789. foreach (ManagementObject MO in MOC)
  790. {
  791. uSize = uSize + Int32.Parse(MO.GetPropertyValue("ContentSize").ToString());
  792. }
  793. return uSize;
  794. }
  795. }
  796. /// <summary>
  797. /// Allow the local Admin to override Site Settings
  798. /// </summary>
  799. /// <example>
  800. /// C#:
  801. /// <code>
  802. /// using System;
  803. /// using System.Collections.Generic;
  804. /// using System.Text;
  805. /// using smsclictr.automation;
  806. /// using System.Management;
  807. ///
  808. /// namespace ConsoleApplication1
  809. /// {
  810. /// class Program
  811. /// {
  812. /// static void Main(string[] args)
  813. /// {
  814. /// SMSClient oClient = new SMSClient("workstation01");
  815. /// //Prevent an Admin to change SMS Settings (Control Panel)
  816. /// oClient.AllowLocalAdminOverride = false;
  817. /// }
  818. /// }
  819. /// }
  820. /// </code>
  821. /// PowerShell:
  822. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  823. /// <code>
  824. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  825. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  826. /// $SMSClient.AllowLocalAdminOverride = "False"
  827. /// </code>
  828. /// </example>
  829. public bool AllowLocalAdminOverride
  830. {
  831. get
  832. {
  833. return Boolean.Parse(mSMS_Client.GetPropertyValue("AllowLocalAdminOverride").ToString());
  834. }
  835. set
  836. {
  837. ManagementObject MO = mSMS_Client;
  838. MO.SetPropertyValue("AllowLocalAdminOverride", value);
  839. MO.Put();
  840. mSMS_Client = MO;
  841. MO.Dispose();
  842. }
  843. }
  844. /// <summary>
  845. /// Get the SMS Agent Type
  846. /// </summary>
  847. /// <remarks>
  848. /// <list type="bullet">
  849. /// <item>1 = Advanced Client</item>
  850. /// <item>0 = Legacy Client</item>
  851. /// </list>
  852. /// </remarks>
  853. /// <example>
  854. /// C#:
  855. /// <code>
  856. /// using System;
  857. /// using System.Collections.Generic;
  858. /// using System.Text;
  859. /// using smsclictr.automation;
  860. /// using System.Management;
  861. ///
  862. /// namespace ConsoleApplication1
  863. /// {
  864. /// class Program
  865. /// {
  866. /// static void Main(string[] args)
  867. /// {
  868. /// SMSClient oClient = new SMSClient("workstation01");
  869. /// if (oClient.ClientType == 1)
  870. /// {
  871. /// Console.WriteLine("Advanced Client");
  872. /// }
  873. /// else
  874. /// {
  875. /// Console.WriteLine("Legacy Client");
  876. /// }
  877. /// }
  878. /// }
  879. /// }
  880. /// </code>
  881. /// PowerShell:
  882. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  883. /// <code>
  884. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  885. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  886. /// $SMSClient.ClientType
  887. /// </code>
  888. /// </example>
  889. public int ClientType
  890. {
  891. get
  892. {
  893. return int.Parse(mSMS_Client.GetPropertyValue("ClientType").ToString());
  894. }
  895. }
  896. /// <summary>
  897. /// Enable automatic Site assignment.
  898. /// <para>This will force the SMS Client to automatically reassign the SMS Site if the client roams to another SMS Primary Site.</para>
  899. /// </summary>
  900. /// <example>
  901. /// C#:
  902. /// <code>
  903. /// using System;
  904. /// using System.Collections.Generic;
  905. /// using System.Text;
  906. /// using smsclictr.automation;
  907. /// using System.Management;
  908. ///
  909. /// namespace ConsoleApplication1
  910. /// {
  911. /// class Program
  912. /// {
  913. /// static void Main(string[] args)
  914. /// {
  915. /// SMSClient oClient = new SMSClient("workstation01");
  916. /// oClient.EnableAutoAssignment = true;
  917. /// }
  918. /// }
  919. /// }
  920. /// </code>
  921. /// PowerShell:
  922. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  923. /// <code>
  924. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  925. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  926. /// $SMSClient.EnableAutoAssignment = "True"
  927. /// </code>
  928. /// </example>
  929. public bool EnableAutoAssignment {
  930. get
  931. {
  932. return bool.Parse(mSMS_Client.GetPropertyValue("EnableAutoAssignment").ToString());
  933. }
  934. set
  935. {
  936. //WMIProvider oProv = new WMIProvider(oWMIProvider.mScope);
  937. //oProv.mScope.Path.NamespacePath = @"ROOT\CCM";
  938. ManagementObject MO = mSMS_Client;
  939. MO.SetPropertyValue("EnableAutoAssignment", value);
  940. MO.Put();
  941. //Refresh cached Object
  942. mSMS_Client = MO;
  943. MO.Dispose();
  944. }
  945. }
  946. /// <summary>
  947. /// Get the SMS GUID
  948. /// </summary>
  949. /// <example>
  950. /// C#:
  951. /// <code>
  952. /// using System;
  953. /// using System.Collections.Generic;
  954. /// using System.Text;
  955. /// using smsclictr.automation;
  956. /// using System.Management;
  957. ///
  958. /// namespace ConsoleApplication1
  959. /// {
  960. /// class Program
  961. /// {
  962. /// static void Main(string[] args)
  963. /// {
  964. /// SMSClient oClient = new SMSClient("workstation01");
  965. /// Console.WriteLine(oClient.ClientId);
  966. /// }
  967. /// }
  968. /// }
  969. /// </code>
  970. /// PowerShell:
  971. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  972. /// <code>
  973. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  974. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  975. /// $SMSClient.ClientID
  976. /// </code>
  977. /// Output Example:
  978. /// <code>
  979. /// GUID:645567CB-D0C5-4A31-8D54-A74A88E565C4
  980. /// </code>
  981. /// </example>
  982. public string ClientId
  983. {
  984. get
  985. {
  986. return mCCM_Client.GetPropertyValue("ClientId").ToString();
  987. }
  988. }
  989. /// <summary>
  990. /// Delete the SMS/SCCM GUID on next SMS Agent restart
  991. /// </summary>
  992. /// <example>
  993. /// C#:
  994. /// <code>
  995. /// using System;
  996. /// using System.Collections.Generic;
  997. /// using System.Text;
  998. /// using smsclictr.automation;
  999. /// using System.Management;
  1000. ///
  1001. /// namespace ConsoleApplication1
  1002. /// {
  1003. /// class Program
  1004. /// {
  1005. /// static void Main(string[] args)
  1006. /// {
  1007. /// SMSClient oClient = new SMSClient("workstation01");
  1008. /// oClient.DeleteGUID();
  1009. /// oClient.RestartSMSAgent();
  1010. /// }
  1011. /// }
  1012. /// }
  1013. /// </code>
  1014. /// PowerShell:
  1015. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  1016. /// <code>
  1017. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  1018. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  1019. /// $SMSClient.DeleteGUID()
  1020. /// $SMSClient.RestartSMSAgent()
  1021. /// </code>
  1022. /// </example>
  1023. public void DeleteGUID()
  1024. {
  1025. if (this.SMSVersion.StartsWith("4"))
  1026. {
  1027. //Create an SMSCFG.INI File with a new, random GUID ...
  1028. using (System.IO.StreamWriter sw = new System.IO.StreamWriter(@"\\" + this.Connection.mScope.Path.Server + @"\admin$\SMSCFG.INI", false))
  1029. {
  1030. sw.WriteLine("[Configuration - Client Properties]");
  1031. sw.WriteLine("SMS Unique Identifier=GUID:" + System.Guid.NewGuid().ToString().ToUpper());
  1032. sw.Close();
  1033. }
  1034. }
  1035. else
  1036. {
  1037. //On SMS2003 Agents, delete the smscfg.ini
  1038. string WinDir = ComputerSystem.WindowsDirectory;
  1039. FileIO.DeleteFile(WinDir + @"\smscfg.ini");
  1040. }
  1041. }
  1042. /// <summary>
  1043. /// Get the last GUID change date
  1044. /// </summary>
  1045. /// <example>
  1046. /// C#:
  1047. /// <code>
  1048. /// using System;
  1049. /// using System.Collections.Generic;
  1050. /// using System.Text;
  1051. /// using smsclictr.automation;
  1052. /// using System.Management;
  1053. ///
  1054. /// namespace ConsoleApplication1
  1055. /// {
  1056. /// class Program
  1057. /// {
  1058. /// static void Main(string[] args)
  1059. /// {
  1060. /// SMSClient oClient = new SMSClient("workstation01");
  1061. /// Console.WriteLine(oClient.ClientIdChangeDate);
  1062. /// }
  1063. /// }
  1064. /// }
  1065. /// </code>
  1066. /// PowerShell:
  1067. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  1068. /// <code>
  1069. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  1070. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  1071. /// $SMSClient.ClientIDChangeDate
  1072. /// </code>
  1073. /// Output Example:
  1074. /// <code>
  1075. /// 12/22/2006 15:18:10
  1076. /// </code>
  1077. /// </example>
  1078. public string ClientIdChangeDate
  1079. {
  1080. get
  1081. {
  1082. return mCCM_Client.GetPropertyValue("ClientIdChangeDate").ToString();
  1083. }
  1084. }
  1085. /// <summary>
  1086. /// Get the previous SMS GUID
  1087. /// </summary>
  1088. /// <example>
  1089. /// C#:
  1090. /// <code>
  1091. /// using System;
  1092. /// using System.Collections.Generic;
  1093. /// using System.Text;
  1094. /// using smsclictr.automation;
  1095. /// using System.Management;
  1096. ///
  1097. /// namespace ConsoleApplication1
  1098. /// {
  1099. /// class Program
  1100. /// {
  1101. /// static void Main(string[] args)
  1102. /// {
  1103. /// SMSClient oClient = new SMSClient("workstation01");
  1104. /// Console.WriteLine(oClient.PreviousClientID);
  1105. /// }
  1106. /// }
  1107. /// }
  1108. /// </code>
  1109. /// PowerShell:
  1110. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  1111. /// <code>
  1112. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  1113. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  1114. /// $SMSClient.PreviousClientID
  1115. /// </code>
  1116. /// Output Example:
  1117. /// <code>
  1118. /// GUID:645567CB-D0C5-4A31-8D54-A74A88E565C4
  1119. /// </code>
  1120. /// </example>
  1121. public string PreviousClientId
  1122. {
  1123. get
  1124. {
  1125. return mCCM_Client.GetPropertyValue("PreviousClientId").ToString();
  1126. }
  1127. }
  1128. /// <summary>
  1129. /// Get the SMS Version (like 2.50 )
  1130. /// </summary>
  1131. /// <value>
  1132. /// Known SMS Versions:
  1133. /// <list type="bullet">
  1134. /// <item>2.50 = SMS 2003</item>
  1135. /// <item>2.00 = SMS 2.0</item>
  1136. /// </list>
  1137. /// </value>
  1138. /// <example>
  1139. /// C#:
  1140. /// <code>
  1141. /// using System;
  1142. /// using System.Collections.Generic;
  1143. /// using System.Text;
  1144. /// using smsclictr.automation;
  1145. /// using System.Management;
  1146. ///
  1147. /// namespace ConsoleApplication1
  1148. /// {
  1149. /// class Program
  1150. /// {
  1151. /// static void Main(string[] args)
  1152. /// {
  1153. /// SMSClient oClient = new SMSClient("workstation01");
  1154. /// Console.WriteLine(oClient.SMSVersion);
  1155. /// }
  1156. /// }
  1157. /// }
  1158. /// </code>
  1159. /// PowerShell:
  1160. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  1161. /// <code>
  1162. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  1163. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  1164. /// $SMSClient.SMSVersion
  1165. /// </code>
  1166. /// </example>
  1167. public string SMSVersion
  1168. {
  1169. get
  1170. {
  1171. if (string.IsNullOrEmpty(sSMSVersion))
  1172. {
  1173. string sVersion = mSMS_Client.GetPropertyValue("ClientVersion").ToString();
  1174. return sVersion;
  1175. }
  1176. else
  1177. return sSMSVersion;
  1178. }
  1179. set
  1180. {
  1181. sSMSVersion = "";
  1182. oSMS_Client = null;
  1183. }
  1184. }
  1185. /// <summary>
  1186. /// Get the Log-Directory Path
  1187. /// </summary>
  1188. /// <example>
  1189. /// C#:
  1190. /// <code>
  1191. /// using System;
  1192. /// using System.Collections.Generic;
  1193. /// using System.Text;
  1194. /// using smsclictr.automation;
  1195. /// using System.Management;
  1196. ///
  1197. /// namespace ConsoleApplication1
  1198. /// {
  1199. /// class Program
  1200. /// {
  1201. /// static void Main(string[] args)
  1202. /// {
  1203. /// SMSClient oClient = new SMSClient("workstation01");
  1204. /// Console.WriteLine(oClient.LogDirectory);
  1205. /// }
  1206. /// }
  1207. /// }
  1208. /// </code>
  1209. /// PowerShell:
  1210. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  1211. /// <code>
  1212. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  1213. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  1214. /// $SMSClient.LogDirectory
  1215. /// </code>
  1216. /// Output Example:
  1217. /// <code>
  1218. /// C:\WINDOWS\system32\CCM\Logs
  1219. /// </code>
  1220. /// </example>
  1221. public string LogDirectory
  1222. {
  1223. get
  1224. {
  1225. WMIProvider oProv = new WMIProvider(oWMIProvider.mScope.Clone());
  1226. oProv.mScope.Path.NamespacePath = @"ROOT\CCM\Policy\Machine";
  1227. return oProv.GetObject("CCM_Logging_GlobalConfiguration.DummyKey=1").GetPropertyValue("LogDirectory").ToString();
  1228. }
  1229. }
  1230. /// <summary>
  1231. /// Get the Local SMS Path
  1232. /// </summary>
  1233. /// <example>
  1234. /// C#:
  1235. /// <code>
  1236. /// using System;
  1237. /// using System.Collections.Generic;
  1238. /// using System.Text;
  1239. /// using smsclictr.automation;
  1240. /// using System.Management;
  1241. ///
  1242. /// namespace ConsoleApplication1
  1243. /// {
  1244. /// class Program
  1245. /// {
  1246. /// static void Main(string[] args)
  1247. /// {
  1248. /// SMSClient oClient = new SMSClient("workstation01");
  1249. /// Console.WriteLine(oClient.LocalSMSPath);
  1250. /// }
  1251. /// }
  1252. /// }
  1253. /// </code>
  1254. /// PowerShell:
  1255. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  1256. /// <code>
  1257. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  1258. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  1259. /// $SMSClient.LocalSMSPath
  1260. /// </code>
  1261. /// Output Example:
  1262. /// <code>
  1263. /// C:\WINDOWS\system32\CCM
  1264. /// </code>
  1265. /// </example>
  1266. public string LocalSMSPath
  1267. {
  1268. get
  1269. {
  1270. if (string.IsNullOrEmpty(sLocalSMSPath))
  1271. {
  1272. sLocalSMSPath = oWMIRegistry.GetString(2147483650, @"SOFTWARE\Microsoft\SMS\Client\Configuration\Client Properties", "Local SMS Path");
  1273. }
  1274. return sLocalSMSPath;
  1275. }
  1276. }
  1277. /// <summary>
  1278. /// Get the MSI ProductCode of the installed SMS Client Agent
  1279. /// </summary>
  1280. /// <example>
  1281. /// C#:
  1282. /// <code>
  1283. /// using System;
  1284. /// using System.Collections.Generic;
  1285. /// using System.Text;
  1286. /// using smsclictr.automation;
  1287. /// using System.Management;
  1288. ///
  1289. /// namespace ConsoleApplication1
  1290. /// {
  1291. /// class Program
  1292. /// {
  1293. /// static void Main(string[] args)
  1294. /// {
  1295. /// SMSClient oClient = new SMSClient("workstation01");
  1296. /// Console.WriteLine(oClient.ProductCode);
  1297. /// }
  1298. /// }
  1299. /// }
  1300. /// </code>
  1301. /// PowerShell:
  1302. /// <para>(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)</para>
  1303. /// <code>
  1304. /// [void][System.Reflection.Assembly]::LoadFile("$HOME\smsclictr.automation.dll")
  1305. /// $SMSClient = New-Object -TypeName smsclictr.automation.SMSClient("workstation01")
  1306. /// $SMSClient.ProductCode
  1307. /// </code>
  1308. /// Output Example:
  1309. /// <code>
  1310. /// {D97113AD-690F-4169-8637-4A046282D8F6}
  1311. /// </code>
  1312. /// </example>
  1313. public string ProductCode
  1314. {
  1315. get