�����JFIF��XX����������    $.' ",#(7),01444'9=82<.342  2!!22222222222222222222222222222222222222222222222222�����"����4���������������������������� ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������,�PG"Z_�4�˷����kjز�Z�,F+��_z�,�© �����zh6�٨�ic�fu������������������������������������#ډb���_�N��?�����������wQ���5-�~�I���8���������������������������������TK<5o�Iv-������������������k�_U_������������������������������~b�M��d��������Ӝ�U�Hh��?]��E�w��Q���k�{��_}qFW7HTՑ��Y��F�����?_�'ϔ��_�Ջt������������������������=||I �����6�έ"�����D���/[�k�9����Y�8������ds|\���Ҿp6�Ҵ���]��.����6���z<�v��@]�i%������������������������$j��~����g��J>��no����pM[me�i$[�����������s�o�ᘨ�˸ nɜG-�ĨU�ycP���3.DB�li�;���������������������hj���x����7Z^�N�h��������N3u{�:j�����x�힞��#M��&��jL P@��_���� P�������������������&��o8��������9������@Sz���6�t7#O�ߋ �����s}Yf�T������lmr����Z)'N��k�۞p�����w\�T���������������ȯ?�8`���O��i{wﭹW�[�r�� ��Q4F�׊������3m&L�=��h3�������z~��#����\�l :�F,j@�� ʱ�wQT����8�"kJO����6�֚l������������������}����R�>ډK���]��y����&����p�}b������;N�1�m�r$����|��7�>e�@���B�TM*-i�H��g�D�)� E�m�|�ؘbҗ�a���Ҿ����������������t4�����o���G��*oCN�rP���Q��@z,|?W[0���������:�n,j���WiE��W������$~/�hp\��?��{(�0���+�Y8rΟ�+����>S-S���������������VN;���}�s?.����� w��9��˟<���Mq4�Wv'������{)0�1mB����V����W[��������8�/<� �%���wT^�5���b��)iM� p�g�N�&ݝ������������VO~��q���u���9��� ����!��J27�����$����O-���! �:���%H��� ـ�������y�ΠM=t{!S�� �oK8�������t<����è��������:a��������[������ա�H���~��w��Qz`�p����o�^ ������Q��n����� �,uu�C��$ ^���,�������8�#��:�6��e�|~�����������!�3��3.�\0�����q��o�4`.|� ����y�Q�`~;�d�ׯ,��O�Zw�������`73�v�܋�<�����Ȏ�� ـ4k��5�K�a�u�=9Yd��$>x�A�&�� j0� ���vF��� Y���|�y��� ~�6�@c��1vOp��������Ig�����4��l�OD�����L����� R���c���j�_�uX�6��3?nk��Wy�f;^*B� ��@���~a�`��Eu�������+�����6�L��.ü>��}y���}_�O�6�͐�:�Yr���G�X��kG������l^w����������~㒶sy���Iu�!���� W ��X��N�7BV��O��!X�2����wvG�R�f�T#�����t�/?���%8�^�W�aT����G�cL�M���I��(J����1~�8�?aT ���]����AS�E��(��*E}� 2������#I/�׍qz��^t�̔���������b�Yz4x����t�){ OH�����+(E��A&�N�������XT��o��"�XC����'���)}�J�z�p� ����~5�}�^����+�6����w��c��Q�|�Lp�d�H��}�(�.|����k��c4^�����"�����Z?ȕ ��a<�������L�!0�39C� �Eu�����C�F�Ew�ç ;�n?�*o���B�8�bʝ���'#Rqf����M}7����]�������s2tcS{�\icTx;�\��7K���P������ʇ Z O-��~�������c>"��?��������P�����E��O�8��@�8��G��Q�g�a�Վ���󁶠��䧘��_%#r�>�����1�z�a���eb��qcP��ѵ��n���#L��� =��׀t� L�7�`�����V����A{�C:�g���e@�����w1 Xp�3�c3�ġ�������p��M"'-�@n4���fG���B3�DJ�8[Jo�ߐ���gK)ƛ��$���� �������8�3�����+���� �����6�ʻ���� ���S�kI�*KZlT _`�������?��K�����QK�d���������B`�s}�>���`������*�>��,*@J�d�oF*�����弝��O}�k��s��]��y�ߘ�������c1G�V���<=�7��7����6��q�PT��tXԀ�!9*4�4Tހ���3XΛex�46�������Y��D ����� ����BdemDa����\�_l,����G�/���֌7���Y�](�xTt^%�GE�����4�}bT����ڹ�����;��Y)���B�Q��u��>J/J ���⮶.�XԄ��j�ݳ������+E��d ���r�5�_D�����1 ���o�� �B�x�΢�#����<��W�����8���R6�@���g�M�.��� dr�D��>(otU��@�x=��~v���2� ӣ�d�oBd�����3�eO�6�㣷����������ݜ�6��6Y��Qz`����S��{���\P��~z m5{J/L��1������<�e�ͅPu���b�]�ϔ��������'�������f�b� Zpw��c`"��i���BD@:)ִ�:�]��h���v�E��w���T�l�������P����"Ju�}��وV ��J��G6��. J/�Qgl߭�e�����@�z�Zev2u����)]կ���������7x�������s�M�-<ɯ�c��r��v�����@��$�ޮ}lk���a����'����>x��O\�Z������Fu>������ck#��&:��`�$��ai�>2Δ����l���oF[h�������lE�ܺ�Π���k:)���`������� $[6�����9�����kOw�\|�����8}������ބ:��񶐕��������I�A1/���=�2[�,�!��.}gN#�u����b���� ~���������݊��}34q�����d�E��L��������c��$���"�[q�U�硬g^��%B ��z���r�p�������J�ru%v\h�����1Y�ne`������ǥ:g����pQM~�^��Xi� ��`S�:V2������9.�P���V������?B�k�� ��������AEvw%�_�9C�Q����wKekP�ؠ�\������;Io d�{ ߞo�c1eP�����\� `����E=���@K<�Y��������eڼ�J����w����{av�F�'�M�@��������������/J��+9p����|]���������Iw &`���8���&�M�hg���[�{�������Xj���%��Ӓ�������������������$��(�����ʹN�������<>�I���RY�����K2�NPlL�ɀ�)��&e��������B+ь����(������������������� � �JTx����_?EZ� }@���� 6�U���뙢ط�z��dWI��n` D����噥�[��uV��"�G&�����Ú����2�g�}&m���������������������?ċ���"����Om#�������������������������� ��{���������������������ON��"S�X���Ne��ysQ���@�������������Fn��Vg�����dX�~nj����������������������]J�<�K]:����FW���b�������62����������=��5f����JKw����bf�X������������������������55��~J �%^�������:�-�QIE��P��v�nZum� z � ~ə ���� ���ة����;�f��\v�������g�8�1��f2�������������������������4;�V���ǔ�)�������������������9���1\������������������������������c��v�/'Ƞ�w������������������$�4�R-��t����������������������������������� e�6�/�ġ �̕Ecy�J���u�B���<�W�ַ~�w[B1L۲�-JS΂�{���΃�������������������������������������������A��20�c#���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@���� 0!1@AP"#2Q`$3V�%45a6�FRUq����� ������^7ׅ,$n��������+��F�`��2X'��0vM��p�L=�������5��8������u�p~���.�`r�����\����O��,ư�0oS ��_�M�����l���4�kv\JSd���x���SW�<��Ae�IX����������$I���w�:S���y���›R��9�Q[���,�5�;�@]�%���u�@ *ro�lbI �� ��+���%m:�͇ZV�����u�̉����θau<�fc�.����{�4Ա� �Q����*�Sm��8\ujqs]{kN���)qO�y�_*dJ�b�7���yQqI&9�ԌK!�M}�R�;�������S�T���1���i[U�ɵz�]��U)V�S6���3$K{��ߊ<�(� E]Զ[ǼENg�����'�\?#)Dkf��J���o��v���'�%ƞ�&K�u��!��b�35LX�Ϸ��63$K�a�;�9>,R��W��3�3� d�JeTYE.Mϧ��-�o�j3+y��y^�c�������VO�9NV\nd�1 ��!͕_)a�v;����թ�M�lWR1��)El��P;��yوÏ�u 3�k�5Pr6<�⒲l�!˞*��u־�n�!�l:����UNW ��%��Chx8vL'��X�@��*��)���̮��ˍ��� ����D-M�+J�U�kvK����+�x8��cY������?�Ԡ��~3mo��|�u@[XeY�C�\Kp�x8�oC�C�&����N�~3-H���� ��MX�s�u<`���~"WL��$8ξ��3���a�)|:@�m�\���^�`�@ҷ)�5p+��6���p�%i)P M���ngc�����#0Aruz���RL+xSS?���ʮ}()#�t��mˇ!��0}}y����<�e� �-ή�Ԩ��X������ MF���ԙ~l L.3���}�V뽺�v������멬��Nl�)�2����^�Iq��a��M��qG��T�����c3#������3U�Ǎ���}��לS�|qa��ڃ�+���-��2�f����/��bz��ڐ�� �ݼ[2�ç����k�X�2�* �Z�d���J�G����M*9W���s{��w���T��x��y,�in�O�v��]���n����P�$��JB@=4�OTI�n��e�22a\����q�d���%�$��(���:���: /*�K[PR�fr\nڙdN���F�n�$�4��[�� U�zƶ����� �mʋ���,�ao�u 3�z� �x��Kn����\[��VFmbE;�_U��&V�Gg�]L�۪&#n%�$ɯ��dG���D�TI=�%+AB�Ru#��b4�1�»x�cs�YzڙJG��f��Il���d�eF'T� iA��T���uC�$����Y��H?����[!G`}���ͪ� �纤Hv\������j�Ex�K���!���OiƸ�Yj�+u-<���'q����uN�*�r\��+�]���<�wOZ.fp�ێ��,-*)V?j-kÊ#�`�r��dV����(�ݽBk�����G�ƛk�QmUڗe��Z���f}|����8�8��a���i��3'J�����~G_�^���d�8w������ R�`(�~�.��u���l�s+g�bv���W���lGc}��u���afE~1�Ue������Z�0�8�=e�� f@/�jqEKQQ�J���oN��J���W5~M>$6�Lt�;$ʳ{���^��6�{����v6���ķܰg�V�cnn �~z�x�«�,2�u�?cE+Ș�H؎�%�Za�)���X>uW�Tz�Nyo����s���FQƤ��$��*�&�LLXL)�1�" L��eO��ɟ�9=���:t��Z���c��Ž���Y?�ӭV�wv�~,Y��r�ۗ�|�y��GaF�����C�����.�+� ���v1���fήJ�����]�S��T��B��n5sW}y�$��~z�'�c ��8 ��� ,! �p��VN�S��N�N�q��y8z˱�A��4��*��'������2n<�s���^ǧ˭P�Jޮɏ�U�G�L�J�*#��<�V��t7�8����TĜ>��i}K%,���)[��z�21z ?�N�i�n1?T�I�R#��m-�����������������1����lA�`��fT5+��ܐ�c�q՝��ʐ��,���3�f2U�եmab��#ŠdQ�y>\��)�SLY����w#��.���ʑ�f��� ,"+�w�~�N�'�c�O�3F�������N<���)j��&��,-� �љ���֊�_�zS���TǦ����w�>��?�������n��U仆�V���e�����0���$�C�d���rP �m�׈e�Xm�Vu� �L��.�bֹ��� �[Դaզ���*��\y�8�Է:�Ez\�0�Kq�C b��̘��cө���Q��=0Y��s�N��S.����3.���O�o:���#���v7�[#߫ ��5�܎�L���Er4���9n��COWlG�^��0k�%<���ZB���aB_���������'=��{i�v�l�$�uC���mƎҝ{�c㱼�y]���W�i ��ߧc��m�H� m�"�"�����;Y�ߝ�Z�Ǔ�����:S#��|}�y�,/k�Ld� TA�(�AI$+I3��;Y*���Z��}|��ӧO��d�v��..#:n��f>�>���ȶI�TX��� 8��y����"d�R�|�)0���=���n4��6ⲑ�+��r<�O�܂~zh�z����7ܓ�HH�Ga롏���nCo�>������a ���~]���R���̲c?�6(�q�;5%� |�uj�~z8R�=X��I�V=�|{v�Gj\gc��q����z�؋%M�ߍ����1y��#��@f^���^�>N������#x#۹��6�Y~�?�dfPO��{��P�4��V��u1E1J �*|���%����JN��`eWu�zk M6���q t[�� ��g�G���v��WIG��u_ft����5�j�"�Y�:T��ɐ���*�;� e5���4����q$C��2d�}���� _S�L#m�Yp��O�.�C�;��c����Hi#֩%+) �Ӎ��ƲV���SYź��g |���tj��3�8���r|���V��1#;.SQ�A[���S������#���`n�+���$��$�I �P\[�@�s��(�ED�z���P��])8�G#��0B��[ى��X�II�q<��9�~[Z멜�Z�⊔IWU&A>�P~�#��dp<�?����7���c��'~���5 ��+$���lx@�M�dm��n<=e�dyX��?{�|Aef ,|n3�<~z�ƃ�uۧ�����P��Y,�ӥQ�*g�#먙R�\���;T��i,��[9Qi歉����c>]9�� ��"�c��P�� �Md?٥��If�ت�u��k��/����F��9�c*9��Ǎ:�ØF���z�n*�@|I�ށ9����N3{'��[�'ͬ�Ҳ4��#}��!�V� Fu��,�,mTIk���v C�7v���B�6k�T9��1�*l� '~��ƞF��lU��'�M ����][ΩũJ_�{�i�I�n��$����L�� j��O�dx�����kza۪��#�E��Cl����x˘�o�����V���ɞ�ljr��)�/,�߬h�L��#��^��L�ф�,íMƁe�̩�NB�L�����iL����q�}��(��q��6IçJ$�W�E$��:������=#����(�K�B����zђ <��K(�N�۫K�w��^O{!����)��H���>x�������lx�?>Պ�+�>�W���,Ly!_�D���Ō�l���Q�!�[ �S����J��1��Ɛ�Y}��b,+�Lo�x�ɓ)����=�y�oh�@�꥟/��I��ѭ=��P�y9��� �ۍYӘ�e+�p�Jnϱ?V\SO%�(�t� ���=?MR�[Ș�����d�/ ��n�l��B�7j� ��!�;ӥ�/�[-���A�>��dN�sLj ��,ɪv��=1c�.SQ�O3�U���ƀ�ܽ�E����������̻��9G�ϷD�7(�}��Ävӌ\��y�_0[w ���<΍>����a_��[0+�L��F.�޺��f�>oN�T����q;���y\��bՃ��y�jH�<|q-eɏ�_?_9+P���Hp$�����[ux�K w�Mw��N�ی'$Y2�=��q���KB��P��~�������Yul:�[<����F1�2�O���5=d����]Y�sw:���Ϯ���E��j,_Q��X��z`H1,#II ��d�wr��P˂@�ZJV����y$�\y�{}��^~���[:N����ߌ�U�������O��d�����ؾe��${p>G��3c���Ė�lʌ�� ת��[��`ϱ�-W����dg�I��ig2��� ��}s ��ؤ(%#sS@���~���3�X�nRG�~\jc3�v��ӍL��M[JB�T��s3}��j�Nʖ��W����;7���ç?=X�F=-�=����q�ߚ���#���='�c��7���ڑW�I(O+=:uxq�������������e2�zi+�kuG�R��������0�&e�n���iT^J����~\jy���p'dtG��s����O��3����9* �b#Ɋ�� p������[Bws�T�>d4�ۧs���nv�n���U���_�~,�v����ƜJ1��s�� �QIz���)�(lv8M���U=�;����56��G���s#�K���MP�=��LvyGd��}�VwWBF�'�à �?MH�U�g2�� ����!�p�7Q��j��ڴ����=��j�u��� Jn�A s���uM������e��Ɔ�Ҕ�!)�'��8Ϣ�ٔ���ޝ(��Vp���צ֖d=�IC�J�Ǡ{q������kԭ�߸���i��@K����u�|�p=..�*+����x�����z[Aqġ#s2a�Ɗ���RR�)*HRsi�~�a &f��M��P����-K�L@��Z��Xy�'x�{}��Zm+���:�)�) IJ�-i�u���� ���ܒH��'��L(7�y�GӜq���� j��� 6ߌg1�g�o���,kر���tY�?W,���p���e���f�OQS��!K�۟cҒA�|ս�j�>��=⬒��˧L[�� �߿2JaB~R��u�:��Q�] �0H~���]�7��Ƽ�I���(�}��cq '�ήET���q�?f�ab���ӥvr� �)o��-Q��_'����ᴎo��K������;��V���o��%���~OK ����*��b�f:���-ťIR��`B�5!RB@���ï�� �u �̯e\�_U�_������� g�ES��3��������QT��a�����x����U<~�c?�*�#]�MW,[8O�a�x��]�1bC|踤�P��lw5V%�)�{t�<��d��5���0i�XSU��m:��Z�┵�i�"��1�^B�-��P�hJ��&)O��*�D��c�W��vM��)����}���P��ܗ-q����\mmζZ-l@�}��a��E�6��F�@��&Sg@���ݚ�M����� ȹ 4����#p�\H����dYDo�H���"��\��..R�B�H�z_�/5˘����6��KhJR��P�mƶi�m���3��,#c�co��q�a)*P�t����R�m�k�7x�D�E�\Y�閣_X�<���~�)���c[[�BP����6�Yq���S��0����%_����;��Àv�~�| VS؇ ��'O0��F0��\���U�-�d@�����7�SJ*z��3n��y��P����O����������m�~�P�3|Y��ʉr#�C�<�G~�.,! ���bqx���h~0=��!ǫ�jy����l��O,�[B��~��|9��ٱ����Xly�#�i�B��g%�S��������tˋ���e���ې��\[d�t)��.+u�|1 ������#�~Oj����hS�%��i.�~X���I�H�m��0n���c�1uE�q��cF�RF�o���7� �O�ꮧ� ���ۛ{��ʛi5�rw?׌#Qn�TW��~?y$��m\�\o����%W� ?=>S�N@�� �Ʈ���R����N�)�r"C�:��:����� �����#��qb��Y�. �6[��2K����2u�Ǧ�HYR��Q�MV��� �G�$��Q+.>�����nNH��q�^��� ����q��mM��V��D�+�-�#*�U�̒ ���p욳��u:�������IB���m����PV@O���r[b= �� ��1U�E��_Nm�yKbN�O���U�}�the�`�|6֮P>�\2�P�V���I�D�i�P�O;�9�r�mAHG�W�S]��J*�_�G��+kP�2����Ka�Z���H�'K�x�W�MZ%�O�YD�Rc+o��?�q��Ghm��d�S�oh�\�D�|:W������UA�Qc yT�q��������~^�H��/��#p�CZ���T�I�1�ӏT����4��"�ČZ�����}��`w�#�*,ʹ�� ��0�i��課�Om�*�da��^gJ݅{���l�e9uF#T�ֲ��̲�ٞC"�q���ߍ ոޑ�o#�XZTp����@ o�8��(jd��xw�]�,f���`~��|,s��^����f�1���t��|��m�򸄭/ctr��5s��7�9Q�4�H1꠲BB@�l9@���C�����+�wp�xu�£Yc�9��?`@#�o�mH�s2��)�=��2�.�l����jg�9$�Y�S�%*L������R�Y������7Z���,*=�䷘$�������arm�o�ϰ���UW.|�r�uf����IGw�t����Zwo��~5 ��YյhO+=8fF�)�W�7�L9lM�̘·Y���֘YLf�큹�pRF���99.A �"wz��=E\Z���'a� 2��Ǚ�#;�'}�G���*��l��^"q��+2FQ� hj��kŦ��${���ޮ-�T�٭cf�|�3#~�RJ����t��$b�(R��(����r���dx� >U b�&9,>���%E\� Ά�e�$��'�q't��*�א���ެ�b��-|d���SB�O�O��$�R+�H�)�܎�K��1m`;�J�2�Y~9��O�g8=vqD`K[�F)k�[���1m޼c��n���]s�k�z$@��)!I �x՝"v��9=�ZA=`Ɠi �:�E��)`�7��vI��}d�YI�_ �o�:ob���o ���3Q��&D&�2=�� �Ά��;>�h����y.*ⅥS������Ӭ�+q&����j|UƧ�����}���J0��WW< ۋS�)jQR�j���Ư��rN)�Gű�4Ѷ(�S)Ǣ�8��i��W52���No˓� ۍ%�5brOn�L�;�n��\G����=�^U�dI���8$�&���h��'���+�(������cȁ߫k�l��S^���cƗjԌE�ꭔ��gF���Ȓ��@���}O���*;e�v�WV���YJ\�]X'5��ղ�k�F��b 6R�o՜m��i N�i�����>J����?��lPm�U��}>_Z&�KK��q�r��I�D�Չ~�q�3fL�:S�e>���E���-G���{L�6p�e,8��������QI��h��a�Xa��U�A'���ʂ���s�+טIjP�-��y�8ۈZ?J$��W�P� ��R�s�]��|�l(�ԓ��sƊi��o(��S0���Y� 8�T97.�����WiL��c�~�dxc�E|�2!�X�K�Ƙਫ਼�$((�6�~|d9u+�qd�^3�89��Y�6L�.I�����?���iI�q���9�)O/뚅����O���X��X�V��ZF[�یgQ�L��K1���RҖr@v�#��X�l��F���Нy�S�8�7�kF!A��sM���^rkp�jP�DyS$N���q���nxҍ!U�f�!eh�i�2�m����`�Y�I�9r�6� �TF���C}/�y�^���Η���5d�'��9A-��J��>{�_l+�`��A���[�'��յ�ϛ#w:݅�%��X�}�&�PSt�Q�"�-��\縵�/����$Ɨh�Xb�*�y��BS����;W�ջ_mc�����vt?2}1�;qS�d�d~u:2k5�2�R�~�z+|HE!)�Ǟl��7`��0�<�,�2*���Hl-��x�^����'_TV�gZA�'j� ^�2Ϊ��N7t�����?w�� �x1��f��Iz�C-Ȗ��K�^q�;���-W�DvT�7��8�Z�������� hK�(P:��Q- �8�n�Z���܃e貾�<�1�YT<�,�����"�6{�/ �?�͟��|1�:�#g��W�>$����d��J��d�B���=��jf[��%rE^��il:��B���x���Sּ�1հ��,�=��*�7 fcG��#q� �eh?��2�7�����,�!7x��6�n�LC�4x��},Geǝ�tC.��vS �F�43��zz\��;QYC,6����~;RYS/6���|2���5���v��T��i����������mlv��������&� �nRh^ejR�LG�f���? �ۉҬܦƩ��|��Ȱ����>3����!v��i�ʯ�>�v��オ�X3e���_1z�Kȗ\<������!�8���V��]��?b�k41�Re��T�q��mz��TiOʦ�Z��Xq���L������q"+���2ۨ��8}�&N7XU7Ap�d�X��~�׿��&4e�o�F��� �H�����O���č�c�� 懴�6���͉��+)��v;j��ݷ�� �UV�� i��� j���Y9GdÒJ1��詞�����V?h��l�����l�cGs�ځ�������y�Ac������\V3�? �� ܙg�>qH�S,�E�W�[�㺨�uch�⍸�O�}���a��>�q�6�n6�����N6�q��������N� ���! 1AQaq�0@����"2BRb�#Pr���3C`��Scst���$4D���%Td���� ?�����N����a��3��m���C���w��������xA�m�q�m����m������$����4n淿t'��C"w��zU=D�\R+w�p+Y�T�&�պ@��ƃ��3ޯ?�Aﶂ��aŘ���@-�����Q�=���9D��ռ�ѻ@��M�V��P��܅�G5�f�Y<�u=,EC)�<�Fy'�"�&�չ�X~f��l�KԆV��?�� �W�N����=(� �;���{�r����ٌ�Y���h{�١������jW����P���Tc�����X�K�r��}���w�R��%��?���E��m�� �Y�q|����\lEE4����r���}�lsI�Y������f�$�=�d�yO����p�����yBj8jU�o�/�S��?�U��*������ˍ�0�������u�q�m [�?f����a�� )Q�>����6#������� ?����0UQ����,IX���(6ڵ[�DI�MNލ�c&���υ�j\��X�R|,4��� j������T�hA�e��^���d���b<����n�� �즇�=!���3�^�`j�h�ȓr��jẕ�c�,ٞX����-����a�ﶔ���#�$��]w�O��Ӫ�1y%��L�Y<�wg#�ǝ�̗`�x�xa�t�w��»1���o7o5��>�m뭛C���Uƃߜ}�C���y1Xνm�F8�jI���]����H���ۺиE@I�i;r�8ӭ�����V�F�Շ| ��&?�3|x�B�MuS�Ge�=Ӕ�#BE5G������Y!z��_e��q�р/W>|-�Ci߇�t�1ޯќd�R3�u��g�=0 5��[?�#͏��q�cf���H��{ ?u�=?�?ǯ���}Z��z���hmΔ�BFTW�����<�q��(v� ��!��z���iW]*�J�V�z��gX֧A�q�&��/w���u�gYӘa���; �i=����g:��?2�dž6�ى�k�4�>�Pxs����}������G�9���3 ���)gG�R<>r h�$��'nc�h�P��Bj��J�ҧH� -��N1���N��?��~��}-q!=��_2hc�M��l�vY%UE�@|�v����M2�.Y[|y�"Eï��K�ZF,�ɯ?,q�?v�M 80jx�"�;�9vk�����+ ֧�� �ȺU��?�%�vcV��mA�6��Qg^M�����A}�3�nl� QRN�l8�kkn�'�����(��M�7m9و�q���%ޟ���*h$Zk"��$�9��: �?U8�Sl��,,|ɒ��xH(ѷ����Gn�/Q�4�P��G�%��Ա8�N��!� �&�7�;���eKM7�4��9R/%����l�c>�x;������>��C�:�����t��h?aKX�bhe�ᜋ^�$�Iհ �hr7%F$�E��Fd���t��5���+�(M6�t����Ü�UU|zW�=a�Ts�Tg������dqP�Q����b'�m���1{|Y����X�N��b �P~��F^F:����k6�"�j!�� �I�r�`��1&�-$�Bevk:y���#y�w��I0��x��=D�4��tU���P�ZH��ڠ底taP��6����b>�xa�����Q�#� WeF��ŮNj�p�J* mQ�N�����*I�-*�ȩ�F�g�3 �5��V�ʊ�ɮ�a��5F���O@{���NX��?����H�]3��1�Ri_u��������ѕ�� ����0��� F��~��:60�p�͈�S��qX#a�5>���`�o&+�<2�D����: �������ڝ�$�nP���*)�N�|y�Ej�F�5ټ�e���ihy�Z �>���k�bH�a�v��h�-#���!�Po=@k̆IEN��@��}Ll?j�O������߭�ʞ���Q|A07x���wt!xf���I2?Z��<ץ�T���cU�j��]���陎Ltl �}5�ϓ��$�,��O�mˊ�;�@O��jE��j(�ا,��LX���LO���Ц�90�O �.����a��nA���7������j4 ��W��_ٓ���zW�jcB������y՗+EM�)d���N�g6�y1_x��p�$Lv�:��9�"z��p���ʙ$��^��JԼ*�ϭ����o���=x�Lj�6�J��u82�A�H�3$�ٕ@�=Vv�]�'�qEz�;I˼��)��=��ɯ���x �/�W(V���p�����$ �m�������u�����񶤑Oqˎ�T����r��㠚x�sr�GC��byp�G��1ߠ�w e�8�$⿄����/�M{*}��W�]˷.�CK\�ުx���/$�WP�w���r� |i���&�}�{�X� �>��$-��l���?-z���g����lΆ���(F���h�vS*���b���߲ڡn,|)mrH[���a�3�ר�[1��3o_�U�3�TC�$��(�=�)0�kgP���� ��u�^=��4 �WYCҸ:��vQ�ר�X�à��tk�m,�t*��^�,�}D*�� �"(�I��9R����>`�`��[~Q]�#af��i6l��8���6�:,s�s�N6�j"�A4���IuQ��6E,�GnH��zS�HO�uk�5$�I�4��ؤ�Q9�@��C����wp��BGv[]�u�Ov����0I4���\��y�����Q�Ѹ��~>Z��8�T��a��q�ޣ;z��a���/��S��I:�ܫ_�|������>=Z����8:�S��U�I�J��"IY���8%b8���H��:�QO�6�;7�I�S��J��ҌAά3��>c���E+&jf$eC+�z�;��V����� �r���ʺ������my�e���aQ�f&��6�ND���.:��NT�vm�<- u���ǝ\MvZY�N�NT��-A�>jr!S��n�O 1�3�Ns�%�3D@���`������ܟ 1�^c<���� �a�ɽ�̲�Xë#�w�|y�cW�=�9I*H8�p�^(4���՗�k��arOcW�tO�\�ƍR��8����'�K���I�Q�����?5�>[�}��yU�ײ -h��=��% q�ThG�2�)���"ו3]�!kB��*p�FDl�A���,�eEi�H�f�Ps�����5�H:�Փ~�H�0Dت�D�I����h�F3�������c��2���E��9�H��5�zԑ�ʚ�i�X�=:m�xg�hd(�v����׊�9iS��O��d@0ڽ���:�p�5�h-��t�&���X�q�ӕ,��ie�|���7A�2���O%P��E��htj��Y1��w�Ѓ!����  ���� ࢽ��My�7�\�a�@�ţ�J ��4�Ȼ�F�@o�̒?4�wx��)��]�P��~�����u�����5�����7X ��9��^ܩ�U;Iꭆ 5 �������eK2�7(�{|��Y׎ �V��\"���Z�1� Z�����}��(�Ǝ"�1S���_�vE30>���p;� ΝD��%x�W�?W?v����o�^V�i�d��r[��/&>�~`�9Wh��y�;���R���� ;;ɮT��?����r$�g1�K����A��C��c��K��l:�'��3 c�ﳯ*"t8�~l��)���m��+U,z��`(��>yJ�?����h>��]��v��ЍG*�{`��;y]��I�T� ;c��NU�fo¾h���/$���|NS���1�S�"�H��V���T���4��uhǜ�]�v;���5�͠x��'C\�SBpl���h}�N����� A�Bx���%��ޭ�l��/����T��w�ʽ]D�=����K���ž�r㻠l4�S�O?=�k �M:� ��c�C�a�#ha���)�ѐxc�s���gP�iG���{+���x���Q���I= �� z��ԫ+ �8"�k�ñ�j=|����c ��y��CF��/���*9ж�h{ �?4�o� ��k�m�Q�N�x��;�Y��4膚�a�w?�6�>�e]�����Q�r�:����g�,i"�����ԩA��*M�<�G��b�if��l^M��5�� �Ҩ�{����6J��ZJ�����P�*�����Y���ݛu�_4�9�I8�7���������,^ToR���m4�H��?�N�S�ѕw��/S��甍�@�9H�S�T��t�ƻ���ʒU��*{Xs�@����f������֒Li�K{H�w^���������Ϥm�tq���s� ���ք��f:��o~s��g�r��ט� �S�ѱC�e]�x���a��) ���(b-$(�j>�7q�B?ӕ�F��hV25r[7 Y� }L�R��}����*sg+��x�r�2�U=�*'WS��ZDW]�WǞ�<��叓���{�$�9Ou4��y�90-�1�'*D`�c�^o?(�9��u���ݐ��'PI&� f�Jݮ�������:wS����jfP1F:X �H�9dԯ����˝[�_54 �}*;@�ܨ�� ð�yn�T���?�ןd�#���4rG�ͨ��H�1�|-#���Mr�S3��G�3�����)�.᧏3v�z֑��r����$G"�`j �1t��x0<Ɔ�Wh6�y�6��,œ�Ga��gA����y��b��)���h�D��ß�_�m��ü �gG;��e�v��ݝ�nQ� ��C����-�*��o���y�a��M��I�>�<���]obD��"�:���G�A��-\%LT�8���c�)��+y76���o�Q�#*{�(F�⽕�y����=���rW�\p���۩�c���A���^e6��K������ʐ�cVf5$�'->���ՉN"���F�"�UQ@�f��Gb~��#�&�M=��8�ט�JNu9��D��[̤�s�o�~������� G��9T�tW^g5y$b��Y'��س�Ǵ�=��U-2 #�MC�t(�i� �lj�@Q 5�̣i�*�O����s�x�K�f��}\��M{E�V�{�υ��Ƈ�����);�H����I��fe�Lȣr�2��>��W��I�Ȃ6������i��k�� �5�YOxȺ����>��Y�f5'��|��H+��98pj�n�.O�y�������jY��~��i�w'������l�;�s�2��Y��:'lg�ꥴ)o#'Sa�a�K��Z� �m��}�`169�n���"���x��I ��*+� }F<��cГ���F�P�������ֹ*�PqX�x۩��,� ��N�� �4<-����%����:��7����W���u�`����� $�?�I��&����o��o��`v�>��P��"��l���4��5'�Z�gE���8���?��[�X�7(��.Q�-��*���ތL@̲����v��.5���[��=�t\+�CNܛ��,g�SQnH����}*F�G16���&:�t��4ُ"A��̣��$�b �|����#rs��a�����T�� ]�<�j��B�S�('$�ɻ� �wP;�/�n��?�ݜ��x�F��yUn�~mL*-�������Xf�wd^�a�}��f�,=t�׵i�.2/wpN�Ep8�OР���•��R�FJ� 55TZ��T �ɭ�<��]��/�0�r�@�f��V��V����Nz�G��^���7hZi����k��3�,kN�e|�vg�1{9]_i��X5y7� 8e]�U����'�-2,���e"����]ot�I��Y_��n�(JҼ��1�O ]bXc���Nu�No��pS���Q_���_�?i�~�x h5d'�(qw52] ��'ޤ�q��o1�R!���`ywy�A4u���h<קy���\[~�4�\ X�Wt/� 6�����n�F�a8��f���z �3$�t(���q��q�x��^�XWeN'p<-v�!�{�(>ӽDP7��ո0�y)�e$ٕv�Ih'Q�EA�m*�H��RI��=:��� ���4牢) �%_iN�ݧ�l]� �Nt���G��H�L��� ɱ�g<���1V�,�J~�ٹ�"K��Q�� 9�HS�9�?@��k����r�;we݁�]I�!{ �@�G�[�"��`���J:�n]�{�cA�E����V��ʆ���#��U9�6����j�#Y�m\��q�e4h�B�7��C�������d<�?J����1g:ٳ���=Y���D�p�ц� ׈ǔ��1�]26؜oS�'��9�V�FVu�P�h�9�xc�oq�X��p�o�5��Ա5$�9W�V(�[Ak�aY錎qf;�'�[�|���b�6�Ck��)��#a#a˙��8���=äh�4��2��C��4tm^ �n'c����]GQ$[Wҿ��i���vN�{Fu ��1�gx��1┷���N�m��{j-,��x�� Ūm�ЧS�[�s���Gna���䑴�� x�p 8<������97�Q���ϴ�v�aϚG��Rt�Һ׈�f^\r��WH�JU�7Z���y)�vg=����n��4�_)y��D'y�6�]�c�5̪��\� �PF�k����&�c;��cq�$~T�7j ���nç]�<�g ":�to�t}�159�<�/�8������m�b�K#g'I'.W������6��I/��>v��\�MN��g���m�A�yQL�4u�Lj�j9��#44�t��l^�}L����n��R��!��t��±]��r��h6ٍ>�yҏ�N��fU�� ���� Fm@�8}�/u��jb9������he:A�y�ծw��GpΧh�5����l}�3p468��)U��d��c����;Us/�֔�YX�1�O2��uq�s��`hwg�r~�{ R��mhN��؎*q 42�*th��>�#���E����#��Hv�O����q�}������6�e��\�,Wk�#���X��b>��p}�դ��3���T5��†��6��[��@��P�y*n��|'f�֧>�lư΂�̺����SU�'*�q�p�_S�����M�� '��c�6������m�� ySʨ;M��r���Ƌ�m�Kxo,���Gm�P��A�G�:��i��w�9�}M(�^�V��$ǒ�ѽ�9���|���� �a����J�SQ�a���r�B;����}���ٻ֢�2�%U���c�#�g���N�a�ݕ�'�v�[�OY'��3L�3�;,p�]@�S��{ls��X�'���c�jw��k'a�.��}�}&�� �dP�*�bK=ɍ!����;3n�gΊU�ߴmt�'*{,=SzfD� A��ko~�G�aoq�_mi}#�m�������P�Xhύ�����mxǍ�΂���巿zf��Q���c���|kc�����?���W��Y�$���_Lv����l߶��c���`?����l�j�ݲˏ!V��6����U�Ђ(A���4y)H���p�Z_�x��>���e���R��$�/�`^'3qˏ�-&Q�=?��CFVR �D�fV�9��{�8g�������n�h�(P"��6�[�D���< E�����~0<@�`�G�6����Hг�cc�� �c�K.5��D��d�B���`?�XQ��2��ٿyqo&+�1^� DW�0�ꊩ���G�#��Q�nL3��c���������/��x ��1�1�[y�x�პCW��C�c�UĨ80�m�e�4.{�m��u���I=��f�����0QRls9���f���������9���~f�����Ǩ��a�"@�8���ȁ�Q����#c�ic������G��$���G���r/$W�(��W���V�"��m�7�[m�A�m����bo��D� j����۳� l���^�k�h׽����� ��#� iXn�v��eT�k�a�^Y�4�BN���ĕ���0������� !01@Q"2AaPq3BR�������?�����@4�Q�����T3,���㺠�W�[=JK�Ϟ���2�r^7��vc�:�9 �E�ߴ�w�S#d���Ix��u��:��Hp��9E!�� V 2;73|F��9Y���*ʬ�F��D����u&���y؟��^EA��A��(ɩ���^��GV:ݜDy�`��Jr29ܾ�㝉��[���E;Fzx��YG��U�e�Y�C���� ����v-tx����I�sם�Ę�q��Eb�+P\ :>�i�C'�;�����k|z�رn�y]�#ǿb��Q��������w�����(�r|ӹs��[�D��2v-%��@;�8<a���[\o[ϧw��I!��*0�krs)�[�J9^��ʜ��p1)� "��/_>��o��<1����A�E�y^�C��`�x1'ܣn�p��s`l���fQ��):�l����b>�Me�jH^?�kl3(�z:���1ŠK&?Q�~�{�ٺ�h�y���/�[��V�|6��}�KbX����mn[-��7�5q�94�������dm���c^���h� X��5��<�eޘ>G���-�}�دB�ޟ� ��|�rt�M��V+�]�c?�-#ڛ��^ǂ}���Lkr���O��u�>�-D�ry� D?:ޞ�U��ǜ�7�V��?瓮�"�#���r��չģVR;�n���/_� ؉v�ݶe5d�b9��/O��009�G���5n�W����JpA�*�r9�>�1��.[t���s�F���nQ� V 77R�]�ɫ8����_0<՜�IF�u(v��4��F�k�3��E)��N:��yڮe��P�`�1}�$WS��J�SQ�N�j��ٺ��޵�#l���ј(�5=��5�lǏmoW�v-�1����v,W�mn��߀$x�<����v�j(����c]��@#��1������Ǔ���o'��u+����;G�#�޸��v-lη��/(`i⣍Pm^����ԯ̾9Z��F��������n��1��� ��]�[��)�'�������:�֪�W��FC����� �B9،!?���]��V��A�Վ�M��b�w��G F>_DȬ0¤�#�QR�[V��kz���m�w�"��9ZG�7'[��=�Q����j8R?�zf�\a�=��O�U����*oB�A�|G���2�54 �p��.w7� �� ���&������ξxGHp� B%��$g�����t�Џ򤵍z���HN�u�Я�-�'4��0���;_���3������� !01"@AQa2Pq#3BR�������?����ʩca��en��^��8���<�u#��m*08r��y�N"�<�Ѳ0��@\�p��� �����Kv�D��J8�Fҽ� �f�Y��-m�ybX�NP����}�!*8t(�OqѢ��Q�wW�K��ZD��Δ^e��!� ��B�K��p~�����e*l}z#9ң�k���q#�Ft�o��S�R����-�w�!�S���Ӥß|M�l޶V��!eˈ�8Y���c�ЮM2��tk���� ������J�fS����Ö*i/2�����n]�k�\���|4yX�8��U�P.���Ы[���l��@"�t�<������5�lF���vU�����W��W��;�b�cД^6[#7@vU�xgZv��F�6��Q,K�v��� �+Ъ��n��Ǣ��Ft���8��0��c�@�!�Zq s�v�t�;#](B��-�nῃ~���3g������5�J�%���O������n�kB�ĺ�.r��+���#�N$?�q�/�s�6��p��a����a��J/��M�8��6�ܰ"�*������ɗud"\w���aT(����[��F��U՛����RT�b���n�*��6���O��SJ�.�ij<�v�MT��R\c��5l�sZB>F��<7�;EA��{��E���Ö��1U/�#��d1�a�n.1ě����0�ʾR�h��|�R��Ao�3�m3 ��%�� ���28Q�� ��y��φ���H�To�7�lW>����#i`�q���c����a��� �m,B�-j����݋�'mR1Ήt�>��V��p���s�0IbI�C.���1R�ea�����]H�6�����������4B>��o��](��$B���m�����a�!=���?�B� K�Ǿ+�Ծ"�n���K��*��+��[T#�{�E�J�S����Q�����s�5�:�U�\wĐ�f�3����܆&�)�����I���Ԇw��E T�lrTf6Q|R�h:��[K�� �z��c֧�G�C��%\��_�a��84��HcO�bi��ؖV��7H �)*ģK~Xhչ0��4?�0��� �E<���}3���#���u�?�� ��|g�S�6ꊤ�|�I#Hڛ� �ա��w�X��9��7���Ŀ%�SL��y6č��|�F�a 8���b���$�sק�h���b9RAu7�˨p�Č�_\*w��묦��F ����4D~�f����|(�"m���NK��i�S�>�$d7SlA��/�²����SL��|6N�}���S�˯���g��]6��; �#�.��<���q'Q�1|KQ$�����񛩶"�$r�b:���N8�w@��8$�� �AjfG|~�9F ���Y��ʺ��Bwؒ������M:I岎�G��`s�YV5����6��A �b:�W���G�q%l�����F��H���7�������Fsv7���k�� 403WebShell
403Webshell
Server IP : 103.30.72.248  /  Your IP : 216.73.216.61
Web Server : Microsoft-IIS/10.0
System : Windows NT WIN-CARKG80MF9A 10.0 build 17763 (Windows Server 2019) AMD64
User : IUSR ( 0)
PHP Version : 8.2.7
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Windows/System32/BestPractices/v1.0/Models/Microsoft/Windows/TerminalServices/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Windows/System32/BestPractices/v1.0/Models/Microsoft/Windows/TerminalServices/TerminalServices.ps1
��#

