Tuesday, October 12, 2021

Get Disk Space Info Remotely

One of the quick and easy ways to get a remote computer/server's disk space info is to use the PowerShell command GET-PSDrive. 

You can create a batch file that runs the GET-PSDrive command remotely using PSTools' PSExec. 


@echo off

psexec \\{ip_address} cmd /c powershell.exe "Get-PSDrive"

pause


Assign local admin rights remotely

To view the local admin users of  the PC you are currently using: 

net localgroup administrators



After downloading and saving PSTools to a folder, which include psexec.exe, and making it available globally through System Variables -> Path, you can run the "net locagroup" command on remote PCs, given that you already have local admin rights to those PCs.

To view the local admin users of another PC remotely, try

psexec  \\<ip_address>  net  localgroup administrators




To add a user to the local admin group remotely: 

psexec \\<ip_address>  net localgroup administratos "<domain_name>\<username>" /add




To remove a user from the local admin group remotely:

psexec \\<ip_address>  net localgroup administratos "<domain_name>\<username>" /delete


Thursday, June 4, 2020

Visual Studio 2013 - Run as administrator - The application cannot start.

All of a sudden, Visual Studio 2013 no longer works with the error message "The application cannot start" when trying to run it as local administrator.

For those of us who prefer to host a development environment using local IIS server (not IIS Express), this could be a show stopper.

Running the "devenv.exe /resetuserdata" did not help. Uninstall/Re-install of VS 2013 did not help either.

Try the following and see if it helps.

  1. Open the folder "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\
  2. Look for files that start with "dte" and "*.olb" extension. For example,
    • dte80.olb
    • dte80a.olb
    • dte90.olb
    • dte90a.olb
    • dte100.olb
  3. Copy all of these files.
  4. Paste them into "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

Monday, January 20, 2020

Simple sticky bottom footer

Simple sticky bottom footer example with text-overflow hidden with ellipses.


<!doctype>
<html><head><title>Sticky Bottom Footer</title>
<style>
#content {
 text-align: center;
}
#google_promo {
 position: fixed;
 bottom: 30px;
 left: 0; 
 right: 0;
 text-align: center;
 transition: bottom 400ms;
}
.promo-content {
 border: 1px solid #ccc;
 border-radius: 16px;
 display: inline-block;
 padding: 0 16px;
 width: 237px;
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;
}

</style>
</head>
<body>
<div id="content">
 <h1>Simple Sticky Bottom Footer</h1>
 <div id="google_promo">
  <div class="promo-content">
   Hello, I am a sticky footer. It's simple to create me.
  </div>
 </div>
</div>
</body>
</html>

Monday, April 8, 2019

Number Only Field - Quick Input Mask

Quick way to allow decimal or integer numbers only in a form.

$(".allowDecimal").on("keypress keyup blur", function (event) {
    $(this).val($(this).val().replace(/[^0-9\.]/g,''));
    if ((event.which != 46 || $(this).val().indexOf('.') != -1) 
       && (event.which < 48 || event.which > 57)) 
    {
        event.preventDefault();       
    }
});

 
$(".allowIntegerOnly").on("keypress keyup blur", function (event) {   
    $(this).val($(this).val().replace(/[^\d].+/, ""));
    if ((event.which < 48 || event.which > 57)) 
    {
        event.preventDefault();
    }
});

Key CodeKey
0That key has no keycode
3break
8backspace / delete
9tab
12clear
13enter
16shift
17ctrl
18alt
19pause/break
20caps lock
21hangul
25hanja
27escape
28conversion
29non-conversion
32spacebar
33page up
34page down
35end
36home
37left arrow
38up arrow
39right arrow
40down arrow
41select
42print
43execute
44Print Screen
45insert
46delete
47help
480
491
502
513
524
535
546
557
568
579
58:
59semicolon (firefox), equals
60<
61equals (firefox)
63ß
64@ (firefox)
65a
66b
67c
68d
69e
70f
71g
72h
73i
74j
75k
76l
77m
78n
79o
80p
81q
82r
83s
84t
85u
86v
87w
88x
89y
90z
91Windows Key / Left ⌘ / Chromebook Search key
92right window key
93Windows Menu / Right ⌘
95sleep
96numpad 0
97numpad 1
98numpad 2
99numpad 3
100numpad 4
101numpad 5
102numpad 6
103numpad 7
104numpad 8
105numpad 9
106multiply
107add
108numpad period (firefox)
109subtract
110decimal point
111divide
112f1
113f2
114f3
115f4
116f5
117f6
118f7
119f8
120f9
121f10
122f11
123f12
124f13
125f14
126f15
127f16
128f17
129f18
130f19
131f20
132f21
133f22
134f23
135f24
144num lock
145scroll lock
160^
161!
162؛ (arabic semicolon)
163#
164$
165ù
166page backward
167page forward
168refresh
169closing paren (AZERTY)
170*
171~ + * key
172home key
173minus (firefox), mute/unmute
174decrease volume level
175increase volume level
176next
177previous
178stop
179play/pause
180e-mail
181mute/unmute (firefox)
182decrease volume level (firefox)
183increase volume level (firefox)
186semi-colon / ñ
187equal sign
188comma
189dash
190period
191forward slash / ç
192grave accent / ñ / æ / ö
193?, / or °
194numpad period (chrome)
219open bracket
220back slash
221close bracket / å
222single quote / ø / ä
223`
224left or right ⌘ key (firefox)
225altgr
226< /git >, left back slash
230GNOME Compose Key
231ç
233XF86Forward
234XF86Back
235non-conversion
240alphanumeric
242hiragana/katakana
243half-width/full-width
244kanji
251unlock trackpad (Chrome/Edge)
255toggle touchpad

Monday, October 22, 2018

C: drive gets full on IIS server

I came across two scenarios where the C: drive gets completely full on a IIS server. I suspected the log file folder first, but it turned out to be something else hidden.


  • Scenario 1: I ran a warmup script that uses an instance of IE to fully mimics a full page load of web applications, not just page hit.
  • Scenario 2: I set up an IIS server as a dedicated SharePoint provider-hosted on-prem web server. Over time, the C: drive was getting full. Warmup script used to run for a while on this server. 
In both cases, the following folder was the culprit. When using an instance of IE, it probably used this folder for caching.

C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Windows\INetCache\


Thursday, August 30, 2018

SSRS: Remove Duplicates in Parameter Drop-down

While SharePoint was being queries from a SSRS report, GroupBy did not work in the CAML query in the DataSet definition of the SSRS report.

 One workaround was to use a global VB function inside the report, which removes duplicate parameter values in a parameter dropdown.

https://social.technet.microsoft.com/wiki/contents/articles/36632.ssrs-remove-duplicate-filter-values-from-parameter-drop-down-using-vb-code.aspx