
 
 P R O V I D E R   N A M E 
 
         S Q L S e r v e r 
 
         
 
 D R I V E S 
 
         S Q L S E R V E R 
 
         
 
 S Y N O P S I S 
 
         A c c e s s   S Q L   S e r v e r   i n s t a n c e s   a n d   t h e i r   d a t a b a s e s . 
 
         
 
 D E S C R I P T I O N 
 
         T h e   M i c r o s o f t   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r   l e t s   y o u   m a n a g e   t h e   c o n f i g u r a t i o n   o f   i n s t a n c e s   o f   t h e   S Q L   S e r v e r   D a t a b a s e   E n g i n e   a n d   t h e   o b j e c t s   i n   t h o s e   i n s t a n 
 
         c e s .   T h e   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r   i m p l e m e n t s   s e p a r a t e   p a t h   h i e r a r c h i e s   f o r   d i f f e r e n t   c l a s s e s   o f   o b j e c t s   t h a t   a r e   s u p p o r t e d   b y   t h e   S Q L   S e r v e r   m a n a g e m e n t 
 
           o b j e c t   m o d e l s . 
 
         
 
         T h e   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r   i m p l e m e n t s   o n e   v i r t u a l   d r i v e   n a m e d   S Q L S E R V E R : .   T h e   S Q L S E R V E R :   d r i v e   h a s   s e v e r a l   f o l d e r s :   \ S Q L ,   \ S Q L P o l i c y ,   \ S Q L R e g i s t r a t i o 
 
         n ,   \ U t i l i t y ,   \ D A C ,   \ D a t a C o l l e c t i o n ,   \ I n t e g r a t i o n S e r v i c e s ,   a n d   S Q L A S . 
 
         
 
         T h e   S Q L S e r v e r : \ S Q L   f o l d e r   l e t s   y o u   n a v i g a t e   t o   i n s t a n c e s   o f   t h e   S Q L   S e r v e r   D a t a b a s e   E n g i n e   a n d   m a n a g e   t h e   o b j e c t s   i n   t h e   i n s t a n c e s ,   s u c h   a s   l o g i n s ,   t a b l e s ,   f 
 
         u n c t i o n s ,   j o b s ,   q u e u e s ,   a n d   m a i l   a g e n t s .   T h e   S Q L   f o l d e r   o p e r a t e s   u s i n g   t h e   o b j e c t s   i n   t h e s e   n a m e s p a c e s : 
 
         
 
             M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . S M O 
 
             M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . S M O . A g e n t 
 
             M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . S M O . B r o k e r 
 
             M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . S M O . M a i l 
 
         
 
         T h e   S Q L S E R V E R : \ S Q L P o l i c y   f o l d e r   l e t s   y o u   n a v i g a t e   t o   i n s t a n c e s   o f   t h e   D a t a b a s e   E n g i n e   t h a t   c o n t a i n s   a   P o l i c y - B a s e d   M a n a g e m e n t   p o l i c y   s t o r e   a n d   m a n a g e   o b j e c t s 
 
           s u c h   a s   p o l i c i e s   a n d   f a c e t s .   T h e   S Q L P o l i c y   f o l d e r   o p e r a t e s   u s i n g   t h e   o b j e c t s   i n   t h e   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . D m f   a n d   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . F a 
 
         c e t s   n a m e s p a c e s . 
 
         
 
         T h e   S Q L S E R V E R : \ S Q L R e g i s t r a t i o n   f o l d e r   l e t s   y o u   n a v i g a t e   t o   i n s t a n c e s   o f   t h e   D a t a b a s e   E n g i n e   a n d   m a n a g e   R e g i s t e r e d   S e r v e r   o b j e c t s   s u c h   a s   s e r v e r   g r o u p s   a n d   r e 
 
         g i s t e r e d   s e r v e r s .   T h e   S Q L R e g i s t r a t i o n   f o l d e r   o p e r a t e s   u s i n g   t h e   o b j e c t s   i n   t h e   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . R e g i s t e r e d S e r v e r s   a n d   M i c r o s o f t . S q l S e r v e r . M a n a g 
 
         e m e n t . R e g S v r E n u m   n a m e s p a c e . 
 
         
 
         T h e   S Q L S E R V E R : \ U t i l i t y   f o l d e r   l e t s   y o u   n a v i g a t e   t o   t h e   m a n a g e d   i n s t a n c e s   a n d   d a t a - t i e r   a p p l i c a t i o n s   r e g i s t e r e d   i n   t h e   S Q L   S e r v e r   U t i l i t y .   T h e   U t i l i t y   f o l d e r   
 
         o p e r a t e s   u s i n g   t h e   o b j e c t s   i n   t h e   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . U t i l i t y   n a m e s p a c e . 
 
         
 
         T h e   S Q L S e r v e r : \ D A C   f o l d e r   l e t s   y o u   n a v i g a g e   t h r o u g h   d a t a - t i e r   a p p l i c a t i o n s   o b j e c t s   s u c h   a s   D A C   p a c k a g e   f i l e s .   T h e   D A C   f o l d e r   o p e r a t e s   u s i n g   t h e   o b j e c t s   i n   t h 
 
         e   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . D A C   n a m e s p a c e . 
 
         
 
         T h e   S Q L S e r v e r : \ D a t a C o l l e c t i o n   f o l d e r   l e t s   y o u   n a v i g a t e   t o   i n s t a n c e s   o f   t h e   D a t a b a s e   E n g i n e   a n d   m a n a g e   D a t a   C o l l e c t o r   o b j e c t s   s u c h   a s   c o l l e c t i o n   s e t s   a n d   c o n f 
 
         i g u r a t i o n   s t o r e s .   T h e   D a t a C o l l e c t i o n   f o l d e r   o p e r a t e s   u s i n g   t h e   o b j e c t s   i n   t h e   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . C o l l e c t o r   n a m e s p a c e . 
 
         
 
         T h e   S Q L S e r v e r : \ I n t e g r a t i o n S e r v i c e s   f o l d e r   l e t s   y o u   m a n a g e   S Q L   S e r v e r   I n t e g r a t i o n   S e r v i c e s   o b j e c t s   s u c h   a s   p r o j e c t s ,   p a c k a g e s ,   a n d   e n v i r o n m e n t s .   T h e   I n t e g r a t i 
 
         o n S e r v i c e s   f o l d e r   o p e r a t e s   u s i n g   t h e   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . I n t e g r a t i o n S e r v i c e s   n a m e s p a c e . 
 
         
 
         T h e   S Q L S e r v e r : \ S Q L A S   f o l d e r s   l e t s   y o u   m a n a g e   S Q L   S e r v e r   A n a l y s i s   S e r v i c e s   o b j e c t s   s u c h   a s   a g g r e g a t i o n s ,   d i m e n s i o n s ,   a n d   c u b e s .   T h e   S Q L A S   f o l d e r   o p e r a t e s   u s i n 
 
         g   t h e   M i c r o s o f t . A n a l y s i s S e r v i c e s   n a m e s p a c e . 
 
         
 
         Y o u   c a n   n a v i g a t e   t h e   S Q L S E R V E R :   p a t h s   b y   u s i n g   P o w e r S h e l l   p a t h   c m d l e t s   s u c h   a s   G e t - L o c a t i o n ,   S e t - L o c a t i o n ,   a n d   G e t - C h i l d I t e m . 
 
         
 
         T h e   l e a d i n g   p a r t   o f   a   S Q L S E R V E R : \ S Q L   p a t h   h a s   t h e   f o r m   S Q L S E R V E R : \ S Q L \ C o m p u t e r N a m e \ I n s t a n c e N a m e .   Y o u   m u s t   a l w a y s   s p e c i f y   a n   i n s t a n c e   n a m e ,   e v e n   f o r   d e f a u l t   i 
 
         n s t a n c e s .   S p e c i f y   D E F A U L T   f o r   d e f a u l t   i n s t a n c e   n a m e s .   T h e   p a t h   n o d e s   f o l l o w i n g   t h e   I n s t a n c e N a m e   a l t e r n a t e   b e t w e e n   o b j e c t   c l a s s e s   a n d   o b j e c t   n a m e s .   S c h e m a s   a r 
 
         e   n o t   r e p r e s e n t e d   a s   a n   o b j e c t   c l a s s .   W h e n   y o u   s p e c i f y   a   p a t h   n o d e   f o r   t o p   l e v e l   o b j e c t s   i n   s c h e m a s ,   s u c h   a s   t a b l e s   o r   v i e w s ,   t h e   n o d e   n a m e   m u s t   b e   i n   t h e   f o 
 
         r m a t   S c h e m a N a m e . O b j e c t N a m e .   F o r   e x a m p l e ,   t h i s   i s   t h e   p a t h   t o   t h e   A d d r e s s I D   c o l u m n   i n   t h e   A d d r e s s   t a b l e   o f   t h e   P e r s o n   s c h e m a : 
 
         
 
         S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ D E F A U L T \ D a t a b a s e s \ A d v e n t u r e W o r k s \ T a b l e s \ P e r s o n . A d d r e s s \ C o l u m n s \ A d d r e s s I D 
 
         
 
         T o   s a v e   t y p i n g ,   y o u   c a n   c r e a t e   y o u r   o w n   P o w e r S h e l l   d r i v e s   t h a t   m a p   o v e r   t h e   f i r s t   s e v e r a l   n o d e s   o f   a n   S Q L   p a t h . 
 
         
 
         T h e   i n f o r m a t i o n   t h a t   i s   r e t u r n e d   b y   G e t - C h i l d I t e m   d e p e n d s   o n   w h i c h   p a r t   o f   t h e   p a t h   t h e   c m d l e t   i s   e x e c u t e d   f r o m : 
 
         
 
         R e t u r n s   t h e   l o c a l   c o m p u t e r   n a m e   a n d   t h e   l i s t   o f   c o m p u t e r s   t o   w h i c h   y o u   h a v e   o p e n e d   D a t a b a s e   E n g i n e   c o n n e c t i o n s   b y   u s i n g   W M I : 
 
         P S   S Q L S E R V E R : \ S Q L >   G e t - C h i l d I t e m 
 
         
 
         R e t u r n s   t h e   l i s t   o f   i n s t a n c e s   o n   t h e   s p e c i f i e d   c o m p u t e r : 
 
         P S   S Q L S E R V E R : \ S Q L \ C o m p u t e r N a m e >   G e t - C h i l d I t e m 
 
         
 
         R e t u r n s   t h e   l i s t   o f   t o p - l e v e l   o b j e c t   t y p e s   f r o m   t h e   i n s t a n c e ,   s u c h   a s   L o g i n s   a n d   D a t a b a s e s : 
 
         P S   S Q L S E R V E R : \ S Q L \ C o m p u t e r N a m e \ I n s t a n c e N a m e >   G e t - C h i l d I t e m . 
 
         
 
         W i t h   t h e   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r ,   y o u   m a n a g e   t h e   o b j e c t s   t h a t   a r e   e x p o s e d   i n   S Q L   S e r v e r   p a t h s   b y   u s i n g   t h e   S Q L   S e r v e r   m a n a g e m e n t   o b j e c t   m o d e l   m e t h o d s   
 
         a n d   p r o p e r t i e s   f o r   t h a t   c l a s s   o f   o b j e c t .   F o r   e x a m p l e ,   y o u   c a n   u s e   t h e   m e t h o d s   o f   t h e   M i c r o s o f t . S Q L S e r v e r . M a n a g e m e n t . S M O . D a t a b a s e   c l a s s   t o   p e r f o r m   a c t i o n s   s u c 
 
         h   a s   c r e a t i n g ,   a l t e r i n g ,   a n d   d r o p p i n g   d a t a b a s e s .   Y o u   c a n   a l s o   u s e   t h e   c l a s s   p r o p e r t i e s   t o   q u e r y   t h e   c u r r e n t   s t a t e   o f   t h e   o b j e c t s .   U s e   t h e   G e t - M e m b e r   c m d l e t   t 
 
         o   g e t   a   l i s t   o f   t h e   m e t h o d s   a n d   p r o p e r t i e s   t h a t   a r e   s u p p o r t e d   f o r   t h e   v a r i o u s   o b j e c t s .   F o r   i n f o r m a t i o n   a b o u t   t h e   c l a s s e s ,   s e e   t h e   n a m e s p a c e   r e f e r e n c e   s e c t i o n 
 
         s   i n   t h e   S Q L   S e r v e r   B o o k s   O n l i n e . 
 
         
 
         Y o u   c a n n o t   s e l e c t ,   i n s e r t ,   u p d a t e ,   o r   d e l e t e   d a t a   i n   t a b l e s   a n d   v i e w s   b y   u s i n g   t h e   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r .   F o r   e x a m p l e ,   t h e r e   i s   n o   S e l e c t ( )   o r   I n s e r 
 
         t ( )   m e t h o d   f o r   t a b l e s .   U s e   t h e   I n v o k e - S q l c m d   c m d l e t   t o   a c c e s s   a n d   c h a n g e   t h e   d a t a   i n   t a b l e s   a n d   v i e w s . 
 
         
 
         B y   d e f a u l t ,   t h e   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r   o p e n s   W i n d o w s   A u t h e n t i c a t i o n   c o n n e c t i o n s   b y   u s i n g   t h e   c r e d e n t i a l s   o f   t h e   W i n d o w s   a c c o u n t   t h a t   i s   r u n n i n g   t h e   P 
 
         o w e r S h e l l   s e s s i o n .   S e e   S Q L   S e r v e r   B o o k s   O n l i n e   f o r   i n f o r m a t i o n   a b o u t   o p e n i n g   a   S Q L   S e r v e r   A u t h e n t i c a t i o n   c o n n e c t i o n   u s i n g   t h e   p r o v i d e r . 
 
         
 
         I n   c o m p l e x   d a t a b a s e s ,   t h e   l i s t s   r e t u r n e d   b y   G e t - C h i l d I t e m   a n d   t h e   P o w e r S h e l l   t a b - c o m p l e t i o n   l i s t s   c a n   b e   v e r y   l a r g e .   Y o u   c a n   u s e   t h r e e   s y s t e m   v a r i a b l e s   c r e a t 
 
         e d   b y   t h e   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r   t o   c o n t r o l   t h e   s i z e   o f   t h e s e   l i s t s : 
 
         
 
         $ S q l S e r v e r M a x i m u m T a b C o m p l e t i o n   =   n 
 
         n   i s   a n   i n t e g e r   t h a t   s p e c i f i e s   t h e   m a x i m u m   n u m b e r   o f   o b j e c t s   i n   a   t a b   c o m p l e t i o n   l i s t .   T h e   d e f a u l t   i s   0 ,   w h i c h   m e a n s   a l l   o b j e c t s   a r e   r e t u r n e d . 
 
         
 
         $ S q l S e r v e r M a x i m u m C h i l d I t e m s   =   n 
 
         n   i s   a n   i n t e g e r   t h a t   s p e c i f i e s   t h e   m a x i m u m   n u m b e r   o f   o b j e c t s   r e t u r n e d   w h e n   y o u   r u n   G e t - C h i l d I t e m   o n   S Q L   S e r v e r   p a t h   n o d e s .   T h e   d e f a u l t   i s   0 ,   w h i c h   m e a n s   a l l   
 
         o b j e c t s   a r e   r e t u r n e d . 
 
         
 
         $ S Q L S e r v e r I n c l u d e S y s t e m O b j e c t s   =   {   $ T r u e   |   $ F a l s e   } 
 
         S p e c i f i e s   w h e t h e r   S Q L   S e r v e r   s y s t e m   o b j e c t s   a r e   r e t u r n e d   b y   G e t - C h i l d I t e m   o r   i n c l u d e d   i n   t a b - c o m p l e t i o n   l i s t s .   T h e   d e f a u l t   i s   $ T r u e 
 
         
 
 C A P A B I L I T I E S 
 
         
 
         
 
 T A S K S 
 
         T A S K :   N a v i g a t i n g   S Q L S E R V E R : \ S Q L   p a t h s 
 
         
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   1   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   e x a m p l e   u s e s   t h e   S e t - L o c a t i o n   c m d l e t   t o   c h a n g e   t h e   p a t h   t o   t h e   S Q L   f o l d e r . 
 
                 
 
                 S e t - L o c a t i o n   S Q L S E R V E R : \ S Q L 
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   2   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   e x a m p l e   u s e s   S e t - L o c a t i o n   t o   c h a n g e   t h e   p a t h   t o   a   d e f a u l t   i n s t a n c e   o f   t h e   D a t a b a s e   E n g i n e 
 
                 
 
                 S e t - L o c a t i o n   S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ D E F A U L T 
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   3   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   e x a m p l e   u s e s   S e t - L o c a t i o n   t o   c h a n g e   t h e   p a t h   t o   t h e   A d v e n t u r e W o r k s   s a m p l e   d a t a b a s e . 
 
                 
 
                 S e t - L o c a t i o n   S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ M y I n s t a n c e \ D a t a b a s e s \ A d v e n t u r e W o r k s 
 
                 
 
                 
 
                 
 
                 
 
                 
 
         T A S K :   B u i l d   a   N e w   P o w e r S h e l l   D r i v e 
 
         
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   1   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 I f   y o u   a r e   g o i n g   t o   d o   a   l o t   o f   w o r k   i n   t h e   A d v e n t u r e W o r k s   d a t a b a s e ,   c r e a t e   a   n e w   A W D B :   d r i v e   t o   s a v e   t y p i n g . 
 
                 
 
                 N e w - P S D r i v e   - N a m e   A W D B   - R o o t   S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ D E F A U L T \ D a t a b a s e s \ A d v e n t u r e W o r k s   - P S P r o v i d e r   S Q L S e r v e r 
 
                 
 
                 
 
                 
 
                 
 
                 
 
         T A S K :   G e t   t h e   M e t h o d s   a n d   P r o p e r t i e s   o f   a   S Q L   S e r v e r   O b j e c t 
 
         
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   1   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   c o m m a n d   s e t s   a   v a r i a b l e   t o   t h e   S M O   D a t a b a s e   c l a s s   a n d   t h e n   g e t s   a   l i s t   o f   t h e   m e t h o d s   a n d   p r o p e r t i e s   s u p p o r t e d   b y   t h e   c l a s s . 
 
                 
 
                 $ M y V a r   =   N e w - O b j e c t   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . S M O . D a t a b a s e 
 
                 $ M y V a r   |   G e t - M e m b e r   - T y p e   M e t h o d s 
 
                 $ M y V a r   |   G e t - M e m b e r   - T y p e   P r o p e r t i e s 
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   2   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   c o m m a n d   n a v i g a t e s   t o   t h e   d a t a b a s e   n o d e   i n   a n   S Q L - b a s e d   p a t h   a n d   g e t   s   a   l i s t   o f   t h e   p r o p e r t i e s   t h a t   a r e   s u p p o r t e d   f o r   d a t a b a s e s . 
 
                 
 
                 S e t - L o c a t i o n   S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ D E F A U L T \ D a t a b a s e s 
 
                 G e t - I t e m   .   |   G e t - M e m b e r   - T y p e   P r o p e r t i e s 
 
                 
 
                 
 
                 
 
                 
 
                 
 
         T A S K :   F i l t e r   S Q L   S e r v e r   O b j e c t s   b y   U s i n g   S M O   P r o p e r t i e s 
 
         
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   1   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   c o m m a n d   l i s t s   o n l y   t h e   t a b l e s   t h a t   a r e   i n   t h e   A d v e n t u r e W o r k s   S a l e s   s c h e m a . 
 
                 
 
                 S e t - L o c a t i o n   S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ D E F A U L T \ D a t a b a s e s \ A d v e n t u r e W o r k s \ T a b l e s 
 
                 G e t - C h i l d I t e m   |   W H E R E   { $ _ . S c h e m a   - e q   " S a l e s " } 
 
                 
 
                 
 
                 
 
                 
 
                 
 
         T A S K :   G e n e r a t e   S c r i p t s   T h a t   C r e a t e   S Q L   S e r v e r   O b j e c t s 
 
         
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   1   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   s c r i p t   c r e a t e s   a   V i e w s . s q l   f i l e   t h a t   c o n t a i n s   t h e   C R E A T E   V I E W   s t a t e m e n t s   t h a t   a r e   r e q u i r e d   t o   r e c r e a t e   a l l   o f   t h e   v i e w s   t h a t   a r e   d e f i n e d   i n   A d v e n t u r 
 
                 e W o r k s . 
 
                 
 
                 R e m o v e _ I t e m   c : \ P o w e r S h e l l \ V i e w s . s q l 
 
                 S e t - L o c a t i o n   S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ D E F A U L T \ D a t a b a s e s \ A d v e n t u r e W o r k s \ V i e w s 
 
                 f o r e a c h   ( $ I t e m   i n   G e t - C h i l d I t e m )   { $ I t e m . S c r i p t ( )   |   O u t - F i l e   - F i l e p a t h   c : \ P o w e r S h e l l \ V i e w s . s q l   - a p p e n d   } 
 
                 
 
                 
 
                 
 
                 
 
                 
 
         T A S K :   U s e   S M O   t o   M a n a g e   S Q L   S e r v e r   O b j e c t s 
 
         
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   1   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   s c r i p t   u s e s   S M O   t o   c r e a t e   a   d a t a b a s e   a n d   t h e n   q u e r y   i t s   s t a t e . 
 
                 
 
                 S e t - L o c a t i o n   S Q L S E R V E R : \ S Q L \ M y C o m p u t e r \ D E F A U L T \ D a t a b a s e s 
 
                 $ M y V a r   =   N e w - O b j e c t   M i c r o s o f t . S q l S e r v e r . M a n a g e m e n t . S M O . D a t a b a s e 
 
                 $ M y V a r . P a r e n t   =   ( G e t - I t e m   . . ) 
 
                 $ M y V a r . N a m e   =   " N e w D B " 
 
                 $ M y V a r . C r e a t e ( ) 
 
                 $ M y V a r . S t a t e 
 
                 
 
                 
 
                 
 
                 
 
                 
 
         T A S K :   C o n t r o l l i n g   S Q L   S e r v e r   O b j e c t s   i n   T a b - c o m p l e t i o n   a n d   G e t - C h i l d I t e m 
 
         
 
                 
 
                 
 
                 
 
                 - - - - - - - - - - - - - - - - - - - - - - - - - -   E X A M P L E   1   - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
                 
 
                 T h i s   s c r i p t   s e t s   t h e   v a l u e s   f o r   t h e   s y s t e m   v a r i a b l e s   t h a t   c o n t r o l   t h e   n u m b e r   o f   S Q L   S e r v e r   o b j e c t s   i n c l u d e d   i n   t a b - c o m p l e t i o n   l i s t s   o r   r e t u r n e d   b y   G e t - C h 
 
                 i l d I t e m . 
 
                 
 
                 $ S q l S e r v e r M a x i m u m T a b C o m p l e t i o n   =   2 0 
 
                 $ S q l S e r v e r M a x i m u m C h i l d I t e m s   =   1 0 
 
                 $ S q l S e r v e r I n c l u d e S y s t e m O b j e c t s   =   $ F a l s e 
 
                 d i r   v a r i a b l e : s q l s e r v e r * 
 
                 
 
                 
 
                 
 
                 
 
                 
 
         
 
         
 
 D Y N A M I C   P A R A M E T E R S 
 
         -   < > 
 
                 
 
                 
 
                         
 
                                 
 
                                 
 
                 
 
                 C m d l e t s   S u p p o r t e d :   
 
                 
 
         
 
 N O T E S 
 
         S Q L   S e r v e r   d e l i m i t e d   i d e n t i f i e r s   a r e   o b j e c t   n a m e s   t h a t   a r e   e n c l o s e d   i n   b r a c k e t s   ( [ T a b l e : N a m e ] )   o r   q u o t a t i o n   m a r k s   ( " V i e w > N a m e " ) .   D e l i m i t e d   i d e n t i f i e r s   c a n   c o 
 
         n t a i n   a n y   U n i c o d e   c h a r a c t e r .   T h e   s p e c i a l   c h a r a c t e r s   i n   t h e s e   n a m e s   m u s t   b e   e i t h e r   e n c o d e d   t o   t h e i r   h e x a d e c i m a l   r e p r e s e n t a t i o n   o r   e s c a p e d   f o r   u s e   i n   P o w e r S h e l 
 
         l   p a t h s .   T h e   h e x a d e c i m a l   e n c o d i n g   f o r   c h a r a c t e r s   u s e s   t h e   f o r m a t   % n n .   A n   e x a m p l e   o f   e n c o d i n g   t h e   c o l o n   ( : ) c h a r a c t e r   i n   t h e   n a m e   " T a b l e : N a m e "   i s : 
 
         S e t - L o c a t i o n   " T a b l e % 3 A N a m e " . 
 
         
 
         T h e   P o w e r S h e l l   e s c a p e   c h a r a c t e r   i s   t h e   b a c k   t i c k   ( ` )   c h a r a c t e r   t h a t   i s   t y p i c a l l y   o n   t h e   k e y   a t   t h e   t o p   l e f t   o f   t h e   k e y b o a r d .   A n   e x a m p l e   o f   e s c a p i n g   a n   e x t e n d 
 
         e d   c h a r a c t e r   i s   a s   f o l l o w s : 
 
         S e t - L o c a t i o n   " V i e w ` > N a m e " 
 
         
 
         C e r t a i n   c h a r a c t e r s ,   s u c h   a s   t h e   c o l o n   c h a r a c t e r   ( : ) ,   c a n n o t   b e   e s c a p e d .   T h e y   m u s t   b e   e n c o d e d .   T h e   S Q L   S e r v e r   P o w e r S h e l l   p r o v i d e r   s n a p i n   i m p l e m e n t s   t w o   c m d l e t 
 
         s   t o   h e l p   e n c o d e   a n d   d e c o d e   d e l i m i t e d   i d e n t i f i e r s :   E n c o d e - S q l N a m e   a n d   D e c o d e - S q l N a m e . 
 
         
 
         Y o u   m u s t   s u p p l y   a   r e g i s t r y   o r   d i r e c t o r y   o b j e c t   f o r   t h e   - T y p e   p a r a m e t e r   w h e n   u s i n g   t h e s e   c o r e   c m d l e t s   w i t h   a   S Q L R e g i s t r a t i o n :   d r i v e :   C o p y - O b j e c t ,   M o v e - O b j e c t , 
 
           N e w - O b j e c t ,   R e m o v e - O b j e c t ,   a n d   R e n a m e - O b j e c t . 
 
 
 
 R E L A T E D   L I N K S 
 
         a b o u t _ p r o v i d e r   
 
         E n c o d e - S q l N a m e   
 
         D e c o d e - S q l N a m e   
 
         I n v o k e - S q l c m d   
 
         N e w - P S D r i v e   
 
         G e t - M e m b e r   
 
         I n v o k e - P o l i c y E v a l u a t i o n   
 
 
 
 