# -----------------------------

# TRANSLATIONS DEFINITION

# -----------------------------

#

data _system_translations {

   ConvertFrom-StringData @'

    # fallback text goes here (optional)

    ###PSLOC start localizing



    #

    # ActivationStatusCheck

    #

    ActivationStatusCheck_Title                        =   The license server must be activated before you can install RDS�CALs onto the license server        

    ActivationStatusCheck_Problem_UnRegistered         =   The Remote Desktop license server is not activated, so you cannot install Remote Desktop Services client access licenses (RDS�CALs) onto the license server.

    ActivationStatusCheck_Problem_StatusUnknown        =   The Remote Desktop license server Activation Status could not be determined.

    ActivationStatusCheck_Impact                       =   Each user or computing device that connects to a remote desktop server must have a valid RDS�CAL issued by a license server. If an activated license server with RDS�CALs installed is not available, the remote desktop server may stop accepting connections.

    ActivationStatusCheck_Resolution_UnRegistered      =   Use the RD Licensing Manager tool to activate the license server and then to install RDS CALs onto the license server.

    ActivationStatusCheck_Resolution_StatusUnknown     =   Check if the Remote Desktop Licensing Service is running.

    ActivationStatusCheck_Compliant                    =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.

       

    #

    # NumberCAPPoliciesCheck - Rule 3

    #

    NumberCAPPoliciesCheck_Title                       =   The RD Gateway server must have at least one RD�CAP enabled

    NumberCAPPoliciesCheck_Problem                     =   The Remote Desktop Gateway (RD Gateway) server does not have a Remote Desktop connection authorization policy (RD�CAP) enabled.     

    NumberCAPPoliciesCheck_Impact                      =   If the RD Gateway server does not have an RD CAP enabled, users cannot connect to internal network resources (computers) through the RD Gateway server.

    NumberCAPPoliciesCheck_Resolution                  =   Use the RD Gateway Manager tool to enable an RD�CAP to specify which users can use the RD Gateway server to connect to internal network resources (computers).

    NumberCAPPoliciesCheck_Compliant                   =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # NumberRAPPoliciesCheck - Rule 4

    #

    NumberRAPPoliciesCheck_Title                       =   The RD Gateway server must have at least one RD�RAP enabled

    NumberRAPPoliciesCheck_Problem                     =   The Remote Desktop Gateway (RD Gateway) server does not have a Remote Desktop resource authorization policy (RD�RAP) enabled.

    NumberRAPPoliciesCheck_Impact                      =   If the RD Gateway server does not have an RD RAP enabled, users cannot connect to internal network resources (computers) through the RD Gateway server.

    NumberRAPPoliciesCheck_Resolution                  =   Use the RD Gateway Manager tool to enable an RD�RAP to specify the internal network resources (computers) that users can connect to through the RD Gateway server. 

    NumberRAPPoliciesCheck_Compliant                   =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # SSLCertConfiguredCheck - Rule 5

    #

    SSLCertConfiguredCheck_Title                       =   The RD Gateway server must be configured to use a valid SSL certificate

    SSLCertConfiguredCheck_Problem                     =   The Remote Desktop Gateway (RD Gateway) server does not have a valid Secure Sockets Layer (SSL) certificate.

    SSLCertConfiguredCheck_Impact                      =   If the RD Gateway server is configured to use an SSL certificate that is not valid, users cannot connect to internal network resources (computers) through the RD Gateway server. 

    SSLCertConfiguredCheck_Resolution                  =   Use the RD Gateway Manager tool to select a valid SSL certificate for the RD Gateway server to use.

    SSLCertConfiguredCheck_Compliant                   =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # SSLCertIsSelfSignedCheck- Rule 6

    #

    SSLCertIsSelfSignedCheck_Title                     =   RD Gateway must be configured to use an SSL certificate signed by a trusted certification authority 

    SSLCertIsSelfSignedCheck_Problem                   =   The Remote Desktop Gateway (RD Gateway) server is configured to use a self-signed certificate. By default, a self-signed certificate is not trusted by client computers.

    SSLCertIsSelfSignedCheck_Impact                    =   If the RD Gateway server is configured to use a Secure Sockets Layer (SSL) certificate that is not signed by a trusted certification authority, users might be unable to connect to internal network resources (computers) through the RD Gateway server.

    SSLCertIsSelfSignedCheck_Resolution                =   Use the RD Gateway Manager tool to configure the RD Gateway server to use an SSL certificate that is signed by a trusted certification authority. Using a self-signed certificate is not recommended.

    SSLCertIsSelfSignedCheck_Compliant                 =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # NPSServerReachableCheck - Rule 7

    #

    NPSServerReachableCheck_Title                      =   The RD Gateway server must be able to contact the server running NPS  

    NPSServerReachableCheck_Problem                    =   The Remote Desktop Gateway (RD Gateway) server is unable to contact the server running Network Policy Server (NPS) that contains the central Remote Desktop connection authorization policy (RD�CAP) store.

    NPSServerReachableCheck_Impact                     =   If the RD Gateway server is unable to contact the server running NPS that contains the central RD CAP store, users cannot connect to internal network resources (computers) through the RD Gateway server.

    NPSServerReachableCheck_Resolution                 =   Ensure that the server running NPS is started and that there is network connectivity between the RD Gateway server and the server running NPS.

    NPSServerReachableCheck_Compliant                  =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # LoadBalancedServerErrorneousCheck - Rule 8

    #

    LoadBalancedServerErrorneousCheck_Title            =   Members of an RD Gateway server farm should be available on the network and configured identically

    LoadBalancedServerErrorneousCheck_Problem          =   At least one Remote Desktop Gateway (RD Gateway) server in the RD Gateway server farm is not available on the network or is not running the same version of the operating system as the other members of the RD Gateway server farm.

    LoadBalancedServerErrorneousCheck_Impact           =   If some of the members of an RD Gateway server farm are not available on the network or are not running the same version of the operating system, users might experience different functionality depending on the RD Gateway server through which they connect.

    LoadBalancedServerErrorneousCheck_Resolution       =   Ensure that all the RD Gateway servers in the RD Gateway server farm are available on the network, are running the same version of the operating system, and are configured identically.

    LoadBalancedServerErrorneousCheck_Compliant        =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # ConnectionsExhaustedCheck - Rule 9

    #

    ConnectionsExhaustedCheck_Title                    =   The RD Gateway server should be configured to allow �an adequate number of simultaneous connections

    ConnectionsExhaustedCheck_Problem                  =   The Remote Desktop Gateway (RD Gateway) server has reached the limit on the maximum number of simultaneous connections allowed.

    ConnectionsExhaustedCheck_Impact                   =   If the RD Gateway server is configured to limit the number of simultaneous connections allowed, users making new connections will be unable to connect to internal network resources (computers) through the RD Gateway server when the limit is exceeded. 

    ConnectionsExhaustedCheck_Resolution               =   Monitor the performance of the RD Gateway server to determine the maximum number of connections that the RD Gateway server can support. If necessary, use the RD Gateway Manager tool to reconfigure the maximum number of simultaneous connections allowed. 

    ConnectionsExhaustedCheck_Compliant                =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # ActiveDirectoryServerRechableCheck - Rule 10

    #

    ActiveDirectoryServerRechableCheck_Title           =   The RD Gateway server must be able to contact Active Directory Domain Services

    ActiveDirectoryServerRechableCheck_Problem         =   An authorization policy on the Remote Desktop Gateway (RD Gateway) server is configured to use an Active Directory security group, but the RD Gateway server is unable to contact Active Directory Domain Services (AD DS).

    ActiveDirectoryServerRechableCheck_Impact          =   If the RD Gateway server is unable to contact AD DS, users cannot be authenticated and the users will be unable to connect to internal network resources (computers) through the RD Gateway server.

    ActiveDirectoryServerRechableCheck_Resolution      =   Ensure that the RD Gateway server is a member of an Active Directory domain and that there is network connectivity between the RD Gateway server and AD DS.

    ActiveDirectoryServerReachableCheckWarning_Title   =   Remote Desktop Services can t connect to Active Directory.

    ActiveDirectoryServerReachableCheckWarning_Problem =   An authorization policy on the Remote Desktop Gateway (RD Gateway) server is set to use an Active Directory security group, but the Remote Desktop Services Best Practices Analyzer can t get a list of domain controllers in the current domain.

    ActiveDirectoryServerReachableCheckWarning_Impact  =   If the Remote Desktop Services Best Practices Analyzer can t get the list of domain controllers, it can t verify connectivity to Active Directory.

    ActiveDirectoryServerReachableCheckWarning_Resolution = Log on with a domain user account, and then run the Best Practices Analyzer to get a list of domain controllers and to verify connectivity to Active Directory.

    ActiveDirectoryServerRechableCheck_Compliant       =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # WebSiteRunningCheck - Rule 11

    #

    WebSiteRunningCheck_Title                          =   The Web site that the RD Gateway server is configured to use must be started on the Web (IIS) server

    WebSiteRunningCheck_Problem                        =   The Web site that the Remote Desktop Gateway (RD Gateway) server is configured to use is not started on the Web (IIS) server.

    WebSiteRunningCheck_Impact                         =   If the Web site that the RD Gateway server is configured to use is not started on the Web (IIS) server, users cannot connect to internal network resources (computers) through the RD Gateway server.

    WebSiteRunningCheck_Resolution                     =   Use the Internet Information Services (IIS) Manager tool to ensure that the Web site that the RD Gateway server is configured to use is started.

    WebSiteRunningCheck_Compliant                      =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # CAPPolicyIsNonCompliantCheck - Rule 12

    #

    CAPPolicyIsNonCompliantCheck_Title                 =   The RD CAP(s) stored on the server running NPS must be configured correctly to support RD Gateway

    CAPPolicyIsNonCompliantCheck_Problem               =   The Remote Desktop connection authorization policy (with Name[s] {0}) stored on the server running Network Policy Server (NPS) is/are not configured correctly to support connections through the Remote Desktop Gateway (RD Gateway) server.

    CAPPolicyIsNonCompliantCheck_Impact                =   If the RD CAP stored on the server running NPS is not configured correctly, users will be unable to connect to internal network resources (computers) through the RD Gateway server.

    CAPPolicyIsNonCompliantCheck_Resolution            =   Use the Network Policy Server tool to ensure that the RD CAP stored on the server running NPS is configured correctly to support connections through the RD Gateway server.

    CAPPolicyIsNonCompliantCheck_Compliant             =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # NONewConnectinsAllowedCheck - Rule 13

    #

    NONewConnectinsAllowedCheck_Title                  =   The RD Gateway server should be configured to allow new connections

    NONewConnectinsAllowedCheck_Problem                =   The Remote Desktop Gateway (RD Gateway) server is configured to disable new connections.

    NONewConnectinsAllowedCheck_Impact                 =   If the RD Gateway server is configured to disable new connections, no new user connections will be allowed through the RD Gateway server.

    NONewConnectinsAllowedCheck_Resolution             =   Use the RD Gateway Manager tool to configure the RD Gateway server to accept new connections.

    NONewConnectinsAllowedCheck_Compliant              =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # ConenctOnlytoWin7ClientCheck - Rule 14

    #

    ConenctOnlytoWin7ClientCheck_Title                 =   The RD Gateway server should be configured to allow connections from all supported clients

    ConenctOnlytoWin7ClientCheck_Problem               =   The Remote Desktop Gateway (RD Gateway) server is configured to accept only connections from clients using the latest version of the Remote Desktop Connection (RDC) software.

    ConenctOnlytoWin7ClientCheck_Impact                =   If a client computer is not running the latest version of RDC, the user will be unable to connect to internal network resources (computers) through the RD Gateway server.

    ConenctOnlytoWin7ClientCheck_Resolution            =   Use the RD Gateway Manager tool to configure the RD Gateway server to accept connections from all supported versions of RDC.

    ConenctOnlytoWin7ClientCheck_Compliant             =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # RDGatewaySvcStartedCheck - Rule 15

    #

    RDGatewaySvcStartedCheck_Title                     =   The Remote Desktop Gateway service must be running on the RD Gateway server

    RDGatewaySvcStartedCheck_Problem                   =   The Remote Desktop Gateway service is not running on the Remote Desktop Gateway (RD Gateway) server. 

    RDGatewaySvcStartedCheck_Impact                    =   If the Remote Desktop Gateway service is not running on the RD Gateway server, users cannot connect to internal network resources (computers) through the RD Gateway server.

    RDGatewaySvcStartedCheck_Resolution                =   Use the Services tool to start the Remote Desktop Gateway service on the RD Gateway server.

    RDGatewaySvcStartedCheck_Compliant                 =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # RDPGrpMemberCountCheck

    #

    RDPGrpMemberCountCheck_Title                       =   The Remote Desktop Users group on the RD Session Host server must contain domain users or groups

    RDPGrpMemberCountCheck_Problem                     =   The Remote Desktop Users group on the Remote Desktop Session Host server does not contain any domain users or groups.

    RDPGrpMemberCountCheck_Impact                      =   If the Remote Desktop Users group on the RD Session Host server does not contain domain users or groups, users will not be able to connect to the RD Session Host server.

    RDPGrpMemberCountCheck_Resolution                  =   Use the Remote tab in the System Properties dialog box to add domain users or groups to the Remote Desktop Users group on the RD Session Host server.

    RDPGrpMemberCountCheck_Compliant                   =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.

    



    #

    # RemoteDesktopDisabledCheck

    #

    RemoteDesktopDisabledCheck_Title                   =   The RD Session Host server should be configured to allow remote desktop connections 

    RemoteDesktopDisabledCheck_Problem                 =   Remote desktop connections to the Remote Desktop Session Host server are disabled.

    RemoteDesktopDisabledCheck_Impact                  =   If remote desktop connections are disabled, users will not be able to connect to the RD Session Host server.

    RemoteDesktopDisabledCheck_Resolution              =   Use the Remote tab in the System Properties dialog box to enable remote desktop connections on the RD Session Host server.

    RemoteDesktopDisabledCheck_Compliant               =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.

        

    #

    # MaxInstanceCountCheck

    #

    MaxInstanceCountCheck_Title                        =   The RD Session Host server should be configured to allow an adequate number of simultaneous connections

    MaxInstanceCountCheck_Problem                      =   The maximum number of simultaneous connections is configured for less than 5 users.

    MaxInstanceCountCheck_Impact                       =   If the maximum number of simultaneous connections is less than the required number of users, some users may not be able to log on to the Remote Desktop Session Host server.

    MaxInstanceCountCheck_Resolution                   =   Increase the maximum number of simultaneous connections by configuring the "Limit number of connections" Group Policy setting.

    MaxInstanceCountCheck_Compliant                    =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.

   

    #

    # AlternateSrvSpecifiedCheck

    #

    AlternateSrvSpecifiedCheck_Title                   =   The alternative server name must be specified for Remote Desktop Connection 6.1 and earlier

    AlternateSrvSpecifiedCheck_Problem                 =   The alternative server name is not specified.

    AlternateSrvSpecifiedCheck_Impact                  =   The alternative server name must be specified if you are using Remote Desktop Connection (RDC) 6.1 and earlier. If it is not specified, RDC 6.1 and earlier clients will not be able to connect.

    AlternateSrvSpecifiedCheck_Resolution              =   The alternative server name is specified by using Remote Desktop Connection Manager on the Remote Desktop Connection Broker server.

    AlternateSrvSpecifiedCheck_Compliant               =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # RedirectorAltServerHaveSameIPCheck

    #

    RedirectorAltServerHaveSameIPCheck_Title           =   The alternative server name must resolve to the IP address of the redirection server

    RedirectorAltServerHaveSameIPCheck_Problem         =   The alternative server name does not have a valid DNS entry, or the DNS entry does not resolve to the same IP address as the Remote Desktop Session Host server running in redirection mode.

    RedirectorAltServerHaveSameIPCheck_Impact          =   The alternative server name must resolve to the IP address of the Remote Desktop Session Host server running in redirection mode. If it does not, RDC 6.1 and earlier clients will not be able to connect.

    RedirectorAltServerHaveSameIPCheck_Resolution      =   The alternative server name is specified by using Remote Desktop Connection Manager on the Remote Desktop Connection Broker server.

    RedirectorAltServerHaveSameIPCheck_Compliant       =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # FireWallExceptionEnabledCheck

    #

    FireWallExceptionEnabledCheck_Title                =   The current Windows Firewall profile must be configured to allow remote desktop connections

    FireWallExceptionEnabledCheck_Problem              =   The current Windows Firewall profile is not configured to allow remote desktop connections.

    FireWallExceptionEnabledCheck_Impact               =   Users are not able to connect to the server by using Remote Desktop Connection.

    FireWallExceptionEnabledCheck_Resolution           =   Enable remote desktop connections by using the Windows Firewall console.

    FireWallExceptionEnabledCheck_Compliant            =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # CALAvailableCheck

    #

    CALAvailableCheck_Title                            =   The Remote Desktop license server must have enough RDS CALs installed to allow users and devices to connect

    CALAvailableCheck_Problem                          =   There are not enough Remote Desktop Services client access licenses (RDS CALs) installed to allow users and devices to connect to the Remote Desktop Session Host server.

    CALAvailableCheck_Impact                           =   Some users or devices may not be able to connect to the Remote Desktop Session Host server.

    CALAvailableCheck_Resolution                       =   Install more Remote Desktop Services client access licenses by using Remote Desktop Licensing Manager.

    CALAvailableCheck_Compliant                        =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #	

    # SSLCertNameIsFQDN

    #

    SSLCertNameIsFQDNCheck_Title                       =   The RD Gateway server SSL certificate must be configured with a valid certificate subject name

    SSLCertNameIsFQDNCheck_Problem                     =   The Remote Desktop Gateway (RD Gateway) server Secure Sockets Layer (SSL) certificate may not have a valid certificate subject name.

    SSLCertNameIsFQDNCheck_Impact                      =   If the RD Gateway server is configured to use an SSL certificate with a certificate subject name that is not valid, users cannot connect to internal network resources (computers) through the RD Gateway server. 

    SSLCertNameIsFQDNCheck_Resolution                  =   Use the RD Gateway Manager tool to select a valid SSL certificate for the RD Gateway server to use.

    SSLCertNameIsFQDNCheck_Compliant                   =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    #

    # RDSHCollectionCheck

    #

    RDSHCollectionCheck_Title                          =   All the RDSH Servers in a collection must be homogenous.

    RDSHCollectionCheck_Problem                        =   Some RDSH Servers in a collection may not be homogenous. Please take a look at the below report. {0}

    RDSHCollectionCheck_Impact                         =   If the RDSH servers in a collection are not homogenous then undesired side effects can happen.

    RDSHCollectionCheck_Resolution                     =   Use the RDMS console to maintain homogeneity across all settings in RDSH servers of a collection.

    RDSHCollectionCheck_Compliant                      =   The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    RDSHCollectionCheck_Collection                     =   Collection: 

    RDSHCollectionCheck_HeterogeneousServers           =   Non-homogeneous servers: 

    RDSHCollectionCheck_MoreInformation                =   See below for more information: 

    RDSHCollectionCheck_ExpectedPropertyValues         =   Collection expected property values: 

    RDSHCollectionCheck_Server=Server: 



    #

    # RDSH Collection Properties

    #

    RDSHCollectionCheck_PropertyUserGroup                               = Property: User Group:



    RDSHCollectionCheck_PropertyConnections_DisconnectedSessionLimit    = Property: Connections: Disconnection Session Limit: 

    RDSHCollectionCheck_PropertyConnections_ActiveSessionLimit          = Property: Connections: Active Session Limit: 

    RDSHCollectionCheck_PropertyConnections_IdleSessionLimit            = Property: Connections: Idle Session Limit: 

    RDSHCollectionCheck_PropertyConnections_BrokenConnectionAction      = Property: Connections: Broken Connection Action: 

    RDSHCollectionCheck_PropertyConnections_EnableAutomaticReconnection = Property: Connections: Enable Automatic Reconnection: 

    RDSHCollectionCheck_PropertyConnections_DeleteTempFoldersOnExit     = Property: Connections: Delete Temp Folders On Exit: 

    RDSHCollectionCheck_PropertyConnections_UseTempFoldersPerSession    = Property: Connections: Use Temp Folders Per Session: 

 



    RDSHCollectionCheck_PropertySecurity_SecurityLayer                  = Property: Security: Security Layer: 

    RDSHCollectionCheck_PropertySecurity_EncryptionLevel                = Property: Security: Encryption Level: 

    RDSHCollectionCheck_PropertySecurity_AuthenticateUsingNLA           = Property: Security: Authenticate Using NLA:



    RDSHCollectionCheck_PropertyClientSettings_DeviceRedirectionOptions = Property: Client Settings: Device Redirection Options:

    RDSHCollectionCheck_PropertyClientSettings_RedirectClientPrinter    = Property: Client Settings: Redirect Client Printer:

    RDSHCollectionCheck_PropertyClientSettings_SetClientPrinterAsDefault= Property: Client Settings: Set Client Printer As Default:

    RDSHCollectionCheck_PropertyClientSettings_UserRDEasyPrintDriver    = Property: Client Settings: Use RD Easy Print Driver:

    RDSHCollectionCheck_PropertyClientSettings_MaxMonitors              = Property: Client Settings: Max Monitors:

 

    RDSHCollectionCheck_PropertyUVHDSettings_IsUserVHDEnabled           = Property: UVHD Settings: Is User VHD Enabled:

    RDSHCollectionCheck_PropertyUVHDSettings_UserVHDShare               = Property: UVHD Settings: User VHD Share:

    RDSHCollectionCheck_PropertyUVHDSettings_UserPolicyXML              = Property: UVHD Settings: User Policy XML:

    RDSHCollectionCheck_PropertyUVHDSettings_DiskSizeInMB               = Property: UVHD Settings: Disk Size In MB:

    RDSHCollectionCheck_PropertyUVHDSettings_DiskType                   = Property: UVHD Settings: Disk Type:

    

    RDSHSvcStartedCheck_Title                                           = The Remote Desktop Session Host service must be running on the RD Session Host server.

    RDSHSvcStartedCheck_Problem                                         = The Remote Desktop Session Host service is not running on the Remote Desktop Session Host (RD Session Host) server.

    RDSHSvcStartedCheck_Impact                                          = If the Remote Desktop Session Host service is not running on the RD Session Host server, users will not be able to connect to the RD Session Host server remotely.

    RDSHSvcStartedCheck_Resolution                                      = Use the Services tool to start the Remote Desktop Session Host service on the RD Session Host server.

    RDSHSvcStartedCheck_Compliant                                       = The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    RDVHSvcStartedCheck_Title                                           = The Remote Desktop Virtualization Host service must be running on the RD Virtualization Host server.

    RDVHSvcStartedCheck_Problem                                         = The Remote Desktop Virtualization Host service is not running on the Remote Desktop Virtualization Host (RD Virtualization Host) server.

    RDVHSvcStartedCheck_Impact                                          = If the Remote Desktop Virtualization Host service is not running on the RD Virtualization Host server, users will not be able to connect to virtual desktops.

    RDVHSvcStartedCheck_Resolution                                      = Use the Services tool to start the Remote Desktop Virtualization Host service on the RD Virtualization Host server.

    RDVHSvcStartedCheck_Compliant                                       = The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.





    RDCBSvcStartedCheck_Title                                           = The Remote Desktop Connection Broker service must be running on the RD Connection Broker server.

    RDCBSvcStartedCheck_Problem                                         = The Remote Desktop Connection Broker service is not running on the Remote Desktop Connection Broker (RD Connection Broker) server.

    RDCBSvcStartedCheck_Impact                                          = If the Remote Desktop Connection Broker service is not running on the RD Connection Broker server, users will not be able to connect to sessions or virtual desktops.

    RDCBSvcStartedCheck_Resolution                                      = Use the Services tool to start the Remote Desktop Connection Broker service on the RD Connection Broker server.

    RDCBSvcStartedCheck_Compliant                                       = The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



    RDWASvcStartedCheck_Title                                           = The IIS service must be running on the RD Web Access server.

    RDWASvcStartedCheck_Problem                                         = The Internet Information Services (IIS) service is not running on the Remote Desktop Web Access (RD Web Access) server.

    RDWASvcStartedCheck_Impact                                          = If the IIS service is not running on the RD Web Access server, users will not be able to see published applications.

    RDWASvcStartedCheck_Resolution                                      = Use the Services tool to start the IIS service on the RD Web Access server.

    RDWASvcStartedCheck_Compliant                                       = The Remote Desktop Services Best Practices Analyzer scan has determined that you are in compliance with this best practice.



'@

}

Import-LocalizedData -BindingVariable _system_translations -filename TerminalServices.psd1



#

# ----------------------

# CUSTOM DATA STRUCTURES

# ----------------------

#

Add-Type -TypeDefinition @"



public struct ConnectionsType

{

    public int    DisconnectedSessionLimit;

    public int    ActiveSessionLimit;

    public int    IdleSessionLimit;

    public int    BrokenConnectionAction;

    public int    EnableAutomaticReconnection;

    public int    DeleteTempFoldersOnExit;

    public int    UseTempFoldersPerSession;



}



public struct SecurityType

{

    public int    SecurityLayer;

    public int    EncryptionLevel;

    public int    AuthenticateUsingNLA;

}



public struct ClientSettingsType

{

    public int    DeviceRedirectionOptions;

    public int    RedirectClientPrinter;

    public int    SetClientPrinterAsDefault;

    public int    UseRDEasyPrintDriver;

    public int    MaxMonitors;

}



public struct UVHDSettingsType

{

    public int    IsUVHDEnabled;

    public string UVHDShare;

    public string UserPolicyXML;

    public int    DiskSizeInMB;

    public int    DiskType;

}



public struct RDSHCollectionPropertiesType

{

    public string[]           UserGroups;

    public ConnectionsType    Connections;

    public SecurityType       Security;

    public ClientSettingsType ClientSettings;

    public UVHDSettingsType   UVHDSettings;

}

"@



$NewLine = [Environment]::NewLine





#

# ------------------

# FUNCTIONS - START

# ------------------

#



#

# An implimentation of try..catch..finally

#

function Try

{

    param

    (

        [ScriptBlock]$Command = $(throw "The parameter -Command is required."),

        [ScriptBlock]$Catch   = { throw $_ },

        [ScriptBlock]$Finally = {}

    )

    

    & {

        $local:ErrorActionPreference = "SilentlyContinue"

        

        trap

        {

            trap

            {

                & {

                    trap { throw $_ }

                    &$Finally

                }

                

                throw $_

            }

            

            $_ | & { &$Catch }

        }

        

        &$Command

    }



    & {

        trap { throw $_ }

        &$Finally

    }

}



#

# Function Description:

#

#  Convert true false value to number

#

function BoolToNum ( $BoolVal )

{

    $NumVal = 0



    if ( $BoolVal -eq $true )

    {

        $NumVal = 1

    }



    $NumVal

}





#

# Function Description:

#  Creates the Document element for the Xml Document

#

# Arguments:

#  $ns - Namespace Name

#  $name - Name of the document element

#

# Return Value:

#  returns the created document element

#

function Create-DocumentElement( $ns, $name )

{

    [xml] "<$name xmlns='$ns'/>"

}



#

# Function Description:

#

#  Adds the specified element in the element hierarchy specified

#  as variable number of arguments

#

# Arguments:

#

#  $docElem - The Document Element for the XML Document

#  $tns - Namespace

#  $elemData - The data value of the element to be added

#  Variable Args - Specifies the hierarchy of elements

#

# Return Value:

#

#  None

#

function AddElementToDocument ( $docElem, $tns, $elemData )

{

    $numLevels = $args.length

    $parent = $docElem.DocumentElement

    

    #

    # Iterate over the elements hierarchy specified. For each level

    # if it doesnt exist, create it.

    # 

    for ( $i=0; $i -lt $numLevels; $i++ )

    {

        #

        # current element in hierarchy

        # 

        $currName = $args[$i]



        if ( $parent.$currName -eq $null )

        {

            #

            # Create a new element since it doesnt exist and add it to the parent

            # to maintain relationship

            #

            $currElem = $docElem.CreateElement( $currName, $tns )

            [void] $parent.AppendChild( $currElem )

        }

        

        #

        # Iterate to the next element in hierarchy

        #

        $parent = $parent[$currName]

    }

    

    #

    # This element is the one that needs to be set the data

    #

    $currElem.InnerText = $elemData

}



#

# Function Description:

#

#  Appends the specified element to the target

#



function Append-Elements( $doc, $target, $ns, $name, $objs )

{

    foreach ($obj in $objs) {

        $parent = $doc.CreateElement( $name, $ns )

        $propnames = $obj | gm -type NoteProperty | foreach {$_.name}

        foreach ($propname in $propnames) {

            if ($propname) {

                  $child = $doc.CreateElement( $propname, $ns )

                  $child.set_InnerText( $obj.$propname )

                  [void] $parent.AppendChild( $child )

            }

        }

        [void] $target.AppendChild( $parent )



    }

}



#

# Function Description:

#

#  This function will add the Server Manager module so that Roles

#  can be queried

#

# Arguments:

#

#  None

#

# Return Value:

#

#  None

#

function RoleQueryInitialize

{

    Import-Module ServerManager

}



#

# Function Description:

#

#  This function will remove the Server Manager module after the Roles

#  have been queried

#

# Arguments:

#

#  None

#

# Return Value:

#

#  None

#

function RoleQueryShutdown

{

    Remove-Module ServerManager

}



#

# Function Description:

#

#  This function will check to see if the specified role is installed

#

# Arguments:

#

#  $roleId - Id of the Role 

#

# Return Value:

#

#  $true - If Role is Installed

#  $false - If Role is not Installed

#

function IsRoleInstalled ( $roleId )

{

    $roleInstalled = $false

    

    #

    # Use the Server Manager CmdLet to obtain detail about Role

    #

    $Role = Get-WindowsFeature -Name $roleId

    if ( $Role -ne $null ) 

    {

        $roleInstalled = $Role.Installed

    }



    $roleInstalled

}





#

# Function Description:

#

#  This function will check to see if the specified service is running

#

# Arguments:

#

#  $Service - Service which needs to be queried

#

# Return Value:

#

#  $true - If service is running

#  $false - If service is not running

#



function IsServiceRunning($Service)

{

    $Svc = $null

    $SvcRunning = $false



    $Svc = get-Service $Service

    

    if ( $Svc -ne $null )

    {

        $status = $Svc.Status



        if ( $status -eq "Running" )

        {

            $SvcRunning = $true

        }



    }

    

    $SvcRunning



}



#

# Function Description:

#

#  This function will count the number of users in the specified group

#

# Arguments:

#

#  $groupName - Name of the User Group

#

# Return Value:

#

#  Count of the number of members in the specified group

#

function CountUsersInGroup ( $groupName )

{

    $countUsers = 0

    

    #

    # Set the Domain to the Local computer name obtained using $env:COMPUTERNAME

    #

    $domain = $env:COMPUTERNAME

    

    #

    # Set up the WMI Query Filter

    #

    $queryFilter = "GroupComponent=`"Win32_Group.Domain='$domain',Name='$groupName'`""

    

    #

    # Make the WMI call to get list of users

    #

    [Object[]] $users = Get-WmiObject Win32_GroupUser -filter $queryFilter

    

    #

    # if $users is $null then the number of users is 0

    #

    if ( $users -eq $null ) 

    {

        $countUsers = 0

    } 

    else

    {

        $countUsers = $users.Count

    }

    

    #

    # Return count of users

    #

    $countUsers

}



#

# Function Description:

#

#  This function will count the number of instances of the specified WMI class

#  in the specified WMI namespace

#

# Arguments:

#

#  $wmiClassName - Name of the WMI Class

#  $wmiNamespace - Name of the WMI Namespace

#

# Return Value:

#

#  Count of instances of WMI class

#

function CountOfWMIClassInstance ( $wmiClassName, $wmiNamespace )

{

    $countInstances = 0

    



    Try {    

        #

        # Make the WMI call to get instances of WMI class

        #

        [Object[]] $instances = Get-WmiObject $wmiClassName -namespace $wmiNamespace

    } Catch { 

       #Nothing

    }

    

    #

    # if $instances is $null then the number of instances is 0

    #

    if ( $instances -eq $null )

    {

        $countInstances = 0

    }

    else

    {

        $countInstances = $instances.Count

    }

    

    #

    # Return count of instances

    #

    $countInstances        

}





#

# Function Description:

#

#  This function will count the number of instances of the specified WMI class with Enabled = $true

#  in the specified WMI namespace

#

# Arguments:

#

#  $wmiClassName - Name of the WMI Class

#  $wmiNamespace - Name of the WMI Namespace

#

# Return Value:

#

#  Count of instances of WMI class

#

function CountOfEnabledWMIClassInstance ( $wmiClassName, $wmiNamespace )

{

    $countInstances = 0

    

    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [Object[]] $instances = Get-WmiObject $wmiClassName -namespace $wmiNamespace | where-object {$_.Enabled -eq $true}

    } Catch { 

       #Nothing

    }

    

    #

    # if $instances is $null then the number of instances is 0

    #

    if ( $instances -eq $null )

    {

        $countInstances = 0

    }

    else

    {

        $countInstances = $instances.Count

    }

    

    #

    # Return count of instances

    #

    $countInstances        

}



#

# Function Description:

#

#  This function gets the OS Version of the computer $compName in x.y format

#



function GetOSVersionComp (  $compName )

{

    $ver = $null



    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        $instanceOSClass = Get-WmiObject "Win32_OperatingSystem" -namespace "root\cimv2" -computername $compName -ErrorAction silentlycontinue  

    } Catch { 

       #Nothing

    }



    $str = $null



   if ( $instanceOSClass -ne $null )

   {

       $ret = $null

       $ret = $instanceOSClass.Version



       if ( $ret -ne $null )

       {

           $val = $ret.Split('.')

           if ( $val.count -ge 2)

           {

               $str = $val[0] + "." + $val[1]

           }

           else

           {

               $str = $ret

           }

       }

   }

 

   $str    

}



#

# Function Description:

#

#  This function will checkif TS Gateway is using Central CAP store

#



function IsCentralCAPEnabled ()

{

    $usesCentralCAPStore = $false

    

    #

    # Make the WMI call to get instances of WMI class

    #

    [Object] $ServerSettingsInstance = Get-WmiObject "Win32_TSGatewayServerSettings" -namespace "root\CIMV2\TerminalServices"

    

    #

    # if $ServerSettingsInstance is $null then the number of instances is 0

    #

    if ( $ServerSettingsInstance -eq $null )

    {

        $usesCentralCAPStore = $false

    }

    else

    {

        $usesCentralCAPStore = $ServerSettingsInstance.CentralCAPEnabled

    }

    

    #

    # Return count of instances

    #

    $usesCentralCAPStore        

}



#

# Function Description:

#

#  This function will check if TS Gateway allows unlimited conenctions

#



function UnlimitedconnectionsSettingTSG ()

{

    $unlimitedconnectionsAllowed = $false

    

    #

    # Make the WMI call to get instances of WMI class

    #

    [Object] $ServerSettingsInstance = Get-WmiObject "Win32_TSGatewayServerSettings" -namespace "root\CIMV2\TerminalServices"

    

    #

    # if $ServerSettingsInstance is $null then the number of instances is 0

    #

    if ( $ServerSettingsInstance -eq $null )

    {

        $unlimitedconnectionsAllowed = $false

    }

    else

    {

        $unlimitedconnectionsAllowed = $ServerSettingsInstance.UnlimitedConnections

    }

    

    #

    # Return count of instances

    #

    $unlimitedconnectionsAllowed        

}



#

# Function Description:

#

#  This function returns the maximum connections allowed by the TSG

#



function NumberConnectionsAllowedByTSG ()

{

    $maxConnectionsAllowed = 0

    

    #

    # Make the WMI call to get instances of WMI class

    #

    [Object] $ServerSettingsInstance = Get-WmiObject "Win32_TSGatewayServerSettings" -namespace "root\CIMV2\TerminalServices"

    

    #

    # if $ServerSettingsInstance is $null then the number of instances is 0

    #

    if ( $ServerSettingsInstance -eq $null )

    {

        $maxConnectionsAllowed = 0

    }

    else

    {

        $maxConnectionsAllowed = $ServerSettingsInstance.MaxConnections

    }

    

    #

    # Return count of instances

    #

    $maxConnectionsAllowed        

}



#

# Function Description:

#

#  This function checks if maximum number of connections has  been

#  exhausted to the TSG

#



function TSGConnectionsExhausted ( $MaxConnectionsAllowed )

{

    $connectionsExhausted = $false



    $numberConnections = CountOfWMIClassInstance "Win32_TSGatewayConnection" "root\CIMV2\TerminalServices"



    if ( $numberConnections -ge $MaxConnectionsAllowed )

    {

        $connectionsExhausted = $true

    }

    else

    {

        $connectionsExhausted = $false

    }

    

    $connectionsExhausted

}



#

# Function Description:

#

#  Returns true if a computer is rechable (can ping to it)

#



function IsComputerReachable ( $computerName )

{

    $pingcount = 0



    $computerRechable = $false

    

    #

    # Make the ping call

    #

    $pingCount =  (ping "$computerName"  | select-string "time[=|<]" ).count



    if ( $pingCount -ge 1 )

    {

        $computerRechable = $true

    }

    

    $computerRechable        

}



#

# Function Description:

#

#  Returns the value of $valueName from registry $keyPath

#

function GetValueFromRegistry ( $keyPath, $valueName )

{



    $value = $null



    $rpcRegKeyPath = "$keyPath"



    $regKeys = Get-ItemProperty $rpcRegKeyPath | get-member -membertype noteproperty | select-object name,Definition



    foreach ( $key in $regKeys)

    {

        if ( $key.name -eq $valueName )

        {

            $regKey = $key

            break

        }

    }



    if ($regKey -ne $null )

    {

        $webSiteDef = $regKey.Definition

        if ( $webSiteDef -ne $null )

        {

            $strings = $webSiteDef.split("=")

            if ($strings.Length -eq 2)

            {

                $value = $strings[1]

            }

        }

    }



    $value

}





#

# Function Description:

#

#  Returns true if the site  $site has the application $app in it

#  false otherwise

#

function IsSiteRuning ( $webSiteName )

{

    $siteRuning = $false



    $winDir = $env:windir



    $op = [System.Reflection.Assembly]::LoadFile("$winDir\System32\inetsrv\Microsoft.Web.Administration.dll")



    $mgr = new-object Microsoft.Web.Administration.ServerManager



    if ( $mgr -ne $null )

    {

        $webSite = GetWebSite -sites:$mgr.Sites -siteName:$webSiteName



        if ( $webSite -ne $null )

        {

            $state = $webSite.state



            if ( $state -eq "Started")

            {

                $siteRuning = $true

            }

        }

    }



    $siteRuning

}



#

# Function Description:

#

#  Returns the corresponding site object from the list of given sites and site name

#

function GetWebSite ( $sites, $siteName )

{

    $site = $null



    foreach ( $tmpSite in $sites )

    {

        if ( $tmpSite.Name -eq $siteName )

        {

            $site = $tmpSite

            break

        }

    }



    $site

}



#

# Function Description:

#

#  Returns true if the site  $site has the application $app in it

#  false otherwise

#

function IsApplicationInSiteConfigured ( $command, $site, $app )

{

    $appConfigd = $false



    $op = & $command List config "$site" -section:"system.applicationHost/sites"



    if ( $op -ne $null )

    {

        $str = "application path=""/$app"""



        $res = $op -clike "*$str*"



        if ( ( $res -eq $null ) -or ( $res.Length -le 0) )

        {

            $appConfigd = $false

        }

        else

        {

            $appConfigd = $true 

        }        

    }



    $appConfigd

}





#

# Function Description:

#

#  Returns 1 if value of reg key "HKLM:\SOFTWARE\Microsoft\Terminal Server Gateway\Authorization plug-ins"

#  is not native, 0 if native and 2 if nothing is configured in this key 

#

function IsAuthorizationPlugginNonNative ()

{

    $retVal = 2



    $keyName = "(default)"



    $RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Terminal Server Gateway\Authorization plug-ins"

 

    $keyVal =  Get-ItemProperty $RegKeyPath -name $keyName



    if ( $keyVal -ne $null )

    {

        $val = $keyVal.$keyName



        $KeyValLen = $val.Length



        if ( $KeyValLen -ge 1)

        {

            $valLower = $val.ToLower()



            if ( $valLower -eq "native")

            {

                $retVal = 0

            }

            else

            {

                $retVal = 1

            }

        }

    }



    $retVal

}



#

# Function Description:

#

#  Checks if any of the NPs servers configured are rechable

#



function GetNPSServers ( )

{

    $serverNames = @()



    [Object[]] $instances = Get-WmiObject "Win32_TSGatewayRADIUSServer" -namespace "root\CIMV2\TerminalServices"



    if ( $instances.count -eq 0 )

    {

        $rechableServerName = $null

    }

    else

    {

        $serverRechable = $false



        Foreach ( $i in $instances )

        {

            $serverNames += @($i.Name)

        }

    }



    $serverNames

}





#

# Function Description:

#

#  Returnes the SSL certificate (if configured) fot the website $webSiteName

#

function GetCertForWebsite ( $webSiteName )

{

    $winDir = $env:windir



    $certForWebPage = $null



    $op = [System.Reflection.Assembly]::LoadFile("$winDir\System32\inetsrv\Microsoft.Web.Administration.dll")



    $mgr = new-object Microsoft.Web.Administration.ServerManager



    if ( $mgr -ne $null )

    {

        $webSite = GetWebSite -sites:$mgr.Sites -sitename:$webSiteName



        if ( $webSite -ne $null)

        {

            $certHash = $null



            foreach ($binding in $webSite.Bindings)

            {

                if (($binding.EndPoint -ne $null) -and ($binding.EndPoint.Port -eq 443))

                {

                    if ($binding.UseDsMapper -eq $true)

                    {

                        $certHash = $binding.CertificateHash;

                        $certStore = $binding.CertificateStoreName 

                    }

                    break;

                }

            }



            if ( $certHash -ne $null )

            {

                $certList = Get-item -path cert:LocalMachine\$certStore\*

                $numCerts = $certList.Length



                $len = $certHash.count

             

                foreach ( $cert in $certList)

                {

                    $certHashcurr = $cert.GetCertHash()



                    $lenCurr = $certHashcurr.count



                    if ( $len -eq $lenCurr)

                    {

                        $match = $true



                        $limit = $len - 1



                        for ( $i=0; $i -le $limit; $i+=1)

                        {

                            $num1 = $certHashcurr[$i]

                            $num2 = $certHash[$i]

                            if ( $num1 -ne $num2)

                            {

                                $match = $false

                                break

                            }

                        }

 

                        if ( $match -eq $true )

                        {

                            $certForWebPage = $cert

                            break

                        } 

                    }

                }

            }

        }

    }



    $certForWebPage

}



#

# Function Description:

#

#  Returnes 1 if subject matches FQDN, 2 if it matches netbios name 0 otherwise

#

function FindDomainFromIPConfig()

{

    $ipconfiginfo = $null



    $ipconfiginfo = ipconfig /all



    $domInf = $null



    $domNm = $null



    if ($ipconfiginfo -ne $null)

    {

        $domInf = $ipconfiginfo  | select-string "Primary Dns Suffix"



        $domInfStr = $domInf.ToString()



        $vals = $null

   

        if ( $domInfStr -ne $null )

        {

            $vals = $domInfStr.split(':')



            if ( $vals.Count -ge 2 )

            {

                $domNm = $vals[1]

               $domNm = $domNm.trim()

            }

        }

    }



    $domNm    

}



#

# Function Description:

#

#  This is a helper function for function GetSubjAltNames

#  This takes in a string (can be multi-line) and returns the DNS names (as an array) in it 

#  (strings starting with "DNS Name=")

#

function ScanStringForNames ( $stringToScan )

{

    $list = @()

    

    $strLookinFor = "DNS Name="

    $endStr = "`r`n"



    $strlenInpStr = $stringToScan.Length

 

    $loopEnd = $false



    $postostartLookin = 0

 

    while ( $postostartLookin -lt $strlenInpStr )

    {

        $posBegin = -1

        $endPos = -1



        $subStr = $null



        $posBegin = $stringToScan.IndexOf( $strLookinFor, $postostartLookin )



        if ( $posBegin -gt -1)

        {

            $endPos = $stringToScan.IndexOf( $endStr, $posBegin )



            $startTrimPos = $posBegin + $strLookinFor.Length

             

            if ( $endPos -gt $posBegin )

            {

                $lenToCut = $endPos - $startTrimPos

                $subStr = $stringToScan.SubString( $startTrimPos, $lenToCut )



            }

            else

            {

                $subStr = $stringToScan.SubString( $startTrimPos )

            }

            

            $subStrLen = $subStr.Length



            $postostartLookin = $posBegin + $subStrLen



            $list += @($subStr)

        }

        else

        {

            $postostartLookin = $strlenInpStr

        }

    }



    $list

}



#

# Function Description:

#

# This is a helper function for function GetIPADDRList

# Recieves the certificate as a string and scans for the section containing SAN's

# the section starts with the heading "Subject Alternative Name(2.5.29.17)"

# The function returns all the DNS names found in the cert as an array

#

function GetSubjAltNames ( $cert )

{

    $extns = $cert.Extensions

    

    $list = @()



    foreach ($extn in $extns)

    {

        if ( $extn -eq $null)

        {

            break

        }



        $str = $extn.Format($true)

        if ( $str -clike "DNS Name=*")

        {

            $nameList = ScanStringForNames ($str)



            foreach ($name in $nameList)

            {

                $list += @($name)

            }

        }

    }



    $list

}



#

# Function GetIPADDRList

#

# Returns the IP Addresses as a list for the provided machine

#

function GetIPADDRList ( $machineName )

{

    $ipAddLst = @()



    if ( ( $machineName -ne $null ) -and ( $machineName.Length -gt 0 ) )

    {



        $colItems = GWMI -cl "Win32_NetworkAdapterConfiguration" -name "root\CimV2" -comp $machineName -filter "IpEnabled = TRUE"



        foreach ( $objItem in $colItems )

        {

            $ipAddListItem = $objItem.IPAddress



            foreach ( $item in $ipAddListItem )

            {

                $ipAddLst += @($item)

            }

        }

    }



    $ipAddLst

}





#

# Function GetIPADDRFfromDNS

#

# Returns the IP Addresses as a list for the provided name from nslookup query

#

function GetIPADDRFfromDNS ( $name )

{

    $addrLst = @()



    if ( ( $name -ne $null) -and ( $name.Length -gt 0 ) )

    {

        $errStr = $null



        $op = ""



        $opList = & nslookup $name 2> $errStr



        foreach ( $item in $opList )

        {

           $op += $item + "`r`n"

        }



        $strToMatch = "*$name`r`nAddress*"



        $strAddress1 = "Address:"

        $strAddress2 = "Addresses:"



        $res = $false

        $res = $op -like $strToMatch





        if ( $res -eq $true )

        {

            $posOfName = -1

            $posOfAddress = -1



            $posOfName = $op.IndexOf($name)



            if ( $posOfName -ge 0 )

            {

                $posToLookFrom = $posOfName + $name.Length

                $posOfAddress = $op.IndexOf($strAddress1, $posToLookFrom)

                $lenOfAddrStr = $strAddress1.Length



                if ( $posOfAddress -le $posToLookFrom )

                {

                    $posOfAddress = $op.IndexOf($strAddress2, $posToLookFrom)

                    $lenOfAddrStr = $strAddress2.Length

                }



                if ( $posOfAddress -gt $posToLookFrom )

                {

                    $subStr = $null



                    $posToCutFrom = $posOfAddress + $lenOfAddrStr



                    $subStr = $op.SubString($posToCutFrom)



                    $splitStrs = $subStr.Split("`r`n")



                    foreach ($str in $splitStrs)

                    {

                        $strTmp = $null

                        $strTmp = $str.Trim()

                

                        if ( ($strTmp -ne $null) -and ( $strTmp.Length -gt 0 ) )

                        {

                            $addrLst += @($strTmp)

                        }

                    }

                }

            }

        }

    }

    $addrLst

}





#

# Funciton IsCommonItemInLists

# Returns true if there is at least one comon item in the two lists

#

function IsCommonItemInLists ( $list1, $list2 )

{

    $found = $false



    if ( ( ( $list1 -ne $null ) -and ( $list2 -ne $null ) ) -and ( ( $list1.Count -gt 0 ) -and ( $list2.count -gt 0 ) ) )

          

    {

        foreach ( $item in $list1 )

        {

            foreach ( $itemInner in $list2 )

            {

                if ( $item -eq $itemInner )

                {

                    $found = $true

                    break

                }

            }



            if ( $found -eq $true )

            {

                break

            }

        }

    }



    $found

}



#

# Function Description:

#

#  Returns 1 if subject(or SAN) matches FQDN, 2 if it matches netbios name ,

#  1 if there is a common ip address in the list of IP's for the certificate subject

#  and the machine and 0 otherwise

#

function CheckIfCertSubjectMatchesCurrentMachineName ( $certToCheck )

{

    $match = 0

    $domains = get-wmiobject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Select-Object -Property DNSDomain



    $machineNetBios = $env:ComputerName

        

    $lookinFor = "CN="



    $strVal = $certToCheck.Subject



    $vals = $strVal.Split(",")



    $certSubj = $null



    foreach ( $val in $vals)

    {

        $val1 = $val.TrimStart(" ")

    

        $boolVal = $val1.StartsWith($lookinFor)

        if ( $boolVal -eq $true)

        {

            $certSubj = $val1.TrimStart($lookinFor)

            break

       }

    }



    $domNotFound = $true



    $ipAddressesForLocalMacine = $null



    $ipListForCertSubject = $null



    $ipAddressesForLocalMacine = GetIPADDRList ( $machineNetBios )



    foreach ( $domain in $domains )

    {

        $domainStr = $domain.DNSDomain



        if ( $domainStr -ne $null )

        {

            $domNotFound = $false



            $FQDN = "$machineNetBios.$domainStr"



            if ( $certSubj -eq $FQDN ) 

            {

                $match = 1

                break

            }

        }

    }



    if ( $domNotFound -eq $true )

    {

        $domName = $null



        $domName = FindDomainFromIPConfig



        $FQDN = "$machineNetBios.$domName"



        if ( $certSubj -eq $FQDN ) 

        {

            $match = 1

        }

    }

    

    if ( $match -eq 0 )

    {

        if ( $machineNetBios -eq $certSubj )

        {

            $match = 2

        }

        else

        {

            $ipListForCertSubject = $null

            $ipListForCertSubject = GetIPADDRFfromDNS ( $certSubj )



            $found = $false



            $found = IsCommonItemInLists -list1:($ipAddressesForLocalMacine) -list2:($ipListForCertSubject)



            if ( $found -eq $true )

            {

                $match = 1

            }

        }

    }



    if ( ( $match -eq 0 ) -or ( $match -eq 2 ) )

    {

        $certSANNameArr = GetSubjAltNames $certToCheck



        if ( $certSANNameArr -ne $null)

        {

            foreach ( $certSANName in $certSANNameArr )  

            {   

                $domNotFound = $true



                foreach ( $domain in $domains )

                {

                    $domainStr = $domain.DNSDomain

    

                    if ( $domainStr -ne $null )

                    {

                        $domNotFound = $false



                        $FQDN = "$machineNetBios.$domainStr"



                        if ( $certSANName -eq $FQDN ) 

                        {

                            $match = 1

                            break

                        }

                    }

                }



                if ( $domNotFound -eq $true )

                {

                    $domName = $null



                    $domName = FindDomainFromIPConfig



                    $FQDN = "$machineNetBios.$domName"



                    if ( $certSANName -eq $FQDN ) 

                    {

                        $match = 1

                    }

                }



                if ( $match -eq 1 )

                {

                    break

                }



                if ( $match -eq 0 )

                {

                   if ( $machineNetBios -eq $certSANName )

                   {

                       $match = 2

                   }

                   else

                   {

                       $ipListForCertSubject = $null

                       $ipListForCertSubject = GetIPADDRFfromDNS ( $certSANName )



                       $found = $false



                       $found = IsCommonItemInLists -list1:($ipAddressesForLocalMacine) -list2:($ipListForCertSubject)



                       if ( $found -eq $true )

                       {

                           $match = 1

                           break

                       }

                   }

               }

           }

       }

    }



    $match

}





#

# Function Description:

#

#  Returnes 1 if cert is Self Signed Cert 0 otherwise

#

function CheckIfCertIsSelfSigned ( $certToCheck )

{

    $match = 0

    $domains = get-wmiobject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Select-Object -Property DNSDomain



    $machineNetBios = $env:ComputerName

        

    $certSubj = ($certToCheck.Issuer.Split("="))[1]



    foreach ( $domain in $domains )

    {

        $domainStr = $domain.DNSDomain



        $FQDN = "$machineNetBios.$domainStr"



        if ( $certSubj -eq $FQDN ) 

        {

            $match = 1

            break

        }

    }



    if ( $match -eq 0 )

    {

        $domName = $null



        $domName = FindDomainFromIPConfig



        $FQDN = "$machineNetBios.$domName"



        if ( $certSubj -eq $FQDN ) 

        {

            $match = 1

        }

    }

    

    if ( $match -eq 0 )

    {

        if ( $machineNetBios -eq $certSubj )

        {

            $match = 1

        }

    }



    $match

}



#

# Function Description:

# Returns if value in HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TerminalServerGateway\Config\Core\OnlyConsentCapableClients

# is 1, returns 0 otherwise

#

function IsConenctOnlyToWin7clientsSet ( )

{

    $keyName = "OnlyConsentCapableClients"

    $RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TerminalServerGateway\Config\Core"



    $retVal = $false



    $keyVal =  Get-ItemProperty $RegKeyPath -name $keyName



    if ( $keyVal -ne $null )

    {

        $val = $keyVal.$keyName



        if ( $val -eq 1)

        {

            $retVal = $true

        }

    }



    $retVal

}



#

# Function Description:

#

#  Returnes the SID's found in $text

#  $text is an excrpt from the NPS configuration dump file (in XML format)

#

function GetGroupNames ( $text )

{

    $ret = $null



    $Index = $text.IndexOf('"')

    $lastIndex = $text.LastIndexOf('"')

    $length = $lastIndex - $Index - 1



    $actualIndex = $index + 1



    if ( $length -ge 1 )

    {

        $SubStr = $text.SubString($actualIndex , $length)

    }



    if ( ( $SubStr -ne $null ) -and ( $SubStr.Length -ne 0 ) )

    {

        $ret = $SubStr.Split(";")

    }



    $ret

}



#

# Function Description:

#

#  Returnes the name for the SID

#

function ConvertSIDToName  ( $SID )

{

    $ret = $null

    $name = $null

    

    $sidObj = new-object System.Security.Principal.SecurityIdentifier ( $SID)

 

    if ( $sidObj -ne $null )

    {

        $name = $sidObj.Translate( [System.Security.Principal.NTAccount])

        if ( $name -ne $null )

        {

            $ret = $name.ToString()

        }

    }



    $ret

}



#

# Function Description:

#

#  Returnes the name of the health policy in $text

#  $text is an excrpt from the NPS configuration dump file (in XML format)

#

function GetHealthPolicyName ( $text )

{

    $ret = $null



    $Index = $text.IndexOf('"')

    $lastIndex = $text.LastIndexOf('"')

    $length = $lastIndex - $Index - 1



    $actualIndex = $index + 1



    if ( $length -ge 1 )

    {

        $SubStr = $text.SubString($actualIndex , $length)

    }



    if ( ( $SubStr -ne $null ) -and ( $SubStr.Length -ne 0 ) )

    {

        $ret = $SubStr

    }



    $ret    

}



#

# Function Description:

#

#  Returnes true if the NAS_PORT_TYPE in $text

#  is "^5$" (i.e. Virtual(VPN)), false otherwise

#

function NASPortTypeVPN ( $text )

{

    $ret = $false



    $Index = $text.IndexOf('"')

    $lastIndex = $text.LastIndexOf('"')

    $length = $lastIndex - $Index - 1

    $actualIndex = $index + 1



    if ( $length -ge 1 )

    {

        $SubStr = $text.SubString($actualIndex , $length)

    }



    $NASPortValStrs = $SubStr.Split('=')



    $count = $NASPortValStrs.Count   



    if ( $count -eq 2 )

    {

        $strVal = $NASPortValStrs[1]



        if ( ( $strVal -ne $null ) -and ( $strVal -eq "^5$" ) )

        {

            $ret = $true

        }

    }



    $ret

}



#

# Function Description:

#

#  Returnes 0, 1, 2 or 3 depending on the auth method found in $text

#  0 means no auth method was found. i = PW, 2 = SC, 3 = PW and SC

#  $text is an excrpt from the NPS configuration dump file (in XML format)

#

function GetAuthMethod ( $text )

{

    $ret = 0



    $Index1 = $text.LastIndexOf('(')

    $Index2 = $text.IndexOf(')')



    $length = $Index2 - $Index1 - 1



    $actualIndex = $Index1 + 1



    if ( $length -ge 1 )

    {

        $SubStr = $text.SubString($actualIndex , $length)

    }



    $strs = $null



    if ( ( $SubStr -ne $null ) -and ( $SubStr.Length -ne 0 ) )

    {

        $strs = $SubStr.Split("|")

    }



    foreach ( $str in $strs)

    {

        if ( $str -eq "PW" )

        {

            $ret += 1

        }



        if ( $str -eq "SC" )

        {

            $ret += 2

        }

    }



    $ret    

}



function IsRemoteDesktopDisabled()

{

    $reg = Get-WMIObject -List -Namespace root\default -class StdRegProv -ErrorAction SilentlyContinue

    $result = $reg.getDwordvalue(2147483650,"software\policies\microsoft\windows nt\terminal services","fDenyTSConnections")

    if(($result.ReturnValue -eq 0) -and ($result.uValue -eq 1)) {

		  return 1

    }

    

    $result = $reg.getDwordvalue(2147483650,"system\currentcontrolset\control\terminal server","fDenyTSConnections")

    if(($result.ReturnValue -eq 0) -and ($result.uValue -eq 1)) {

		  return 1

    }

    return 0

}



function GetTsMaxInstanceCount()

{

    $MaxInstanceCount = 0

    Import-Module RemoteDesktopServices

    $TotalConnections = Get-Item "RDS:\RDSConfiguration\Connections\*\ConnectionStatus" | ?{$_.CurrentValue -eq 1} | %{Get-Item "$($_.parentpath)\MaximumConnections"} | Measure-Object -Sum -Property CurrentValue

    if($TotalConnections -ne $NULL) {

        $MaxInstanceCount = $TotalConnections.Sum

    }

    

    # the following code is needed to handle a bug in the BPA frame work

    if($MaxInstanceCount -gt 1024) {

        $MaxInstanceCount = 1024

    }

    return $MaxInstanceCount

}





function IsAltServerSpecified()

{

    $WrkSpace = Get-WmiObject -Namespace root\cimv2\terminalservices -Class win32_workspace

    $Redirector = $WrkSpace.Redirector

    $AltSrv = $WrkSpace.RedirectorAlternateAddress

    

    # no redirector hence complaint

    if(($Redirector -eq $NULL) -or ($Redirector -eq "")) {

        return 1

    }

    

    # alternate server not specified though redirector is specified

    if(($AltSrv -eq $NULL) -or ($AltSrv -eq "")) {

        return 0

    }

    

    return 1

}



#

# Gets IP addresses of a machine(both IPv4 and IPv6)

#

function GetMachineIP($MachineName)

{

    $MachineIP = @()

    try {

        $MachineIPAddr = [System.Net.Dns]::GetHostAddresses($MachineName)

        $IPv4 = @($MachineIPAddr|?{$_.AddressFamily -eq "InterNetwork" } | %{$_.IPAddressToString})

        if($IPv4.Count -gt 0) {

            $MachineIP = $MachineIP + $IPv4

        }

        $IPv6 = @($MachineIPAddr|?{$_.AddressFamily -eq "InterNetworkV6" } | %{$_.IPAddressToString})

        if($IPv6.Count -gt 0) {

            $MachineIP = $MachineIP + $IPv6

        }

    }catch{

    }

    return $MachineIP

}



function IsIPAdress([System.String]$Address)

{

    $RetValue = $TRUE

    try {

        [System.Net.IPAddress]::Parse($Address)

    }catch {

        $RetValue = $FALSE

    }

    return $RetValue

}



function IsFQDN([System.String]$Name)

{

    $Components = $Name.Split(".")

    if($Components.Count -gt 1) {

        return $TRUE

    }

    return $FALSE

}



function AreNamesSame([System.String]$Name1, [System.String]$Name2)

{

    $RetValue = $FALSE

    $Name1 = $Name1.ToLower()

    $Name2 = $Name2.ToLower()

    if((IsFQDN $Name1) -and (IsFQDN $Name2)) {

        $RetValue = $Name1.Equals($Name2)

    }else {

        $RetValue = $Name1.Split(".")[0].Equals($Name2.Split(".")[0])

    }

    return $RetValue

}



function CheckRedirectorAltServerSameIP()

{

    $WrkSpace = Get-WmiObject -Namespace root\cimv2\terminalservices -Class win32_workspace

    $Redirector = $WrkSpace.Redirector

    $AltSrv = $WrkSpace.RedirectorAlternateAddress

    

    # alternate server not specified, so complaint

    if(($AltSrv -eq $NULL) -or ($AltSrv -eq "")) {

        return 1

    }

    

    # only alternative server is specified, so not complaint

    if(($Redirector -eq $NULL) -or ($Redirector -eq "")) {

        return 0

    }

    

    # check if alternate server name and redirector name are the same

    if(!(IsIPAdress $AltSrv) -and !(IsIPAdress $Redirector)) {

        if(AreNamesSame $AltSrv $Redirector) { 

            return 0

        }

    }

    

    # redirector is IP pass the rule. Avoid false -ve

    if((IsIPAdress $Redirector)) {

        return 1

    }

    

    $AltSrvIP = @(GetMachineIP $AltSrv)

    if($AltSrvIP.Count -eq 0) {

        return 0

    }

    

    

    $RedirectorIP = @(GetMachineIP $Redirector)

    if($RedirectorIP.Count -eq 0) {

        return 0

    }

    

    

    if([System.Array]::IndexOf($RedirectorIP, $AltSrvIP[0]) -ne -1) {

        return 1

    }

    

    return 0

}



#

# check if firewall exception is enabled for remote desktop

#

function IsFireWallExEnabledForRD()

{

    $FwPolicy2 = New-Object -ComObject HNetCfg.FwPolicy2

    $Enabled = $FwPolicy2.IsRuleGroupCurrentlyEnabled("@FirewallAPI.dll,-28752")

    if($Enabled) {

        return 1

    }

    return 0

}



function IsCALTypeAvailable([System.String]$CalType, [System.Collections.Hashtable]$AvailableCALTab)

{

    if($AvailableCALTab.ContainsKey($CalType)) {

        if($AvailableCALTab[$CalType] -gt 0) {

            return $TRUE

        }

    }

    

    return $FALSE

}



function IsHigherVersionCALAvailable([System.String]$CalType, [System.Collections.Hashtable]$AvailableCALTab, [System.Collections.Hashtable]$HigherVersionCALTab)

{

    

    #

    # this condition does not throw false warnings for the future cal versions

    # 

    if(!($HigherVersionCALTab.ContainsKey($CalType))) {

        return $TRUE

    }

    

    $HigherVersionCalTypes = $HigherVersionCALTab[$CalType]

    foreach($HigherVersionCal in $HigherVersionCalTypes) {

        if(IsCALTypeAvailable $HigherVersionCal $AvailableCALTab) {

            return $TRUE

        }

    }

    return $FALSE

}



function IsLSPreventUpgradeGPEnabled()

{

    $LSServer = New-Object System.Management.ManagementClass("Win32_TSLicenseServer")

    if($LSServer) {

        $Status = $LSServer.IsLSPreventUpgradeGPEnabled()

        if($Status.ReturnValue -eq 0) {

            return $Status.Enabled

        }

    }

    return $FALSE

}



#

# Compute the available Non-PU CALs (i.e., PD or Internet type) for each product version (for which CAL has been installed) and

# report if any of the product versions has zero available Non-PU CALs

# Return Values:

#   0 - there is atleast one product version (for which CAL has been installed) for which Non-PU CALs available count is zero

#   1 - all product versions (for which CAL has been installed) have atleast one Non-PU CAL available

#   2 - there are no Non-PU CAL packs

#

function IsNonPUCALAvailable([System.Array]$CALPacks)

{

    

    $AvailableCALTab = @{}

    foreach($CALPack in $CALPacks) {     

        # enumerate available CALs for all product types other than PU

        if($CALPack.ProductType -ne 1) {

            [String]$Key =  [String]$CALPack.ProductVersionID + "_" + $CALPack.ProductType

            if($AvailableCALTab.ContainsKey($Key)) {

               $AvailableCALTab[$Key] += $CALPack.AvailableLicenses

            }else{

               $AvailableCALTab.Add($Key, $CALPack.AvailableLicenses)

            }

        }

    }

    

    # No Non-PU CAL packs

    if($AvailableCALTab.Count -eq 0) {

        return 2

    }

    

    $NoAvailableCALProdVers = $AvailableCALTab.GetEnumerator() | ?{$_.Value -le 0}

    if($NoAvailableCALProdVers) {

        if((IsLSPreventUpgradeGPEnabled)) {

            return 0

        }

        

        # define a hashtable that contains the higher version CAL information

        # for example, the higher version cals for win2k PD("0_0") are win2k3("1_0") and win2k8("2_0")

        $HigherVersionCALTab = @{}

        

        # Add higher version cals

        # the following encoding is used for representing win2k, win2k3 and win2k8 PD cal types

        # A code of the form "ProductVersionID_ProductType" represents a CAL of particualr product version

        # and of a particular product type. for example, "0_0" represents win2k PD cal and 

        # "2_0" represents win2k8 PD cal

        

        $HigherVersionCALTab.Add("0_0", @("1_0", "2_0"))

        $HigherVersionCALTab.Add("0_2", @())

        $HigherVersionCALTab.Add("1_0", @("2_0"))

        $HigherVersionCALTab.Add("2_0", @())

        

        foreach($ProdVerCALType in $NoAvailableCALProdVers) {

            if(!(IsHigherVersionCALAvailable $ProdVerCALType.Name $AvailableCALTab $HigherVersionCALTab)) {

                return 0

            }

        }

    }

    return 1

}



function IsPUCALAvailable()

{

    

    import-module RemoteDesktopServices

    $res = 1

    $repObj = New-Item "RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports" -Scope AllTrustedDom

    if($repObj -eq $NULL) {

        $repObj = New-Item "RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports" -Scope Dom

    }

    if($repObj -eq $NULL) {

        return $res

    }

    $rep = $repObj | %{$_.Name}

    $caltypes = Get-ChildItem "RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports\$rep" | ?{($_.name -ne "Version") -and ($_.name -ne "Scope")} | %{$_.name}

    foreach($ctype in $caltypes) {

        $InsCount = (Get-Item "RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports\$rep\$ctype\InstalledCount").CurrentValue

        $IssCount = (Get-Item "RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports\$rep\$ctype\IssuedCount").CurrentValue

        if(($InsCount -eq 0) -and ($IssCount -eq 0)) {

            continue

        }

        if($IssCount -ge $InsCount) {

            $res = 0

            break

        }

    }

    if($rep) {

        Remove-Item "RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports\$rep" -Recurse

    }

    return $res

}



function IsCALAvailable()

{

    $CALPacks = Get-WMIObject -NameSpace root\cimv2 -Class Win32_TsLicenseKeyPack

    

    # No packs installed

    if(($CALPacks -eq $NULL)) {

        return 0

    }

    

    $InstalledPermCALPacks = @()

    foreach($CALPack in $CALPacks) {

        # exclude temp cals and win2k default cals

        if(($CALPack.KeyPackType -eq 4) -or (($CALPack.ProductVersionID -eq 0) -and ($CALPack.KeyPackType -eq 6))) {

             continue

        }

        $InstalledPermCALPacks += $CALPack

    }

    

    if($InstalledPermCALPacks.Count -eq 0) {

        return 0

    }

    

    if((IsNonPUCALAvailable $InstalledPermCALPacks) -eq 0) {

        return 0

    }

    return (IsPUCALAvailable)

}



function AreDomainUsrsInRemoteDesktopUsersGrp([System.String]$GroupName)

{

     $DomainUsrs = net localgroup $GroupName|?{$_ -match "\\"}

     if($DomainUsrs) {

        return 1

     }

     return 0

}



#

# Retrieves the collection user groups properties for a specified collection

# 

# Returns collection properties

#

function GetRDSHCollectionPropertiesUserGroups ($RDSHCollection, [REF]$RDSHCollectionReport)

{

    $UserGroups = @()

    $RDSHCollectionTempReport = ""

    

    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        $RetVal = Invoke-WmiMethod -Name "GetStringProperty" -InputObject $RDSHCollection -ArgumentList "SecurityDescriptor" 

    } Catch { 

       #Nothing

    }



    if ($RetVal.ReturnValue -eq 0)

    {

        #

        # Convert from SID to User Group

        #

        $parts = $RetVal.Value.Split("()")

        foreach ($part in $parts)

        {

            $index = $part.LastIndexOf(';')

            if ($index -le 0)

            {

                continue

            }

            $UserGroups += @(ConvertSIDToName $part.SubString($index+1))

        }

        $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyUserGroup + " " + $UserGroups + $NewLine

    }



    $RDSHCollectionReport.Value = $RDSHCollectionTempReport 

    return $UserGroups

}



#

# Retrieves the collection connection properties for a specified collection

# 

# Returns collection properties

#

function GetRDSHCollectionPropertiesConnections ($RDSHCollection, [REF]$RDSHCollectionReport)

{

    $Connections = New-Object ConnectionsType

    $RDSHCollectionTempReport = ""



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "DisconnectedSessionLimit" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Connections.DisconnectedSessionLimit = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_DisconnectedSessionLimit + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "ActiveSessionLimit" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Connections.ActiveSessionLimit = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_ActiveSessionLimit + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "IdleSessionLimit" 

    } Catch { 

        #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Connections.IdleSessionLimit = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_IdleSessionLimit + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "BrokenConnectionAction" 

    } Catch { 

        #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

        $Connections.BrokenConnectionAction = $RetVal.Value

        $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_BrokenConnectionAction + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "EnableAutomaticReconnection" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Connections.EnableAutomaticReconnection = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_EnableAutomaticReconnection + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "DeleteTempFoldersOnExit" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Connections.DeleteTempFoldersOnExit = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_DeleteTempFoldersOnExit + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "UseTempFoldersPerSession" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Connections.UseTempFoldersPerSession = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_UseTempFoldersPerSession + " " + $RetVal.Value + $NewLine

    }



    $RDSHCollectionReport.Value = $RDSHCollectionTempReport

    return $Connections

}



#

# Retrieves the collection security properties for a specified collection

# 

# Returns collection properties

#

function GetRDSHCollectionPropertiesSecurity ($RDSHCollection, [REF]$RDSHCollectionReport)

{

    $Security = New-Object SecurityType

    $RDSHCollectionTempReport = ""



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "SecurityLayer" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Security.SecurityLayer = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertySecurity_SecurityLayer + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "EncryptionLevel" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Security.EncryptionLevel = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertySecurity_EncryptionLevel + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "AuthenticateUsingNLA" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $Security.AuthenticateUsingNLA = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertySecurity_AuthenticateUsingNLA + " " + $RetVal.Value + $NewLine

    }



    $RDSHCollectionReport.Value = $RDSHCollectionTempReport 

    return $Security

}



#

# Retrieves the collection client settings properties for a specified collection

# 

# Returns collection properties

#

function GetRDSHCollectionPropertiesClientSettings ($RDSHCollection, [REF]$RDSHCollectionReport)

{

    $ClientSettings = New-Object ClientSettingsType

    $RDSHCollectionTempReport = ""



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "DeviceRedirectionOptions" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $ClientSettings.DeviceRedirectionOptions = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_DeviceRedirectionOptions + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "RedirectClientPrinter" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $ClientSettings.RedirectClientPrinter = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_RedirectClientPrinter + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "SetClientPrinterAsDefault" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $ClientSettings.SetClientPrinterAsDefault = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_SetClientPrinterAsDefault + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "UseRDEasyPrintDriver" 

    } Catch { 

       #Nothing

    }

        if ($RetVal.ReturnValue -eq 0)

    {

       $ClientSettings.UseRDEasyPrintDriver = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_UserRDEasyPrintDriver + " " + $RetVal.Value + $NewLine

    }



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "MaxMonitors" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $ClientSettings.MaxMonitors = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_MaxMonitors + " " + $RetVal.Value + $NewLine

    }



    $RDSHCollectionReport.Value = $RDSHCollectionTempReport 

    return $ClientSettings

}



#

# Retrieves the collection UVHD properties for a specified collection

# 

# Returns collection properties

#

function GetRDSHCollectionPropertiesUVHDSettings ($RDSHCollection, [REF]$RDSHCollectionReport)

{

    $UVHDSettings = New-Object UVHDSettingsType

    $RDSHCollectionTempReport = ""



    Try {

        #

        # Make the WMI call to get the desired property

        #

        $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "IsUserVHDEnabled" 

    } Catch { 

       #Nothing

    }

    if ($RetVal.ReturnValue -eq 0)

    {

       $UVHDSettings.IsUVHDEnabled = $RetVal.Value

       $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyUVHDSettings_IsUserVHDEnabled + " " + $RetVal.Value + $NewLine

    }



    if ($UVHDSettings -ne $NULL -and $UVHDSettings.IsUVHDEnabled -eq 1)

    {

        Try {

            #

            # Make the WMI call to get the desired property

            #

            $RetVal = Invoke-WmiMethod -Name "GetStringProperty" -InputObject $RDSHCollection -ArgumentList "UserVHDShare" 

        } Catch { 

            #Nothing

        }

        if ($RetVal.ReturnValue -eq 0)

        {

           $UVHDSettings.UserVHDShare = $RetVal.Value

           $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyUVHDSettings_UserVHDShare + " " + $RetVal.Value + $NewLine

        }



        Try {

            #

            # Make the WMI call to get the desired property

            #

            $RetVal = Invoke-WmiMethod -Name "GetStringProperty" -InputObject $RDSHCollection -ArgumentList "UserPolicyXML" 

        } Catch { 

            #Nothing

        }

        if ($RetVal.ReturnValue -eq 0)

            {

                $UVHDSettings.UserPolicyXML = $RetVal.Value

                $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyUVHDSettings_UserPolicyXML + " " + $RetVal.Value + $NewLine

            }



        Try {

            #

            # Make the WMI call to get the desired property

            #

            $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "DiskSizeInMB" 

        } Catch { 

            #Nothing

        }

        if ($RetVal.ReturnValue -eq 0)

        {

           $UVHDSettings.DiskSizeInMB = $RetVal.Value

           $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyUVHDSettings_DiskSizeInMB + " " + $RetVal.Value + $NewLine

        }



        Try {

            #

            # Make the WMI call to get the desired property

            #

            $RetVal = Invoke-WmiMethod -Name "GetInt32Property" -InputObject $RDSHCollection -ArgumentList "DiskType" 

        } Catch { 

            #Nothing

        }

        if ($RetVal.ReturnValue -eq 0)

        {

           $UVHDSettings.DiskType = $RetVal.Value

           $RDSHCollectionTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyUVHDSettings_DiskType + " " + $RetVal.Value + $NewLine

        }

    }



    $RDSHCollectionReport.Value = $RDSHCollectionTempReport 

    return $UVHDSettings

}



#

# Retrieves the collection properties for a specified collection

# 

# Returns collection properties

#

function GetRDSHCollectionProperties ($RDSHCollection, [REF]$RDSHCollectionReport)

{

    $RDSHCollectionProperties = New-Object RDSHCollectionPropertiesType



    $RDSHCollectionTempReport = $_system_translations.RDSHCollectionCheck_ExpectedPropertyValues + $NewLine 

    $RDSHCollectionTempReport2 = ""



    $RDSHCollectionProperties.UserGroups = GetRDSHCollectionPropertiesUserGroups $RDSHCollection ([REF]$RDSHCollectionTempReport2)

    $RDSHCollectionTempReport += $RDSHCollectionTempReport2



    $RDSHCollectionProperties.Connections = GetRDSHCollectionPropertiesConnections $RDSHCollection ([REF]$RDSHCollectionTempReport2)

    $RDSHCollectionTempReport += $RDSHCollectionTempReport2



    $RDSHCollectionProperties.Security = GetRDSHCollectionPropertiesSecurity $RDSHCollection ([REF]$RDSHCollectionTempReport2)

    $RDSHCollectionTempReport += $RDSHCollectionTempReport2



    $RDSHCollectionProperties.ClientSettings = GetRDSHCollectionPropertiesClientSettings $RDSHCollection ([REF]$RDSHCollectionTempReport2)

    $RDSHCollectionTempReport += $RDSHCollectionTempReport2



    $RDSHCollectionProperties.UVHDSettings = GetRDSHCollectionPropertiesUVHDSettings $RDSHCollection ([REF]$RDSHCollectionTempReport2)

    $RDSHCollectionTempReport += $RDSHCollectionTempReport2

    

    $RDSHCollectionReport.Value = $RDSHCollectionTempReport

    return $RDSHCollectionProperties

}



#

# Check whether a specified RDSH server has identical user groups settings compared to the collection settings. 

# This function also dumps the settings which are different.

# 

# Returns 0 if there is some differences

# Returns 1 if the settings are same

#

function CheckRDSHServerPropertiesUserGroups($RDSHServerName, $UserGroups, [REF]$RDSHCollectionServerReport)

{

    $ArePropertiesSame = $TRUE

    $RDSHCollectionServerTempReport = ""

    $TempUserGroups = @()



    $RemoteDesktopUsersGroupSID = "S-1-5-32-555"

    $GroupName = (ConvertSIDToName $RemoteDesktopUsersGroupSID).Split("\")[1]



    $Domain = $env:COMPUTERNAME

    $QueryFilter = "GroupComponent=`"Win32_Group.Domain='$Domain',Name='$GroupName'`""

    

    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [Object[]] $Users = Get-WmiObject Win32_GroupUser -filter $QueryFilter

    } Catch { 

        #Nothing

    }

    foreach ($User in $Users)

    {

        if ($User -eq $NULL)

        {

            continue

        }

        $StartIndex = $User.PartComponent.IndexOf("=")

        $EndIndex = $User.PartComponent.IndexOf(",")

        if ($StartIndex -ge 0 -and $EndIndex-$StartIndex-3 -ge 0)

        {

            $TempUserGroup = $User.PartComponent.Substring($StartIndex+2, $EndIndex-$StartIndex-3)

        }



        $StartIndex = $User.PartComponent.LastIndexOf("=")

        $EndIndex = $User.PartComponent.LastIndexOf("`"")

        if ($StartIndex -ge 0 -and $EndIndex-$StartIndex-2 -ge 0)

        {

            $TempUserGroup += "\" + $User.PartComponent.Substring($StartIndex+2, $EndIndex-$StartIndex-2)

        }

        $TempUserGroups += @($TempUserGroup)

    }

    if ($TempUserGroups -ne $UserGroups)

    {

        $ArePropertiesSame = $FALSE

        $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyUserGroup + " " + $TempUserGroup + $NewLine

    }

    

    $RDSHCollectionServerReport.Value = $RDSHCollectionServerTempReport

    return $ArePropertiesSame

}



#

# Check whether a specified RDSH server has identical connection settings compared to the collection settings. 

# This function also dumps the settings which are different.

# 

# Returns 0 if there is some differences

# Returns 1 if the settings are same

#

function CheckRDSHServerPropertiesConnections($RDSHServerName, [ConnectionsType]$Connections, [REF]$RDSHCollectionServerReport)

{

    $ArePropertiesSame = $TRUE

    $RDSHCollectionServerTempReport = ""



    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [object] $RDSHServerTSSessionSetting = Get-WmiObject Win32_TSSessionSetting -Namespace "root\cimv2\TerminalServices" -ComputerName $RDSHServerName -Authentication PacketPrivacy

    } Catch { 

        #Nothing

    }

    if ($RDSHServerTSSessionSetting -ne $NULL)

    {

        if ($RDSHServerTSSessionSetting.DisconnectedSessionLimit -ne $Connections.DisconnectedSessionLimit)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_DisconnectedSessionLimit + " " + $RDSHServerTSSessionSetting.DisconnectedSessionLimit + $NewLine

        }



        if ($RDSHServerTSSessionSetting.ActiveSessionLimit -ne $Connections.ActiveSessionLimit)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_ActiveSessionLimit + " " + $RDSHServerTSSessionSetting.ActiveSessionLimit + $NewLine

        }



        if ($RDSHServerTSSessionSetting.IdleSessionLimit -ne $Connections.IdleSessionLimit)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_IdleSessionLimit + " " + $RDSHServerTSSessionSetting.IdleSessionLimit + $NewLine

        }



        if ($Connections.BrokenConnectionAction -eq 0 -and $RDSHServerTSSessionSetting.BrokenConnectionPolicy -ne 1)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_BrokenConnectionAction + " " + $RDSHServerTSSessionSetting.BrokenConnectionPolicy + $RDSHServerTSSessionSetting.BrokenConnectionAction + $NewLine

        }

        elseif ($Connections.BrokenConnectionAction -eq 2 -and $RDSHServerTSSessionSetting.BrokenConnectionPolicy -ne 0 -and $RDSHServerTSSessionSetting.BrokenConnectionPolicy -ne 1)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_BrokenConnectionAction + " " + $RDSHServerTSSessionSetting.BrokenConnectionPolicy + $RDSHServerTSSessionSetting.BrokenConnectionAction + $NewLine

        }

        elseif ($RDSHServerTSSessionSetting.BrokenConnectionPolicy -ne 0 -and $RDSHServerTSSessionSetting.BrokenConnectionPolicy -ne 0)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_BrokenConnectionAction + " " + $RDSHServerTSSessionSetting.BrokenConnectionPolicy + $RDSHServerTSSessionSetting.BrokenConnectionAction + $NewLine

        }



        # Automatic reconnection policy is handled by GP. Hence the check is excluded here.



#        if ($RDSHServerTSSessionSetting.ReconnectionPolicy -ne $Connections.EnableAutomaticReconnection)

#        {

#            $ArePropertiesSame = $FALSE

#            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_EnableAutomaticReconnection + " " + $RDSHServerTSSessionSetting.ReconnectionPolicy + $NewLine

#        }

    }



    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [object] $RDSHServerTerminalServiceSetting = Get-WmiObject Win32_TerminalServiceSetting -Namespace "root\cimv2\TerminalServices" -ComputerName $RDSHServerName -Authentication PacketPrivacy

    } Catch { 

        #Nothing

    }



    if ($RDSHServerTerminalServiceSetting -ne $NULL)

    {

        if ($RDSHServerTerminalServiceSetting.DeleteTempFolders -ne $Connections.DeleteTempFoldersOnExit)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_DeleteTempFoldersOnExit + " " + $RDSHServerTerminalServiceSetting.DeleteTempFolders + $NewLine

        }



        if ($RDSHServerTerminalServiceSetting.UseTempFolders -ne $Connections.UseTempFoldersPerSession)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyConnections_UseTempFoldersPerSession + " " + $RDSHServerTerminalServiceSetting.UseTempFolders + $NewLine

        }

    }



    $RDSHCollectionServerReport.Value = $RDSHCollectionServerTempReport

    return $ArePropertiesSame

}



#

# Check whether a specified RDSH server has identical security settings compared to the collection settings. 

# This function also dumps the settings which are different.

# 

# Returns 0 if there is some differences

# Returns 1 if the settings are same

#

function CheckRDSHServerPropertiesSecurity($RDSHServerName, [SecurityType]$Security, [REF]$RDSHCollectionServerReport)

{

    $ArePropertiesSame = $TRUE

    $RDSHCollectionServerTempReport = ""



    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [object] $RDSHServerTSGeneralSetting = Get-WmiObject Win32_TSGeneralSetting -Namespace "root\cimv2\TerminalServices" -ComputerName $RDSHServerName -Authentication PacketPrivacy

    } Catch { 

        #Nothing

    }

    if ($RDSHServerTSGeneralSetting -ne $NULL)

    {

        if ($RDSHServerTSGeneralSetting.SecurityLayer -ne $Security.SecurityLayer)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertySecurity_SecurityLayer + " " + $RDSHServerTSGeneralSetting.SecurityLayer + $NewLine

        }



        if ($RDSHServerTSGeneralSetting.MinEncryptionLevel -ne $Security.EncryptionLevel)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertySecurity_EncryptionLevel + " " + $RDSHServerTSGeneralSetting.MinEncryptionLevel + $NewLine

        }



        if ($RDSHServerTSGeneralSetting.UserAuthenticationRequired -ne $Security.AuthenticateUsingNLA)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertySecurity_AuthenticateUsingNLA + " " + $RDSHServerTSGeneralSetting.UserAuthenticationRequired + $NewLine

        }

    }



    $RDSHCollectionServerReport.Value = $RDSHCollectionServerTempReport

    return $ArePropertiesSame

}



#

# Check whether a specified RDSH server has identical client settings compared to the collection settings. 

# This function also dumps the settings which are different.

# 

# Returns 0 if there is some differences

# Returns 1 if the settings are same

#

function CheckRDSHServerPropertiesClientSettings($RDSHServerName, [ClientSettingsType]$ClientSettings, [REF]$RDSHCollectionServerReport)

{

    $ArePropertiesSame = $TRUE

    $RDSHCollectionServerTempReport = ""



    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [object] $RDSHServerTSDeploymentSetting = Get-WmiObject Win32_TSDeploymentSettings -Namespace "root\cimv2\TerminalServices" -ComputerName $RDSHServerName -Authentication PacketPrivacy

    } Catch { 

        #Nothing

    }

    if ($RDSHServerTSDeploymentSetting -ne $NULL)

    {

         # TODO: Device redirection options are not matching. Disabling this check now.



#        if ($RDSHServerTSDeploymentSetting.RedirectionOptions -ne $ClientSettings.DeviceRedirectionOptions)

#        {

#            $ArePropertiesSame = $FALSE

#            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_DeviceRedirectionOptions + " " + $RDSHServerTSDeploymentSetting.RedirectionOptions + $NewLine

#        }

    }



    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [object] $RDSHServerTSClientSetting = Get-WmiObject Win32_TSClientSetting -Namespace "root\cimv2\TerminalServices" -ComputerName $RDSHServerName -Authentication PacketPrivacy

    } Catch { 

        #Nothing

    }

    if ($RDSHServerTSClientSetting -ne $NULL)

    {

        # Printer settings are controlled by GP and hence excluded in this check. Check for UserRDEasyPrintDriver is missing.



#        if ($RDSHServerTSClientSetting.WindowsPrinterMapping -ne $ClientSettings.RedirectClientPrinter)

#        {

#            $ArePropertiesSame = $FALSE

#            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_RedirectClientPrinter + " " + $RDSHServerTSClientSetting.ConnectPrinterAtLogon + $NewLine

#        }



#        if ($RDSHServerTSClientSetting.DefaultToClientPrinter -ne $ClientSettings.SetClientPrinterAsDefault)

#        {

#            $ArePropertiesSame = $FALSE

#            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_SetClientPrinterAsDefault + " " + $RDSHServerTSClientSetting.DefaultToClientPrinter + $NewLine

#        }



        if ($RDSHServerTSClientSetting.MaxMonitors -ne $ClientSettings.MaxMonitors)

        {

            $ArePropertiesSame = $FALSE

            $RDSHCollectionServerTempReport += "    " + $_system_translations.RDSHCollectionCheck_PropertyClientSettings_MaxMonitors + " " + $RDSHServerTSClientSetting.MaxMonitors + $NewLine

        }

    }



    $RDSHCollectionServerReport.Value = $RDSHCollectionServerTempReport

    return $ArePropertiesSame

}



#

# Check whether a specified RDSH server has identical UVHD settings compared to the collection settings. 

# This function also dumps the settings which are different.

# 

# Returns 0 if there is some differences

# Returns 1 if the settings are same

#

function CheckRDSHServerPropertiesUVHDSettings($RDSHServerName, [UVHDSettingsType]$UVHDSettings, [REF]$RDSHCollectionServerReport)

{

    # TODO

    $RDSHCollectionServerReport.Value = ""

    return $TRUE

}



#

# Check whether a specified RDSH server has identical settings compared to the collection settings. 

# This function also dumps the settings which are different.

# 

# Returns 0 if there is some differences

# Returns 1 if the settings are same

#

function CheckRDSHServerProperties([RDSHCollectionPropertiesType]$RDSHCollectionProperties, $RDSHServerName, [REF]$RDSHCollectionServerReport)

{

    $ArePropertiesSame = $TRUE



    $RDSHCollectionServerTempReport = $_system_translations.RDSHCollectionCheck_Server + " " + $RDSHServerInstance.Name + $NewLine 

    $RDSHCollectionServerTempReport2 = ""



    $RetVal = CheckRDSHServerPropertiesUserGroups $RDSHServerName $RDSHCollectionProperties.UserGroups ([REF]$RDSHCollectionServerTempReport2)

    $RDSHCollectionServerTempReport += $RDSHCollectionServerTempReport2

    if ($RetVal -ne $TRUE)

    {

        $ArePropertiesSame = $FALSE

    }



    $RetVal = CheckRDSHServerPropertiesConnections $RDSHServerName $RDSHCollectionProperties.Connections ([REF]$RDSHCollectionServerTempReport2)

    $RDSHCollectionServerTempReport += $RDSHCollectionServerTempReport2

    if ($RetVal -ne $TRUE)

    {

        $ArePropertiesSame = $FALSE

    }



    $RetVal = CheckRDSHServerPropertiesSecurity $RDSHServerName $RDSHCollectionProperties.Security ([REF]$RDSHCollectionServerTempReport2)

    $RDSHCollectionServerTempReport += $RDSHCollectionServerTempReport2

    if ($RetVal -ne $TRUE)

    {

        $ArePropertiesSame = $FALSE

    }



    $RetVal = CheckRDSHServerPropertiesClientSettings $RDSHServerName $RDSHCollectionProperties.ClientSettings ([REF]$RDSHCollectionServerTempReport2)

    $RDSHCollectionServerTempReport += $RDSHCollectionServerTempReport2

    if ($RetVal -ne $TRUE)

    {

        $ArePropertiesSame = $FALSE

    }



    $RetVal = CheckRDSHServerPropertiesUVHDSettings $RDSHServerName $RDSHCollectionProperties.UVHDSettings ([REF]$RDSHCollectionServerTempReport2)

    $RDSHCollectionServerTempReport += $RDSHCollectionServerTempReport2

    if ($RetVal -ne $TRUE)

    {

        $ArePropertiesSame = $FALSE

    }



    $RDSHCollectionServerReport.Value = $RDSHCollectionServerTempReport + $NewLine

    return $ArePropertiesSame

}



#

# Check whether all the RDSH servers in a given collection have identical settings. 

# 

# Returns 0 if there is some differences

# Returns 1 if the collections are homogeneous

#

function CheckRDSHCollection()

{

    $ArePropertiesSame = 1



    Try {

        #

        # Make the WMI call to get instances of WMI class

        #

        [Object[]] $RDSHCollections = Get-WmiObject Win32_RDSHCollection -namespace "root\cimv2\rdms" 

        [Object[]] $RDSHServers = Get-WmiObject Win32_RDSHServer -namespace "root\cimv2\rdms" 

    } Catch { 

       #Nothing

    }



    if ($RDSHCollections -eq $NULL -or $RDSHservers -eq $NULL)

    {

        #

        # Base WMI objects failed. Trigger failure with no data.

        #

        return 0

    }

 

    $RDSHCollectionsReport  = @()



    foreach ($RDSHCollectionInstance in $RDSHCollections)

    {   

        $RDSHCollectionReport = $NewLine + $NewLine + $_system_translations.RDSHCollectionCheck_Collection + " " + $RDSHCollectionInstance.Name + $NewLine 

        $RDSHCollectionReport += $_system_translations.RDSHCollectionCheck_HeterogeneousServers

        $RDSHCollectionReportExpectedPropertyValues = ""

        $RDSHCollectionProperties = GetRDSHCollectionProperties $RDSHCollectionInstance ([REF]$RDSHCollectionReportExpectedPropertyValues)



        $RDSHCollectionServersReport = ""



        foreach ($RDSHServerInstance in $RDSHServers)

        {

            if ($RDSHCollectionInstance.Name -eq $RDSHServerInstance.CollectionAlias)

            {

                $RDSHCollectionServerReport = ""

                $RetVal = CheckRDSHServerProperties $RDSHCollectionProperties $RDSHServerInstance.Name ([REF]$RDSHCollectionServerReport)

                if ($RetVal -ne $TRUE)

                {

                    $ArePropertiesSame = 0

                    $RDSHCollectionReport += $RDSHServerInstance.Name + " "

                    $RDSHCollectionServersReport += $RDSHCollectionServerReport



                }

            }

        }

        $RDSHCollectionReport += $NewLine + $_system_translations.RDSHCollectionCheck_MoreInformation + $NewLine + $NewLine + $RDSHCollectionReportExpectedPropertyValues + $NewLine + $RDSHCollectionServersReport + $NewLine

        $RDSHCollectionsReport += @($RDSHCollectionReport)

    }

    AddElementToDocument $doc $tns $RDSHCollectionsReport "RDMS" "RDSHCollection" "RDSHCollectionReport"

    return $ArePropertiesSame

}    



#

# ------------------

# FUNCTIONS - END

# ------------------

#



#

# ------------------------

# SCRIPT MAIN BODY - START

# ------------------------

#



#

# Initialize to perform querying Role information

#

RoleQueryInitialize



$TSGatewayInstalled = IsRoleInstalled "RDS-Gateway"

$TSLicensingInstalled = IsRoleInstalled "RDS-Licensing"

$TSTerminalServerInstalled = IsRoleInstalled "RDS-RD-Server"

$IISInatalled = IsRoleInstalled "Web-Server"

$RDConnectionBrokerInstalled = IsRoleInstalled "RDS-Connection-Broker"

$RDVHInstalled = IsRoleInstalled "RDS-Virtualization"

$RDWebAccessInstalled = IsRoleInstalled "RDS-Web-Access"



#

# Role Information obtained.

#

RoleQueryShutdown



# 

# Set the Target Namespace to be used by XML

#

$tns="http://schemas.microsoft.com/bestpractices/models/ServerManager/TerminalServices/TerminalServicesComposite/2008/04"



#

# Create a new XmlDocument

#

$doc = Create-DocumentElement $tns "TerminalServicesComposite"



$NumVal = 0

$NumVal = BoolToNum $TSGatewayInstalled



#

# Adding this value to the XML Document

# 

AddElementToDocument $doc $tns $NumVal "TSGateway" "TSGatewayInstalled"



#

# If TS-Gateway is installed, we need to get count of CAPs and RAPs

#

if ( $TSGatewayInstalled -eq $true )

{

    $NumVal = 0

    $NumVal = BoolToNum $IISInatalled



    $nonNativeAuthnPluginUsed = 2



    $nonNativeAuthnPluginUsed = IsAuthorizationPlugginNonNative  



#

#  If Authorization plugin in non native, no need of verifying CAP/RAP and NPS settings

#



    if ( $nonNativeAuthnPluginUsed -eq 0 )

    {

        $rechableNPSServer = $null

        #

        # Is Central CAP store Enabled

        #

        $centralCAPEnabled = IsCentralCAPEnabled 



        if ( $centralCAPEnabled -eq $true )

        {

            $NPSServers = GetNPSServers 

     

            $NAPServerRechable = $false



            $SomeNPSServersUnrechable = $false



            if ( $NPSServers.Count -ne 0 )

            {

                $UnrechableNPSServers = $null



                foreach ( $server in $NPSServers )

                {

                    $serverRechable = $false



                    $serverRechable = IsComputerReachable $server



                    if ( $serverRechable -eq $true )

                    {

                        if ( $NAPServerRechable -eq $false)

                        {

                            $rechableNPSServer = $server

                            $NAPServerRechable = $true

                        }

                    }

                    else

                    {

                        $UnrechableNPSServers += $server + " "

                    }

                } 



                $NumVal = 0

                $NumVal = BoolToNum $NAPServerRechable



                AddElementToDocument $doc $tns $NumVal "TSGateway" "CAPSetup" "NPSServerReachable"

            }

        }



        $NumberCAPSconfigured = 0



        $NumberCapsActive = 0  



        $NumberCAPSNonCompliant = 0



        $NamesNonCompliantCAPS = $null



        $tempDir = $env:temp

 

        $file = "$tempDir\NPS_Settings_1.xml"



        $op = $null

        $res = $null



        if ( $centralCAPEnabled -eq $true )

        {

            if ( $rechableNPSServer -ne $null )

            {

                $op = &netsh -r "$rechableNPSServer" nps export filename = "$file" exportPSK = YES

            }

        }

        else

        {

            $op = &netsh nps export filename = "$file" exportPSK = YES

        }



        $opStr = "The NPS server configuration is successfully exported."



        if ( $op -ne $null )

        {

            $res = $op -clike "*$opStr*"

        }



        $delFile = $false



        if ( $res -ne $null )

        {

            $delFile = $true

        } 



        $fileData = $null



        if ( $delFile -eq $true )

        {

            $fileData = get-content -Path "$file"

        }



        if ( $fileData -ne $null )

        {

            $XMLData = [xml] $fileData



            $root = $XMLData.Root



            $networkPolicies = $XMLData.Root.Children.Microsoft_Internet_Authentication_Service.Children.NetworkPolicy.Children



            $policyNodes = $networkPolicies.ChildNodes



            $num = $policyNodes.count



            $gatewayPolicies = @()



            foreach ( $policy in $policyNodes )

            {

                $selectPolicy = $false



                $propertiesNode = $policy.Properties

                $properties = $propertiesNode.ChildNodes

        

                $obj = "" | select-object "name", "text"



                foreach ( $property in $properties )

                {

                    $obj.name = $property.name

                    $obj.text = $property.InnerText



                    if ( ( $obj.name -eq "Policy_SourceTag") -and ( $obj.text -eq 1 ) )

                    {

                        $selectPolicy = $true

                    }

                }



                if ( $selectPolicy -eq $true )

                {

                    $name = $policy.Name

                    $str = "TSG Marker Policy"

                    $str1 = "RDG Marker Policy"

                    $res = $name -clike "*$str*"

                    $res1 = $name -clike "*$str1*"



                    if ( ( $res -eq $false) -and ( $res1 -eq $false ) )

                    {

                        $gatewayPolicies += @($policy)

                        $NumberCAPSconfigured += 1

                    }

                }

            }



           $num = $gatewayPolicies.count



            $CAPPoliciesToAddToXML = @()



            foreach ( $policy in $gatewayPolicies)

            {

                $PolicyObject = "" | Select-object A1CAPPolicyName, A2PolicyAllowConenction, A3AllowClientWithoutAuthNego, A4NASPortTypeVPN, A5NumberUserGroups, A6AuthenticationSet, A7NumberHealthPolicies, A8PolicyCompliant

                $name = $policy.Name



                $groupNames = @()

                $healthPoliciesUsed = @() 

                $authMethod  = 0

                $policyEnabled = $false

                $nasPortTypeisVirtualVPN = $false

                $policyIsAllowAccess = $false

                $AllowCleintWithoutAuthNego = $false





                $propertiesNode = $policy.Properties



                $properties = $propertiesNode.ChildNodes     



                foreach ( $property in $properties )

                {

                    $propName = $property.Name

                    $text = $property.InnerText



                    if ( $propName -eq "Policy_Enabled" )

                    {

                        if ( $text -eq 1 )

                        {

                            $policyEnabled = $true

                            $NumberCapsActive += 1

                        }

                    } 



                    $str = "USERNTGROUPS"

                    $res = $text  -clike "*$str*"

                    $groups = $null



                    if ( $res -ne $false )

                    {

                        $groups = GetGroupNames $text



                        if ( $groups -ne $null )

                        {

                            foreach ( $group in $groups)

                            {

                                $grpName = ConvertSIDToName $group



                                if ( $grpName -ne $null)

                                {

                                    $groupNames += @($grpName)

                                }

                                else

                                {

                                    $groupNames += @($group)

                                }

                            }

                        }

                    }



                    $str = "NAS-Port-Type="

                    $res = $text  -clike "*$str*"

                    if ( $res -ne $false )

                    {

                        $nasPortTypeisVirtualVPN = NASPortTypeVPN $text

                    }



                    $str = "UserAuthType:"

                    $res = $text  -clike "*$str*"

                    if ( $res -ne $false )

                    {

                        $authMethod = GetAuthMethod $text

                    }



                    $str = "SHV("""

                    $res = $text  -clike "*$str*"

                    if ( $res -ne $false )

                    {

                        $hpName = $null

                        $hpName = GetHealthPolicyName $text



                        if ( $hpName -ne $null )

                        {

                            $healthPoliciesUsed += @($hpName)

                        }

                    }

                }





                $AuthStr = "None"



                $node = $XMLData.Root.Children.Microsoft_Internet_Authentication_Service.Children.RadiusProfiles.Children



                $policyNodes2 = $node.ChildNodes



                $nodeToCheck = $null



                foreach ( $policyNode2 in $policyNodes2)

                {

                    $namePolNode = $policyNode2.Name

                    if ( $namePolNode -eq $name )

                    {

                        $nodeToCheck = $policyNode2

                        break

                    }

                }



                $propNode = $nodeToCheck.Properties



                $props = $propNode.ChildNodes



                $authNegoAlreadySeen = $false

                $savedMachHalthChkOnly = $false



                foreach ( $prop in $props )

                {

                    $propName = $prop.Name



                    if ( $propName -eq "msNPAllowDialin")

                    {

                        $propText = $prop.InnerText



                        if ( $propText -eq 1 )

                        {

                            $policyIsAllowAccess = $true

                        }

                    }



                    if ( $propName -eq "msSavedMachineHealthCheckOnly")

                    {

                        $savedMachHalthChkOnly = $true

                        if ( $AllowCleintWithoutAuthNego -eq $true )

                        {

                            $AllowCleintWithoutAuthNego = $false

                        }

                    }



                    if ( $propName -eq "msNPAuthenticationType2")

                    {



                        if ( ( $authNegoAlreadySeen -eq $false ) -and (  $savedMachHalthChkOnly -eq $false ) )

                        {

                            $propText = $prop.InnerText



                            if ( $propText -eq 7 )

                            {

                                $AllowCleintWithoutAuthNego = $true

                            }



                            $authNegoAlreadySeen = $true

                        }

                        else

                        {

                            if ( $AllowCleintWithoutAuthNego -eq $true )

                            {

                                $AllowCleintWithoutAuthNego = $false

                            }

                        }



                    }

        

                }



                $PolicyObject.A1CAPPolicyName = $policy.Name



                $NumVal = 0

                $NumVal = BoolToNum $policyIsAllowAccess



                $PolicyObject.A2PolicyAllowConenction = $NumVal



                $NumVal = 0

                $NumVal = BoolToNum $AllowCleintWithoutAuthNego



                $PolicyObject.A3AllowClientWithoutAuthNego = $NumVal



                $NumVal = 0

                $NumVal = BoolToNum $nasPortTypeisVirtualVPN



                $PolicyObject.A4NASPortTypeVPN = $NumVal



                $grpCount = $groupNames.Count



                $PolicyObject.A5NumberUserGroups = $grpCount



                $PolicyObject.A6AuthenticationSet = $authMethod



                $hlthPolCnt = $healthPoliciesUsed.Count



                $PolicyObject.A7NumberHealthPolicies = $hlthPolCnt



                $CAPPolicyIsCompliant = $false



                if ( ( $policyIsAllowAccess -eq $true) -and ( $AllowCleintWithoutAuthNego -eq $true ) -and ( $nasPortTypeisVirtualVPN -eq $true) -and ( $grpCount -ge 1) -and ( $authMethod -ne 0 ) )

                {

                    $CAPPolicyIsCompliant = $true

                }  



                $NumVal = 0

                $NumVal = BoolToNum $CAPPolicyIsCompliant



                $PolicyObject.A8PolicyCompliant = $NumVal



                if ( $CAPPolicyIsCompliant -eq $false )

                {

                    $NumberCAPSNonCompliant += 1

                    $NamesNonCompliantCAPS += """" + $policy.Name + """ "

                }



                $CAPPoliciesToAddToXML += @($PolicyObject)

            }



        }



        $CAPPoliciesActiveState = 0



        if ( $NumberCapsActive -ge 1 )

        {

            $CAPPoliciesActiveState = 1

        }



        $someCapPoliciesNonCompliant = 0



        if ( $NumberCAPSNonCompliant -gt 0 )

        {

            $someCapPoliciesNonCompliant = 1

        }            



        if ( $centralCAPEnabled -eq $false )

       {

            AddElementToDocument $doc $tns $CAPPoliciesActiveState "TSGateway" "CAPSetup" "NumberCAPPoliciesActive"



            if ( $NumberCAPSconfigured -ge 1)

            {

                AddElementToDocument $doc $tns $someCapPoliciesNonCompliant "TSGateway" "CAPSetup" "SomeCAPPoliciesNonCompliant"

            }



            if ( $NumberCAPSNonCompliant -gt 0 )

            {

                AddElementToDocument $doc $tns $NamesNonCompliantCAPS "TSGateway" "CAPSetup" "NamesCAPPoliciesNonCompliant"

            }

        }

        else

        {

            if ( $NAPServerRechable -eq $true)

            {

                AddElementToDocument $doc $tns $CAPPoliciesActiveState "TSGateway" "CAPSetup" "NumberCAPPoliciesActive"



                if ( $NumberCAPSconfigured -ge 1)

                {

                    AddElementToDocument $doc $tns $someCapPoliciesNonCompliant "TSGateway" "CAPSetup" "SomeCAPPoliciesNonCompliant"

                }



                if ( $NumberCAPSNonCompliant -gt 0 )

                {

                    AddElementToDocument $doc $tns $NamesNonCompliantCAPS "TSGateway" "CAPSetup" "NamesCAPPoliciesNonCompliant"

                }

            }

        }

     

        if ( $NumberCAPSconfigured -ge 1)

        {

            $rootElement = $doc.DocumentElement

            $tsgRootElement = $rootElement.childNodes | where { $_.name -eq "TSGateway"}

            $CAPSetupNode = $tsgRootElement.childNodes | where { $_.name -eq "CAPSetup"}

            Append-Elements $doc $CAPSetupNode $tns "CAPPolicy" $CAPPoliciesToAddToXML

        }



        if ( $delFile -eq $true )

        {

            del $file

        }



        #

        # Count of RAPs

        #

        $countTSGatewayRAPs = CountOfWMIClassInstance "Win32_TSGatewayResourceAuthorizationPolicy" "root\CIMV2\TerminalServices"



        $countActiveTSGatewayRAPs = 0    

        if ( $countTSGatewayRAPs -ge 1 )

        {

            #

            # Count of Active RAPs

            #

            $countActiveTSGatewayRAPs = CountOfEnabledWMIClassInstance "Win32_TSGatewayResourceAuthorizationPolicy" "root\CIMV2\TerminalServices"

        }



        #

        # Adding thie value to the XML Document

        # 

        AddElementToDocument $doc $tns $countActiveTSGatewayRAPs "TSGateway" "RAPSetup" "NumberRAPPoliciesActive"

    }

##### CAP/RAP and NPS checking stuff ends here

    

    #

    # Check for unlimited connections allowed setting on TSG

    #

    $maxConnectionsAllowed = 0



    $connectionsExhausted = $true  



    $unlimitedConectionsAllowed = UnlimitedconnectionsSettingTSG 



    if ( $unlimitedConectionsAllowed -eq $false)

    {

        $maxConnectionsAllowed = NumberConnectionsAllowedByTSG



        if ( $maxConnectionsAllowed -ne 0 )

        {

            $connectionsExhausted = TSGConnectionsExhausted $maxConnectionsAllowed 

        }



    }

    else

    {

        $maxConnectionsAllowed = 1



        $connectionsExhausted = $false        

    }



    AddElementToDocument $doc $tns $maxConnectionsAllowed "TSGateway" "MaxConnectionsAllowed"



    $NumVal = 0

    $NumVal = BoolToNum $connectionsExhausted



    AddElementToDocument $doc $tns $NumVal "TSGateway" "ConnectionsExhausted"



    #

    # Check if server is load balanced

    #



    [Object] $LoadBalancingServerInstance = Get-WmiObject "Win32_TSGatewayLoadBalancer" -namespace "root\CIMV2\TerminalServices"



    if ( $LoadBalancingServerInstance -eq $null )

    {

        $loadBalancedServers = $null

    }

    else

    {

        $loadBalancedServers = $LoadBalancingServerInstance.Servers

    }   



    $gatewayFarmConfigured = 0

    

    if ( ( $loadBalancedServers -eq $null ) -or ( $loadBalancedServers.Length -eq 0 ) )

    {

        $gatewayFarmConfigured = 0

    }

    else

    {

        $gatewayFarmConfigured = 1

    }



    AddElementToDocument $doc $tns $gatewayFarmConfigured "TSGateway" "GatewayFarmConfigured"



    $webSitename = $null



    $RPCRegKeyPAth = "HKLM:\SOFTWARE\Microsoft\Rpc\RpcProxy"



    $webSitename = $webSitename = GetValueFromRegistry "$RPCRegKeyPAth" "Website" 



    if ( ( $webSitename -eq $null ) -or ( $webSitename.Length -le 0 ) )

    {

        $webSitename = "Default Web Site"

    }    



    AddElementToDocument $doc $tns $webSitename "TSGateway" "IISConfiguration" "WebSiteName"



    $winPath = $env:windir



    $appCmd = "$winPath\system32\inetsrv\AppCmd.exe"

        

    $op = & $appCmd List site "$webSitename"



    $siteConfigured = $false



    if ( ($op -ne $null ) -or ( $op.Length -ge 1 ) )

    {

        $siteConfigured = $true

    }

           

    $NumVal = 0

    $NumVal = BoolToNum $siteConfigured



    AddElementToDocument $doc $tns $NumVal "TSGateway" "IISConfiguration" "WebSiteConfigured"



    if ( $siteConfigured -eq $true )

    {

        $siteRuning = IsSiteRuning ( $webSitename )

        $NumVal = 0

        $NumVal = BoolToNum $siteRuning

        AddElementToDocument $doc $tns $NumVal "TSGateway" "IISConfiguration" "WebSiteRunning"



        $certForSite = $null



        $certConfigured = 0



        $certCompliant = 0



        $certNameIsFQDN = 0



        $certForSite = GetCertForWebsite "$webSitename"



        if ( $certForSite -ne $null )

        {

            $certConfigured = 1



            $certCompliant = 1

        }            



        AddElementToDocument $doc $tns $certConfigured "TSGateway" "CertConfiguration" "CertConfigured"



        if ( $certConfigured -eq 1 )

        {

            $subjCert = $certForSite.Subject



            if ( $subjCert -ne $null )

            {

                $CompNameInSubj = ($subjCert.Split("="))[1]

                AddElementToDocument $doc $tns $CompNameInSubj "TSGateway" "CertConfiguration" "CertSubject"

            }



            $startDate = $certForSite.NotBefore

 

            $endDate = $certForSite.NotAfter



            $dateNow = get-date



            $comp1 = -1



            $comp2 = -1



            if ( $startDate -ne $null )

            {

                $comp1 = $dateNow.CompareTo($startDate)

            }

            else

            {

                $certCompliant = 0

            }



            if ( $endDate -ne $null )

            {

                $comp2 = $endDate.CompareTo($dateNow)

            }

            else

            {

                $certCompliant = 0

            }



            $certActive = $false;

            $certExpired = $true



            if ( $comp1 -ge 0)

            {

                $certActive = $true

            }

            else

            {

                $certCompliant = 0

            }



            if ( $comp2 -ge 1)

            {

                $certExpired = $false

            }

            else

            {

                $certCompliant = 0

            }

            

            $NumVal = 0

            $NumVal = BoolToNum $certActive                   



            AddElementToDocument $doc $tns $NumVal "TSGateway" "CertConfiguration" "CertActive"

 

            if ( $NumVal -ne 0)

            {

                $NumVal = 0

                $NumVal = BoolToNum $certExpired                   



                AddElementToDocument $doc $tns $NumVal "TSGateway" "CertConfiguration" "CertExpired"

 

                if ( $certExpired -eq $false)

                {

                    $NumVal = 1

                }

            }



            if ( $NumVal -ne 0)

            {

                $match = 0

                $match = CheckIfCertSubjectMatchesCurrentMachineName $certForSite



                if ( $match -eq 2 )

                {

                    $certCompliant = 0

                }

                

                if ( $match -eq 1 )

                {

                    $certNameIsFQDN = 1

                }



                AddElementToDocument $doc $tns $match "TSGateway" "CertConfiguration" "CertSubjectMatchesCompName"



                AddElementToDocument $doc $tns $certNameIsFQDN "TSGateway" "CertConfiguration" "CertNameIsFQDN"



                $NumVal = $match

            }







            $certIsSelfSigned = CheckIfCertIsSelfSigned $certForSite



            if ( $certIsSelfSigned -eq 0)

            {

                $certIsCACert = 1

            }

            else

            {

                $certIsCACert = 0

            }



            AddElementToDocument $doc $tns $certIsCACert "TSGateway" "CertConfiguration" "CertIsCACert"

        }



    AddElementToDocument $doc $tns $certCompliant "TSGateway" "CertConfiguration" "CertSettingsCompliant"



    }



    $conenctOnlyToWin7Clients = $false



    $conenctOnlyToWin7Clients = IsConenctOnlyToWin7clientsSet 



    $NumVal = 0

    $NumVal = BoolToNum $conenctOnlyToWin7Clients                   



    AddElementToDocument $doc $tns $NumVal "TSGateway" "ConenctOnlytoWin7Client"



    #

    # Find out if the AD for this machine is reachable (in case this machine is attached to a domain)

    #



    [Object] $ComputerSystemInstance = Get-WmiObject "Win32_ComputerSystem" -namespace "root\CIMV2"



    if ($ComputerSystemInstance.PartOfDomain -eq $true)

    {

        $dom = $null

        $dcReachable = $false



        Try 

        {

            $dom = [System.DirectoryServices.ActiveDirectory.Domain]::getcurrentdomain()

        } Catch {

            #Nothing

        }



        if ( $dom -eq $null )

        {

            Try 

            {

                $dom = [System.DirectoryServices.ActiveDirectory.Domain]::getcomputerdomain()

            } catch [System.Security.Authentication.AuthenticationException] {

                # If computer is part of domain and got authentication exception, user needs to login as domain user

                $NumVal = 2

            } catch {

                # For any other exception, such as NIC disabled etc, give error

                $NumVal = 0

            }

        }





        if ( $dom -ne $null )

        {

            $dcInstances = $null



            $domName = $dom.Name

 

            $dcInstances = $dom.FindAllDomainControllers()



            if ($dcInstances -ne $null)

            {

                $numItm = $dcInstances.Count



                for ($i=0;$i -lt $numItm; $i += 1)

                {



                    $dcName = $dcInstances.Item($i)



                    $reachable = $false



                    $reachable = IsComputerReachable ( $dcName )



                    if ( $reachable -eq $true )

                    {

                        $dcReachable = $true

                        break

                    }

                }



            }



            $NumVal = 0

            $NumVal = BoolToNum $dcReachable   

            AddElementToDocument $doc $tns $NumVal "TSGateway" "ADForDomainReachable"

        }

        else

        {

            AddElementToDocument $doc $tns $NumVal "TSGateway" "ADForDomainReachable"

        }

    }



    #

    # Find out if the TS Gateway service is runing or not

    #  

    $gwSvc = $null



    $gwSvc = get-Service tsgateway



    if ( $gwSvc -ne $null )

    {

        $gwSvcRunning = $false



        $status = $gwSvc.Status



        if ( $status -eq "Running" )

        {

            $gwSvcRunning = $true

        }



        $NumVal = 0

        $NumVal = BoolToNum $gwSvcRunning   

        AddElementToDocument $doc $tns $NumVal "TSGateway" "RDGatewaySvcStarted"

    }



    if ( $gatewayFarmConfigured -eq 1 )

    {   

        $OSVersionThisComp = $null

        $OSVersionThisComp = GetOSVersionComp "."



        $serverList = $loadBalancedServers.split(";")



        $co = @()



        foreach ($server in $serverList)

        {

            $serverReachable = $false



            $serverReachableOrOSSameNum  = 0



            $serverReachable = IsComputerReachable $server



            if ( $serverReachable -eq $true )

            {

                $RemoteCompOSVer = $null



                Try {

                    $RemoteCompOSVer = GetOSVersionComp "$server"

                } Catch { 

                   #Nothing

                }



                if ( ( $RemoteCompOSVer -ne $null ) -and ( $OSVersionThisComp -ne $null ) )

                {

                    if ( $RemoteCompOSVer -eq $OSVersionThisComp )

                    {

                        $serverReachableOrOSSameNum = 1

                    }

                }

            }



            $value = "" | Select-Object ServerName,serverReachableOrOSSameNum  



            $value.ServerName = $server

            $value.serverReachableOrOSSameNum  = $serverReachableOrOSSameNum 



            $co += $value

        }      



        $totalNumServers = $co.count



        $noServerWithError = 1



        foreach ( $element in $co )

        {

            $valTocheck = $element.serverReachableOrOSSameNum 

            if ( $valTocheck -eq 0 )

            {

                $noServerWithError = 0

                break

            }



        }





        AddElementToDocument $doc $tns $noServerWithError "TSGateway" "LoadBalancedServerComposite" "LoadBalancedServersErrorFree"

        

    }

  

}



#

# If TS-Licensing is installed, we need to get activation status of Licensing Server

#

if ( $TSLicensingInstalled -eq $true )

{



    #

    # Create WMI .NET object (as we need to call a method on it)

    #

    $LicenseServerObj = [WMICLASS] "root\cimv2:Win32_TSLicenseServer"

    

    #

    # Obtain ActivationStatus from the object

    #

    $licenseServerActivationStatus = $LicenseServerObj.GetActivationStatus().ActivationStatus



    #

    # Adding thie value to the XML Document

    # 

    AddElementToDocument $doc $tns $licenseServerActivationStatus "TSLicensing" "ActivationStatus"

    

    $CALAvailable = IsCALAvailable

    AddElementToDocument $doc $tns $CALAvailable "TSLicensing" "CALAvailable"



}



#

# If TS-TerminalServer is installed, we need to get number of users in Remote Desktop Users Group

#

if ( $TSTerminalServerInstalled -eq $true )

{

    $SvcRunning = IsServiceRunning termservice

    $NumSvcRunning = 0

    $NumSvcRunning = BoolToNum $SvcRunning

    AddElementToDocument $doc $tns $NumSvcRunning "TSTerminalServer" "RDSServiceRunning"



}





#   check connection broker rules

#

if ($RDConnectionBrokerInstalled -eq $true )

{

    $SvcRunning = IsServiceRunning tssdis

    $NumSvcRunning = 0

    $NumSvcRunning = BoolToNum $SvcRunning

    AddElementToDocument $doc $tns $NumSvcRunning "RDConnectionBroker" "RDCBServiceRunning"



}



#   check RDWA rules

#

if ($RDWebAccessInstalled -eq $true )

{

    $SvcRunning = IsServiceRunning w3svc

    $NumSvcRunning = 0

    $NumSvcRunning = BoolToNum $SvcRunning

    AddElementToDocument $doc $tns $NumSvcRunning "RDWebAccess" "RDWebAccessServiceRunning"



}





#   check  RDVH rules

#

if ($RDVHInstalled -eq $true )

{

    $SvcRunning = IsServiceRunning vmhostagent

    $NumSvcRunning = 0

    $NumSvcRunning = BoolToNum $SvcRunning

    AddElementToDocument $doc $tns $NumSvcRunning "RDVH" "RDVHServiceRunning"



}



#

# The following rule is not associated with any role since it is expected to run to machines 

# without RS roles installed. 

# TODO: CheckCollection should take a parameter which is the RDMS Server name. It should be supplied to the

# gwmi call on the rdms name space. 

#



#$RDSHCollectionCheck = CheckRDSHCollection

#AddElementToDocument $doc $tns $RDSHCollectionCheck "RDMS" "RDSHCollection" "RDSHCollectionStatus"    



#

# send the document to the output stream

#

$doc



#

# ------------------------

# SCRIPT MAIN BODY - END

# ------------------------

#

# SIG # Begin signature block

# MIIkKAYJKoZIhvcNAQcCoIIkGTCCJBUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB

# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR

# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU35CeNpVHu0E6AhSPrj639x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+gvuHkvXRvx6WMsvAcfXjrndGvM6L18/YMFEdAYmPt92lw

# IO/tkd8v4nl5pf0+tYj+mPaKOfDpb+YCVaGCAh8wggIbBgkqhkiG9w0BCQYxggIM

# MIICCAIBATCBhzB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ

# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u

# MSMwIQYDVQQDExpNaWNyb3NvZnQgVGltZXN0YW1waW5nIFBDQQIKYUl87QAAAAAA

# BTAHBgUrDgMCGqBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcN

# AQkFMQ8XDTA4MDkxOTE5NDUxOFowIwYJKoZIhvcNAQkEMRYEFEHgT3+OFeiTT0Ub

# GghmBiBAa37GMA0GCSqGSIb3DQEBBQUABIIBALrpKlBoaY0QyXZe57LlcQtk1axZ

# hh0tw7LPTL0S5hbIgkJ93ZdmtmghIl54yQN7Apvjfk4qmAyqDGaI9vtJE/57gxAb

# jhd/kJAAWIYAlkFq3xOT3wxYopoa8p72hpZGDSRRjWWK/ATOwvp/mnrZ1h7mGWxu

# apDVnaYceBvLx5E82JkLI8pqZVI0BxcLLhalJcVWRDvdaAzEae/SSgxNmP65LjB7

# p0QTfRf+V4H37OCYqnvJZdQq6vr62wEEZ1fMGjBlDZ+80PmpHiUOIE5lvXjneOHu

# z2Weta84jC51CnQI6czDRJXcpb7Hhs3PrIHT8bCZTZ0bNeueweHKfJaGkuE=

# SIG # End signature block


Youez - 2016 - github.com/yon3zu
LinuXploit